fix(treesitter): update queries

This commit is contained in:
Christian Clason
2024-05-05 12:57:36 +02:00
parent 97b7ddc376
commit 3d4eb9d544
8 changed files with 65 additions and 26 deletions

View File

@ -228,5 +228,5 @@
((program ((program
. .
(comment) @keyword.directive) (comment) @keyword.directive @nospell)
(#lua-match? @keyword.directive "^#!/")) (#lua-match? @keyword.directive "^#!/"))

View File

@ -16,6 +16,7 @@
(preproc_function_def) (preproc_function_def)
(initializer_list) (initializer_list)
(gnu_asm_expression) (gnu_asm_expression)
(preproc_include)+
] @fold ] @fold
(compound_statement (compound_statement

View File

@ -7,15 +7,18 @@
[ [
"default" "default"
"enum"
"struct"
"typedef"
"union"
"goto" "goto"
"asm" "asm"
"__asm__" "__asm__"
] @keyword ] @keyword
[
"enum"
"struct"
"union"
"typedef"
] @keyword.type
[ [
"sizeof" "sizeof"
"offsetof" "offsetof"

View File

@ -33,10 +33,17 @@
] @markup.link ] @markup.link
(#set! conceal "")) (#set! conceal ""))
[
(link_label)
(link_text)
(link_title)
(image_description)
] @markup.link.label
(inline_link (inline_link
(link_text) @markup.link.label (link_text) @_label
(link_destination) @markup.link (link_destination) @_url
(#set! @markup.link.label "url" @markup.link)) (#set! @_label "url" @_url))
; Conceal image links ; Conceal image links
(image (image
@ -80,13 +87,6 @@
(uri_autolink) (uri_autolink)
] @markup.link.url @nospell ] @markup.link.url @nospell
[
(link_label)
(link_text)
(link_title)
(image_description)
] @markup.link.label
; Replace common HTML entities. ; Replace common HTML entities.
((entity_reference) @character.special ((entity_reference) @character.special
(#eq? @character.special " ") (#eq? @character.special " ")

View File

@ -21,3 +21,8 @@
(dictionary) (dictionary)
(string) (string)
] @fold ] @fold
[
(import_statement)
(import_from_statement)
]+ @fold

View File

@ -188,7 +188,7 @@
((module ((module
. .
(comment) @keyword.directive) (comment) @keyword.directive @nospell)
(#lua-match? @keyword.directive "^#!/")) (#lua-match? @keyword.directive "^#!/"))
(string) @string (string) @string
@ -204,19 +204,41 @@
(comment)* (comment)*
. .
(expression_statement (expression_statement
(string) @string.documentation @spell)) (string) @string.documentation))
(class_definition (class_definition
body: (block body: (block
. .
(expression_statement (expression_statement
(string) @string.documentation @spell))) (string) @string.documentation)))
(function_definition (function_definition
body: (block body: (block
. .
(expression_statement (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 ; Tokens
[ [
@ -278,7 +300,6 @@
[ [
"assert" "assert"
"class"
"exec" "exec"
"global" "global"
"nonlocal" "nonlocal"
@ -286,9 +307,13 @@
"print" "print"
"with" "with"
"as" "as"
"type"
] @keyword ] @keyword
[
"type"
"class"
] @keyword.type
[ [
"async" "async"
"await" "await"

View File

@ -53,17 +53,17 @@
. .
(comment)* (comment)*
. .
(comment) @keyword.import) (comment) @keyword.import @nospell)
(#lua-match? @keyword.import "^;+ *inherits *:")) (#lua-match? @keyword.import "^;+ *inherits *:"))
((program ((program
. .
(comment)* (comment)*
. .
(comment) @keyword.directive) (comment) @keyword.directive @nospell)
(#lua-match? @keyword.directive "^;+ *extends *$")) (#lua-match? @keyword.directive "^;+ *extends *$"))
((comment) @keyword.directive ((comment) @keyword.directive @nospell
(#lua-match? @keyword.directive "^;+%s*format%-ignore%s*$")) (#lua-match? @keyword.directive "^;+%s*format%-ignore%s*$"))
((predicate ((predicate

View File

@ -126,6 +126,7 @@
"view" "view"
"eval" "eval"
"sign" "sign"
"abort"
] @keyword ] @keyword
(map_statement (map_statement
@ -277,8 +278,6 @@
"/" "/"
"%" "%"
".." ".."
"is"
"isnot"
"==" "=="
"!=" "!="
">" ">"
@ -297,9 +296,15 @@
"..=" "..="
"<<" "<<"
"=<<" "=<<"
"->"
(match_case) (match_case)
] @operator ] @operator
[
"is"
"isnot"
] @keyword.operator
; Some characters have different meanings based on the context ; Some characters have different meanings based on the context
(unary_operation (unary_operation
"!" @operator) "!" @operator)