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

Add syntax highlighting and indentation for Python pattern matching expressions #4560

Merged
merged 2 commits into from
Nov 2, 2022
Merged
Changes from 1 commit
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
Next Next commit
Add syntax highlighting for Python pattern matching
Add syntax highlighting for `match` and `case` keywords in Python
(https://peps.python.org/pep-0636/).
ygabuev committed Nov 1, 2022
commit abf24bd2ef93acf06e7a599da916c0bfd1e72a2a
8 changes: 5 additions & 3 deletions runtime/queries/python/highlights.scm
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@

(dotted_name
(identifier)* @namespace)

(aliased_import
alias: (identifier) @namespace)

@@ -67,7 +67,7 @@
(parameters
(dictionary_splat_pattern ; **kwargs
(identifier) @variable.parameter))

(lambda_parameters
(identifier) @variable.parameter)

@@ -97,7 +97,7 @@
(#match? @constant "^[A-Z_]{2,}$"))

((identifier) @type
(#match? @type "^[A-Z]"))
(#match? @type "^[A-Z]"))

(attribute attribute: (identifier) @variable.other.member)
(identifier) @variable
@@ -168,6 +168,8 @@
"if"
"elif"
"else"
"match"
"case"
] @keyword.control.conditional

[