Skip to content

Commit

Permalink
[Python] Fix type parameter punctuation scope (#3887)
Browse files Browse the repository at this point in the history
Fixes #3886
  • Loading branch information
deathaxe authored Dec 13, 2023
1 parent 9ff949b commit 8b99823
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
8 changes: 8 additions & 0 deletions Python/Fold.tmPreferences
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@
<key>end</key>
<string>comment.block.documentation punctuation.definition.comment.end</string>
</dict>
<dict>
<key>begin</key>
<string>punctuation.definition.generic.begin</string>
<key>end</key>
<string>punctuation.definition.generic.end</string>
<key>excludeTrailingNewlines</key>
<false/>
</dict>
<dict>
<key>begin</key>
<string>punctuation.section.arguments.begin</string>
Expand Down
2 changes: 1 addition & 1 deletion Python/Python.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -1090,7 +1090,7 @@ contexts:
type-parameter-list-body:
- meta_content_scope: meta.generic.python
- match: \]
scope: meta.generic.python punctuation.section.parameters.end.python
scope: meta.generic.python punctuation.definition.generic.end.python
pop: 1
- match: ','
scope: punctuation.separator.parameters.python
Expand Down
12 changes: 6 additions & 6 deletions Python/tests/syntax_test_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -2047,7 +2047,7 @@ def f[T: Hashable, U: (int, str), *V, **P](x: T = SOME_CONSTANT, y: U, *args: *T
# ^ punctuation.separator.parameters.python
# ^^ keyword.operator.unpacking.mapping.python
# ^ variable.parameter.type.python
# ^ punctuation.section.parameters.end.python
# ^ punctuation.definition.generic.end.python
# ^ punctuation.section.parameters.begin.python
# ^ variable.parameter.python
# ^ punctuation.separator.annotation.python
Expand Down Expand Up @@ -2107,7 +2107,7 @@ def f[
#^^^^ meta.function.python meta.generic.python
# ^^ meta.function.parameters.python
# ^^^^ meta.function.return-type.python
# ^ punctuation.section.parameters.end.python
# ^ punctuation.definition.generic.end.python
# ^ punctuation.section.parameters.begin.python
# ^ punctuation.section.parameters.end.python
# ^^ punctuation.separator.return-type.python
Expand Down Expand Up @@ -2224,7 +2224,7 @@ class GenericClass[T: X, **U]:
# ^ punctuation.separator.parameters.python
# ^^ keyword.operator.unpacking.mapping.python
# ^ variable.parameter.type.python
# ^ punctuation.section.parameters.end.python
# ^ punctuation.definition.generic.end.python
# ^ punctuation.section.class.begin.python

from typing import override
Expand Down Expand Up @@ -2266,7 +2266,7 @@ def method(arg: T):
# ^ variable.parameter.type.python
# ^ punctuation.separator.bound.python
# ^^^ meta.type.python support.type.python
# ^ punctuation.section.parameters.end.python
# ^ punctuation.definition.generic.end.python
# ^ keyword.operator.assignment.python
# ^^^^ support.type.python
# ^^^ meta.brackets.python
Expand All @@ -2283,7 +2283,7 @@ def method(arg: T):
# ^ variable.parameter.type.python
# ^ punctuation.separator.bound.python
# ^^^ meta.type.python support.type.python
# ^ punctuation.section.parameters.end.python
# ^ punctuation.definition.generic.end.python
# ^ keyword.operator.assignment.python
# ^^^^ support.type.python
# ^^^ meta.brackets.python
Expand All @@ -2300,7 +2300,7 @@ def method(arg: T):
# ^ variable.parameter.type.python
# ^ punctuation.separator.bound.python
# ^^^ meta.type.python support.type.python
# ^ punctuation.section.parameters.end.python
# ^ punctuation.definition.generic.end.python
# ^ keyword.operator.assignment.python
# ^^^^ support.type.python
# ^^^ meta.brackets.python
Expand Down

0 comments on commit 8b99823

Please sign in to comment.