[Python] Fix broken highlighting after case statements#4436
Merged
deathaxe merged 5 commits intosublimehq:masterfrom Feb 6, 2026
Merged
[Python] Fix broken highlighting after case statements#4436deathaxe merged 5 commits intosublimehq:masterfrom
deathaxe merged 5 commits intosublimehq:masterfrom
Conversation
This commit removes `^\s*` restriction from function definitions' patterns to ensure those are matched after first case statements. Leading whitespace of a line after first case statement is already consumed and scoped `meta.disable-dedentation` to support ST's indentation engine. For consistency the restriction is globally removed, so space before `def` keyword is never scoped `meta.function`.
This commit removes `^\s*` restriction from class definitions' patterns to ensure those are matched after first case statements. Leading whitespace of a line after first case statement is already consumed and scoped `meta.disable-dedentation` to support ST's indentation engine. For consistency the restriction is globally removed, so space before `class` keyword is never scoped `meta.class`.
This commit removes `^\s*` restriction from type definitions' patterns to ensure those are matched after first case statements. Leading whitespace of a line after first case statement is already consumed and scoped `meta.disable-dedentation` to support ST's indentation engine. For consistency the restriction is globally removed, so space before `type` keyword is never scoped `meta.type-alias`.
This commit pushes a special context for special patterns right after first case statement in order to consume decorators. A `@` denotes an decorator only at the beginning of a line. In any other position it is an operator.
michaelblyons
approved these changes
Feb 5, 2026
keith-hall
approved these changes
Feb 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4433
This PR fixes various highlighting issues after first case statement, caused by
meta.disable-dedentationpattern requirements.It removes
^\s*restrictions from various patterns.