aboutsummaryrefslogtreecommitdiff
path: root/runtime/queries
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2024-05-24 19:18:11 +0000
committerJosh Rahm <joshuarahm@gmail.com>2024-05-24 19:18:11 +0000
commitff7ed8f586589d620a806c3758fac4a47a8e7e15 (patch)
tree729bbcb92231538fa61dab6c3d890b025484b7f5 /runtime/queries
parent376914f419eb08fdf4c1a63a77e1f035898a0f10 (diff)
parent28c04948a1c887a1cc0cb64de79fa32631700466 (diff)
downloadrneovim-ff7ed8f586589d620a806c3758fac4a47a8e7e15.tar.gz
rneovim-ff7ed8f586589d620a806c3758fac4a47a8e7e15.tar.bz2
rneovim-ff7ed8f586589d620a806c3758fac4a47a8e7e15.zip
Merge remote-tracking branch 'upstream/master' into mix_20240309
Diffstat (limited to 'runtime/queries')
-rw-r--r--runtime/queries/bash/highlights.scm55
-rw-r--r--runtime/queries/bash/injections.scm3
-rw-r--r--runtime/queries/c/folds.scm1
-rw-r--r--runtime/queries/c/highlights.scm41
-rw-r--r--runtime/queries/lua/highlights.scm78
-rw-r--r--runtime/queries/lua/injections.scm123
-rw-r--r--runtime/queries/markdown/highlights.scm32
-rw-r--r--runtime/queries/markdown_inline/highlights.scm27
-rw-r--r--runtime/queries/python/folds.scm5
-rw-r--r--runtime/queries/python/highlights.scm168
-rw-r--r--runtime/queries/query/highlights.scm28
-rw-r--r--runtime/queries/vim/highlights.scm23
-rw-r--r--runtime/queries/vim/injections.scm4
-rw-r--r--runtime/queries/vimdoc/highlights.scm31
14 files changed, 338 insertions, 281 deletions
diff --git a/runtime/queries/bash/highlights.scm b/runtime/queries/bash/highlights.scm
index b4360ce7e1..feb0e038ea 100644
--- a/runtime/queries/bash/highlights.scm
+++ b/runtime/queries/bash/highlights.scm
@@ -68,10 +68,6 @@
argument: "$" @string) ; bare dollar
(concatenation
- [
- (simple_expansion)
- (expansion)
- ]
(word) @string)
[
@@ -110,7 +106,15 @@
; trap -l
((word) @constant.builtin
- (#match? @constant.builtin "^SIG(HUP|INT|QUIT|ILL|TRAP|ABRT|BUS|FPE|KILL|USR[12]|SEGV|PIPE|ALRM|TERM|STKFLT|CHLD|CONT|STOP|TSTP|TT(IN|OU)|URG|XCPU|XFSZ|VTALRM|PROF|WINCH|IO|PWR|SYS|RTMIN([+]([1-9]|1[0-5]))?|RTMAX(-([1-9]|1[0-4]))?)$"))
+ (#any-of? @constant.builtin
+ "SIGHUP" "SIGINT" "SIGQUIT" "SIGILL" "SIGTRAP" "SIGABRT" "SIGBUS" "SIGFPE" "SIGKILL" "SIGUSR1"
+ "SIGSEGV" "SIGUSR2" "SIGPIPE" "SIGALRM" "SIGTERM" "SIGSTKFLT" "SIGCHLD" "SIGCONT" "SIGSTOP"
+ "SIGTSTP" "SIGTTIN" "SIGTTOU" "SIGURG" "SIGXCPU" "SIGXFSZ" "SIGVTALRM" "SIGPROF" "SIGWINCH"
+ "SIGIO" "SIGPWR" "SIGSYS" "SIGRTMIN" "SIGRTMIN+1" "SIGRTMIN+2" "SIGRTMIN+3" "SIGRTMIN+4"
+ "SIGRTMIN+5" "SIGRTMIN+6" "SIGRTMIN+7" "SIGRTMIN+8" "SIGRTMIN+9" "SIGRTMIN+10" "SIGRTMIN+11"
+ "SIGRTMIN+12" "SIGRTMIN+13" "SIGRTMIN+14" "SIGRTMIN+15" "SIGRTMAX-14" "SIGRTMAX-13"
+ "SIGRTMAX-12" "SIGRTMAX-11" "SIGRTMAX-10" "SIGRTMAX-9" "SIGRTMAX-8" "SIGRTMAX-7" "SIGRTMAX-6"
+ "SIGRTMAX-5" "SIGRTMAX-4" "SIGRTMAX-3" "SIGRTMAX-2" "SIGRTMAX-1" "SIGRTMAX"))
((word) @boolean
(#any-of? @boolean "true" "false"))
@@ -120,10 +124,15 @@
(test_operator) @operator
(command_substitution
- "$(" @punctuation.bracket)
+ "$(" @punctuation.special
+ ")" @punctuation.special)
(process_substitution
- "<(" @punctuation.bracket)
+ [
+ "<("
+ ">("
+ ] @punctuation.special
+ ")" @punctuation.special)
(arithmetic_expansion
[
@@ -156,27 +165,21 @@
(command_name
(word) @function.call)
-((command_name
- (word) @function.builtin)
- ; format-ignore
+(command_name
+ (word) @function.builtin
(#any-of? @function.builtin
- "alias" "bg" "bind" "break" "builtin" "caller" "cd"
- "command" "compgen" "complete" "compopt" "continue"
- "coproc" "dirs" "disown" "echo" "enable" "eval"
- "exec" "exit" "fc" "fg" "getopts" "hash" "help"
- "history" "jobs" "kill" "let" "logout" "mapfile"
- "popd" "printf" "pushd" "pwd" "read" "readarray"
- "return" "set" "shift" "shopt" "source" "suspend"
- "test" "time" "times" "trap" "type" "typeset"
- "ulimit" "umask" "unalias" "wait"))
+ "alias" "bg" "bind" "break" "builtin" "caller" "cd" "command" "compgen" "complete" "compopt"
+ "continue" "coproc" "dirs" "disown" "echo" "enable" "eval" "exec" "exit" "fc" "fg" "getopts"
+ "hash" "help" "history" "jobs" "kill" "let" "logout" "mapfile" "popd" "printf" "pushd" "pwd"
+ "read" "readarray" "return" "set" "shift" "shopt" "source" "suspend" "test" "time" "times"
+ "trap" "type" "typeset" "ulimit" "umask" "unalias" "wait"))
(command
- argument:
- [
- (word) @variable.parameter
- (concatenation
- (word) @variable.parameter)
- ])
+ argument: [
+ (word) @variable.parameter
+ (concatenation
+ (word) @variable.parameter)
+ ])
(number) @number
@@ -225,5 +228,5 @@
((program
.
- (comment) @keyword.directive)
+ (comment) @keyword.directive @nospell)
(#lua-match? @keyword.directive "^#!/"))
diff --git a/runtime/queries/bash/injections.scm b/runtime/queries/bash/injections.scm
new file mode 100644
index 0000000000..427b414958
--- /dev/null
+++ b/runtime/queries/bash/injections.scm
@@ -0,0 +1,3 @@
+(heredoc_redirect
+ (heredoc_body) @injection.content
+ (heredoc_end) @injection.language)
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 c848f68dca..170937c8f8 100644
--- a/runtime/queries/c/highlights.scm
+++ b/runtime/queries/c/highlights.scm
@@ -7,16 +7,19 @@
[
"default"
- "enum"
- "struct"
- "typedef"
- "union"
"goto"
"asm"
"__asm__"
] @keyword
[
+ "enum"
+ "struct"
+ "union"
+ "typedef"
+] @keyword.type
+
+[
"sizeof"
"offsetof"
] @keyword.operator
@@ -142,9 +145,6 @@
(char_literal) @character
-((preproc_arg) @function.macro
- (#set! "priority" 90))
-
(preproc_defined) @function.macro
((field_expression
@@ -159,21 +159,26 @@
(statement_identifier) @label
+(declaration
+ type: (type_identifier) @_type
+ declarator: (identifier) @label
+ (#eq? @_type "__label__"))
+
[
(type_identifier)
(type_descriptor)
] @type
-(storage_class_specifier) @keyword.storage
+(storage_class_specifier) @keyword.modifier
[
(type_qualifier)
(gnu_asm_qualifier)
"__extension__"
-] @type.qualifier
+] @keyword.modifier
(linkage_specification
- "extern" @keyword.storage)
+ "extern" @keyword.modifier)
(type_definition
declarator: (type_identifier) @type.definition)
@@ -232,10 +237,10 @@
(argument_list
(identifier) @variable.builtin))
-((attribute_specifier
+(attribute_specifier
(argument_list
(call_expression
- function: (identifier) @variable.builtin))))
+ function: (identifier) @variable.builtin)))
((call_expression
function: (identifier) @function.builtin)
@@ -258,18 +263,16 @@
function: (identifier) @function.call)
(call_expression
- function:
- (field_expression
- field: (field_identifier) @function.call))
+ function: (field_expression
+ field: (field_identifier) @function.call))
(function_declarator
declarator: (identifier) @function)
(function_declarator
- declarator:
- (parenthesized_declarator
- (pointer_declarator
- declarator: (field_identifier) @function)))
+ declarator: (parenthesized_declarator
+ (pointer_declarator
+ declarator: (field_identifier) @function)))
(preproc_function_def
name: (identifier) @function.macro)
diff --git a/runtime/queries/lua/highlights.scm b/runtime/queries/lua/highlights.scm
index 0b0bf35a8b..0c8f07f290 100644
--- a/runtime/queries/lua/highlights.scm
+++ b/runtime/queries/lua/highlights.scm
@@ -180,27 +180,24 @@
(vararg_expression) @variable.parameter.builtin
(function_declaration
- name:
- [
- (identifier) @function
- (dot_index_expression
- field: (identifier) @function)
- ])
+ name: [
+ (identifier) @function
+ (dot_index_expression
+ field: (identifier) @function)
+ ])
(function_declaration
- name:
- (method_index_expression
- method: (identifier) @function.method))
+ name: (method_index_expression
+ method: (identifier) @function.method))
(assignment_statement
(variable_list
.
- name:
- [
- (identifier) @function
- (dot_index_expression
- field: (identifier) @function)
- ])
+ name: [
+ (identifier) @function
+ (dot_index_expression
+ field: (identifier) @function)
+ ])
(expression_list
.
value: (function_definition)))
@@ -211,27 +208,24 @@
value: (function_definition)))
(function_call
- name:
- [
- (identifier) @function.call
- (dot_index_expression
- field: (identifier) @function.call)
- (method_index_expression
- method: (identifier) @function.method.call)
- ])
+ name: [
+ (identifier) @function.call
+ (dot_index_expression
+ field: (identifier) @function.call)
+ (method_index_expression
+ method: (identifier) @function.method.call)
+ ])
(function_call
(identifier) @function.builtin
- ; format-ignore
(#any-of? @function.builtin
; built-in functions in Lua 5.1
- "assert" "collectgarbage" "dofile" "error" "getfenv" "getmetatable" "ipairs"
- "load" "loadfile" "loadstring" "module" "next" "pairs" "pcall" "print"
- "rawequal" "rawget" "rawlen" "rawset" "require" "select" "setfenv" "setmetatable"
- "tonumber" "tostring" "type" "unpack" "xpcall"
- "__add" "__band" "__bnot" "__bor" "__bxor" "__call" "__concat" "__div" "__eq" "__gc"
- "__idiv" "__index" "__le" "__len" "__lt" "__metatable" "__mod" "__mul" "__name" "__newindex"
- "__pairs" "__pow" "__shl" "__shr" "__sub" "__tostring" "__unm"))
+ "assert" "collectgarbage" "dofile" "error" "getfenv" "getmetatable" "ipairs" "load" "loadfile"
+ "loadstring" "module" "next" "pairs" "pcall" "print" "rawequal" "rawget" "rawlen" "rawset"
+ "require" "select" "setfenv" "setmetatable" "tonumber" "tostring" "type" "unpack" "xpcall"
+ "__add" "__band" "__bnot" "__bor" "__bxor" "__call" "__concat" "__div" "__eq" "__gc" "__idiv"
+ "__index" "__le" "__len" "__lt" "__metatable" "__mod" "__mul" "__name" "__newindex" "__pairs"
+ "__pow" "__shl" "__shr" "__sub" "__tostring" "__unm"))
; Others
(comment) @comment @spell
@@ -255,21 +249,19 @@
(dot_index_expression
field: (identifier) @_method
(#any-of? @_method "find" "match" "gmatch" "gsub"))
- arguments:
- (arguments
- .
- (_)
- .
- (string
- content: (string_content) @string.regexp)))
+ arguments: (arguments
+ .
+ (_)
+ .
+ (string
+ content: (string_content) @string.regexp)))
;("123"):match("%d+")
(function_call
(method_index_expression
method: (identifier) @_method
(#any-of? @_method "find" "match" "gmatch" "gsub"))
- arguments:
- (arguments
- .
- (string
- content: (string_content) @string.regexp)))
+ arguments: (arguments
+ .
+ (string
+ content: (string_content) @string.regexp)))
diff --git a/runtime/queries/lua/injections.scm b/runtime/queries/lua/injections.scm
index c8a1843c84..4345c71ce8 100644
--- a/runtime/queries/lua/injections.scm
+++ b/runtime/queries/lua/injections.scm
@@ -1,66 +1,69 @@
((function_call
- name:
- [
- (identifier) @_cdef_identifier
- (_
- _
- (identifier) @_cdef_identifier)
- ]
- arguments:
- (arguments
- (string
- content: _ @injection.content)))
+ name: [
+ (identifier) @_cdef_identifier
+ (_
+ _
+ (identifier) @_cdef_identifier)
+ ]
+ arguments: (arguments
+ (string
+ content: _ @injection.content)))
(#set! injection.language "c")
(#eq? @_cdef_identifier "cdef"))
((function_call
name: (_) @_vimcmd_identifier
- arguments:
- (arguments
- (string
- content: _ @injection.content)))
+ arguments: (arguments
+ (string
+ content: _ @injection.content)))
(#set! injection.language "vim")
- (#any-of? @_vimcmd_identifier "vim.cmd" "vim.api.nvim_command" "vim.api.nvim_command" "vim.api.nvim_exec2"))
+ (#any-of? @_vimcmd_identifier
+ "vim.cmd" "vim.api.nvim_command" "vim.api.nvim_command" "vim.api.nvim_exec2"))
((function_call
name: (_) @_vimcmd_identifier
- arguments:
- (arguments
- (string
- content: _ @injection.content) .))
+ arguments: (arguments
+ (string
+ content: _ @injection.content) .))
(#set! injection.language "query")
(#any-of? @_vimcmd_identifier "vim.treesitter.query.set" "vim.treesitter.query.parse"))
((function_call
name: (_) @_vimcmd_identifier
- arguments:
- (arguments
- .
- (_)
- .
- (string
- content: _ @_method)
- .
- (string
- content: _ @injection.content)))
+ arguments: (arguments
+ .
+ (_)
+ .
+ (string
+ content: _ @_method)
+ .
+ (string
+ content: _ @injection.content)))
(#any-of? @_vimcmd_identifier "vim.rpcrequest" "vim.rpcnotify")
(#eq? @_method "nvim_exec_lua")
(#set! injection.language "lua"))
+; exec_lua [[ ... ]] in functionaltests
+((function_call
+ name: (identifier) @_function
+ arguments: (arguments
+ (string
+ content: (string_content) @injection.content)))
+ (#eq? @_function "exec_lua")
+ (#set! injection.language "lua"))
+
; vim.api.nvim_create_autocmd("FileType", { command = "injected here" })
(function_call
name: (_) @_vimcmd_identifier
- arguments:
- (arguments
- .
- (_)
- .
- (table_constructor
- (field
- name: (identifier) @_command
- value:
- (string
- content: (_) @injection.content))) .)
+ arguments: (arguments
+ .
+ (_)
+ .
+ (table_constructor
+ (field
+ name: (identifier) @_command
+ value: (string
+ content: (_) @injection.content))) .)
; limit so only 2-argument functions gets matched before pred handle
(#eq? @_vimcmd_identifier "vim.api.nvim_create_autocmd")
(#eq? @_command "command")
@@ -68,31 +71,29 @@
(function_call
name: (_) @_user_cmd
- arguments:
- (arguments
- .
- (_)
- .
- (string
- content: (_) @injection.content)
- .
- (_) .)
+ arguments: (arguments
+ .
+ (_)
+ .
+ (string
+ content: (_) @injection.content)
+ .
+ (_) .)
(#eq? @_user_cmd "vim.api.nvim_create_user_command")
(#set! injection.language "vim"))
(function_call
name: (_) @_user_cmd
- arguments:
- (arguments
- .
- (_)
- .
- (_)
- .
- (string
- content: (_) @injection.content)
- .
- (_) .)
+ arguments: (arguments
+ .
+ (_)
+ .
+ (_)
+ .
+ (string
+ content: (_) @injection.content)
+ .
+ (_) .)
; Limiting predicate handling to only functions with 4 arguments
(#eq? @_user_cmd "vim.api.nvim_buf_create_user_command")
(#set! injection.language "vim"))
diff --git a/runtime/queries/markdown/highlights.scm b/runtime/queries/markdown/highlights.scm
index 7c26fd710c..4b445e02f3 100644
--- a/runtime/queries/markdown/highlights.scm
+++ b/runtime/queries/markdown/highlights.scm
@@ -1,34 +1,34 @@
;From MDeiml/tree-sitter-markdown & Helix
(setext_heading
(paragraph) @markup.heading.1
- (setext_h1_underline) @markup.heading.1.marker)
+ (setext_h1_underline) @markup.heading.1)
(setext_heading
(paragraph) @markup.heading.2
- (setext_h2_underline) @markup.heading.2.marker)
+ (setext_h2_underline) @markup.heading.2)
(atx_heading
- (atx_h1_marker) @markup.heading.1.marker
+ (atx_h1_marker) @markup.heading.1
(inline) @markup.heading.1)
(atx_heading
- (atx_h2_marker) @markup.heading.2.marker
+ (atx_h2_marker) @markup.heading.2
(inline) @markup.heading.2)
(atx_heading
- (atx_h3_marker) @markup.heading.3.marker
+ (atx_h3_marker) @markup.heading.3
(inline) @markup.heading.3)
(atx_heading
- (atx_h4_marker) @markup.heading.4.marker
+ (atx_h4_marker) @markup.heading.4
(inline) @markup.heading.4)
(atx_heading
- (atx_h5_marker) @markup.heading.5.marker
+ (atx_h5_marker) @markup.heading.5
(inline) @markup.heading.5)
(atx_heading
- (atx_h6_marker) @markup.heading.6.marker
+ (atx_h6_marker) @markup.heading.6
(inline) @markup.heading.6)
(info_string) @label
@@ -54,12 +54,12 @@
(#set! "priority" 90))
(fenced_code_block
- (fenced_code_block_delimiter) @markup.raw.delimiter
+ (fenced_code_block_delimiter) @markup.raw.block
(#set! conceal ""))
(fenced_code_block
(info_string
- (language) @conceal
+ (language) @label
(#set! conceal "")))
(link_destination) @markup.link.url
@@ -69,6 +69,10 @@
(link_label)
] @markup.link.label
+((link_label)
+ .
+ ":" @punctuation.delimiter)
+
[
(list_marker_plus)
(list_marker_minus)
@@ -79,7 +83,7 @@
; NOTE: The following has been commented out due to issues with spaces in the
; list marker nodes generated by the parser. If those spaces ever get captured
-; by a different node (e.g. block_continuation) we can safely readd these
+; by a different node (e.g. block_continuation) we can safely re-add these
; conceals.
; ;; Conceal bullet points
; ([(list_marker_plus) (list_marker_star)]
@@ -107,6 +111,12 @@
((block_quote) @markup.quote
(#set! "priority" 90))
+([
+ (plus_metadata)
+ (minus_metadata)
+] @keyword.directive
+ (#set! "priority" 90))
+
[
(block_continuation)
(block_quote_marker)
diff --git a/runtime/queries/markdown_inline/highlights.scm b/runtime/queries/markdown_inline/highlights.scm
index e9b41c31d5..233ab411cd 100644
--- a/runtime/queries/markdown_inline/highlights.scm
+++ b/runtime/queries/markdown_inline/highlights.scm
@@ -16,10 +16,10 @@
] @string.escape
; Conceal codeblock and text style markers
-((code_span_delimiter) @markup.raw.delimiter
- (#set! conceal ""))
-
-((emphasis_delimiter) @conceal
+([
+ (code_span_delimiter)
+ (emphasis_delimiter)
+] @conceal
(#set! conceal ""))
; Conceal inline links
@@ -33,6 +33,18 @@
] @markup.link
(#set! conceal ""))
+[
+ (link_label)
+ (link_text)
+ (link_title)
+ (image_description)
+] @markup.link.label
+
+(inline_link
+ (link_text) @_label
+ (link_destination) @_url
+ (#set! @_label "url" @_url))
+
; Conceal image links
(image
[
@@ -75,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 "&nbsp;")
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 764521c7be..5e5a2a88de 100644
--- a/runtime/queries/python/highlights.scm
+++ b/runtime/queries/python/highlights.scm
@@ -17,11 +17,9 @@
(#lua-match? @constant.builtin "^__[a-zA-Z0-9_]*__$"))
((identifier) @constant.builtin
- ; format-ignore
- (#any-of? @constant.builtin
+ (#any-of? @constant.builtin
; https://docs.python.org/3/library/constants.html
- "NotImplemented" "Ellipsis"
- "quit" "exit" "copyright" "credits" "license"))
+ "NotImplemented" "Ellipsis" "quit" "exit" "copyright" "credits" "license"))
"_" @constant.builtin ; match wildcard
@@ -37,9 +35,8 @@
((assignment
left: (identifier) @type.definition
- right:
- (call
- function: (identifier) @_func))
+ right: (call
+ function: (identifier) @_func))
(#any-of? @_func "TypeVar" "NewType"))
; Function calls
@@ -47,18 +44,16 @@
function: (identifier) @function.call)
(call
- function:
- (attribute
- attribute: (identifier) @function.method.call))
+ function: (attribute
+ attribute: (identifier) @function.method.call))
((call
function: (identifier) @constructor)
(#lua-match? @constructor "^%u"))
((call
- function:
- (attribute
- attribute: (identifier) @constructor))
+ function: (attribute
+ attribute: (identifier) @constructor))
(#lua-match? @constructor "^%u"))
; Decorators
@@ -84,12 +79,19 @@
((decorator
(identifier) @attribute.builtin)
- (#any-of? @attribute.builtin "classmethod" "property"))
+ (#any-of? @attribute.builtin "classmethod" "property" "staticmethod"))
; Builtin functions
((call
function: (identifier) @function.builtin)
- (#any-of? @function.builtin "abs" "all" "any" "ascii" "bin" "bool" "breakpoint" "bytearray" "bytes" "callable" "chr" "classmethod" "compile" "complex" "delattr" "dict" "dir" "divmod" "enumerate" "eval" "exec" "filter" "float" "format" "frozenset" "getattr" "globals" "hasattr" "hash" "help" "hex" "id" "input" "int" "isinstance" "issubclass" "iter" "len" "list" "locals" "map" "max" "memoryview" "min" "next" "object" "oct" "open" "ord" "pow" "print" "property" "range" "repr" "reversed" "round" "set" "setattr" "slice" "sorted" "staticmethod" "str" "sum" "super" "tuple" "type" "vars" "zip" "__import__"))
+ (#any-of? @function.builtin
+ "abs" "all" "any" "ascii" "bin" "bool" "breakpoint" "bytearray" "bytes" "callable" "chr"
+ "classmethod" "compile" "complex" "delattr" "dict" "dir" "divmod" "enumerate" "eval" "exec"
+ "filter" "float" "format" "frozenset" "getattr" "globals" "hasattr" "hash" "help" "hex" "id"
+ "input" "int" "isinstance" "issubclass" "iter" "len" "list" "locals" "map" "max" "memoryview"
+ "min" "next" "object" "oct" "open" "ord" "pow" "print" "property" "range" "repr" "reversed"
+ "round" "set" "setattr" "slice" "sorted" "staticmethod" "str" "sum" "super" "tuple" "type"
+ "vars" "zip" "__import__"))
; Function definitions
(function_definition
@@ -104,10 +106,9 @@
((call
function: (identifier) @_isinstance
- arguments:
- (argument_list
- (_)
- (identifier) @type))
+ arguments: (argument_list
+ (_)
+ (identifier) @type))
(#eq? @_isinstance "isinstance"))
; Normal parameters
@@ -187,7 +188,7 @@
((module
.
- (comment) @keyword.directive)
+ (comment) @keyword.directive @nospell)
(#lua-match? @keyword.directive "^#!/"))
(string) @string
@@ -200,22 +201,44 @@
; doc-strings
(module
.
+ (comment)*
+ .
(expression_statement
- (string) @string.documentation @spell))
+ (string) @string.documentation))
(class_definition
- body:
- (block
- .
- (expression_statement
- (string) @string.documentation @spell)))
+ body: (block
+ .
+ (expression_statement
+ (string) @string.documentation)))
(function_definition
- body:
- (block
- .
- (expression_statement
- (string) @string.documentation @spell)))
+ body: (block
+ .
+ (expression_statement
+ (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
[
@@ -277,7 +300,6 @@
[
"assert"
- "class"
"exec"
"global"
"nonlocal"
@@ -285,10 +307,14 @@
"print"
"with"
"as"
- "type"
] @keyword
[
+ "type"
+ "class"
+] @keyword.type
+
+[
"async"
"await"
] @keyword.coroutine
@@ -371,33 +397,28 @@
name: (identifier) @type)
(class_definition
- body:
- (block
- (function_definition
- name: (identifier) @function.method)))
+ body: (block
+ (function_definition
+ name: (identifier) @function.method)))
(class_definition
- superclasses:
- (argument_list
- (identifier) @type))
+ superclasses: (argument_list
+ (identifier) @type))
((class_definition
- body:
- (block
- (expression_statement
- (assignment
- left: (identifier) @variable.member))))
- (#lua-match? @variable.member "^%l.*$"))
+ body: (block
+ (expression_statement
+ (assignment
+ left: (identifier) @variable.member))))
+ (#lua-match? @variable.member "^[%l_].*$"))
((class_definition
- body:
- (block
- (expression_statement
- (assignment
- left:
- (_
- (identifier) @variable.member)))))
- (#lua-match? @variable.member "^%l.*$"))
+ body: (block
+ (expression_statement
+ (assignment
+ left: (_
+ (identifier) @variable.member)))))
+ (#lua-match? @variable.member "^[%l_].*$"))
((class_definition
(block
@@ -406,32 +427,31 @@
(#any-of? @constructor "__new__" "__init__"))
((identifier) @type.builtin
- ; format-ignore
(#any-of? @type.builtin
; https://docs.python.org/3/library/exceptions.html
- "BaseException" "Exception" "ArithmeticError" "BufferError" "LookupError" "AssertionError" "AttributeError"
- "EOFError" "FloatingPointError" "GeneratorExit" "ImportError" "ModuleNotFoundError" "IndexError" "KeyError"
- "KeyboardInterrupt" "MemoryError" "NameError" "NotImplementedError" "OSError" "OverflowError" "RecursionError"
- "ReferenceError" "RuntimeError" "StopIteration" "StopAsyncIteration" "SyntaxError" "IndentationError" "TabError"
- "SystemError" "SystemExit" "TypeError" "UnboundLocalError" "UnicodeError" "UnicodeEncodeError" "UnicodeDecodeError"
- "UnicodeTranslateError" "ValueError" "ZeroDivisionError" "EnvironmentError" "IOError" "WindowsError"
- "BlockingIOError" "ChildProcessError" "ConnectionError" "BrokenPipeError" "ConnectionAbortedError"
- "ConnectionRefusedError" "ConnectionResetError" "FileExistsError" "FileNotFoundError" "InterruptedError"
- "IsADirectoryError" "NotADirectoryError" "PermissionError" "ProcessLookupError" "TimeoutError" "Warning"
+ "BaseException" "Exception" "ArithmeticError" "BufferError" "LookupError" "AssertionError"
+ "AttributeError" "EOFError" "FloatingPointError" "GeneratorExit" "ImportError"
+ "ModuleNotFoundError" "IndexError" "KeyError" "KeyboardInterrupt" "MemoryError" "NameError"
+ "NotImplementedError" "OSError" "OverflowError" "RecursionError" "ReferenceError" "RuntimeError"
+ "StopIteration" "StopAsyncIteration" "SyntaxError" "IndentationError" "TabError" "SystemError"
+ "SystemExit" "TypeError" "UnboundLocalError" "UnicodeError" "UnicodeEncodeError"
+ "UnicodeDecodeError" "UnicodeTranslateError" "ValueError" "ZeroDivisionError" "EnvironmentError"
+ "IOError" "WindowsError" "BlockingIOError" "ChildProcessError" "ConnectionError"
+ "BrokenPipeError" "ConnectionAbortedError" "ConnectionRefusedError" "ConnectionResetError"
+ "FileExistsError" "FileNotFoundError" "InterruptedError" "IsADirectoryError"
+ "NotADirectoryError" "PermissionError" "ProcessLookupError" "TimeoutError" "Warning"
"UserWarning" "DeprecationWarning" "PendingDeprecationWarning" "SyntaxWarning" "RuntimeWarning"
"FutureWarning" "ImportWarning" "UnicodeWarning" "BytesWarning" "ResourceWarning"
; https://docs.python.org/3/library/stdtypes.html
- "bool" "int" "float" "complex" "list" "tuple" "range" "str"
- "bytes" "bytearray" "memoryview" "set" "frozenset" "dict" "type" "object"))
+ "bool" "int" "float" "complex" "list" "tuple" "range" "str" "bytes" "bytearray" "memoryview"
+ "set" "frozenset" "dict" "type" "object"))
; Regex from the `re` module
(call
- function:
- (attribute
- object: (identifier) @_re)
- arguments:
- (argument_list
- .
- (string
- (string_content) @string.regexp))
+ function: (attribute
+ object: (identifier) @_re)
+ arguments: (argument_list
+ .
+ (string
+ (string_content) @string.regexp))
(#eq? @_re "re"))
diff --git a/runtime/queries/query/highlights.scm b/runtime/queries/query/highlights.scm
index cdedb23e29..210d03dc33 100644
--- a/runtime/queries/query/highlights.scm
+++ b/runtime/queries/query/highlights.scm
@@ -53,35 +53,33 @@
.
(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
name: (identifier) @_name
- parameters:
- (parameters
- (string
- "\"" @string
- "\"" @string) @string.regexp))
+ parameters: (parameters
+ (string
+ "\"" @string
+ "\"" @string) @string.regexp))
(#any-of? @_name "match" "not-match" "vim-match" "not-vim-match" "lua-match" "not-lua-match"))
((predicate
name: (identifier) @_name
- parameters:
- (parameters
- (string
- "\"" @string
- "\"" @string) @string.regexp
- .
- (string) .))
+ parameters: (parameters
+ (string
+ "\"" @string
+ "\"" @string) @string.regexp
+ .
+ (string) .))
(#any-of? @_name "gsub" "not-gsub"))
diff --git a/runtime/queries/vim/highlights.scm b/runtime/queries/vim/highlights.scm
index 54832ffa56..14e5a8128f 100644
--- a/runtime/queries/vim/highlights.scm
+++ b/runtime/queries/vim/highlights.scm
@@ -42,9 +42,8 @@
function: (identifier) @function.call)
(call_expression
- function:
- (scoped_identifier
- (identifier) @function.call))
+ function: (scoped_identifier
+ (identifier) @function.call))
(parameters
(identifier) @variable.parameter)
@@ -127,11 +126,14 @@
"view"
"eval"
"sign"
+ "abort"
] @keyword
(map_statement
cmd: _ @keyword)
+(keycode) @character.special
+
(command_name) @function.macro
; Filetype command
@@ -204,10 +206,9 @@
(command_attribute
name: _ @property
- val:
- (behavior
- name: _ @constant
- val: (identifier)? @function)?)
+ val: (behavior
+ name: _ @constant
+ val: (identifier)? @function)?)
; Edit command
(plus_plus_opt
@@ -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)
diff --git a/runtime/queries/vim/injections.scm b/runtime/queries/vim/injections.scm
index 16ec57ca99..5feb832ec4 100644
--- a/runtime/queries/vim/injections.scm
+++ b/runtime/queries/vim/injections.scm
@@ -28,5 +28,7 @@
((set_item
option: (option_name) @_option
value: (set_value) @injection.content)
- (#any-of? @_option "includeexpr" "inex" "printexpr" "pexpr" "formatexpr" "fex" "indentexpr" "inde" "foldtext" "fdt" "foldexpr" "fde" "diffexpr" "dex" "patchexpr" "pex" "charconvert" "ccv")
+ (#any-of? @_option
+ "includeexpr" "inex" "printexpr" "pexpr" "formatexpr" "fex" "indentexpr" "inde" "foldtext" "fdt"
+ "foldexpr" "fde" "diffexpr" "dex" "patchexpr" "pex" "charconvert" "ccv")
(#set! injection.language "vim"))
diff --git a/runtime/queries/vimdoc/highlights.scm b/runtime/queries/vimdoc/highlights.scm
index 294fa94f10..70a3a2f206 100644
--- a/runtime/queries/vimdoc/highlights.scm
+++ b/runtime/queries/vimdoc/highlights.scm
@@ -7,39 +7,46 @@
(column_heading) @markup.heading.4
(column_heading
- "~" @markup.heading.4.marker
+ "~" @markup.heading.4
+ (#set! conceal ""))
+
+(tag
+ "*" @label
(#set! conceal ""))
(tag
- "*" @markup.heading.5.marker
- (#set! conceal "")
text: (_) @label)
(taglink
"|" @markup.link
- (#set! conceal "")
+ (#set! conceal ""))
+
+(taglink
text: (_) @markup.link)
(optionlink
text: (_) @markup.link)
(codespan
- "`" @markup.raw.delimiter
- (#set! conceal "")
+ "`" @markup.raw
+ (#set! conceal ""))
+
+(codespan
text: (_) @markup.raw)
((codeblock) @markup.raw.block
(#set! "priority" 90))
(codeblock
- [
- ">"
- (language)
- ] @markup.raw.delimiter
+ ">" @markup.raw
+ (#set! conceal ""))
+
+(codeblock
+ (language) @label
(#set! conceal ""))
(block
- "<" @markup.raw.delimiter
+ "<" @markup.raw
(#set! conceal ""))
(argument) @variable.parameter
@@ -48,6 +55,8 @@
(url) @string.special.url
+(modeline) @keyword.directive
+
((note) @comment.note
(#any-of? @comment.note "Note:" "NOTE:" "Notes:"))