aboutsummaryrefslogtreecommitdiffstats
path: root/queries/python
diff options
context:
space:
mode:
authorThomas Vigouroux <39092278+vigoux@users.noreply.github.com>2020-06-01 08:49:18 +0200
committerGitHub <noreply@github.com>2020-06-01 08:49:18 +0200
commitd73988a90782decafa0115e0e935bf86256f43b7 (patch)
tree4a9c22d5c728ac62bad5c1a84467a02c4da6ace6 /queries/python
parentMerge pull request #65 from theHamsta/typo-foldexpr (diff)
parentImprove Python highlights (diff)
downloadnvim-treesitter-d73988a90782decafa0115e0e935bf86256f43b7.tar
nvim-treesitter-d73988a90782decafa0115e0e935bf86256f43b7.tar.gz
nvim-treesitter-d73988a90782decafa0115e0e935bf86256f43b7.tar.bz2
nvim-treesitter-d73988a90782decafa0115e0e935bf86256f43b7.tar.lz
nvim-treesitter-d73988a90782decafa0115e0e935bf86256f43b7.tar.xz
nvim-treesitter-d73988a90782decafa0115e0e935bf86256f43b7.tar.zst
nvim-treesitter-d73988a90782decafa0115e0e935bf86256f43b7.zip
Merge pull request #66 from theHamsta/python-kw-highlight
Improve Python highlights
Diffstat (limited to 'queries/python')
-rw-r--r--queries/python/highlights.scm33
1 files changed, 33 insertions, 0 deletions
diff --git a/queries/python/highlights.scm b/queries/python/highlights.scm
index 4cd8b8998..0b6e30033 100644
--- a/queries/python/highlights.scm
+++ b/queries/python/highlights.scm
@@ -9,6 +9,9 @@
(identifier)) @type)
(match? @type "^[A-Z]"))
+((identifier) @type
+ (match? @type "^[A-Z]"))
+
((identifier) @constant
(match? @constant "^[A-Z][A-Z_]*$"))
@@ -43,8 +46,30 @@
(identifier) @variable
(attribute attribute: (identifier) @property)
(type (identifier) @type)
+((call
+ function: (identifier) @isinstance
+ arguments: (argument_list
+ (*)
+ (identifier) @type))
+ (eq? @isinstance "isinstance"))
+
+; Normal parameters
(parameters
(identifier) @parameter)
+; Default parameters
+(keyword_argument
+ name: (identifier) @parameter)
+; Naming parameters on call-site
+(default_parameter
+ name: (identifier) @parameter)
+; Variadic parameters *args, **kwargs
+(parameters
+ (list_splat ; *args
+ (identifier) @parameter))
+(parameters
+ (dictionary_splat ; **kwargs
+ (identifier) @parameter))
+
; Literals
@@ -68,6 +93,7 @@
; Tokens
"-" @operator
+"->" @operator
"-=" @operator
"!=" @operator
"*" @operator
@@ -145,6 +171,9 @@
(class_definition
name: (identifier) @type)
+(class_definition
+ superclasses: (argument_list
+ (identifier) @type))
(attribute
attribute: (identifier) @field)
@@ -157,6 +186,10 @@
attribute: (identifier) @type)
(match? @type "^[A-Z][a-z_]+"))
+((attribute
+ object: (identifier) @type)
+ (match? @type "^[A-Z][a-z_]+"))
+
(class_definition
body: (block
(expression_statement