Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add more granularity to _pyrepl syntax theming for "keywords" #134953

Closed
Labels
3.14bugs and security fixesstdlibStandard Library Python modules in the Lib/ directorytopic-replRelated to the interactive shelltriagedThe issue has been accepted as valid by a triager.type-featureA feature request or enhancement
@treyhunner

Description

@treyhunner

Feature or enhancement

Proposal:

I made a custom_colorize theme to try making my REPL syntax highlighting look similar to my text editor's.

This is the theme I used:

theme_with_dim_operators=default_theme.copy_with(syntax=Syntax(keyword=ANSIColors.GREEN,builtin=ANSIColors.BLUE,comment=ANSIColors.INTENSE_YELLOW,string=ANSIColors.CYAN,number=ANSIColors.CYAN,definition=ANSIColors.BLUE,soft_keyword=ANSIColors.BOLD_GREEN,    ),)

I then used this example code to check the highlighting between the two:

frommathimportpiprint(f"Welcome to Python{pi:.2f}")name=NoneifnameisNone:print("It's",True)

Pasting that code in my text editor (vim), looks like this:

Image

Pasting the same code in the REPL, looks like this:

Image

The granularity with syntax highlighting needs to stopsomewhere, but I feel it would be nice to add a bit more granularity than is currently supported by_colorize.

In particular, it would be nice to distinguish between:

  1. Syntax keywords in general (if,is,def,for,with, etc.)
  2. Keywords that are variables (True,False,None)
  3. Imports in particular (from,import)

I feel that distinguishing between 1 and 2 is more important than between 1 and 3. WhileNoneis a keyword, seeing it appear in the same color asis and other keywords feels odd.

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.14bugs and security fixesstdlibStandard Library Python modules in the Lib/ directorytopic-replRelated to the interactive shelltriagedThe issue has been accepted as valid by a triager.type-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp