From 3d4eb9d544cbbe39544586890b5de83a48de3680 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 5 May 2024 12:57:36 +0200 Subject: [PATCH] fix(treesitter): update queries --- runtime/queries/bash/highlights.scm | 2 +- runtime/queries/c/folds.scm | 1 + runtime/queries/c/highlights.scm | 11 ++++-- .../queries/markdown_inline/highlights.scm | 20 +++++----- runtime/queries/python/folds.scm | 5 +++ runtime/queries/python/highlights.scm | 37 ++++++++++++++++--- runtime/queries/query/highlights.scm | 6 +-- runtime/queries/vim/highlights.scm | 9 ++++- 8 files changed, 65 insertions(+), 26 deletions(-) diff --git a/runtime/queries/bash/highlights.scm b/runtime/queries/bash/highlights.scm index 6547bea7ae..feb0e038ea 100644 --- a/runtime/queries/bash/highlights.scm +++ b/runtime/queries/bash/highlights.scm @@ -228,5 +228,5 @@ ((program . - (comment) @keyword.directive) + (comment) @keyword.directive @nospell) (#lua-match? @keyword.directive "^#!/")) diff --git a/runtime/queries/c/folds.scm b/runtime/queries/c/folds.scm index 2e2a6b4d0c..bb26a62eb5 100644 --- a/runtime/queries/c/folds.scm +++ b/runtime/queries/c/folds.scm @@ -16,6 +16,7 @@ (preproc_function_def) (initializer_list) (gnu_asm_expression) + (preproc_include)+ ] @fold (compound_statement diff --git a/runtime/queries/c/highlights.scm b/runtime/queries/c/highlights.scm index c901b96f31..170937c8f8 100644 --- a/runtime/queries/c/highlights.scm +++ b/runtime/queries/c/highlights.scm @@ -7,15 +7,18 @@ [ "default" - "enum" - "struct" - "typedef" - "union" "goto" "asm" "__asm__" ] @keyword +[ + "enum" + "struct" + "union" + "typedef" +] @keyword.type + [ "sizeof" "offsetof" diff --git a/runtime/queries/markdown_inline/highlights.scm b/runtime/queries/markdown_inline/highlights.scm index e38ef3d7b0..233ab411cd 100644 --- a/runtime/queries/markdown_inline/highlights.scm +++ b/runtime/queries/markdown_inline/highlights.scm @@ -33,10 +33,17 @@ ] @markup.link (#set! conceal "")) +[ + (link_label) + (link_text) + (link_title) + (image_description) +] @markup.link.label + (inline_link - (link_text) @markup.link.label - (link_destination) @markup.link - (#set! @markup.link.label "url" @markup.link)) + (link_text) @_label + (link_destination) @_url + (#set! @_label "url" @_url)) ; Conceal image links (image @@ -80,13 +87,6 @@ (uri_autolink) ] @markup.link.url @nospell -[ - (link_label) - (link_text) - (link_title) - (image_description) -] @markup.link.label - ; Replace common HTML entities. ((entity_reference) @character.special (#eq? @character.special " ") diff --git a/runtime/queries/python/folds.scm b/runtime/queries/python/folds.scm index 7c547db38f..ecb9352d78 100644 --- a/runtime/queries/python/folds.scm +++ b/runtime/queries/python/folds.scm @@ -21,3 +21,8 @@ (dictionary) (string) ] @fold + +[ + (import_statement) + (import_from_statement) +]+ @fold diff --git a/runtime/queries/python/highlights.scm b/runtime/queries/python/highlights.scm index 4d62aeff06..5e5a2a88de 100644 --- a/runtime/queries/python/highlights.scm +++ b/runtime/queries/python/highlights.scm @@ -188,7 +188,7 @@ ((module . - (comment) @keyword.directive) + (comment) @keyword.directive @nospell) (#lua-match? @keyword.directive "^#!/")) (string) @string @@ -204,19 +204,41 @@ (comment)* . (expression_statement - (string) @string.documentation @spell)) + (string) @string.documentation)) (class_definition body: (block . (expression_statement - (string) @string.documentation @spell))) + (string) @string.documentation))) (function_definition body: (block . (expression_statement - (string) @string.documentation @spell))) + (string) @string.documentation))) + +(module + . + (comment)* + . + (expression_statement + (string + (string_content) @spell))) + +(class_definition + body: (block + . + (expression_statement + (string + (string_content) @spell)))) + +(function_definition + body: (block + . + (expression_statement + (string + (string_content) @spell)))) ; Tokens [ @@ -278,7 +300,6 @@ [ "assert" - "class" "exec" "global" "nonlocal" @@ -286,9 +307,13 @@ "print" "with" "as" - "type" ] @keyword +[ + "type" + "class" +] @keyword.type + [ "async" "await" diff --git a/runtime/queries/query/highlights.scm b/runtime/queries/query/highlights.scm index abc7aa50ad..210d03dc33 100644 --- a/runtime/queries/query/highlights.scm +++ b/runtime/queries/query/highlights.scm @@ -53,17 +53,17 @@ . (comment)* . - (comment) @keyword.import) + (comment) @keyword.import @nospell) (#lua-match? @keyword.import "^;+ *inherits *:")) ((program . (comment)* . - (comment) @keyword.directive) + (comment) @keyword.directive @nospell) (#lua-match? @keyword.directive "^;+ *extends *$")) -((comment) @keyword.directive +((comment) @keyword.directive @nospell (#lua-match? @keyword.directive "^;+%s*format%-ignore%s*$")) ((predicate diff --git a/runtime/queries/vim/highlights.scm b/runtime/queries/vim/highlights.scm index 2950278f9f..14e5a8128f 100644 --- a/runtime/queries/vim/highlights.scm +++ b/runtime/queries/vim/highlights.scm @@ -126,6 +126,7 @@ "view" "eval" "sign" + "abort" ] @keyword (map_statement @@ -277,8 +278,6 @@ "/" "%" ".." - "is" - "isnot" "==" "!=" ">" @@ -297,9 +296,15 @@ "..=" "<<" "=<<" + "->" (match_case) ] @operator +[ + "is" + "isnot" +] @keyword.operator + ; Some characters have different meanings based on the context (unary_operation "!" @operator)