Skip to content

IDLE - colorize type as a soft keyword when it begins a statememt #151471

Closed

Description

@Locked-chess-official

Activity

  1. StanFromIreland commented on Jun 14, 2026

    @StanFromIreland
    Member

    Marking as easy, it's not quite trivial but I think a reasonable start. It will require writing a regex for the soft keyword, but it's not a terribly complicated one.

    Maybe @robsdedude is interested in this?

  2. robsdedude commented on Jun 14, 2026

    @robsdedude
    Contributor

    Thanks for the ping. I'm travelling this week without a laptop. If the issue still open next week I'd love to work on it!

  3. omkar-334 commented on Jun 14, 2026

    @omkar-334
    Contributor

    hi, can I work on this

  4. StanFromIreland commented on Jun 14, 2026

    @StanFromIreland
    Member

    Hi @omkar-334, I'm sorry but this issue already has someone assigned.

  5. changed the title [-]Wrong colorize for soft keyword `type` in IDLE[/-] [+]IDLE - colorize `type` as a soft keyword when it begins a statememt[/+] on Jun 14, 2026
  6. terryjreedy commented on Jun 14, 2026

    @terryjreedy
    Member

    I missed this syntax addition in 3.12. Soft keywords can sometimes be a bit nasty. All keywords and builtins, including new ones, are automatically recognized, whereas each soft keyword needs custom additions to both colorizer.py and test_colorizer.py*. A test that would currently fail in test_colorizer.ColorDelegatorTest is that the class has a 'test_soft...' test for each soft keyword other than '' in keyword.softkwlist. (EDIT: '' is included with 'case _')

    • Each file needs additions in about 3 places. I should add a comment to each. 'lazy' needs to be added to 'source' in the test.

    The statement syntax for 'type' is most similar to that of 'lazy'. The re for identifiers is currently buried in the idprog definition, but should be separately defined before make_pat.

    @robsdedude If you want comments on an incomplete patch, post it and mark it as a draft.

  7. terryjreedy commented on Jun 14, 2026

    @terryjreedy
    Member

    After reading #151390, I discovered that IDLE colorizes beginning-of-line 'match' and only uncolorizes it when followed by something identified as 'wrong', like a keyword or certain chars such as =. REPL does not colorize it until followed by something right. Either could be considered correct; I prefer the immediate coloring of initial 'match' as 'likely a keyword'. But IDLE does not always uncolorize when it should. For instance, match + remains colored because + could be valid, as in match +1. But IDLE stops there and also does not uncolorize on +=. case in handled similarly differently.

    Like the REPL, IDLE does not colorize 'lazy' until confirmed as a keyword by 'import' or 'from'. type <identifier> should do the same, although the simple re for identifier is only approximate.

  8. Santhosh-I commented on Jun 18, 2026

    @Santhosh-I
    Contributor

    Hi, Is this Bug fixed...

  9. robsdedude commented on Jun 19, 2026

    @robsdedude
    Contributor

    I've not been able to work on it this week as written above, but early next week I'll pick it up. And given the GH issue is still open and nobody commented or linked a PR, I guess it's not fixed. Unless in the somewhat unlikely event that it got fixed as a side-effect of another PR.

  10. arshalaromal commented on Jul 19, 2026

    @arshalaromal
    Contributor

    @robsdedude are you still working on this?

  11. robsdedude commented on Jul 19, 2026

    @robsdedude
    Contributor

    No, I didn't start after I saw that @Locked-chess-official had already opened a PR (see link at the bottom of the issue).

  12. added a commit that references this issue on Sep 23, 2026
  13. added 2 commits that reference this issue on Sep 23, 2026
  14. added a commit that references this issue on Oct 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

easystdlibStandard Library Python modules in the Lib/ directorytopic-IDLEtype-bugAn unexpected behavior, bug, or error

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions