mirror of
https://github.com/neovim/neovim
synced 2025-07-16 17:21:49 +00:00
feat(treesitter)!: new standard capture names
Problem: Sharing queries with upstream and Helix is difficult due to different capture names. Solution: Define and document a new set of standard captures that matches tree-sitter "standard captures" (where defined) and is closer to Helix' Atom-style nested groups. This is a breaking change for colorschemes that defined highlights based on the old captures. On the other hand, the default colorscheme now defines links for all standard captures (not just those used in bundled queries), improving the out-of-the-box experience.
This commit is contained in:
@ -112,6 +112,11 @@ The following changes may require adaptations in user config or plugins.
|
|||||||
• 'termguicolors' is enabled by default when Nvim is able to determine that
|
• 'termguicolors' is enabled by default when Nvim is able to determine that
|
||||||
the host terminal emulator supports 24-bit color.
|
the host terminal emulator supports 24-bit color.
|
||||||
|
|
||||||
|
• Treesitter highlight groups have been renamed to be more in line with
|
||||||
|
upstream tree-sitter and Helix to make it easier to share queries. The full
|
||||||
|
list is documented in |treesitter-highlight-groups|.
|
||||||
|
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
BREAKING CHANGES IN HEAD *news-breaking-dev*
|
BREAKING CHANGES IN HEAD *news-breaking-dev*
|
||||||
|
|
||||||
|
@ -400,58 +400,115 @@ instance, to highlight comments differently per language: >vim
|
|||||||
hi @comment.lua guifg=DarkBlue
|
hi @comment.lua guifg=DarkBlue
|
||||||
hi link @comment.doc.java String
|
hi link @comment.doc.java String
|
||||||
<
|
<
|
||||||
The following captures are linked by default to standard |group-name|s:
|
The following captures are linked by default to standard |group-name|s (use
|
||||||
|
|:Inspect| on a group to see the current link):
|
||||||
|
|
||||||
@text.literal Comment
|
@variable various variable names
|
||||||
@text.reference Identifier
|
@variable.builtin built-in variable names (e.g. `this`)
|
||||||
@text.title Title
|
@variable.parameter parameters of a function
|
||||||
@text.uri Underlined
|
@variable.member object and struct fields
|
||||||
@text.underline Underlined
|
|
||||||
@text.todo Todo
|
|
||||||
|
|
||||||
@comment Comment
|
@constant constant identifiers
|
||||||
@punctuation Delimiter
|
@constant.builtin built-in constant values
|
||||||
|
@constant.macro constants defined by the preprocessor
|
||||||
|
|
||||||
@constant Constant
|
@module modules or namespaces
|
||||||
@constant.builtin Special
|
@module.builtin built-in modules or namespaces
|
||||||
@constant.macro Define
|
@label GOTO and other labels (e.g. `label:` in C), including heredoc labels
|
||||||
@define Define
|
|
||||||
@macro Macro
|
|
||||||
@string String
|
|
||||||
@string.escape SpecialChar
|
|
||||||
@string.special SpecialChar
|
|
||||||
@character Character
|
|
||||||
@character.special SpecialChar
|
|
||||||
@number Number
|
|
||||||
@boolean Boolean
|
|
||||||
@float Float
|
|
||||||
|
|
||||||
@function Function
|
@string string literals
|
||||||
@function.builtin Special
|
@string.documentation string documenting code (e.g. Python docstrings)
|
||||||
@function.macro Macro
|
@string.regexp regular expressions
|
||||||
@parameter Identifier
|
@string.escape escape sequences
|
||||||
@method Function
|
@string.special other special strings (e.g. dates)
|
||||||
@field Identifier
|
@string.special.symbol symbols or atoms
|
||||||
@property Identifier
|
@string.special.path filenames
|
||||||
@constructor Special
|
@string.special.url URIs (e.g. hyperlinks)
|
||||||
|
|
||||||
@conditional Conditional
|
@character character literals
|
||||||
@repeat Repeat
|
@character.special special characters (e.g. wildcards)
|
||||||
@label Label
|
|
||||||
@operator Operator
|
|
||||||
@keyword Keyword
|
|
||||||
@exception Exception
|
|
||||||
|
|
||||||
@variable Identifier
|
@boolean boolean literals
|
||||||
@type Type
|
@number numeric literals
|
||||||
@type.definition Typedef
|
@number.float floating-point number literals
|
||||||
@storageclass StorageClass
|
|
||||||
@structure Structure
|
@type type or class definitions and annotations
|
||||||
@namespace Identifier
|
@type.builtin built-in types
|
||||||
@include Include
|
@type.definition identifiers in type definitions (e.g. `typedef <type> <identifier>` in C)
|
||||||
@preproc PreProc
|
@type.qualifier type qualifiers (e.g. `const`)
|
||||||
@debug Debug
|
|
||||||
@tag Tag
|
@attribute attribute annotations (e.g. Python decorators)
|
||||||
|
@property the key in key/value pairs
|
||||||
|
|
||||||
|
@function function definitions
|
||||||
|
@function.builtin built-in functions
|
||||||
|
@function.call function calls
|
||||||
|
@function.macro preprocessor macros
|
||||||
|
|
||||||
|
@function.method method definitions
|
||||||
|
@function.method.call method calls
|
||||||
|
|
||||||
|
@constructor constructor calls and definitions
|
||||||
|
@operator symbolic operators (e.g. `+` / `*`)
|
||||||
|
|
||||||
|
@keyword keywords not fitting into specific categories
|
||||||
|
@keyword.coroutine keywords related to coroutines (e.g. `go` in Go, `async/await` in Python)
|
||||||
|
@keyword.function keywords that define a function (e.g. `func` in Go, `def` in Python)
|
||||||
|
@keyword.operator operators that are English words (e.g. `and` / `or`)
|
||||||
|
@keyword.import keywords for including modules (e.g. `import` / `from` in Python)
|
||||||
|
@keyword.storage modifiers that affect storage in memory or life-time
|
||||||
|
@keyword.repeat keywords related to loops (e.g. `for` / `while`)
|
||||||
|
@keyword.return keywords like `return` and `yield`
|
||||||
|
@keyword.debug keywords related to debugging
|
||||||
|
@keyword.exception keywords related to exceptions (e.g. `throw` / `catch`)
|
||||||
|
|
||||||
|
@keyword.conditional keywords related to conditionals (e.g. `if` / `else`)
|
||||||
|
@keyword.conditional.ternary ternary operator (e.g. `?` / `:`)
|
||||||
|
|
||||||
|
@keyword.directive various preprocessor directives and shebangs
|
||||||
|
@keyword.directive.define preprocessor definition directives
|
||||||
|
|
||||||
|
@punctuation.delimiter delimiters (e.g. `;` / `.` / `,`)
|
||||||
|
@punctuation.bracket brackets (e.g. `()` / `{}` / `[]`)
|
||||||
|
@punctuation.special special symbols (e.g. `{}` in string interpolation)
|
||||||
|
|
||||||
|
@comment line and block comments
|
||||||
|
@comment.documentation comments documenting code
|
||||||
|
|
||||||
|
@comment.error error-type comments (e.g. `ERROR`, `FIXME`, `DEPRECATED:`)
|
||||||
|
@comment.warning warning-type comments (e.g. `WARNING:`, `FIX:`, `HACK:`)
|
||||||
|
@comment.todo todo-type comments (e.g. `TODO:`, `WIP:`, `FIXME:`)
|
||||||
|
@comment.note note-type comments (e.g. `NOTE:`, `INFO:`, `XXX`)
|
||||||
|
|
||||||
|
@markup.strong bold text
|
||||||
|
@markup.italic italic text
|
||||||
|
@markup.strikethrough struck-through text
|
||||||
|
@markup.underline underlined text (only for literal underline markup!)
|
||||||
|
|
||||||
|
@markup.heading headings, titles (including markers)
|
||||||
|
|
||||||
|
@markup.quote block quotes
|
||||||
|
@markup.math math environments (e.g. `$ ... $` in LaTeX)
|
||||||
|
@markup.environment environments (e.g. in LaTeX)
|
||||||
|
|
||||||
|
@markup.link text references, footnotes, citations, etc.
|
||||||
|
@markup.link.label link, reference descriptions
|
||||||
|
@markup.link.url URL-style links
|
||||||
|
|
||||||
|
@markup.raw literal or verbatim text (e.g. inline code)
|
||||||
|
@markup.raw.block literal or verbatim text as a stand-alone block
|
||||||
|
|
||||||
|
@markup.list list markers
|
||||||
|
@markup.list.checked checked todo-style list markers
|
||||||
|
@markup.list.unchecked unchecked todo-style list markers
|
||||||
|
|
||||||
|
@diff.plus added text (for diff files)
|
||||||
|
@diff.minus deleted text (for diff files)
|
||||||
|
@diff.delta changed text (for diff files)
|
||||||
|
|
||||||
|
@tag XML-style tag names (e.g. in XML, HTML, etc.)
|
||||||
|
@tag.attribute XML-style tag attributes
|
||||||
|
@tag.delimiter XML-style tag delimiters
|
||||||
|
|
||||||
*treesitter-highlight-spell*
|
*treesitter-highlight-spell*
|
||||||
The special `@spell` capture can be used to indicate that a node should be
|
The special `@spell` capture can be used to indicate that a node should be
|
||||||
|
@ -5,4 +5,5 @@
|
|||||||
(for_statement)
|
(for_statement)
|
||||||
(while_statement)
|
(while_statement)
|
||||||
(c_style_for_statement)
|
(c_style_for_statement)
|
||||||
|
(heredoc_redirect)
|
||||||
] @fold
|
] @fold
|
||||||
|
@ -1,81 +1,100 @@
|
|||||||
(simple_expansion) @none
|
|
||||||
(expansion
|
|
||||||
"${" @punctuation.special
|
|
||||||
"}" @punctuation.special) @none
|
|
||||||
[
|
[
|
||||||
"("
|
"("
|
||||||
")"
|
")"
|
||||||
"(("
|
"{"
|
||||||
"))"
|
"}"
|
||||||
"{"
|
"["
|
||||||
"}"
|
"]"
|
||||||
"["
|
"[["
|
||||||
"]"
|
"]]"
|
||||||
"[["
|
"(("
|
||||||
"]]"
|
"))"
|
||||||
] @punctuation.bracket
|
] @punctuation.bracket
|
||||||
|
|
||||||
[
|
[
|
||||||
";"
|
";"
|
||||||
";;"
|
";;"
|
||||||
(heredoc_start)
|
";&"
|
||||||
] @punctuation.delimiter
|
";;&"
|
||||||
|
"&"
|
||||||
|
] @punctuation.delimiter
|
||||||
|
|
||||||
[
|
[
|
||||||
"$"
|
">"
|
||||||
] @punctuation.special
|
">>"
|
||||||
|
"<"
|
||||||
|
"<<"
|
||||||
|
"&&"
|
||||||
|
"|"
|
||||||
|
"|&"
|
||||||
|
"||"
|
||||||
|
"="
|
||||||
|
"+="
|
||||||
|
"=~"
|
||||||
|
"=="
|
||||||
|
"!="
|
||||||
|
"&>"
|
||||||
|
"&>>"
|
||||||
|
"<&"
|
||||||
|
">&"
|
||||||
|
">|"
|
||||||
|
"<&-"
|
||||||
|
">&-"
|
||||||
|
"<<-"
|
||||||
|
"<<<"
|
||||||
|
".."
|
||||||
|
] @operator
|
||||||
|
|
||||||
|
; Do *not* spell check strings since they typically have some sort of
|
||||||
|
; interpolation in them, or, are typically used for things like filenames, URLs,
|
||||||
|
; flags and file content.
|
||||||
|
[
|
||||||
|
(string)
|
||||||
|
(raw_string)
|
||||||
|
(ansi_c_string)
|
||||||
|
(heredoc_body)
|
||||||
|
] @string
|
||||||
|
|
||||||
[
|
[
|
||||||
">"
|
(heredoc_start)
|
||||||
">>"
|
(heredoc_end)
|
||||||
"<"
|
] @label
|
||||||
"<<"
|
|
||||||
"&"
|
(variable_assignment
|
||||||
"&&"
|
(word) @string)
|
||||||
"|"
|
|
||||||
"||"
|
(command
|
||||||
"="
|
argument: "$" @string) ; bare dollar
|
||||||
"=~"
|
|
||||||
"=="
|
|
||||||
"!="
|
|
||||||
] @operator
|
|
||||||
|
|
||||||
[
|
[
|
||||||
(string)
|
"if"
|
||||||
(raw_string)
|
"then"
|
||||||
(ansi_c_string)
|
"else"
|
||||||
(heredoc_body)
|
"elif"
|
||||||
] @string @spell
|
"fi"
|
||||||
|
"case"
|
||||||
(variable_assignment (word) @string)
|
"in"
|
||||||
|
"esac"
|
||||||
|
] @keyword.conditional
|
||||||
|
|
||||||
[
|
[
|
||||||
"if"
|
"for"
|
||||||
"then"
|
"do"
|
||||||
"else"
|
"done"
|
||||||
"elif"
|
"select"
|
||||||
"fi"
|
"until"
|
||||||
"case"
|
"while"
|
||||||
"in"
|
] @keyword.repeat
|
||||||
"esac"
|
|
||||||
] @conditional
|
|
||||||
|
|
||||||
[
|
[
|
||||||
"for"
|
"declare"
|
||||||
"do"
|
"typeset"
|
||||||
"done"
|
"export"
|
||||||
"select"
|
"readonly"
|
||||||
"until"
|
"local"
|
||||||
"while"
|
"unset"
|
||||||
] @repeat
|
"unsetenv"
|
||||||
|
] @keyword
|
||||||
[
|
|
||||||
"declare"
|
|
||||||
"export"
|
|
||||||
"local"
|
|
||||||
"readonly"
|
|
||||||
"unset"
|
|
||||||
] @keyword
|
|
||||||
|
|
||||||
"function" @keyword.function
|
"function" @keyword.function
|
||||||
|
|
||||||
@ -83,28 +102,56 @@
|
|||||||
|
|
||||||
; trap -l
|
; trap -l
|
||||||
((word) @constant.builtin
|
((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]))?)$"))
|
(#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]))?)$"))
|
||||||
|
|
||||||
((word) @boolean
|
((word) @boolean
|
||||||
(#any-of? @boolean "true" "false"))
|
(#any-of? @boolean "true" "false"))
|
||||||
|
|
||||||
(comment) @comment @spell
|
(comment) @comment @spell
|
||||||
(test_operator) @string
|
|
||||||
|
(test_operator) @operator
|
||||||
|
|
||||||
(command_substitution
|
(command_substitution
|
||||||
[ "$(" ")" ] @punctuation.bracket)
|
"$(" @punctuation.bracket)
|
||||||
|
|
||||||
(process_substitution
|
(process_substitution
|
||||||
[ "<(" ")" ] @punctuation.bracket)
|
"<(" @punctuation.bracket)
|
||||||
|
|
||||||
|
(arithmetic_expansion
|
||||||
|
[
|
||||||
|
"$(("
|
||||||
|
"(("
|
||||||
|
] @punctuation.special
|
||||||
|
"))" @punctuation.special)
|
||||||
|
|
||||||
|
(arithmetic_expansion
|
||||||
|
"," @punctuation.delimiter)
|
||||||
|
|
||||||
|
(ternary_expression
|
||||||
|
[
|
||||||
|
"?"
|
||||||
|
":"
|
||||||
|
] @keyword.conditional.ternary)
|
||||||
|
|
||||||
|
(binary_expression
|
||||||
|
operator: _ @operator)
|
||||||
|
|
||||||
|
(unary_expression
|
||||||
|
operator: _ @operator)
|
||||||
|
|
||||||
|
(postfix_expression
|
||||||
|
operator: _ @operator)
|
||||||
|
|
||||||
(function_definition
|
(function_definition
|
||||||
name: (word) @function)
|
name: (word) @function)
|
||||||
|
|
||||||
(command_name (word) @function.call)
|
(command_name
|
||||||
|
(word) @function.call)
|
||||||
|
|
||||||
((command_name (word) @function.builtin)
|
((command_name
|
||||||
(#any-of? @function.builtin
|
(word) @function.builtin)
|
||||||
|
; format-ignore
|
||||||
|
(#any-of? @function.builtin
|
||||||
"alias" "bg" "bind" "break" "builtin" "caller" "cd"
|
"alias" "bg" "bind" "break" "builtin" "caller" "cd"
|
||||||
"command" "compgen" "complete" "compopt" "continue"
|
"command" "compgen" "complete" "compopt" "continue"
|
||||||
"coproc" "dirs" "disown" "echo" "enable" "eval"
|
"coproc" "dirs" "disown" "echo" "enable" "eval"
|
||||||
@ -116,30 +163,59 @@
|
|||||||
"ulimit" "umask" "unalias" "wait"))
|
"ulimit" "umask" "unalias" "wait"))
|
||||||
|
|
||||||
(command
|
(command
|
||||||
argument: [
|
argument:
|
||||||
(word) @parameter
|
[
|
||||||
(concatenation (word) @parameter)
|
(word) @variable.parameter
|
||||||
])
|
(concatenation
|
||||||
|
(word) @variable.parameter)
|
||||||
|
])
|
||||||
|
|
||||||
|
(number) @number
|
||||||
|
|
||||||
((word) @number
|
((word) @number
|
||||||
(#lua-match? @number "^[0-9]+$"))
|
(#lua-match? @number "^[0-9]+$"))
|
||||||
|
|
||||||
(file_redirect
|
(file_redirect
|
||||||
descriptor: (file_descriptor) @operator
|
destination: (word) @variable.parameter)
|
||||||
destination: (word) @parameter)
|
|
||||||
|
(file_descriptor) @operator
|
||||||
|
|
||||||
|
(simple_expansion
|
||||||
|
"$" @punctuation.special) @none
|
||||||
|
|
||||||
(expansion
|
(expansion
|
||||||
[ "${" "}" ] @punctuation.bracket)
|
"${" @punctuation.special
|
||||||
|
"}" @punctuation.special) @none
|
||||||
|
|
||||||
|
(expansion
|
||||||
|
operator: _ @punctuation.special)
|
||||||
|
|
||||||
|
(expansion
|
||||||
|
"@"
|
||||||
|
.
|
||||||
|
operator: _ @character.special)
|
||||||
|
|
||||||
|
((expansion
|
||||||
|
(subscript
|
||||||
|
index: (word) @character.special))
|
||||||
|
(#any-of? @character.special "@" "*"))
|
||||||
|
|
||||||
|
"``" @punctuation.special
|
||||||
|
|
||||||
(variable_name) @variable
|
(variable_name) @variable
|
||||||
|
|
||||||
((variable_name) @constant
|
((variable_name) @constant
|
||||||
(#lua-match? @constant "^[A-Z][A-Z_0-9]*$"))
|
(#lua-match? @constant "^[A-Z][A-Z_0-9]*$"))
|
||||||
|
|
||||||
(case_item
|
(case_item
|
||||||
value: (word) @parameter)
|
value: (word) @variable.parameter)
|
||||||
|
|
||||||
(regex) @string.regex
|
[
|
||||||
|
(regex)
|
||||||
|
(extglob_pattern)
|
||||||
|
] @string.regexp
|
||||||
|
|
||||||
((program . (comment) @preproc)
|
((program
|
||||||
(#lua-match? @preproc "^#!/"))
|
.
|
||||||
|
(comment) @keyword.directive)
|
||||||
|
(#lua-match? @keyword.directive "^#!/"))
|
||||||
|
@ -1,19 +1,21 @@
|
|||||||
[
|
[
|
||||||
(for_statement)
|
(for_statement)
|
||||||
(if_statement)
|
(if_statement)
|
||||||
(while_statement)
|
(while_statement)
|
||||||
(switch_statement)
|
(do_statement)
|
||||||
(case_statement)
|
(switch_statement)
|
||||||
(function_definition)
|
(case_statement)
|
||||||
(struct_specifier)
|
(function_definition)
|
||||||
(enum_specifier)
|
(struct_specifier)
|
||||||
(comment)
|
(enum_specifier)
|
||||||
(preproc_if)
|
(comment)
|
||||||
(preproc_elif)
|
(preproc_if)
|
||||||
(preproc_else)
|
(preproc_elif)
|
||||||
(preproc_ifdef)
|
(preproc_else)
|
||||||
(initializer_list)
|
(preproc_ifdef)
|
||||||
(gnu_asm_expression)
|
(preproc_function_def)
|
||||||
|
(initializer_list)
|
||||||
|
(gnu_asm_expression)
|
||||||
] @fold
|
] @fold
|
||||||
|
|
||||||
(compound_statement
|
(compound_statement
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
; Lower priority to prefer @parameter when identifier appears in parameter_declaration.
|
; Lower priority to prefer @variable.parameter when identifier appears in parameter_declaration.
|
||||||
((identifier) @variable (#set! "priority" 95))
|
((identifier) @variable
|
||||||
(preproc_def (preproc_arg) @variable)
|
(#set! "priority" 95))
|
||||||
|
|
||||||
|
(preproc_def
|
||||||
|
(preproc_arg) @variable)
|
||||||
|
|
||||||
[
|
[
|
||||||
"default"
|
"default"
|
||||||
@ -17,7 +20,10 @@
|
|||||||
"sizeof"
|
"sizeof"
|
||||||
"offsetof"
|
"offsetof"
|
||||||
] @keyword.operator
|
] @keyword.operator
|
||||||
(alignof_expression . _ @keyword.operator)
|
|
||||||
|
(alignof_expression
|
||||||
|
.
|
||||||
|
_ @keyword.operator)
|
||||||
|
|
||||||
"return" @keyword.return
|
"return" @keyword.return
|
||||||
|
|
||||||
@ -27,14 +33,14 @@
|
|||||||
"do"
|
"do"
|
||||||
"continue"
|
"continue"
|
||||||
"break"
|
"break"
|
||||||
] @repeat
|
] @keyword.repeat
|
||||||
|
|
||||||
[
|
[
|
||||||
"if"
|
"if"
|
||||||
"else"
|
"else"
|
||||||
"case"
|
"case"
|
||||||
"switch"
|
"switch"
|
||||||
] @conditional
|
] @keyword.conditional
|
||||||
|
|
||||||
[
|
[
|
||||||
"#if"
|
"#if"
|
||||||
@ -46,48 +52,54 @@
|
|||||||
"#elifdef"
|
"#elifdef"
|
||||||
"#elifndef"
|
"#elifndef"
|
||||||
(preproc_directive)
|
(preproc_directive)
|
||||||
] @preproc
|
] @keyword.directive
|
||||||
|
|
||||||
"#define" @define
|
"#define" @keyword.directive.define
|
||||||
|
|
||||||
"#include" @include
|
"#include" @keyword.import
|
||||||
|
|
||||||
[ ";" ":" "," "::" ] @punctuation.delimiter
|
[
|
||||||
|
";"
|
||||||
|
":"
|
||||||
|
","
|
||||||
|
"::"
|
||||||
|
] @punctuation.delimiter
|
||||||
|
|
||||||
"..." @punctuation.special
|
"..." @punctuation.special
|
||||||
|
|
||||||
[ "(" ")" "[" "]" "{" "}"] @punctuation.bracket
|
[
|
||||||
|
"("
|
||||||
|
")"
|
||||||
|
"["
|
||||||
|
"]"
|
||||||
|
"{"
|
||||||
|
"}"
|
||||||
|
] @punctuation.bracket
|
||||||
|
|
||||||
[
|
[
|
||||||
"="
|
"="
|
||||||
|
|
||||||
"-"
|
"-"
|
||||||
"*"
|
"*"
|
||||||
"/"
|
"/"
|
||||||
"+"
|
"+"
|
||||||
"%"
|
"%"
|
||||||
|
|
||||||
"~"
|
"~"
|
||||||
"|"
|
"|"
|
||||||
"&"
|
"&"
|
||||||
"^"
|
"^"
|
||||||
"<<"
|
"<<"
|
||||||
">>"
|
">>"
|
||||||
|
|
||||||
"->"
|
"->"
|
||||||
"."
|
"."
|
||||||
|
|
||||||
"<"
|
"<"
|
||||||
"<="
|
"<="
|
||||||
">="
|
">="
|
||||||
">"
|
">"
|
||||||
"=="
|
"=="
|
||||||
"!="
|
"!="
|
||||||
|
|
||||||
"!"
|
"!"
|
||||||
"&&"
|
"&&"
|
||||||
"||"
|
"||"
|
||||||
|
|
||||||
"-="
|
"-="
|
||||||
"+="
|
"+="
|
||||||
"*="
|
"*="
|
||||||
@ -102,45 +114,57 @@
|
|||||||
"++"
|
"++"
|
||||||
] @operator
|
] @operator
|
||||||
|
|
||||||
;; Make sure the comma operator is given a highlight group after the comma
|
; Make sure the comma operator is given a highlight group after the comma
|
||||||
;; punctuator so the operator is highlighted properly.
|
; punctuator so the operator is highlighted properly.
|
||||||
(comma_expression [ "," ] @operator)
|
(comma_expression
|
||||||
|
"," @operator)
|
||||||
|
|
||||||
[
|
[
|
||||||
(true)
|
(true)
|
||||||
(false)
|
(false)
|
||||||
] @boolean
|
] @boolean
|
||||||
|
|
||||||
(conditional_expression [ "?" ":" ] @conditional.ternary)
|
(conditional_expression
|
||||||
|
[
|
||||||
|
"?"
|
||||||
|
":"
|
||||||
|
] @keyword.conditional.ternary)
|
||||||
|
|
||||||
(string_literal) @string
|
(string_literal) @string
|
||||||
|
|
||||||
(system_lib_string) @string
|
(system_lib_string) @string
|
||||||
|
|
||||||
(escape_sequence) @string.escape
|
(escape_sequence) @string.escape
|
||||||
|
|
||||||
(null) @constant.builtin
|
(null) @constant.builtin
|
||||||
|
|
||||||
(number_literal) @number
|
(number_literal) @number
|
||||||
|
|
||||||
(char_literal) @character
|
(char_literal) @character
|
||||||
|
|
||||||
((preproc_arg) @function.macro (#set! "priority" 90))
|
((preproc_arg) @function.macro
|
||||||
|
(#set! "priority" 90))
|
||||||
|
|
||||||
(preproc_defined) @function.macro
|
(preproc_defined) @function.macro
|
||||||
|
|
||||||
(((field_expression
|
((field_expression
|
||||||
(field_identifier) @property)) @_parent
|
(field_identifier) @property) @_parent
|
||||||
(#not-has-parent? @_parent template_method function_declarator call_expression))
|
(#not-has-parent? @_parent template_method function_declarator call_expression))
|
||||||
|
|
||||||
(field_designator) @property
|
(field_designator) @property
|
||||||
(((field_identifier) @property)
|
|
||||||
(#has-ancestor? @property field_declaration)
|
((field_identifier) @property
|
||||||
(#not-has-ancestor? @property function_declarator))
|
(#has-ancestor? @property field_declaration)
|
||||||
|
(#not-has-ancestor? @property function_declarator))
|
||||||
|
|
||||||
(statement_identifier) @label
|
(statement_identifier) @label
|
||||||
|
|
||||||
[
|
[
|
||||||
(type_identifier)
|
(type_identifier)
|
||||||
(type_descriptor)
|
(type_descriptor)
|
||||||
] @type
|
] @type
|
||||||
|
|
||||||
(storage_class_specifier) @storageclass
|
(storage_class_specifier) @keyword.storage
|
||||||
|
|
||||||
[
|
[
|
||||||
(type_qualifier)
|
(type_qualifier)
|
||||||
@ -149,25 +173,32 @@
|
|||||||
] @type.qualifier
|
] @type.qualifier
|
||||||
|
|
||||||
(linkage_specification
|
(linkage_specification
|
||||||
"extern" @storageclass)
|
"extern" @keyword.storage)
|
||||||
|
|
||||||
(type_definition
|
(type_definition
|
||||||
declarator: (type_identifier) @type.definition)
|
declarator: (type_identifier) @type.definition)
|
||||||
|
|
||||||
(primitive_type) @type.builtin
|
(primitive_type) @type.builtin
|
||||||
|
|
||||||
(sized_type_specifier _ @type.builtin type: _?)
|
(sized_type_specifier
|
||||||
|
_ @type.builtin
|
||||||
|
type: _?)
|
||||||
|
|
||||||
((identifier) @constant
|
((identifier) @constant
|
||||||
(#lua-match? @constant "^[A-Z][A-Z0-9_]+$"))
|
|
||||||
(preproc_def (preproc_arg) @constant
|
|
||||||
(#lua-match? @constant "^[A-Z][A-Z0-9_]+$"))
|
(#lua-match? @constant "^[A-Z][A-Z0-9_]+$"))
|
||||||
|
|
||||||
|
(preproc_def
|
||||||
|
(preproc_arg) @constant
|
||||||
|
(#lua-match? @constant "^[A-Z][A-Z0-9_]+$"))
|
||||||
|
|
||||||
(enumerator
|
(enumerator
|
||||||
name: (identifier) @constant)
|
name: (identifier) @constant)
|
||||||
|
|
||||||
(case_statement
|
(case_statement
|
||||||
value: (identifier) @constant)
|
value: (identifier) @constant)
|
||||||
|
|
||||||
((identifier) @constant.builtin
|
((identifier) @constant.builtin
|
||||||
|
; format-ignore
|
||||||
(#any-of? @constant.builtin
|
(#any-of? @constant.builtin
|
||||||
"stderr" "stdin" "stdout"
|
"stderr" "stdin" "stdout"
|
||||||
"__FILE__" "__LINE__" "__DATE__" "__TIME__"
|
"__FILE__" "__LINE__" "__DATE__" "__TIME__"
|
||||||
@ -180,7 +211,10 @@
|
|||||||
"__clang_wide_literal_encoding__"
|
"__clang_wide_literal_encoding__"
|
||||||
"__FUNCTION__" "__func__" "__PRETTY_FUNCTION__"
|
"__FUNCTION__" "__func__" "__PRETTY_FUNCTION__"
|
||||||
"__VA_ARGS__" "__VA_OPT__"))
|
"__VA_ARGS__" "__VA_OPT__"))
|
||||||
(preproc_def (preproc_arg) @constant.builtin
|
|
||||||
|
(preproc_def
|
||||||
|
(preproc_arg) @constant.builtin
|
||||||
|
; format-ignore
|
||||||
(#any-of? @constant.builtin
|
(#any-of? @constant.builtin
|
||||||
"stderr" "stdin" "stdout"
|
"stderr" "stdin" "stdout"
|
||||||
"__FILE__" "__LINE__" "__DATE__" "__TIME__"
|
"__FILE__" "__LINE__" "__DATE__" "__TIME__"
|
||||||
@ -195,21 +229,26 @@
|
|||||||
"__VA_ARGS__" "__VA_OPT__"))
|
"__VA_ARGS__" "__VA_OPT__"))
|
||||||
|
|
||||||
(attribute_specifier
|
(attribute_specifier
|
||||||
(argument_list (identifier) @variable.builtin))
|
(argument_list
|
||||||
|
(identifier) @variable.builtin))
|
||||||
|
|
||||||
((attribute_specifier
|
((attribute_specifier
|
||||||
(argument_list (call_expression
|
(argument_list
|
||||||
function: (identifier) @variable.builtin))))
|
(call_expression
|
||||||
|
function: (identifier) @variable.builtin))))
|
||||||
|
|
||||||
((call_expression
|
((call_expression
|
||||||
function: (identifier) @function.builtin)
|
function: (identifier) @function.builtin)
|
||||||
(#lua-match? @function.builtin "^__builtin_"))
|
(#lua-match? @function.builtin "^__builtin_"))
|
||||||
|
|
||||||
((call_expression
|
((call_expression
|
||||||
function: (identifier) @function.builtin)
|
function: (identifier) @function.builtin)
|
||||||
(#has-ancestor? @function.builtin attribute_specifier))
|
(#has-ancestor? @function.builtin attribute_specifier))
|
||||||
|
|
||||||
;; Preproc def / undef
|
; Preproc def / undef
|
||||||
(preproc_def
|
(preproc_def
|
||||||
name: (_) @constant)
|
name: (_) @constant)
|
||||||
|
|
||||||
(preproc_call
|
(preproc_call
|
||||||
directive: (preproc_directive) @_u
|
directive: (preproc_directive) @_u
|
||||||
argument: (_) @constant
|
argument: (_) @constant
|
||||||
@ -217,15 +256,21 @@
|
|||||||
|
|
||||||
(call_expression
|
(call_expression
|
||||||
function: (identifier) @function.call)
|
function: (identifier) @function.call)
|
||||||
|
|
||||||
(call_expression
|
(call_expression
|
||||||
function: (field_expression
|
function:
|
||||||
field: (field_identifier) @function.call))
|
(field_expression
|
||||||
|
field: (field_identifier) @function.call))
|
||||||
|
|
||||||
(function_declarator
|
(function_declarator
|
||||||
declarator: (identifier) @function)
|
declarator: (identifier) @function)
|
||||||
|
|
||||||
(function_declarator
|
(function_declarator
|
||||||
declarator: (parenthesized_declarator
|
declarator:
|
||||||
(pointer_declarator
|
(parenthesized_declarator
|
||||||
declarator: (field_identifier) @function)))
|
(pointer_declarator
|
||||||
|
declarator: (field_identifier) @function)))
|
||||||
|
|
||||||
(preproc_function_def
|
(preproc_function_def
|
||||||
name: (identifier) @function.macro)
|
name: (identifier) @function.macro)
|
||||||
|
|
||||||
@ -234,17 +279,40 @@
|
|||||||
((comment) @comment.documentation
|
((comment) @comment.documentation
|
||||||
(#lua-match? @comment.documentation "^/[*][*][^*].*[*]/$"))
|
(#lua-match? @comment.documentation "^/[*][*][^*].*[*]/$"))
|
||||||
|
|
||||||
;; Parameters
|
; Parameters
|
||||||
(parameter_declaration
|
(parameter_declaration
|
||||||
declarator: (identifier) @parameter)
|
declarator: (identifier) @variable.parameter)
|
||||||
|
|
||||||
(parameter_declaration
|
(parameter_declaration
|
||||||
declarator: (array_declarator) @parameter)
|
declarator: (array_declarator) @variable.parameter)
|
||||||
|
|
||||||
(parameter_declaration
|
(parameter_declaration
|
||||||
declarator: (pointer_declarator) @parameter)
|
declarator: (pointer_declarator) @variable.parameter)
|
||||||
|
|
||||||
(preproc_params (identifier) @parameter)
|
; K&R functions
|
||||||
|
; To enable support for K&R functions,
|
||||||
|
; add the following lines to your own query config and uncomment them.
|
||||||
|
; They are commented out as they'll conflict with C++
|
||||||
|
; Note that you'll need to have `; extends` at the top of your query file.
|
||||||
|
;
|
||||||
|
; (parameter_list (identifier) @variable.parameter)
|
||||||
|
;
|
||||||
|
; (function_definition
|
||||||
|
; declarator: _
|
||||||
|
; (declaration
|
||||||
|
; declarator: (identifier) @variable.parameter))
|
||||||
|
;
|
||||||
|
; (function_definition
|
||||||
|
; declarator: _
|
||||||
|
; (declaration
|
||||||
|
; declarator: (array_declarator) @variable.parameter))
|
||||||
|
;
|
||||||
|
; (function_definition
|
||||||
|
; declarator: _
|
||||||
|
; (declaration
|
||||||
|
; declarator: (pointer_declarator) @variable.parameter))
|
||||||
|
(preproc_params
|
||||||
|
(identifier) @variable.parameter)
|
||||||
|
|
||||||
[
|
[
|
||||||
"__attribute__"
|
"__attribute__"
|
||||||
@ -259,5 +327,3 @@
|
|||||||
(ms_pointer_modifier)
|
(ms_pointer_modifier)
|
||||||
(attribute_declaration)
|
(attribute_declaration)
|
||||||
] @attribute
|
] @attribute
|
||||||
|
|
||||||
(ERROR) @error
|
|
||||||
|
@ -1,21 +1,2 @@
|
|||||||
((preproc_def
|
((preproc_arg) @injection.content
|
||||||
(preproc_arg) @injection.content)
|
(#set! injection.self))
|
||||||
(#lua-match? @injection.content "\n")
|
|
||||||
(#set! injection.language "c"))
|
|
||||||
|
|
||||||
(preproc_function_def
|
|
||||||
(preproc_arg) @injection.content
|
|
||||||
(#set! injection.language "c"))
|
|
||||||
|
|
||||||
(preproc_call
|
|
||||||
(preproc_arg) @injection.content
|
|
||||||
(#set! injection.language "c"))
|
|
||||||
|
|
||||||
; ((comment) @injection.content
|
|
||||||
; (#set! injection.language "comment"))
|
|
||||||
|
|
||||||
; TODO: add when asm is added
|
|
||||||
; (gnu_asm_expression assembly_code: (string_literal) @injection.content
|
|
||||||
; (#set! injection.language "asm"))
|
|
||||||
; (gnu_asm_expression assembly_code: (concatenated_string (string_literal) @injection.content)
|
|
||||||
; (#set! injection.language "asm"))
|
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
[
|
[
|
||||||
(do_statement)
|
(do_statement)
|
||||||
(while_statement)
|
(while_statement)
|
||||||
(repeat_statement)
|
(repeat_statement)
|
||||||
(if_statement)
|
(if_statement)
|
||||||
(for_statement)
|
(for_statement)
|
||||||
(function_declaration)
|
(function_declaration)
|
||||||
(function_definition)
|
(function_definition)
|
||||||
(table_constructor)
|
(parameters)
|
||||||
|
(arguments)
|
||||||
|
(table_constructor)
|
||||||
] @fold
|
] @fold
|
||||||
|
@ -1,81 +1,79 @@
|
|||||||
;; Keywords
|
; Keywords
|
||||||
|
|
||||||
"return" @keyword.return
|
"return" @keyword.return
|
||||||
|
|
||||||
[
|
[
|
||||||
"goto"
|
"goto"
|
||||||
"in"
|
"in"
|
||||||
"local"
|
"local"
|
||||||
] @keyword
|
] @keyword
|
||||||
|
|
||||||
(break_statement) @keyword
|
(break_statement) @keyword
|
||||||
|
|
||||||
(do_statement
|
(do_statement
|
||||||
[
|
[
|
||||||
"do"
|
"do"
|
||||||
"end"
|
"end"
|
||||||
] @keyword)
|
] @keyword)
|
||||||
|
|
||||||
(while_statement
|
(while_statement
|
||||||
[
|
[
|
||||||
"while"
|
"while"
|
||||||
"do"
|
"do"
|
||||||
"end"
|
"end"
|
||||||
] @repeat)
|
] @keyword.repeat)
|
||||||
|
|
||||||
(repeat_statement
|
(repeat_statement
|
||||||
[
|
[
|
||||||
"repeat"
|
"repeat"
|
||||||
"until"
|
"until"
|
||||||
] @repeat)
|
] @keyword.repeat)
|
||||||
|
|
||||||
(if_statement
|
(if_statement
|
||||||
[
|
[
|
||||||
"if"
|
"if"
|
||||||
"elseif"
|
"elseif"
|
||||||
"else"
|
"else"
|
||||||
"then"
|
"then"
|
||||||
"end"
|
"end"
|
||||||
] @conditional)
|
] @keyword.conditional)
|
||||||
|
|
||||||
(elseif_statement
|
(elseif_statement
|
||||||
[
|
[
|
||||||
"elseif"
|
"elseif"
|
||||||
"then"
|
"then"
|
||||||
"end"
|
"end"
|
||||||
] @conditional)
|
] @keyword.conditional)
|
||||||
|
|
||||||
(else_statement
|
(else_statement
|
||||||
[
|
[
|
||||||
"else"
|
"else"
|
||||||
"end"
|
"end"
|
||||||
] @conditional)
|
] @keyword.conditional)
|
||||||
|
|
||||||
(for_statement
|
(for_statement
|
||||||
[
|
[
|
||||||
"for"
|
"for"
|
||||||
"do"
|
"do"
|
||||||
"end"
|
"end"
|
||||||
] @repeat)
|
] @keyword.repeat)
|
||||||
|
|
||||||
(function_declaration
|
(function_declaration
|
||||||
[
|
[
|
||||||
"function"
|
"function"
|
||||||
"end"
|
"end"
|
||||||
] @keyword.function)
|
] @keyword.function)
|
||||||
|
|
||||||
(function_definition
|
(function_definition
|
||||||
[
|
[
|
||||||
"function"
|
"function"
|
||||||
"end"
|
"end"
|
||||||
] @keyword.function)
|
] @keyword.function)
|
||||||
|
|
||||||
;; Operators
|
|
||||||
|
|
||||||
|
; Operators
|
||||||
[
|
[
|
||||||
"and"
|
"and"
|
||||||
"not"
|
"not"
|
||||||
"or"
|
"or"
|
||||||
] @keyword.operator
|
] @keyword.operator
|
||||||
|
|
||||||
[
|
[
|
||||||
@ -102,8 +100,7 @@
|
|||||||
".."
|
".."
|
||||||
] @operator
|
] @operator
|
||||||
|
|
||||||
;; Punctuations
|
; Punctuations
|
||||||
|
|
||||||
[
|
[
|
||||||
";"
|
";"
|
||||||
":"
|
":"
|
||||||
@ -112,19 +109,17 @@
|
|||||||
"."
|
"."
|
||||||
] @punctuation.delimiter
|
] @punctuation.delimiter
|
||||||
|
|
||||||
;; Brackets
|
; Brackets
|
||||||
|
|
||||||
[
|
[
|
||||||
"("
|
"("
|
||||||
")"
|
")"
|
||||||
"["
|
"["
|
||||||
"]"
|
"]"
|
||||||
"{"
|
"{"
|
||||||
"}"
|
"}"
|
||||||
] @punctuation.bracket
|
] @punctuation.bracket
|
||||||
|
|
||||||
;; Variables
|
; Variables
|
||||||
|
|
||||||
(identifier) @variable
|
(identifier) @variable
|
||||||
|
|
||||||
((identifier) @constant.builtin
|
((identifier) @constant.builtin
|
||||||
@ -133,27 +128,28 @@
|
|||||||
((identifier) @variable.builtin
|
((identifier) @variable.builtin
|
||||||
(#eq? @variable.builtin "self"))
|
(#eq? @variable.builtin "self"))
|
||||||
|
|
||||||
((identifier) @namespace.builtin
|
((identifier) @module.builtin
|
||||||
(#any-of? @namespace.builtin "_G" "debug" "io" "jit" "math" "os" "package" "string" "table" "utf8"))
|
(#any-of? @module.builtin "_G" "debug" "io" "jit" "math" "os" "package" "string" "table" "utf8"))
|
||||||
|
|
||||||
((identifier) @keyword.coroutine
|
((identifier) @keyword.coroutine
|
||||||
(#eq? @keyword.coroutine "coroutine"))
|
(#eq? @keyword.coroutine "coroutine"))
|
||||||
|
|
||||||
(variable_list
|
(variable_list
|
||||||
attribute: (attribute
|
(attribute
|
||||||
(["<" ">"] @punctuation.bracket
|
"<" @punctuation.bracket
|
||||||
(identifier) @attribute)))
|
(identifier) @attribute
|
||||||
|
">" @punctuation.bracket))
|
||||||
|
|
||||||
;; Labels
|
; Labels
|
||||||
|
(label_statement
|
||||||
|
(identifier) @label)
|
||||||
|
|
||||||
(label_statement (identifier) @label)
|
(goto_statement
|
||||||
|
(identifier) @label)
|
||||||
(goto_statement (identifier) @label)
|
|
||||||
|
|
||||||
;; Constants
|
|
||||||
|
|
||||||
|
; Constants
|
||||||
((identifier) @constant
|
((identifier) @constant
|
||||||
(#lua-match? @constant "^[A-Z][A-Z_0-9]*$"))
|
(#lua-match? @constant "^[A-Z][A-Z_0-9]*$"))
|
||||||
|
|
||||||
(vararg_expression) @constant
|
(vararg_expression) @constant
|
||||||
|
|
||||||
@ -164,41 +160,49 @@
|
|||||||
(true)
|
(true)
|
||||||
] @boolean
|
] @boolean
|
||||||
|
|
||||||
;; Tables
|
; Tables
|
||||||
|
(field
|
||||||
|
name: (identifier) @variable.member)
|
||||||
|
|
||||||
(field name: (identifier) @field)
|
(dot_index_expression
|
||||||
|
field: (identifier) @variable.member)
|
||||||
(dot_index_expression field: (identifier) @field)
|
|
||||||
|
|
||||||
(table_constructor
|
(table_constructor
|
||||||
[
|
[
|
||||||
"{"
|
"{"
|
||||||
"}"
|
"}"
|
||||||
] @constructor)
|
] @constructor)
|
||||||
|
|
||||||
;; Functions
|
; Functions
|
||||||
|
(parameters
|
||||||
|
(identifier) @variable.parameter)
|
||||||
|
|
||||||
(parameters (identifier) @parameter)
|
(vararg_expression) @variable.parameter.builtin
|
||||||
|
|
||||||
(function_declaration
|
(function_declaration
|
||||||
name: [
|
name:
|
||||||
(identifier) @function
|
[
|
||||||
(dot_index_expression
|
|
||||||
field: (identifier) @function)
|
|
||||||
])
|
|
||||||
|
|
||||||
(function_declaration
|
|
||||||
name: (method_index_expression
|
|
||||||
method: (identifier) @method))
|
|
||||||
|
|
||||||
(assignment_statement
|
|
||||||
(variable_list .
|
|
||||||
name: [
|
|
||||||
(identifier) @function
|
(identifier) @function
|
||||||
(dot_index_expression
|
(dot_index_expression
|
||||||
field: (identifier) @function)
|
field: (identifier) @function)
|
||||||
])
|
])
|
||||||
(expression_list .
|
|
||||||
|
(function_declaration
|
||||||
|
name:
|
||||||
|
(method_index_expression
|
||||||
|
method: (identifier) @function.method))
|
||||||
|
|
||||||
|
(assignment_statement
|
||||||
|
(variable_list
|
||||||
|
.
|
||||||
|
name:
|
||||||
|
[
|
||||||
|
(identifier) @function
|
||||||
|
(dot_index_expression
|
||||||
|
field: (identifier) @function)
|
||||||
|
])
|
||||||
|
(expression_list
|
||||||
|
.
|
||||||
value: (function_definition)))
|
value: (function_definition)))
|
||||||
|
|
||||||
(table_constructor
|
(table_constructor
|
||||||
@ -207,18 +211,20 @@
|
|||||||
value: (function_definition)))
|
value: (function_definition)))
|
||||||
|
|
||||||
(function_call
|
(function_call
|
||||||
name: [
|
name:
|
||||||
(identifier) @function.call
|
[
|
||||||
(dot_index_expression
|
(identifier) @function.call
|
||||||
field: (identifier) @function.call)
|
(dot_index_expression
|
||||||
(method_index_expression
|
field: (identifier) @function.call)
|
||||||
method: (identifier) @method.call)
|
(method_index_expression
|
||||||
])
|
method: (identifier) @function.method.call)
|
||||||
|
])
|
||||||
|
|
||||||
(function_call
|
(function_call
|
||||||
(identifier) @function.builtin
|
(identifier) @function.builtin
|
||||||
|
; format-ignore
|
||||||
(#any-of? @function.builtin
|
(#any-of? @function.builtin
|
||||||
;; built-in functions in Lua 5.1
|
; built-in functions in Lua 5.1
|
||||||
"assert" "collectgarbage" "dofile" "error" "getfenv" "getmetatable" "ipairs"
|
"assert" "collectgarbage" "dofile" "error" "getfenv" "getmetatable" "ipairs"
|
||||||
"load" "loadfile" "loadstring" "module" "next" "pairs" "pcall" "print"
|
"load" "loadfile" "loadstring" "module" "next" "pairs" "pcall" "print"
|
||||||
"rawequal" "rawget" "rawlen" "rawset" "require" "select" "setfenv" "setmetatable"
|
"rawequal" "rawget" "rawlen" "rawset" "require" "select" "setfenv" "setmetatable"
|
||||||
@ -227,8 +233,7 @@
|
|||||||
"__idiv" "__index" "__le" "__len" "__lt" "__metatable" "__mod" "__mul" "__name" "__newindex"
|
"__idiv" "__index" "__le" "__len" "__lt" "__metatable" "__mod" "__mul" "__name" "__newindex"
|
||||||
"__pairs" "__pow" "__shl" "__shr" "__sub" "__tostring" "__unm"))
|
"__pairs" "__pow" "__shl" "__shr" "__sub" "__tostring" "__unm"))
|
||||||
|
|
||||||
;; Others
|
; Others
|
||||||
|
|
||||||
(comment) @comment @spell
|
(comment) @comment @spell
|
||||||
|
|
||||||
((comment) @comment.documentation
|
((comment) @comment.documentation
|
||||||
@ -237,13 +242,34 @@
|
|||||||
((comment) @comment.documentation
|
((comment) @comment.documentation
|
||||||
(#lua-match? @comment.documentation "^[-][-](%s?)@"))
|
(#lua-match? @comment.documentation "^[-][-](%s?)@"))
|
||||||
|
|
||||||
(hash_bang_line) @preproc
|
(hash_bang_line) @keyword.directive
|
||||||
|
|
||||||
(number) @number
|
(number) @number
|
||||||
|
|
||||||
(string) @string @spell
|
(string) @string
|
||||||
|
|
||||||
(escape_sequence) @string.escape
|
(escape_sequence) @string.escape
|
||||||
|
|
||||||
;; Error
|
; string.match("123", "%d+")
|
||||||
(ERROR) @error
|
(function_call
|
||||||
|
(dot_index_expression
|
||||||
|
field: (identifier) @_method
|
||||||
|
(#any-of? @_method "find" "match" "gmatch" "gsub"))
|
||||||
|
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)))
|
||||||
|
@ -1,35 +1,130 @@
|
|||||||
((function_call
|
((function_call
|
||||||
name: [
|
name:
|
||||||
(identifier) @_cdef_identifier
|
[
|
||||||
(_ _ (identifier) @_cdef_identifier)
|
(identifier) @_cdef_identifier
|
||||||
]
|
(_
|
||||||
|
_
|
||||||
|
(identifier) @_cdef_identifier)
|
||||||
|
]
|
||||||
arguments:
|
arguments:
|
||||||
(arguments
|
(arguments
|
||||||
(string content: _ @injection.content)))
|
(string
|
||||||
|
content: _ @injection.content)))
|
||||||
(#set! injection.language "c")
|
(#set! injection.language "c")
|
||||||
(#eq? @_cdef_identifier "cdef"))
|
(#eq? @_cdef_identifier "cdef"))
|
||||||
|
|
||||||
((function_call
|
((function_call
|
||||||
name: (_) @_vimcmd_identifier
|
name: (_) @_vimcmd_identifier
|
||||||
arguments: (arguments (string content: _ @injection.content)))
|
arguments:
|
||||||
|
(arguments
|
||||||
|
(string
|
||||||
|
content: _ @injection.content)))
|
||||||
(#set! injection.language "vim")
|
(#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
|
((function_call
|
||||||
name: (_) @_vimcmd_identifier
|
name: (_) @_vimcmd_identifier
|
||||||
arguments: (arguments (string content: _ @injection.content) .))
|
arguments:
|
||||||
|
(arguments
|
||||||
|
(string
|
||||||
|
content: _ @injection.content) .))
|
||||||
(#set! injection.language "query")
|
(#set! injection.language "query")
|
||||||
(#any-of? @_vimcmd_identifier "vim.treesitter.query.set" "vim.treesitter.query.parse"))
|
(#any-of? @_vimcmd_identifier "vim.treesitter.query.set" "vim.treesitter.query.parse"))
|
||||||
|
|
||||||
((function_call
|
((function_call
|
||||||
name: (_) @_vimcmd_identifier
|
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")
|
(#any-of? @_vimcmd_identifier "vim.rpcrequest" "vim.rpcnotify")
|
||||||
(#eq? @_method "nvim_exec_lua")
|
(#eq? @_method "nvim_exec_lua")
|
||||||
(#set! injection.language "lua"))
|
(#set! injection.language "lua"))
|
||||||
|
|
||||||
;; highlight string as query if starts with `;; query`
|
; vim.api.nvim_create_autocmd("FileType", { command = "injected here" })
|
||||||
(string content: _ @injection.content
|
(function_call
|
||||||
(#lua-match? @injection.content "^%s*;+%s?query")
|
name: (_) @_vimcmd_identifier
|
||||||
(#set! injection.language "query"))
|
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")
|
||||||
|
(#set! injection.language "vim"))
|
||||||
|
|
||||||
|
(function_call
|
||||||
|
name: (_) @_user_cmd
|
||||||
|
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)
|
||||||
|
.
|
||||||
|
(_) .)
|
||||||
|
; Limiting predicate handling to only functions with 4 arguments
|
||||||
|
(#eq? @_user_cmd "vim.api.nvim_buf_create_user_command")
|
||||||
|
(#set! injection.language "vim"))
|
||||||
|
|
||||||
|
; rhs highlighting for vim.keymap.set/vim.api.nvim_set_keymap/vim.api.nvim_buf_set_keymap
|
||||||
|
; (function_call
|
||||||
|
; name: (_) @_map
|
||||||
|
; arguments:
|
||||||
|
; (arguments
|
||||||
|
; . (_)
|
||||||
|
; . (_)
|
||||||
|
; .
|
||||||
|
; (string
|
||||||
|
; content: (_) @injection.content))
|
||||||
|
; (#any-of? @_map "vim.api.nvim_set_keymap" "vim.keymap.set")
|
||||||
|
; (#set! injection.language "vim"))
|
||||||
|
;
|
||||||
|
; (function_call
|
||||||
|
; name: (_) @_map
|
||||||
|
; arguments:
|
||||||
|
; (arguments
|
||||||
|
; . (_)
|
||||||
|
; . (_)
|
||||||
|
; . (_)
|
||||||
|
; .
|
||||||
|
; (string
|
||||||
|
; content: (_) @injection.content)
|
||||||
|
; . (_) .)
|
||||||
|
; (#eq? @_map "vim.api.nvim_buf_set_keymap")
|
||||||
|
; (#set! injection.language "vim"))
|
||||||
|
; highlight string as query if starts with `;; query`
|
||||||
|
(string
|
||||||
|
content: _ @injection.content
|
||||||
|
(#lua-match? @injection.content "^%s*;+%s?query")
|
||||||
|
(#set! injection.language "query"))
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
(
|
([
|
||||||
[
|
(fenced_code_block)
|
||||||
(fenced_code_block)
|
(indented_code_block)
|
||||||
(indented_code_block)
|
(list)
|
||||||
(list)
|
(section)
|
||||||
(section)
|
] @fold
|
||||||
] @fold
|
(#trim! @fold))
|
||||||
(#trim! @fold)
|
|
||||||
)
|
|
||||||
|
@ -1,40 +1,73 @@
|
|||||||
;From MDeiml/tree-sitter-markdown & Helix
|
;From MDeiml/tree-sitter-markdown & Helix
|
||||||
(setext_heading (paragraph) @text.title.1 (setext_h1_underline) @text.title.1.marker)
|
(setext_heading
|
||||||
(setext_heading (paragraph) @text.title.2 (setext_h2_underline) @text.title.2.marker)
|
(paragraph) @markup.heading.1
|
||||||
|
(setext_h1_underline) @markup.heading.1.marker)
|
||||||
|
|
||||||
(atx_heading (atx_h1_marker) @text.title.1.marker (inline) @text.title.1)
|
(setext_heading
|
||||||
(atx_heading (atx_h2_marker) @text.title.2.marker (inline) @text.title.2)
|
(paragraph) @markup.heading.2
|
||||||
(atx_heading (atx_h3_marker) @text.title.3.marker (inline) @text.title.3)
|
(setext_h2_underline) @markup.heading.2.marker)
|
||||||
(atx_heading (atx_h4_marker) @text.title.4.marker (inline) @text.title.4)
|
|
||||||
(atx_heading (atx_h5_marker) @text.title.5.marker (inline) @text.title.5)
|
|
||||||
(atx_heading (atx_h6_marker) @text.title.6.marker (inline) @text.title.6)
|
|
||||||
|
|
||||||
(link_title) @text.literal
|
(atx_heading
|
||||||
(indented_code_block) @text.literal.block
|
(atx_h1_marker) @markup.heading.1.marker
|
||||||
((fenced_code_block) @text.literal.block (#set! "priority" 90))
|
(inline) @markup.heading.1)
|
||||||
|
|
||||||
|
(atx_heading
|
||||||
|
(atx_h2_marker) @markup.heading.2.marker
|
||||||
|
(inline) @markup.heading.2)
|
||||||
|
|
||||||
|
(atx_heading
|
||||||
|
(atx_h3_marker) @markup.heading.3.marker
|
||||||
|
(inline) @markup.heading.3)
|
||||||
|
|
||||||
|
(atx_heading
|
||||||
|
(atx_h4_marker) @markup.heading.4.marker
|
||||||
|
(inline) @markup.heading.4)
|
||||||
|
|
||||||
|
(atx_heading
|
||||||
|
(atx_h5_marker) @markup.heading.5.marker
|
||||||
|
(inline) @markup.heading.5)
|
||||||
|
|
||||||
|
(atx_heading
|
||||||
|
(atx_h6_marker) @markup.heading.6.marker
|
||||||
|
(inline) @markup.heading.6)
|
||||||
|
|
||||||
(info_string) @label
|
(info_string) @label
|
||||||
|
|
||||||
(pipe_table_header (pipe_table_cell) @text.title)
|
(pipe_table_header
|
||||||
|
(pipe_table_cell) @markup.heading)
|
||||||
|
|
||||||
|
(pipe_table_header
|
||||||
|
"|" @punctuation.special)
|
||||||
|
|
||||||
|
(pipe_table_row
|
||||||
|
"|" @punctuation.special)
|
||||||
|
|
||||||
|
(pipe_table_delimiter_row
|
||||||
|
"|" @punctuation.special)
|
||||||
|
|
||||||
(pipe_table_header "|" @punctuation.special)
|
|
||||||
(pipe_table_row "|" @punctuation.special)
|
|
||||||
(pipe_table_delimiter_row "|" @punctuation.special)
|
|
||||||
(pipe_table_delimiter_cell) @punctuation.special
|
(pipe_table_delimiter_cell) @punctuation.special
|
||||||
|
|
||||||
[
|
; Code blocks (conceal backticks and language annotation)
|
||||||
(fenced_code_block_delimiter)
|
(indented_code_block) @markup.raw.block
|
||||||
] @punctuation.delimiter
|
|
||||||
|
|
||||||
(code_fence_content) @none
|
((fenced_code_block) @markup.raw.block
|
||||||
|
(#set! "priority" 90))
|
||||||
[
|
|
||||||
(link_destination)
|
(fenced_code_block
|
||||||
] @text.uri
|
(fenced_code_block_delimiter) @markup.raw.delimiter
|
||||||
|
(#set! conceal ""))
|
||||||
|
|
||||||
|
(fenced_code_block
|
||||||
|
(info_string
|
||||||
|
(language) @conceal
|
||||||
|
(#set! conceal "")))
|
||||||
|
|
||||||
|
(link_destination) @markup.link.url
|
||||||
|
|
||||||
[
|
[
|
||||||
|
(link_title)
|
||||||
(link_label)
|
(link_label)
|
||||||
] @text.reference
|
] @markup.link.label
|
||||||
|
|
||||||
[
|
[
|
||||||
(list_marker_plus)
|
(list_marker_plus)
|
||||||
@ -42,30 +75,43 @@
|
|||||||
(list_marker_star)
|
(list_marker_star)
|
||||||
(list_marker_dot)
|
(list_marker_dot)
|
||||||
(list_marker_parenthesis)
|
(list_marker_parenthesis)
|
||||||
(thematic_break)
|
] @markup.list
|
||||||
] @punctuation.special
|
|
||||||
|
|
||||||
|
; 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
|
||||||
|
; conceals.
|
||||||
|
; ;; Conceal bullet points
|
||||||
|
; ([(list_marker_plus) (list_marker_star)]
|
||||||
|
; @punctuation.special
|
||||||
|
; (#offset! @punctuation.special 0 0 0 -1)
|
||||||
|
; (#set! conceal "•"))
|
||||||
|
; ([(list_marker_plus) (list_marker_star)]
|
||||||
|
; @punctuation.special
|
||||||
|
; (#any-of? @punctuation.special "+" "*")
|
||||||
|
; (#set! conceal "•"))
|
||||||
|
; ((list_marker_minus)
|
||||||
|
; @punctuation.special
|
||||||
|
; (#offset! @punctuation.special 0 0 0 -1)
|
||||||
|
; (#set! conceal "—"))
|
||||||
|
; ((list_marker_minus)
|
||||||
|
; @punctuation.special
|
||||||
|
; (#eq? @punctuation.special "-")
|
||||||
|
; (#set! conceal "—"))
|
||||||
|
(thematic_break) @punctuation.special
|
||||||
|
|
||||||
(task_list_marker_unchecked) @text.todo.unchecked
|
(task_list_marker_unchecked) @markup.list.unchecked
|
||||||
(task_list_marker_checked) @text.todo.checked
|
|
||||||
|
|
||||||
(block_quote) @text.quote
|
(task_list_marker_checked) @markup.list.checked
|
||||||
|
|
||||||
|
((block_quote) @markup.quote
|
||||||
|
(#set! "priority" 90))
|
||||||
|
|
||||||
[
|
[
|
||||||
(block_continuation)
|
(block_continuation)
|
||||||
(block_quote_marker)
|
(block_quote_marker)
|
||||||
] @punctuation.special
|
] @punctuation.special
|
||||||
|
|
||||||
[
|
(backslash_escape) @string.escape
|
||||||
(backslash_escape)
|
|
||||||
] @string.escape
|
|
||||||
|
|
||||||
(inline) @spell
|
(inline) @spell
|
||||||
|
|
||||||
;; Conceal backticks
|
|
||||||
(fenced_code_block
|
|
||||||
(fenced_code_block_delimiter) @conceal
|
|
||||||
(#set! conceal ""))
|
|
||||||
(fenced_code_block
|
|
||||||
(info_string (language) @conceal
|
|
||||||
(#set! conceal "")))
|
|
||||||
|
@ -4,22 +4,22 @@
|
|||||||
(code_fence_content) @injection.content)
|
(code_fence_content) @injection.content)
|
||||||
|
|
||||||
((html_block) @injection.content
|
((html_block) @injection.content
|
||||||
(#set! injection.language "html")
|
(#set! injection.language "html")
|
||||||
(#set! injection.combined)
|
(#set! injection.combined)
|
||||||
(#set! injection.include-children))
|
(#set! injection.include-children))
|
||||||
|
|
||||||
((minus_metadata) @injection.content
|
((minus_metadata) @injection.content
|
||||||
(#set! injection.language "yaml")
|
(#set! injection.language "yaml")
|
||||||
(#offset! @injection.content 1 0 -1 0)
|
(#offset! @injection.content 1 0 -1 0)
|
||||||
(#set! injection.include-children))
|
(#set! injection.include-children))
|
||||||
|
|
||||||
((plus_metadata) @injection.content
|
((plus_metadata) @injection.content
|
||||||
(#set! injection.language "toml")
|
(#set! injection.language "toml")
|
||||||
(#offset! @injection.content 1 0 -1 0)
|
(#offset! @injection.content 1 0 -1 0)
|
||||||
(#set! injection.include-children))
|
(#set! injection.include-children))
|
||||||
|
|
||||||
([
|
([
|
||||||
(inline)
|
(inline)
|
||||||
(pipe_table_cell)
|
(pipe_table_cell)
|
||||||
] @injection.content
|
] @injection.content
|
||||||
(#set! injection.language "markdown_inline"))
|
(#set! injection.language "markdown_inline"))
|
||||||
|
@ -1,49 +1,26 @@
|
|||||||
;; From MDeiml/tree-sitter-markdown
|
; From MDeiml/tree-sitter-markdown
|
||||||
[
|
(code_span) @markup.raw @nospell
|
||||||
(code_span)
|
|
||||||
(link_title)
|
|
||||||
] @text.literal @nospell
|
|
||||||
|
|
||||||
[
|
(emphasis) @markup.italic
|
||||||
(emphasis_delimiter)
|
|
||||||
(code_span_delimiter)
|
|
||||||
] @punctuation.delimiter
|
|
||||||
|
|
||||||
(emphasis) @text.emphasis
|
(strong_emphasis) @markup.strong
|
||||||
|
|
||||||
(strong_emphasis) @text.strong
|
(strikethrough) @markup.strikethrough
|
||||||
|
|
||||||
(strikethrough) @text.strike
|
(shortcut_link
|
||||||
|
(link_text) @nospell)
|
||||||
[
|
|
||||||
(link_destination)
|
|
||||||
(uri_autolink)
|
|
||||||
] @text.uri @nospell
|
|
||||||
|
|
||||||
(shortcut_link (link_text) @nospell)
|
|
||||||
|
|
||||||
[
|
|
||||||
(link_label)
|
|
||||||
(link_text)
|
|
||||||
(image_description)
|
|
||||||
] @text.reference
|
|
||||||
|
|
||||||
[
|
[
|
||||||
(backslash_escape)
|
(backslash_escape)
|
||||||
(hard_line_break)
|
(hard_line_break)
|
||||||
] @string.escape
|
] @string.escape
|
||||||
|
|
||||||
(image "!" @punctuation.special)
|
|
||||||
(image ["[" "]" "(" ")"] @punctuation.bracket)
|
|
||||||
(inline_link ["[" "]" "(" ")"] @punctuation.bracket)
|
|
||||||
(shortcut_link ["[" "]"] @punctuation.bracket)
|
|
||||||
|
|
||||||
; Conceal codeblock and text style markers
|
; Conceal codeblock and text style markers
|
||||||
([
|
((code_span_delimiter) @markup.raw.delimiter
|
||||||
(code_span_delimiter)
|
(#set! conceal ""))
|
||||||
(emphasis_delimiter)
|
|
||||||
] @conceal
|
((emphasis_delimiter) @conceal
|
||||||
(#set! conceal ""))
|
(#set! conceal ""))
|
||||||
|
|
||||||
; Conceal inline links
|
; Conceal inline links
|
||||||
(inline_link
|
(inline_link
|
||||||
@ -53,7 +30,7 @@
|
|||||||
"("
|
"("
|
||||||
(link_destination)
|
(link_destination)
|
||||||
")"
|
")"
|
||||||
] @conceal
|
] @markup.link
|
||||||
(#set! conceal ""))
|
(#set! conceal ""))
|
||||||
|
|
||||||
; Conceal image links
|
; Conceal image links
|
||||||
@ -65,7 +42,7 @@
|
|||||||
"("
|
"("
|
||||||
(link_destination)
|
(link_destination)
|
||||||
")"
|
")"
|
||||||
] @conceal
|
] @markup.link
|
||||||
(#set! conceal ""))
|
(#set! conceal ""))
|
||||||
|
|
||||||
; Conceal full reference links
|
; Conceal full reference links
|
||||||
@ -74,7 +51,7 @@
|
|||||||
"["
|
"["
|
||||||
"]"
|
"]"
|
||||||
(link_label)
|
(link_label)
|
||||||
] @conceal
|
] @markup.link
|
||||||
(#set! conceal ""))
|
(#set! conceal ""))
|
||||||
|
|
||||||
; Conceal collapsed reference links
|
; Conceal collapsed reference links
|
||||||
@ -82,7 +59,7 @@
|
|||||||
[
|
[
|
||||||
"["
|
"["
|
||||||
"]"
|
"]"
|
||||||
] @conceal
|
] @markup.link
|
||||||
(#set! conceal ""))
|
(#set! conceal ""))
|
||||||
|
|
||||||
; Conceal shortcut links
|
; Conceal shortcut links
|
||||||
@ -90,13 +67,42 @@
|
|||||||
[
|
[
|
||||||
"["
|
"["
|
||||||
"]"
|
"]"
|
||||||
] @conceal
|
] @markup.link
|
||||||
(#set! conceal ""))
|
(#set! conceal ""))
|
||||||
|
|
||||||
;; Replace common HTML entities.
|
[
|
||||||
((entity_reference) @conceal (#eq? @conceal " ") (#set! conceal ""))
|
(link_destination)
|
||||||
((entity_reference) @conceal (#eq? @conceal "<") (#set! conceal "<"))
|
(uri_autolink)
|
||||||
((entity_reference) @conceal (#eq? @conceal ">") (#set! conceal ">"))
|
] @markup.link.url @nospell
|
||||||
((entity_reference) @conceal (#eq? @conceal "&") (#set! conceal "&"))
|
|
||||||
((entity_reference) @conceal (#eq? @conceal """) (#set! conceal "\""))
|
[
|
||||||
((entity_reference) @conceal (#any-of? @conceal " " " ") (#set! conceal " "))
|
(link_label)
|
||||||
|
(link_text)
|
||||||
|
(link_title)
|
||||||
|
(image_description)
|
||||||
|
] @markup.link.label
|
||||||
|
|
||||||
|
; Replace common HTML entities.
|
||||||
|
((entity_reference) @character.special
|
||||||
|
(#eq? @character.special " ")
|
||||||
|
(#set! conceal ""))
|
||||||
|
|
||||||
|
((entity_reference) @character.special
|
||||||
|
(#eq? @character.special "<")
|
||||||
|
(#set! conceal "<"))
|
||||||
|
|
||||||
|
((entity_reference) @character.special
|
||||||
|
(#eq? @character.special ">")
|
||||||
|
(#set! conceal ">"))
|
||||||
|
|
||||||
|
((entity_reference) @character.special
|
||||||
|
(#eq? @character.special "&")
|
||||||
|
(#set! conceal "&"))
|
||||||
|
|
||||||
|
((entity_reference) @character.special
|
||||||
|
(#eq? @character.special """)
|
||||||
|
(#set! conceal "\""))
|
||||||
|
|
||||||
|
((entity_reference) @character.special
|
||||||
|
(#any-of? @character.special " " " ")
|
||||||
|
(#set! conceal " "))
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
((html_tag) @injection.content
|
((html_tag) @injection.content
|
||||||
(#set! injection.language "html")
|
(#set! injection.language "html")
|
||||||
(#set! injection.combined)
|
(#set! injection.combined))
|
||||||
(#set! injection.include-children))
|
|
||||||
|
|
||||||
((latex_block) @injection.content
|
((latex_block) @injection.content
|
||||||
(#set! injection.language "latex")
|
(#set! injection.language "latex")
|
||||||
(#set! injection.include-children))
|
(#set! injection.include-children))
|
||||||
|
@ -1,28 +1,23 @@
|
|||||||
[
|
[
|
||||||
(function_definition)
|
(function_definition)
|
||||||
(class_definition)
|
(class_definition)
|
||||||
|
|
||||||
(while_statement)
|
(while_statement)
|
||||||
(for_statement)
|
(for_statement)
|
||||||
(if_statement)
|
(if_statement)
|
||||||
(with_statement)
|
(with_statement)
|
||||||
(try_statement)
|
(try_statement)
|
||||||
(match_statement)
|
(match_statement)
|
||||||
|
|
||||||
(import_from_statement)
|
(import_from_statement)
|
||||||
(parameters)
|
(parameters)
|
||||||
(argument_list)
|
(argument_list)
|
||||||
|
|
||||||
(parenthesized_expression)
|
(parenthesized_expression)
|
||||||
(generator_expression)
|
(generator_expression)
|
||||||
(list_comprehension)
|
(list_comprehension)
|
||||||
(set_comprehension)
|
(set_comprehension)
|
||||||
(dictionary_comprehension)
|
(dictionary_comprehension)
|
||||||
|
|
||||||
(tuple)
|
(tuple)
|
||||||
(list)
|
(list)
|
||||||
(set)
|
(set)
|
||||||
(dictionary)
|
(dictionary)
|
||||||
|
|
||||||
(string)
|
(string)
|
||||||
] @fold
|
] @fold
|
||||||
|
@ -1,183 +1,223 @@
|
|||||||
;; From tree-sitter-python licensed under MIT License
|
; From tree-sitter-python licensed under MIT License
|
||||||
; Copyright (c) 2016 Max Brunsfeld
|
; Copyright (c) 2016 Max Brunsfeld
|
||||||
|
|
||||||
; Variables
|
; Variables
|
||||||
(identifier) @variable
|
(identifier) @variable
|
||||||
|
|
||||||
; Reset highlighting in f-string interpolations
|
; Reset highlighting in f-string interpolations
|
||||||
(interpolation) @none
|
(interpolation) @none
|
||||||
|
|
||||||
;; Identifier naming conventions
|
; Identifier naming conventions
|
||||||
((identifier) @type
|
((identifier) @type
|
||||||
(#lua-match? @type "^[A-Z].*[a-z]"))
|
(#lua-match? @type "^[A-Z].*[a-z]"))
|
||||||
|
|
||||||
((identifier) @constant
|
((identifier) @constant
|
||||||
(#lua-match? @constant "^[A-Z][A-Z_0-9]*$"))
|
(#lua-match? @constant "^[A-Z][A-Z_0-9]*$"))
|
||||||
|
|
||||||
((identifier) @constant.builtin
|
((identifier) @constant.builtin
|
||||||
(#lua-match? @constant.builtin "^__[a-zA-Z0-9_]*__$"))
|
(#lua-match? @constant.builtin "^__[a-zA-Z0-9_]*__$"))
|
||||||
|
|
||||||
((identifier) @constant.builtin
|
((identifier) @constant.builtin
|
||||||
(#any-of? @constant.builtin
|
; format-ignore
|
||||||
;; https://docs.python.org/3/library/constants.html
|
(#any-of? @constant.builtin
|
||||||
"NotImplemented"
|
; https://docs.python.org/3/library/constants.html
|
||||||
"Ellipsis"
|
"NotImplemented" "Ellipsis"
|
||||||
"quit"
|
"quit" "exit" "copyright" "credits" "license"))
|
||||||
"exit"
|
|
||||||
"copyright"
|
|
||||||
"credits"
|
|
||||||
"license"))
|
|
||||||
|
|
||||||
"_" @constant.builtin ; match wildcard
|
"_" @constant.builtin ; match wildcard
|
||||||
|
|
||||||
((attribute
|
((attribute
|
||||||
attribute: (identifier) @field)
|
attribute: (identifier) @variable.member)
|
||||||
(#lua-match? @field "^[%l_].*$"))
|
(#lua-match? @variable.member "^[%l_].*$"))
|
||||||
|
|
||||||
((assignment
|
((assignment
|
||||||
left: (identifier) @type.definition
|
left: (identifier) @type.definition
|
||||||
(type (identifier) @_annotation))
|
(type
|
||||||
(#eq? @_annotation "TypeAlias"))
|
(identifier) @_annotation))
|
||||||
|
(#eq? @_annotation "TypeAlias"))
|
||||||
|
|
||||||
((assignment
|
((assignment
|
||||||
left: (identifier) @type.definition
|
left: (identifier) @type.definition
|
||||||
right: (call
|
right:
|
||||||
function: (identifier) @_func))
|
(call
|
||||||
(#any-of? @_func "TypeVar" "NewType"))
|
function: (identifier) @_func))
|
||||||
|
(#any-of? @_func "TypeVar" "NewType"))
|
||||||
|
|
||||||
; Function calls
|
; Function calls
|
||||||
|
|
||||||
(call
|
(call
|
||||||
function: (identifier) @function.call)
|
function: (identifier) @function.call)
|
||||||
|
|
||||||
(call
|
(call
|
||||||
function: (attribute
|
function:
|
||||||
attribute: (identifier) @method.call))
|
(attribute
|
||||||
|
attribute: (identifier) @function.method.call))
|
||||||
|
|
||||||
((call
|
((call
|
||||||
function: (identifier) @constructor)
|
function: (identifier) @constructor)
|
||||||
(#lua-match? @constructor "^%u"))
|
(#lua-match? @constructor "^%u"))
|
||||||
|
|
||||||
((call
|
((call
|
||||||
function: (attribute
|
function:
|
||||||
attribute: (identifier) @constructor))
|
(attribute
|
||||||
(#lua-match? @constructor "^%u"))
|
attribute: (identifier) @constructor))
|
||||||
|
(#lua-match? @constructor "^%u"))
|
||||||
|
|
||||||
;; Decorators
|
; Decorators
|
||||||
|
((decorator
|
||||||
((decorator "@" @attribute)
|
"@" @attribute)
|
||||||
(#set! "priority" 101))
|
(#set! "priority" 101))
|
||||||
|
|
||||||
(decorator
|
(decorator
|
||||||
(identifier) @attribute)
|
(identifier) @attribute)
|
||||||
|
|
||||||
(decorator
|
(decorator
|
||||||
(attribute
|
(attribute
|
||||||
attribute: (identifier) @attribute))
|
attribute: (identifier) @attribute))
|
||||||
|
|
||||||
(decorator
|
(decorator
|
||||||
(call (identifier) @attribute))
|
(call
|
||||||
|
(identifier) @attribute))
|
||||||
|
|
||||||
(decorator
|
(decorator
|
||||||
(call (attribute
|
(call
|
||||||
attribute: (identifier) @attribute)))
|
(attribute
|
||||||
|
attribute: (identifier) @attribute)))
|
||||||
|
|
||||||
((decorator
|
((decorator
|
||||||
(identifier) @attribute.builtin)
|
(identifier) @attribute.builtin)
|
||||||
(#any-of? @attribute.builtin "classmethod" "property"))
|
(#any-of? @attribute.builtin "classmethod" "property"))
|
||||||
|
|
||||||
;; Builtin functions
|
|
||||||
|
|
||||||
|
; Builtin functions
|
||||||
((call
|
((call
|
||||||
function: (identifier) @function.builtin)
|
function: (identifier) @function.builtin)
|
||||||
(#any-of? @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__"))
|
||||||
"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 definitions
|
||||||
(function_definition
|
(function_definition
|
||||||
name: (identifier) @function)
|
name: (identifier) @function)
|
||||||
|
|
||||||
(type (identifier) @type)
|
(type
|
||||||
|
(identifier) @type)
|
||||||
|
|
||||||
(type
|
(type
|
||||||
(subscript
|
(subscript
|
||||||
(identifier) @type)) ; type subscript: Tuple[int]
|
(identifier) @type)) ; type subscript: Tuple[int]
|
||||||
|
|
||||||
((call
|
((call
|
||||||
function: (identifier) @_isinstance
|
function: (identifier) @_isinstance
|
||||||
arguments: (argument_list
|
arguments:
|
||||||
(_)
|
(argument_list
|
||||||
(identifier) @type))
|
(_)
|
||||||
(#eq? @_isinstance "isinstance"))
|
(identifier) @type))
|
||||||
|
(#eq? @_isinstance "isinstance"))
|
||||||
|
|
||||||
;; Normal parameters
|
; Normal parameters
|
||||||
(parameters
|
(parameters
|
||||||
(identifier) @parameter)
|
(identifier) @variable.parameter)
|
||||||
;; Lambda parameters
|
|
||||||
|
; Lambda parameters
|
||||||
(lambda_parameters
|
(lambda_parameters
|
||||||
(identifier) @parameter)
|
(identifier) @variable.parameter)
|
||||||
|
|
||||||
(lambda_parameters
|
(lambda_parameters
|
||||||
(tuple_pattern
|
(tuple_pattern
|
||||||
(identifier) @parameter))
|
(identifier) @variable.parameter))
|
||||||
|
|
||||||
; Default parameters
|
; Default parameters
|
||||||
(keyword_argument
|
(keyword_argument
|
||||||
name: (identifier) @parameter)
|
name: (identifier) @variable.parameter)
|
||||||
|
|
||||||
; Naming parameters on call-site
|
; Naming parameters on call-site
|
||||||
(default_parameter
|
(default_parameter
|
||||||
name: (identifier) @parameter)
|
name: (identifier) @variable.parameter)
|
||||||
|
|
||||||
(typed_parameter
|
(typed_parameter
|
||||||
(identifier) @parameter)
|
(identifier) @variable.parameter)
|
||||||
|
|
||||||
(typed_default_parameter
|
(typed_default_parameter
|
||||||
(identifier) @parameter)
|
name: (identifier) @variable.parameter)
|
||||||
|
|
||||||
; Variadic parameters *args, **kwargs
|
; Variadic parameters *args, **kwargs
|
||||||
(parameters
|
(parameters
|
||||||
(list_splat_pattern ; *args
|
(list_splat_pattern ; *args
|
||||||
(identifier) @parameter))
|
(identifier) @variable.parameter))
|
||||||
|
|
||||||
(parameters
|
(parameters
|
||||||
(dictionary_splat_pattern ; **kwargs
|
(dictionary_splat_pattern ; **kwargs
|
||||||
(identifier) @parameter))
|
(identifier) @variable.parameter))
|
||||||
|
|
||||||
|
; Typed variadic parameters
|
||||||
|
(parameters
|
||||||
|
(typed_parameter
|
||||||
|
(list_splat_pattern ; *args: type
|
||||||
|
(identifier) @variable.parameter)))
|
||||||
|
|
||||||
;; Literals
|
(parameters
|
||||||
|
(typed_parameter
|
||||||
|
(dictionary_splat_pattern ; *kwargs: type
|
||||||
|
(identifier) @variable.parameter)))
|
||||||
|
|
||||||
|
; Lambda parameters
|
||||||
|
(lambda_parameters
|
||||||
|
(list_splat_pattern
|
||||||
|
(identifier) @variable.parameter))
|
||||||
|
|
||||||
|
(lambda_parameters
|
||||||
|
(dictionary_splat_pattern
|
||||||
|
(identifier) @variable.parameter))
|
||||||
|
|
||||||
|
; Literals
|
||||||
(none) @constant.builtin
|
(none) @constant.builtin
|
||||||
[(true) (false)] @boolean
|
|
||||||
|
[
|
||||||
|
(true)
|
||||||
|
(false)
|
||||||
|
] @boolean
|
||||||
|
|
||||||
((identifier) @variable.builtin
|
((identifier) @variable.builtin
|
||||||
(#eq? @variable.builtin "self"))
|
(#eq? @variable.builtin "self"))
|
||||||
|
|
||||||
((identifier) @variable.builtin
|
((identifier) @variable.builtin
|
||||||
(#eq? @variable.builtin "cls"))
|
(#eq? @variable.builtin "cls"))
|
||||||
|
|
||||||
(integer) @number
|
(integer) @number
|
||||||
(float) @float
|
|
||||||
|
(float) @number.float
|
||||||
|
|
||||||
(comment) @comment @spell
|
(comment) @comment @spell
|
||||||
|
|
||||||
((module . (comment) @preproc)
|
((module
|
||||||
(#lua-match? @preproc "^#!/"))
|
.
|
||||||
|
(comment) @keyword.directive)
|
||||||
|
(#lua-match? @keyword.directive "^#!/"))
|
||||||
|
|
||||||
(string) @string
|
(string) @string
|
||||||
|
|
||||||
[
|
[
|
||||||
(escape_sequence)
|
(escape_sequence)
|
||||||
(escape_interpolation)
|
(escape_interpolation)
|
||||||
] @string.escape
|
] @string.escape
|
||||||
|
|
||||||
; doc-strings
|
; doc-strings
|
||||||
|
(module
|
||||||
(module . (expression_statement (string) @string.documentation @spell))
|
.
|
||||||
|
(expression_statement
|
||||||
|
(string) @string.documentation @spell))
|
||||||
|
|
||||||
(class_definition
|
(class_definition
|
||||||
body:
|
body:
|
||||||
(block
|
(block
|
||||||
. (expression_statement (string) @string.documentation @spell)))
|
.
|
||||||
|
(expression_statement
|
||||||
|
(string) @string.documentation @spell)))
|
||||||
|
|
||||||
(function_definition
|
(function_definition
|
||||||
body:
|
body:
|
||||||
(block
|
(block
|
||||||
. (expression_statement (string) @string.documentation @spell)))
|
.
|
||||||
|
(expression_statement
|
||||||
|
(string) @string.documentation @spell)))
|
||||||
|
|
||||||
; Tokens
|
; Tokens
|
||||||
|
|
||||||
[
|
[
|
||||||
"-"
|
"-"
|
||||||
"-="
|
"-="
|
||||||
@ -227,7 +267,6 @@
|
|||||||
"or"
|
"or"
|
||||||
"is not"
|
"is not"
|
||||||
"not in"
|
"not in"
|
||||||
|
|
||||||
"del"
|
"del"
|
||||||
] @keyword.operator
|
] @keyword.operator
|
||||||
|
|
||||||
@ -258,19 +297,36 @@
|
|||||||
"return"
|
"return"
|
||||||
"yield"
|
"yield"
|
||||||
] @keyword.return
|
] @keyword.return
|
||||||
(yield "from" @keyword.return)
|
|
||||||
|
(yield
|
||||||
|
"from" @keyword.return)
|
||||||
|
|
||||||
(future_import_statement
|
(future_import_statement
|
||||||
"from" @include
|
"from" @keyword.import
|
||||||
"__future__" @constant.builtin)
|
"__future__" @constant.builtin)
|
||||||
(import_from_statement "from" @include)
|
|
||||||
"import" @include
|
|
||||||
|
|
||||||
(aliased_import "as" @include)
|
(import_from_statement
|
||||||
|
"from" @keyword.import)
|
||||||
|
|
||||||
["if" "elif" "else" "match" "case"] @conditional
|
"import" @keyword.import
|
||||||
|
|
||||||
["for" "while" "break" "continue"] @repeat
|
(aliased_import
|
||||||
|
"as" @keyword.import)
|
||||||
|
|
||||||
|
[
|
||||||
|
"if"
|
||||||
|
"elif"
|
||||||
|
"else"
|
||||||
|
"match"
|
||||||
|
"case"
|
||||||
|
] @keyword.conditional
|
||||||
|
|
||||||
|
[
|
||||||
|
"for"
|
||||||
|
"while"
|
||||||
|
"break"
|
||||||
|
"continue"
|
||||||
|
] @keyword.repeat
|
||||||
|
|
||||||
[
|
[
|
||||||
"try"
|
"try"
|
||||||
@ -278,15 +334,23 @@
|
|||||||
"except*"
|
"except*"
|
||||||
"raise"
|
"raise"
|
||||||
"finally"
|
"finally"
|
||||||
] @exception
|
] @keyword.exception
|
||||||
|
|
||||||
(raise_statement "from" @exception)
|
(raise_statement
|
||||||
|
"from" @keyword.exception)
|
||||||
|
|
||||||
(try_statement
|
(try_statement
|
||||||
(else_clause
|
(else_clause
|
||||||
"else" @exception))
|
"else" @keyword.exception))
|
||||||
|
|
||||||
["(" ")" "[" "]" "{" "}"] @punctuation.bracket
|
[
|
||||||
|
"("
|
||||||
|
")"
|
||||||
|
"["
|
||||||
|
"]"
|
||||||
|
"{"
|
||||||
|
"}"
|
||||||
|
] @punctuation.bracket
|
||||||
|
|
||||||
(interpolation
|
(interpolation
|
||||||
"{" @punctuation.special
|
"{" @punctuation.special
|
||||||
@ -294,58 +358,80 @@
|
|||||||
|
|
||||||
(type_conversion) @function.macro
|
(type_conversion) @function.macro
|
||||||
|
|
||||||
["," "." ":" ";" (ellipsis)] @punctuation.delimiter
|
[
|
||||||
|
","
|
||||||
|
"."
|
||||||
|
":"
|
||||||
|
";"
|
||||||
|
(ellipsis)
|
||||||
|
] @punctuation.delimiter
|
||||||
|
|
||||||
;; Class definitions
|
; Class definitions
|
||||||
|
(class_definition
|
||||||
(class_definition name: (identifier) @type)
|
name: (identifier) @type)
|
||||||
|
|
||||||
(class_definition
|
(class_definition
|
||||||
body: (block
|
body:
|
||||||
(function_definition
|
(block
|
||||||
name: (identifier) @method)))
|
(function_definition
|
||||||
|
name: (identifier) @function.method)))
|
||||||
|
|
||||||
(class_definition
|
(class_definition
|
||||||
superclasses: (argument_list
|
superclasses:
|
||||||
(identifier) @type))
|
(argument_list
|
||||||
|
(identifier) @type))
|
||||||
|
|
||||||
((class_definition
|
((class_definition
|
||||||
body: (block
|
body:
|
||||||
(expression_statement
|
(block
|
||||||
(assignment
|
(expression_statement
|
||||||
left: (identifier) @field))))
|
(assignment
|
||||||
(#lua-match? @field "^%l.*$"))
|
left: (identifier) @variable.member))))
|
||||||
|
(#lua-match? @variable.member "^%l.*$"))
|
||||||
|
|
||||||
((class_definition
|
((class_definition
|
||||||
body: (block
|
body:
|
||||||
(expression_statement
|
(block
|
||||||
(assignment
|
(expression_statement
|
||||||
left: (_
|
(assignment
|
||||||
(identifier) @field)))))
|
left:
|
||||||
(#lua-match? @field "^%l.*$"))
|
(_
|
||||||
|
(identifier) @variable.member)))))
|
||||||
|
(#lua-match? @variable.member "^%l.*$"))
|
||||||
|
|
||||||
((class_definition
|
((class_definition
|
||||||
(block
|
(block
|
||||||
(function_definition
|
(function_definition
|
||||||
name: (identifier) @constructor)))
|
name: (identifier) @constructor)))
|
||||||
(#any-of? @constructor "__new__" "__init__"))
|
(#any-of? @constructor "__new__" "__init__"))
|
||||||
|
|
||||||
((identifier) @type.builtin
|
((identifier) @type.builtin
|
||||||
(#any-of? @type.builtin
|
; format-ignore
|
||||||
;; https://docs.python.org/3/library/exceptions.html
|
(#any-of? @type.builtin
|
||||||
"BaseException" "Exception" "ArithmeticError" "BufferError" "LookupError" "AssertionError" "AttributeError"
|
; https://docs.python.org/3/library/exceptions.html
|
||||||
"EOFError" "FloatingPointError" "GeneratorExit" "ImportError" "ModuleNotFoundError" "IndexError" "KeyError"
|
"BaseException" "Exception" "ArithmeticError" "BufferError" "LookupError" "AssertionError" "AttributeError"
|
||||||
"KeyboardInterrupt" "MemoryError" "NameError" "NotImplementedError" "OSError" "OverflowError" "RecursionError"
|
"EOFError" "FloatingPointError" "GeneratorExit" "ImportError" "ModuleNotFoundError" "IndexError" "KeyError"
|
||||||
"ReferenceError" "RuntimeError" "StopIteration" "StopAsyncIteration" "SyntaxError" "IndentationError" "TabError"
|
"KeyboardInterrupt" "MemoryError" "NameError" "NotImplementedError" "OSError" "OverflowError" "RecursionError"
|
||||||
"SystemError" "SystemExit" "TypeError" "UnboundLocalError" "UnicodeError" "UnicodeEncodeError" "UnicodeDecodeError"
|
"ReferenceError" "RuntimeError" "StopIteration" "StopAsyncIteration" "SyntaxError" "IndentationError" "TabError"
|
||||||
"UnicodeTranslateError" "ValueError" "ZeroDivisionError" "EnvironmentError" "IOError" "WindowsError"
|
"SystemError" "SystemExit" "TypeError" "UnboundLocalError" "UnicodeError" "UnicodeEncodeError" "UnicodeDecodeError"
|
||||||
"BlockingIOError" "ChildProcessError" "ConnectionError" "BrokenPipeError" "ConnectionAbortedError"
|
"UnicodeTranslateError" "ValueError" "ZeroDivisionError" "EnvironmentError" "IOError" "WindowsError"
|
||||||
"ConnectionRefusedError" "ConnectionResetError" "FileExistsError" "FileNotFoundError" "InterruptedError"
|
"BlockingIOError" "ChildProcessError" "ConnectionError" "BrokenPipeError" "ConnectionAbortedError"
|
||||||
"IsADirectoryError" "NotADirectoryError" "PermissionError" "ProcessLookupError" "TimeoutError" "Warning"
|
"ConnectionRefusedError" "ConnectionResetError" "FileExistsError" "FileNotFoundError" "InterruptedError"
|
||||||
"UserWarning" "DeprecationWarning" "PendingDeprecationWarning" "SyntaxWarning" "RuntimeWarning"
|
"IsADirectoryError" "NotADirectoryError" "PermissionError" "ProcessLookupError" "TimeoutError" "Warning"
|
||||||
"FutureWarning" "ImportWarning" "UnicodeWarning" "BytesWarning" "ResourceWarning"
|
"UserWarning" "DeprecationWarning" "PendingDeprecationWarning" "SyntaxWarning" "RuntimeWarning"
|
||||||
;; https://docs.python.org/3/library/stdtypes.html
|
"FutureWarning" "ImportWarning" "UnicodeWarning" "BytesWarning" "ResourceWarning"
|
||||||
"bool" "int" "float" "complex" "list" "tuple" "range" "str"
|
; https://docs.python.org/3/library/stdtypes.html
|
||||||
"bytes" "bytearray" "memoryview" "set" "frozenset" "dict" "type" "object"))
|
"bool" "int" "float" "complex" "list" "tuple" "range" "str"
|
||||||
|
"bytes" "bytearray" "memoryview" "set" "frozenset" "dict" "type" "object"))
|
||||||
|
|
||||||
;; Error
|
; Regex from the `re` module
|
||||||
(ERROR) @error
|
(call
|
||||||
|
function:
|
||||||
|
(attribute
|
||||||
|
object: (identifier) @_re)
|
||||||
|
arguments:
|
||||||
|
(argument_list
|
||||||
|
.
|
||||||
|
(string
|
||||||
|
(string_content) @string.regexp))
|
||||||
|
(#eq? @_re "re"))
|
||||||
|
@ -1,14 +1,30 @@
|
|||||||
(string) @string
|
(string) @string
|
||||||
|
|
||||||
(escape_sequence) @string.escape
|
(escape_sequence) @string.escape
|
||||||
(capture (identifier) @type)
|
|
||||||
(anonymous_node (identifier) @string)
|
(capture
|
||||||
(predicate name: (identifier) @function)
|
(identifier) @type)
|
||||||
(named_node name: (identifier) @variable)
|
|
||||||
(field_definition name: (identifier) @property)
|
(anonymous_node
|
||||||
(negated_field "!" @operator (identifier) @property)
|
(identifier) @string)
|
||||||
|
|
||||||
|
(predicate
|
||||||
|
name: (identifier) @function.call)
|
||||||
|
|
||||||
|
(named_node
|
||||||
|
name: (identifier) @variable)
|
||||||
|
|
||||||
|
(field_definition
|
||||||
|
name: (identifier) @property)
|
||||||
|
|
||||||
|
(negated_field
|
||||||
|
"!" @operator
|
||||||
|
(identifier) @property)
|
||||||
|
|
||||||
(comment) @comment @spell
|
(comment) @comment @spell
|
||||||
|
|
||||||
(quantifier) @operator
|
(quantifier) @operator
|
||||||
|
|
||||||
(predicate_type) @punctuation.special
|
(predicate_type) @punctuation.special
|
||||||
|
|
||||||
"." @operator
|
"." @operator
|
||||||
@ -21,14 +37,51 @@
|
|||||||
] @punctuation.bracket
|
] @punctuation.bracket
|
||||||
|
|
||||||
":" @punctuation.delimiter
|
":" @punctuation.delimiter
|
||||||
["@" "#"] @punctuation.special
|
|
||||||
|
[
|
||||||
|
"@"
|
||||||
|
"#"
|
||||||
|
] @punctuation.special
|
||||||
|
|
||||||
"_" @constant
|
"_" @constant
|
||||||
|
|
||||||
((parameters (identifier) @number)
|
((parameters
|
||||||
(#match? @number "^[-+]?[0-9]+(.[0-9]+)?$"))
|
(identifier) @number)
|
||||||
|
(#match? @number "^[-+]?[0-9]+(.[0-9]+)?$"))
|
||||||
|
|
||||||
((program . (comment)* . (comment) @include)
|
((program
|
||||||
(#lua-match? @include "^;+ *inherits *:"))
|
.
|
||||||
|
(comment)*
|
||||||
|
.
|
||||||
|
(comment) @keyword.import)
|
||||||
|
(#lua-match? @keyword.import "^;+ *inherits *:"))
|
||||||
|
|
||||||
((program . (comment)* . (comment) @preproc)
|
((program
|
||||||
(#lua-match? @preproc "^;+ *extends"))
|
.
|
||||||
|
(comment)*
|
||||||
|
.
|
||||||
|
(comment) @keyword.directive)
|
||||||
|
(#lua-match? @keyword.directive "^;+ *extends *$"))
|
||||||
|
|
||||||
|
((comment) @keyword.directive
|
||||||
|
(#lua-match? @keyword.directive "^;+%s*format%-ignore%s*$"))
|
||||||
|
|
||||||
|
((predicate
|
||||||
|
name: (identifier) @_name
|
||||||
|
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) .))
|
||||||
|
(#any-of? @_name "gsub" "not-gsub"))
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
[
|
[
|
||||||
(if_statement)
|
(if_statement)
|
||||||
(function_definition)
|
(function_definition)
|
||||||
] @fold
|
] @fold
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
(identifier) @variable
|
(identifier) @variable
|
||||||
|
|
||||||
((identifier) @constant
|
((identifier) @constant
|
||||||
(#lua-match? @constant "^[A-Z][A-Z_0-9]*$"))
|
(#lua-match? @constant "^[A-Z][A-Z_0-9]*$"))
|
||||||
|
|
||||||
;; Keywords
|
|
||||||
|
|
||||||
|
; Keywords
|
||||||
[
|
[
|
||||||
"if"
|
"if"
|
||||||
"else"
|
"else"
|
||||||
"elseif"
|
"elseif"
|
||||||
"endif"
|
"endif"
|
||||||
] @conditional
|
] @keyword.conditional
|
||||||
|
|
||||||
[
|
[
|
||||||
"try"
|
"try"
|
||||||
@ -17,7 +17,7 @@
|
|||||||
"finally"
|
"finally"
|
||||||
"endtry"
|
"endtry"
|
||||||
"throw"
|
"throw"
|
||||||
] @exception
|
] @keyword.exception
|
||||||
|
|
||||||
[
|
[
|
||||||
"for"
|
"for"
|
||||||
@ -27,31 +27,50 @@
|
|||||||
"endwhile"
|
"endwhile"
|
||||||
"break"
|
"break"
|
||||||
"continue"
|
"continue"
|
||||||
] @repeat
|
] @keyword.repeat
|
||||||
|
|
||||||
[
|
[
|
||||||
"function"
|
"function"
|
||||||
"endfunction"
|
"endfunction"
|
||||||
] @keyword.function
|
] @keyword.function
|
||||||
|
|
||||||
;; Function related
|
; Function related
|
||||||
(function_declaration name: (_) @function)
|
(function_declaration
|
||||||
(call_expression function: (identifier) @function.call)
|
name: (_) @function)
|
||||||
(call_expression function: (scoped_identifier (identifier) @function.call))
|
|
||||||
(parameters (identifier) @parameter)
|
|
||||||
(default_parameter (identifier) @parameter)
|
|
||||||
|
|
||||||
[ (bang) (spread) ] @punctuation.special
|
(call_expression
|
||||||
|
function: (identifier) @function.call)
|
||||||
|
|
||||||
|
(call_expression
|
||||||
|
function:
|
||||||
|
(scoped_identifier
|
||||||
|
(identifier) @function.call))
|
||||||
|
|
||||||
|
(parameters
|
||||||
|
(identifier) @variable.parameter)
|
||||||
|
|
||||||
|
(default_parameter
|
||||||
|
(identifier) @variable.parameter)
|
||||||
|
|
||||||
|
[
|
||||||
|
(bang)
|
||||||
|
(spread)
|
||||||
|
] @punctuation.special
|
||||||
|
|
||||||
|
[
|
||||||
|
(no_option)
|
||||||
|
(inv_option)
|
||||||
|
(default_option)
|
||||||
|
(option_name)
|
||||||
|
] @variable.builtin
|
||||||
|
|
||||||
[ (no_option) (inv_option) (default_option) (option_name) ] @variable.builtin
|
|
||||||
[
|
[
|
||||||
(scope)
|
(scope)
|
||||||
"a:"
|
"a:"
|
||||||
"$"
|
"$"
|
||||||
] @namespace
|
] @module
|
||||||
|
|
||||||
;; Commands and user defined commands
|
|
||||||
|
|
||||||
|
; Commands and user defined commands
|
||||||
[
|
[
|
||||||
"let"
|
"let"
|
||||||
"unlet"
|
"unlet"
|
||||||
@ -83,6 +102,7 @@
|
|||||||
"delcommand"
|
"delcommand"
|
||||||
"comclear"
|
"comclear"
|
||||||
"colorscheme"
|
"colorscheme"
|
||||||
|
"scriptencoding"
|
||||||
"startinsert"
|
"startinsert"
|
||||||
"stopinsert"
|
"stopinsert"
|
||||||
"global"
|
"global"
|
||||||
@ -106,41 +126,48 @@
|
|||||||
"visual"
|
"visual"
|
||||||
"view"
|
"view"
|
||||||
"eval"
|
"eval"
|
||||||
|
"sign"
|
||||||
] @keyword
|
] @keyword
|
||||||
(map_statement cmd: _ @keyword)
|
|
||||||
|
(map_statement
|
||||||
|
cmd: _ @keyword)
|
||||||
|
|
||||||
(command_name) @function.macro
|
(command_name) @function.macro
|
||||||
|
|
||||||
;; Filetype command
|
; Filetype command
|
||||||
|
(filetype_statement
|
||||||
|
[
|
||||||
|
"detect"
|
||||||
|
"plugin"
|
||||||
|
"indent"
|
||||||
|
"on"
|
||||||
|
"off"
|
||||||
|
] @keyword)
|
||||||
|
|
||||||
(filetype_statement [
|
; Syntax command
|
||||||
"detect"
|
(syntax_statement
|
||||||
"plugin"
|
(keyword) @string)
|
||||||
"indent"
|
|
||||||
"on"
|
|
||||||
"off"
|
|
||||||
] @keyword)
|
|
||||||
|
|
||||||
;; Syntax command
|
(syntax_statement
|
||||||
|
[
|
||||||
|
"enable"
|
||||||
|
"on"
|
||||||
|
"off"
|
||||||
|
"reset"
|
||||||
|
"case"
|
||||||
|
"spell"
|
||||||
|
"foldlevel"
|
||||||
|
"iskeyword"
|
||||||
|
"keyword"
|
||||||
|
"match"
|
||||||
|
"cluster"
|
||||||
|
"region"
|
||||||
|
"clear"
|
||||||
|
"include"
|
||||||
|
] @keyword)
|
||||||
|
|
||||||
(syntax_statement (keyword) @string)
|
(syntax_argument
|
||||||
(syntax_statement [
|
name: _ @keyword)
|
||||||
"enable"
|
|
||||||
"on"
|
|
||||||
"off"
|
|
||||||
"reset"
|
|
||||||
"case"
|
|
||||||
"spell"
|
|
||||||
"foldlevel"
|
|
||||||
"iskeyword"
|
|
||||||
"keyword"
|
|
||||||
"match"
|
|
||||||
"cluster"
|
|
||||||
"region"
|
|
||||||
"clear"
|
|
||||||
"include"
|
|
||||||
] @keyword)
|
|
||||||
|
|
||||||
(syntax_argument name: _ @keyword)
|
|
||||||
|
|
||||||
[
|
[
|
||||||
"<buffer>"
|
"<buffer>"
|
||||||
@ -151,69 +178,95 @@
|
|||||||
"<unique>"
|
"<unique>"
|
||||||
] @constant.builtin
|
] @constant.builtin
|
||||||
|
|
||||||
(augroup_name) @namespace
|
(augroup_name) @module
|
||||||
|
|
||||||
(au_event) @constant
|
(au_event) @constant
|
||||||
(normal_statement (commands) @constant)
|
|
||||||
|
|
||||||
;; Highlight command
|
(normal_statement
|
||||||
|
(commands) @constant)
|
||||||
|
|
||||||
|
; Highlight command
|
||||||
(hl_attribute
|
(hl_attribute
|
||||||
key: _ @property
|
key: _ @property
|
||||||
val: _ @constant)
|
val: _ @constant)
|
||||||
|
|
||||||
(hl_group) @type
|
(hl_group) @type
|
||||||
|
|
||||||
(highlight_statement [
|
(highlight_statement
|
||||||
"default"
|
[
|
||||||
"link"
|
"default"
|
||||||
"clear"
|
"link"
|
||||||
] @keyword)
|
"clear"
|
||||||
|
] @keyword)
|
||||||
;; Command command
|
|
||||||
|
|
||||||
|
; Command command
|
||||||
(command) @string
|
(command) @string
|
||||||
|
|
||||||
(command_attribute
|
(command_attribute
|
||||||
name: _ @property
|
name: _ @property
|
||||||
val: (behavior
|
val:
|
||||||
name: _ @constant
|
(behavior
|
||||||
val: (identifier)? @function)?)
|
name: _ @constant
|
||||||
|
val: (identifier)? @function)?)
|
||||||
|
|
||||||
;; Edit command
|
; Edit command
|
||||||
(plus_plus_opt
|
(plus_plus_opt
|
||||||
val: _? @constant) @property
|
val: _? @constant) @property
|
||||||
(plus_cmd "+" @property) @property
|
|
||||||
|
|
||||||
;; Runtime command
|
(plus_cmd
|
||||||
|
"+" @property) @property
|
||||||
|
|
||||||
(runtime_statement (where) @keyword.operator)
|
; Runtime command
|
||||||
|
(runtime_statement
|
||||||
|
(where) @keyword.operator)
|
||||||
|
|
||||||
;; Colorscheme command
|
; Colorscheme command
|
||||||
|
(colorscheme_statement
|
||||||
|
(name) @string)
|
||||||
|
|
||||||
(colorscheme_statement (name) @string)
|
; Scriptencoding command
|
||||||
|
(scriptencoding_statement
|
||||||
;; Literals
|
(encoding) @string.special)
|
||||||
|
|
||||||
|
; Literals
|
||||||
(string_literal) @string
|
(string_literal) @string
|
||||||
|
|
||||||
(integer_literal) @number
|
(integer_literal) @number
|
||||||
(float_literal) @float
|
|
||||||
|
(float_literal) @number.float
|
||||||
|
|
||||||
(comment) @comment @spell
|
(comment) @comment @spell
|
||||||
|
|
||||||
(line_continuation_comment) @comment @spell
|
(line_continuation_comment) @comment @spell
|
||||||
|
|
||||||
(pattern) @string.special
|
(pattern) @string.special
|
||||||
(pattern_multi) @string.regex
|
|
||||||
(filename) @string
|
(pattern_multi) @string.regexp
|
||||||
(heredoc (body) @string)
|
|
||||||
(heredoc (parameter) @keyword)
|
(filename) @string.special.path
|
||||||
[ (marker_definition) (endmarker) ] @label
|
|
||||||
(literal_dictionary (literal_key) @label)
|
(heredoc
|
||||||
|
(body) @string)
|
||||||
|
|
||||||
|
(heredoc
|
||||||
|
(parameter) @keyword)
|
||||||
|
|
||||||
|
[
|
||||||
|
(marker_definition)
|
||||||
|
(endmarker)
|
||||||
|
] @label
|
||||||
|
|
||||||
|
(literal_dictionary
|
||||||
|
(literal_key) @property)
|
||||||
|
|
||||||
((scoped_identifier
|
((scoped_identifier
|
||||||
(scope) @_scope . (identifier) @boolean)
|
(scope) @_scope
|
||||||
(#eq? @_scope "v:")
|
.
|
||||||
(#any-of? @boolean "true" "false"))
|
(identifier) @boolean)
|
||||||
|
(#eq? @_scope "v:")
|
||||||
;; Operators
|
(#any-of? @boolean "true" "false"))
|
||||||
|
|
||||||
|
; Operators
|
||||||
[
|
[
|
||||||
"||"
|
"||"
|
||||||
"&&"
|
"&&"
|
||||||
@ -248,12 +301,13 @@
|
|||||||
] @operator
|
] @operator
|
||||||
|
|
||||||
; Some characters have different meanings based on the context
|
; Some characters have different meanings based on the context
|
||||||
(unary_operation "!" @operator)
|
(unary_operation
|
||||||
(binary_operation "." @operator)
|
"!" @operator)
|
||||||
|
|
||||||
|
(binary_operation
|
||||||
|
"." @operator)
|
||||||
|
|
||||||
;; Punctuation
|
; Punctuation
|
||||||
|
|
||||||
[
|
[
|
||||||
"("
|
"("
|
||||||
")"
|
")"
|
||||||
@ -264,27 +318,31 @@
|
|||||||
"#{"
|
"#{"
|
||||||
] @punctuation.bracket
|
] @punctuation.bracket
|
||||||
|
|
||||||
(field_expression "." @punctuation.delimiter)
|
(field_expression
|
||||||
|
"." @punctuation.delimiter)
|
||||||
|
|
||||||
[
|
[
|
||||||
","
|
","
|
||||||
":"
|
":"
|
||||||
] @punctuation.delimiter
|
] @punctuation.delimiter
|
||||||
|
|
||||||
(ternary_expression ["?" ":"] @conditional.ternary)
|
(ternary_expression
|
||||||
|
[
|
||||||
|
"?"
|
||||||
|
":"
|
||||||
|
] @keyword.conditional.ternary)
|
||||||
|
|
||||||
; Options
|
; Options
|
||||||
((set_value) @number
|
((set_value) @number
|
||||||
(#lua-match? @number "^[%d]+(%.[%d]+)?$"))
|
(#lua-match? @number "^[%d]+(%.[%d]+)?$"))
|
||||||
|
|
||||||
(inv_option "!" @operator)
|
(inv_option
|
||||||
(set_item "?" @operator)
|
"!" @operator)
|
||||||
|
|
||||||
|
(set_item
|
||||||
|
"?" @operator)
|
||||||
|
|
||||||
((set_item
|
((set_item
|
||||||
option: (option_name) @_option
|
option: (option_name) @_option
|
||||||
value: (set_value) @function)
|
value: (set_value) @function)
|
||||||
(#any-of? @_option
|
(#any-of? @_option "tagfunc" "tfu" "completefunc" "cfu" "omnifunc" "ofu" "operatorfunc" "opfunc"))
|
||||||
"tagfunc" "tfu"
|
|
||||||
"completefunc" "cfu"
|
|
||||||
"omnifunc" "ofu"
|
|
||||||
"operatorfunc" "opfunc"))
|
|
||||||
|
@ -1,48 +1,32 @@
|
|||||||
((lua_statement (script (body) @injection.content))
|
(lua_statement
|
||||||
(#set! injection.language "lua"))
|
(script
|
||||||
|
(body) @injection.content
|
||||||
|
(#set! injection.language "lua")))
|
||||||
|
|
||||||
((lua_statement (chunk) @injection.content)
|
(lua_statement
|
||||||
(#set! injection.language "lua"))
|
(chunk) @injection.content
|
||||||
|
(#set! injection.language "lua"))
|
||||||
|
|
||||||
((ruby_statement (script (body) @injection.content))
|
(ruby_statement
|
||||||
(#set! injection.language "ruby"))
|
(script
|
||||||
|
(body) @injection.content
|
||||||
|
(#set! injection.language "ruby")))
|
||||||
|
|
||||||
((ruby_statement (chunk) @injection.content)
|
(ruby_statement
|
||||||
(#set! injection.language "ruby"))
|
(chunk) @injection.content
|
||||||
|
(#set! injection.language "ruby"))
|
||||||
|
|
||||||
((python_statement (script (body) @injection.content))
|
(python_statement
|
||||||
(#set! injection.language "python"))
|
(script
|
||||||
|
(body) @injection.content
|
||||||
|
(#set! injection.language "python")))
|
||||||
|
|
||||||
((python_statement (chunk) @injection.content)
|
(python_statement
|
||||||
(#set! injection.language "python"))
|
(chunk) @injection.content
|
||||||
|
(#set! injection.language "python"))
|
||||||
;; If we support perl at some point...
|
|
||||||
;; ((perl_statement (script (body) @injection.content))
|
|
||||||
;; (#set! injection.language "perl"))
|
|
||||||
;; ((perl_statement (chunk) @injection.content)
|
|
||||||
;; (#set! injection.language "perl"))
|
|
||||||
|
|
||||||
((autocmd_statement (pattern) @injection.content)
|
|
||||||
(#set! injection.language "regex"))
|
|
||||||
|
|
||||||
((set_item
|
((set_item
|
||||||
option: (option_name) @_option
|
option: (option_name) @_option
|
||||||
value: (set_value) @injection.content)
|
value: (set_value) @injection.content)
|
||||||
(#any-of? @_option
|
(#any-of? @_option "includeexpr" "inex" "printexpr" "pexpr" "formatexpr" "fex" "indentexpr" "inde" "foldtext" "fdt" "foldexpr" "fde" "diffexpr" "dex" "patchexpr" "pex" "charconvert" "ccv")
|
||||||
"includeexpr" "inex"
|
|
||||||
"printexpr" "pexpr"
|
|
||||||
"formatexpr" "fex"
|
|
||||||
"indentexpr" "inde"
|
|
||||||
"foldtext" "fdt"
|
|
||||||
"foldexpr" "fde"
|
|
||||||
"diffexpr" "dex"
|
|
||||||
"patchexpr" "pex"
|
|
||||||
"charconvert" "ccv")
|
|
||||||
(#set! injection.language "vim"))
|
(#set! injection.language "vim"))
|
||||||
|
|
||||||
|
|
||||||
; ((comment) @injection.content
|
|
||||||
; (#set! injection.language "comment"))
|
|
||||||
|
|
||||||
; ((line_continuation_comment) @injection.content
|
|
||||||
; (#set! injection.language "comment"))
|
|
||||||
|
@ -1,25 +1,58 @@
|
|||||||
(h1) @text.title.1
|
(h1) @markup.heading.1
|
||||||
(h2) @text.title.2
|
|
||||||
(h3) @text.title.3
|
(h2) @markup.heading.2
|
||||||
(column_heading) @text.title.4
|
|
||||||
|
(h3) @markup.heading.3
|
||||||
|
|
||||||
|
(column_heading) @markup.heading.4
|
||||||
|
|
||||||
(column_heading
|
(column_heading
|
||||||
"~" @conceal (#set! conceal ""))
|
"~" @markup.heading.4.marker
|
||||||
|
(#set! conceal ""))
|
||||||
|
|
||||||
(tag
|
(tag
|
||||||
"*" @conceal (#set! conceal "")
|
"*" @markup.heading.5.marker
|
||||||
text: (_) @label)
|
(#set! conceal "")
|
||||||
|
text: (_) @label)
|
||||||
|
|
||||||
(taglink
|
(taglink
|
||||||
"|" @conceal (#set! conceal "")
|
"|" @markup.link
|
||||||
text: (_) @text.reference)
|
(#set! conceal "")
|
||||||
|
text: (_) @markup.link)
|
||||||
|
|
||||||
(optionlink
|
(optionlink
|
||||||
text: (_) @text.reference)
|
text: (_) @markup.link)
|
||||||
|
|
||||||
(codespan
|
(codespan
|
||||||
"`" @conceal (#set! conceal "")
|
"`" @markup.raw.delimiter
|
||||||
text: (_) @text.literal)
|
(#set! conceal "")
|
||||||
(codeblock) @text.literal
|
text: (_) @markup.raw)
|
||||||
|
|
||||||
|
((codeblock) @markup.raw.block
|
||||||
|
(#set! "priority" 90))
|
||||||
|
|
||||||
(codeblock
|
(codeblock
|
||||||
[">" (language)] @conceal (#set! conceal ""))
|
[
|
||||||
|
">"
|
||||||
|
(language)
|
||||||
|
] @markup.raw.delimiter
|
||||||
|
(#set! conceal ""))
|
||||||
|
|
||||||
(block
|
(block
|
||||||
"<" @conceal (#set! conceal ""))
|
"<" @markup.raw.delimiter
|
||||||
(argument) @parameter
|
(#set! conceal ""))
|
||||||
|
|
||||||
|
(argument) @variable.parameter
|
||||||
|
|
||||||
(keycode) @string.special
|
(keycode) @string.special
|
||||||
(url) @text.uri
|
|
||||||
|
(url) @string.special.url
|
||||||
|
|
||||||
|
((note) @comment.note
|
||||||
|
(#any-of? @comment.note "Note:" "NOTE:" "Notes:"))
|
||||||
|
|
||||||
|
((note) @comment.warning
|
||||||
|
(#any-of? @comment.warning "Warning:" "WARNING:"))
|
||||||
|
|
||||||
|
((note) @comment.error
|
||||||
|
(#any-of? @comment.error "Deprecated:" "DEPRECATED:"))
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
((codeblock
|
((codeblock
|
||||||
(language) @injection.language
|
(language) @injection.language
|
||||||
(code) @injection.content)
|
(code) @injection.content)
|
||||||
(#set! injection.include-children))
|
(#set! injection.include-children))
|
||||||
|
@ -230,60 +230,98 @@ static const char *highlight_init_both[] = {
|
|||||||
"default link DiagnosticSignOk DiagnosticOk",
|
"default link DiagnosticSignOk DiagnosticOk",
|
||||||
"default link DiagnosticUnnecessary Comment",
|
"default link DiagnosticUnnecessary Comment",
|
||||||
|
|
||||||
// Text
|
// Treesitter standard groups
|
||||||
"default link @text.literal Comment",
|
"default link @variable NONE", // don't highlight to reduce visual overload
|
||||||
"default link @text.reference Identifier",
|
"default link @variable.builtin Special",
|
||||||
"default link @text.title Title",
|
"default link @variable.parameter Identifier",
|
||||||
"default link @text.uri Underlined",
|
"default link @variable.member Identifier",
|
||||||
"default link @text.underline Underlined",
|
|
||||||
"default link @text.todo Todo",
|
|
||||||
|
|
||||||
// Miscs
|
|
||||||
"default link @comment Comment",
|
|
||||||
"default link @punctuation Delimiter",
|
|
||||||
|
|
||||||
// Constants
|
|
||||||
"default link @constant Constant",
|
"default link @constant Constant",
|
||||||
"default link @constant.builtin Special",
|
"default link @constant.builtin Special",
|
||||||
"default link @constant.macro Define",
|
"default link @constant.macro Define",
|
||||||
"default link @define Define",
|
|
||||||
"default link @macro Macro",
|
|
||||||
"default link @string String",
|
|
||||||
"default link @string.escape SpecialChar",
|
|
||||||
"default link @string.special SpecialChar",
|
|
||||||
"default link @character Character",
|
|
||||||
"default link @character.special SpecialChar",
|
|
||||||
"default link @number Number",
|
|
||||||
"default link @boolean Boolean",
|
|
||||||
"default link @float Float",
|
|
||||||
|
|
||||||
// Functions
|
"default link @module Structure",
|
||||||
"default link @function Function",
|
"default link @label Label",
|
||||||
"default link @function.builtin Special",
|
|
||||||
"default link @function.macro Macro",
|
|
||||||
"default link @parameter Identifier",
|
|
||||||
"default link @method Function",
|
|
||||||
"default link @field Identifier",
|
|
||||||
"default link @property Identifier",
|
|
||||||
"default link @constructor Special",
|
|
||||||
|
|
||||||
// Keywords
|
"default link @string String",
|
||||||
"default link @conditional Conditional",
|
"default link @string.regexp SpecialChar",
|
||||||
"default link @repeat Repeat",
|
"default link @string.escape SpecialChar",
|
||||||
"default link @label Label",
|
"default link @string.special SpecialChar",
|
||||||
"default link @operator Operator",
|
"default link @string.special.symbol Constant",
|
||||||
"default link @keyword Keyword",
|
"default link @string.special.url Underlined",
|
||||||
"default link @exception Exception",
|
|
||||||
|
|
||||||
"default link @variable NONE", // don't highlight to reduce visual overload
|
"default link @character Character",
|
||||||
"default link @type Type",
|
"default link @character.special SpecialChar",
|
||||||
"default link @type.definition Typedef",
|
|
||||||
"default link @storageclass StorageClass",
|
"default link @boolean Boolean",
|
||||||
"default link @namespace Identifier",
|
"default link @number Number",
|
||||||
"default link @include Include",
|
"default link @number.float Float",
|
||||||
"default link @preproc PreProc",
|
|
||||||
"default link @debug Debug",
|
"default link @type Type",
|
||||||
"default link @tag Tag",
|
"default link @type.builtin Special",
|
||||||
|
"default link @type.definition Typedef",
|
||||||
|
"default link @type.qualifier StorageClass",
|
||||||
|
|
||||||
|
"default link @attribute Macro",
|
||||||
|
"default link @property Identifier",
|
||||||
|
|
||||||
|
"default link @function Function",
|
||||||
|
"default link @function.builtin Special",
|
||||||
|
"default link @function.macro Macro",
|
||||||
|
|
||||||
|
"default link @constructor Special",
|
||||||
|
"default link @operator Operator",
|
||||||
|
|
||||||
|
"default link @keyword Keyword",
|
||||||
|
"default link @keyword.function Statement",
|
||||||
|
"default link @keyword.operator Operator",
|
||||||
|
"default link @keyword.import Include",
|
||||||
|
"default link @keyword.storage StorageClass",
|
||||||
|
"default link @keyword.repeat Repeat",
|
||||||
|
"default link @keyword.debug Debug",
|
||||||
|
"default link @keyword.exception Exception",
|
||||||
|
|
||||||
|
"default link @keyword.conditional Conditional",
|
||||||
|
|
||||||
|
"default link @keyword.directive Preproc",
|
||||||
|
"default link @keyword.directive.define Define",
|
||||||
|
|
||||||
|
"default link @punctuation.delimiter Delimiter",
|
||||||
|
"default link @punctuation.bracket Delimiter",
|
||||||
|
"default link @punctuation.special Special",
|
||||||
|
|
||||||
|
"default link @comment Comment",
|
||||||
|
|
||||||
|
"default link @comment.error DiagnosticError",
|
||||||
|
"default link @comment.warning DiagnosticWarn",
|
||||||
|
"default link @comment.note DiagnosticInfo",
|
||||||
|
"default link @comment.todo Todo",
|
||||||
|
|
||||||
|
"@markup.strong gui=bold cterm=bold",
|
||||||
|
"@markup.italic gui=italic cterm=italic",
|
||||||
|
"@markup.strikethrough gui=strikethrough, cterm=strikethrough",
|
||||||
|
"@markup.underline gui=underline, cterm=underline",
|
||||||
|
|
||||||
|
"default link @markup.heading Title",
|
||||||
|
|
||||||
|
"default link @markup.raw Comment",
|
||||||
|
"default link @markup.quote Comment",
|
||||||
|
"default link @markup.math Comment",
|
||||||
|
"default link @markup.environment Comment",
|
||||||
|
|
||||||
|
"default link @markup.link Underlined",
|
||||||
|
"default link @markup.link.label Identifier",
|
||||||
|
|
||||||
|
"default link @markup.list Special",
|
||||||
|
"default link @markup.list.checked DiagnosticOk",
|
||||||
|
"default link @markup.list.unchecked DiagnosticWarn",
|
||||||
|
|
||||||
|
"default link @diff.plus Added",
|
||||||
|
"default link @diff.minus Removed",
|
||||||
|
"default link @diff.delta Changed",
|
||||||
|
|
||||||
|
"default link @tag Tag",
|
||||||
|
"default link @tag.delimiter Delimiter",
|
||||||
|
|
||||||
// LSP semantic tokens
|
// LSP semantic tokens
|
||||||
"default link @lsp.type.class Structure",
|
"default link @lsp.type.class Structure",
|
||||||
|
@ -729,7 +729,7 @@ void qsort(void *base, size_t nel, size_t width, int (*compar)(const void *, con
|
|||||||
feed('ggVGzf')
|
feed('ggVGzf')
|
||||||
screen:expect {
|
screen:expect {
|
||||||
grid = [[
|
grid = [[
|
||||||
{2:^void}{1: }{3:qsort}{4:(}{2:void}{1: }{5:*}{3:base}{4:,}{1: }{2:size_t}{1: }{3:nel}{4:,}{1: }{2:size_t}{1: }{3:width}{4:,}{1: }{2:int}{1: }{4:(}{5:*}{3:compa}|
|
{4:^void}{1: }{3:qsort}{4:(void}{1: }{5:*}{3:base}{4:,}{1: }{4:size_t}{1: }{3:nel}{4:,}{1: }{4:size_t}{1: }{3:width}{4:,}{1: }{4:int}{1: }{4:(}{5:*}{3:compa}|
|
||||||
{0:~ }|*3
|
{0:~ }|*3
|
||||||
|
|
|
|
||||||
]],
|
]],
|
||||||
|
@ -766,7 +766,7 @@ describe('treesitter highlighting (help)', function()
|
|||||||
{1:>ruby} |
|
{1:>ruby} |
|
||||||
{1: -- comment} |
|
{1: -- comment} |
|
||||||
{1: local this_is = 'actually_lua'} |
|
{1: local this_is = 'actually_lua'} |
|
||||||
< |
|
{1:<} |
|
||||||
^ |
|
^ |
|
||||||
|
|
|
|
||||||
]],
|
]],
|
||||||
@ -779,7 +779,7 @@ describe('treesitter highlighting (help)', function()
|
|||||||
{1:>lua} |
|
{1:>lua} |
|
||||||
{1: -- comment} |
|
{1: -- comment} |
|
||||||
{1: }{3:local}{1: }{4:this_is}{1: }{3:=}{1: }{5:'actually_lua'} |
|
{1: }{3:local}{1: }{4:this_is}{1: }{3:=}{1: }{5:'actually_lua'} |
|
||||||
< |
|
{1:<} |
|
||||||
^ |
|
^ |
|
||||||
|
|
|
|
||||||
]],
|
]],
|
||||||
@ -792,7 +792,7 @@ describe('treesitter highlighting (help)', function()
|
|||||||
{1:>ruby} |
|
{1:>ruby} |
|
||||||
{1: -- comment} |
|
{1: -- comment} |
|
||||||
{1: local this_is = 'actually_lua'} |
|
{1: local this_is = 'actually_lua'} |
|
||||||
< |
|
{1:<} |
|
||||||
^ |
|
^ |
|
||||||
|
|
|
|
||||||
]],
|
]],
|
||||||
|
@ -197,14 +197,14 @@ func Test_syntax_completion()
|
|||||||
" Check that clearing "Aap" avoids it showing up before Boolean.
|
" Check that clearing "Aap" avoids it showing up before Boolean.
|
||||||
hi @Aap ctermfg=blue
|
hi @Aap ctermfg=blue
|
||||||
call feedkeys(":syn list \<C-A>\<C-B>\"\<CR>", 'tx')
|
call feedkeys(":syn list \<C-A>\<C-B>\"\<CR>", 'tx')
|
||||||
call assert_match('^"syn list @Aap @boolean @character ', @:)
|
call assert_match('^"syn list @Aap @attribute @boolean @character ', @:)
|
||||||
hi clear @Aap
|
hi clear @Aap
|
||||||
|
|
||||||
call feedkeys(":syn list \<C-A>\<C-B>\"\<CR>", 'tx')
|
call feedkeys(":syn list \<C-A>\<C-B>\"\<CR>", 'tx')
|
||||||
call assert_match('^"syn list @boolean @character ', @:)
|
call assert_match('^"syn list @attribute @boolean @character ', @:)
|
||||||
|
|
||||||
call feedkeys(":syn match \<C-A>\<C-B>\"\<CR>", 'tx')
|
call feedkeys(":syn match \<C-A>\<C-B>\"\<CR>", 'tx')
|
||||||
call assert_match('^"syn match @boolean @character ', @:)
|
call assert_match('^"syn match @attribute @boolean @character ', @:)
|
||||||
|
|
||||||
syn cluster Aax contains=Aap
|
syn cluster Aax contains=Aap
|
||||||
call feedkeys(":syn list @A\<C-A>\<C-B>\"\<CR>", 'tx')
|
call feedkeys(":syn list @A\<C-A>\<C-B>\"\<CR>", 'tx')
|
||||||
|
Reference in New Issue
Block a user