Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Python] Fix type parameter punctuation scope #3887

Merged
merged 1 commit into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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