diff options
Diffstat (limited to 'runtime/queries')
-rw-r--r-- | runtime/queries/bash/folds.scm | 9 | ||||
-rw-r--r-- | runtime/queries/bash/highlights.scm | 232 | ||||
-rw-r--r-- | runtime/queries/bash/injections.scm | 3 | ||||
-rw-r--r-- | runtime/queries/c/highlights.scm | 2 | ||||
-rw-r--r-- | runtime/queries/lua/highlights.scm | 2 | ||||
-rw-r--r-- | runtime/queries/markdown/highlights.scm | 24 | ||||
-rw-r--r-- | runtime/queries/markdown_inline/highlights.scm | 19 | ||||
-rw-r--r-- | runtime/queries/python/folds.scm | 28 | ||||
-rw-r--r-- | runtime/queries/python/highlights.scm | 457 | ||||
-rw-r--r-- | runtime/queries/query/highlights.scm | 19 | ||||
-rw-r--r-- | runtime/queries/vimdoc/highlights.scm | 21 |
11 files changed, 56 insertions, 760 deletions
diff --git a/runtime/queries/bash/folds.scm b/runtime/queries/bash/folds.scm deleted file mode 100644 index 766dbe598b..0000000000 --- a/runtime/queries/bash/folds.scm +++ /dev/null @@ -1,9 +0,0 @@ -[ - (function_definition) - (if_statement) - (case_statement) - (for_statement) - (while_statement) - (c_style_for_statement) - (heredoc_redirect) -] @fold diff --git a/runtime/queries/bash/highlights.scm b/runtime/queries/bash/highlights.scm deleted file mode 100644 index feb0e038ea..0000000000 --- a/runtime/queries/bash/highlights.scm +++ /dev/null @@ -1,232 +0,0 @@ -[ - "(" - ")" - "{" - "}" - "[" - "]" - "[[" - "]]" - "((" - "))" -] @punctuation.bracket - -[ - ";" - ";;" - ";&" - ";;&" - "&" -] @punctuation.delimiter - -[ - ">" - ">>" - "<" - "<<" - "&&" - "|" - "|&" - "||" - "=" - "+=" - "=~" - "==" - "!=" - "&>" - "&>>" - "<&" - ">&" - ">|" - "<&-" - ">&-" - "<<-" - "<<<" - ".." - "!" -] @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 - -(concatenation - (word) @string) - -[ - "if" - "then" - "else" - "elif" - "fi" - "case" - "in" - "esac" -] @keyword.conditional - -[ - "for" - "do" - "done" - "select" - "until" - "while" -] @keyword.repeat - -[ - "declare" - "typeset" - "export" - "readonly" - "local" - "unset" - "unsetenv" -] @keyword - -"function" @keyword.function - -(special_variable_name) @constant - -; trap -l -((word) @constant.builtin - (#any-of? @constant.builtin - "SIGHUP" "SIGINT" "SIGQUIT" "SIGILL" "SIGTRAP" "SIGABRT" "SIGBUS" "SIGFPE" "SIGKILL" "SIGUSR1" - "SIGSEGV" "SIGUSR2" "SIGPIPE" "SIGALRM" "SIGTERM" "SIGSTKFLT" "SIGCHLD" "SIGCONT" "SIGSTOP" - "SIGTSTP" "SIGTTIN" "SIGTTOU" "SIGURG" "SIGXCPU" "SIGXFSZ" "SIGVTALRM" "SIGPROF" "SIGWINCH" - "SIGIO" "SIGPWR" "SIGSYS" "SIGRTMIN" "SIGRTMIN+1" "SIGRTMIN+2" "SIGRTMIN+3" "SIGRTMIN+4" - "SIGRTMIN+5" "SIGRTMIN+6" "SIGRTMIN+7" "SIGRTMIN+8" "SIGRTMIN+9" "SIGRTMIN+10" "SIGRTMIN+11" - "SIGRTMIN+12" "SIGRTMIN+13" "SIGRTMIN+14" "SIGRTMIN+15" "SIGRTMAX-14" "SIGRTMAX-13" - "SIGRTMAX-12" "SIGRTMAX-11" "SIGRTMAX-10" "SIGRTMAX-9" "SIGRTMAX-8" "SIGRTMAX-7" "SIGRTMAX-6" - "SIGRTMAX-5" "SIGRTMAX-4" "SIGRTMAX-3" "SIGRTMAX-2" "SIGRTMAX-1" "SIGRTMAX")) - -((word) @boolean - (#any-of? @boolean "true" "false")) - -(comment) @comment @spell - -(test_operator) @operator - -(command_substitution - "$(" @punctuation.special - ")" @punctuation.special) - -(process_substitution - [ - "<(" - ">(" - ] @punctuation.special - ")" @punctuation.special) - -(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 - name: (word) @function) - -(command_name - (word) @function.call) - -(command_name - (word) @function.builtin - (#any-of? @function.builtin - "alias" "bg" "bind" "break" "builtin" "caller" "cd" "command" "compgen" "complete" "compopt" - "continue" "coproc" "dirs" "disown" "echo" "enable" "eval" "exec" "exit" "fc" "fg" "getopts" - "hash" "help" "history" "jobs" "kill" "let" "logout" "mapfile" "popd" "printf" "pushd" "pwd" - "read" "readarray" "return" "set" "shift" "shopt" "source" "suspend" "test" "time" "times" - "trap" "type" "typeset" "ulimit" "umask" "unalias" "wait")) - -(command - argument: [ - (word) @variable.parameter - (concatenation - (word) @variable.parameter) - ]) - -(number) @number - -((word) @number - (#lua-match? @number "^[0-9]+$")) - -(file_redirect - destination: (word) @variable.parameter) - -(file_descriptor) @operator - -(simple_expansion - "$" @punctuation.special) @none - -(expansion - "${" @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) @constant - (#lua-match? @constant "^[A-Z][A-Z_0-9]*$")) - -(case_item - value: (word) @variable.parameter) - -[ - (regex) - (extglob_pattern) -] @string.regexp - -((program - . - (comment) @keyword.directive @nospell) - (#lua-match? @keyword.directive "^#!/")) diff --git a/runtime/queries/bash/injections.scm b/runtime/queries/bash/injections.scm deleted file mode 100644 index 427b414958..0000000000 --- a/runtime/queries/bash/injections.scm +++ /dev/null @@ -1,3 +0,0 @@ -(heredoc_redirect - (heredoc_body) @injection.content - (heredoc_end) @injection.language) diff --git a/runtime/queries/c/highlights.scm b/runtime/queries/c/highlights.scm index 170937c8f8..eba272d5c9 100644 --- a/runtime/queries/c/highlights.scm +++ b/runtime/queries/c/highlights.scm @@ -1,6 +1,6 @@ ; Lower priority to prefer @variable.parameter when identifier appears in parameter_declaration. ((identifier) @variable - (#set! "priority" 95)) + (#set! priority 95)) (preproc_def (preproc_arg) @variable) diff --git a/runtime/queries/lua/highlights.scm b/runtime/queries/lua/highlights.scm index 0c8f07f290..01c280f2d5 100644 --- a/runtime/queries/lua/highlights.scm +++ b/runtime/queries/lua/highlights.scm @@ -162,7 +162,7 @@ ; Tables (field - name: (identifier) @variable.member) + name: (identifier) @property) (dot_index_expression field: (identifier) @variable.member) diff --git a/runtime/queries/markdown/highlights.scm b/runtime/queries/markdown/highlights.scm index 4b445e02f3..a12669ca2b 100644 --- a/runtime/queries/markdown/highlights.scm +++ b/runtime/queries/markdown/highlights.scm @@ -8,28 +8,22 @@ (setext_h2_underline) @markup.heading.2) (atx_heading - (atx_h1_marker) @markup.heading.1 - (inline) @markup.heading.1) + (atx_h1_marker)) @markup.heading.1 (atx_heading - (atx_h2_marker) @markup.heading.2 - (inline) @markup.heading.2) + (atx_h2_marker)) @markup.heading.2 (atx_heading - (atx_h3_marker) @markup.heading.3 - (inline) @markup.heading.3) + (atx_h3_marker)) @markup.heading.3 (atx_heading - (atx_h4_marker) @markup.heading.4 - (inline) @markup.heading.4) + (atx_h4_marker)) @markup.heading.4 (atx_heading - (atx_h5_marker) @markup.heading.5 - (inline) @markup.heading.5) + (atx_h5_marker)) @markup.heading.5 (atx_heading - (atx_h6_marker) @markup.heading.6 - (inline) @markup.heading.6) + (atx_h6_marker)) @markup.heading.6 (info_string) @label @@ -51,7 +45,7 @@ (indented_code_block) @markup.raw.block ((fenced_code_block) @markup.raw.block - (#set! "priority" 90)) + (#set! priority 90)) (fenced_code_block (fenced_code_block_delimiter) @markup.raw.block @@ -109,13 +103,13 @@ (task_list_marker_checked) @markup.list.checked ((block_quote) @markup.quote - (#set! "priority" 90)) + (#set! priority 90)) ([ (plus_metadata) (minus_metadata) ] @keyword.directive - (#set! "priority" 90)) + (#set! priority 90)) [ (block_continuation) diff --git a/runtime/queries/markdown_inline/highlights.scm b/runtime/queries/markdown_inline/highlights.scm index 233ab411cd..148ef0fad0 100644 --- a/runtime/queries/markdown_inline/highlights.scm +++ b/runtime/queries/markdown_inline/highlights.scm @@ -43,7 +43,12 @@ (inline_link (link_text) @_label (link_destination) @_url - (#set! @_label "url" @_url)) + (#set! @_label url @_url)) + +(image + (image_description) @_label + (link_destination) @_url + (#set! @_label url @_url)) ; Conceal image links (image @@ -85,12 +90,22 @@ [ (link_destination) (uri_autolink) + (email_autolink) ] @markup.link.url @nospell +((link_destination) @_url + (#set! @_url url @_url)) + +((uri_autolink) @_url + (#offset! @_url 0 1 0 -1) + (#set! @_url url @_url)) + +(entity_reference) @nospell + ; Replace common HTML entities. ((entity_reference) @character.special (#eq? @character.special " ") - (#set! conceal "")) + (#set! conceal " ")) ((entity_reference) @character.special (#eq? @character.special "<") diff --git a/runtime/queries/python/folds.scm b/runtime/queries/python/folds.scm deleted file mode 100644 index ecb9352d78..0000000000 --- a/runtime/queries/python/folds.scm +++ /dev/null @@ -1,28 +0,0 @@ -[ - (function_definition) - (class_definition) - (while_statement) - (for_statement) - (if_statement) - (with_statement) - (try_statement) - (match_statement) - (import_from_statement) - (parameters) - (argument_list) - (parenthesized_expression) - (generator_expression) - (list_comprehension) - (set_comprehension) - (dictionary_comprehension) - (tuple) - (list) - (set) - (dictionary) - (string) -] @fold - -[ - (import_statement) - (import_from_statement) -]+ @fold diff --git a/runtime/queries/python/highlights.scm b/runtime/queries/python/highlights.scm deleted file mode 100644 index 5e5a2a88de..0000000000 --- a/runtime/queries/python/highlights.scm +++ /dev/null @@ -1,457 +0,0 @@ -; From tree-sitter-python licensed under MIT License -; Copyright (c) 2016 Max Brunsfeld -; Variables -(identifier) @variable - -; Reset highlighting in f-string interpolations -(interpolation) @none - -; Identifier naming conventions -((identifier) @type - (#lua-match? @type "^[A-Z].*[a-z]")) - -((identifier) @constant - (#lua-match? @constant "^[A-Z][A-Z_0-9]*$")) - -((identifier) @constant.builtin - (#lua-match? @constant.builtin "^__[a-zA-Z0-9_]*__$")) - -((identifier) @constant.builtin - (#any-of? @constant.builtin - ; https://docs.python.org/3/library/constants.html - "NotImplemented" "Ellipsis" "quit" "exit" "copyright" "credits" "license")) - -"_" @constant.builtin ; match wildcard - -((attribute - attribute: (identifier) @variable.member) - (#lua-match? @variable.member "^[%l_].*$")) - -((assignment - left: (identifier) @type.definition - (type - (identifier) @_annotation)) - (#eq? @_annotation "TypeAlias")) - -((assignment - left: (identifier) @type.definition - right: (call - function: (identifier) @_func)) - (#any-of? @_func "TypeVar" "NewType")) - -; Function calls -(call - function: (identifier) @function.call) - -(call - function: (attribute - attribute: (identifier) @function.method.call)) - -((call - function: (identifier) @constructor) - (#lua-match? @constructor "^%u")) - -((call - function: (attribute - attribute: (identifier) @constructor)) - (#lua-match? @constructor "^%u")) - -; Decorators -((decorator - "@" @attribute) - (#set! "priority" 101)) - -(decorator - (identifier) @attribute) - -(decorator - (attribute - attribute: (identifier) @attribute)) - -(decorator - (call - (identifier) @attribute)) - -(decorator - (call - (attribute - attribute: (identifier) @attribute))) - -((decorator - (identifier) @attribute.builtin) - (#any-of? @attribute.builtin "classmethod" "property" "staticmethod")) - -; Builtin functions -((call - function: (identifier) @function.builtin) - (#any-of? @function.builtin - "abs" "all" "any" "ascii" "bin" "bool" "breakpoint" "bytearray" "bytes" "callable" "chr" - "classmethod" "compile" "complex" "delattr" "dict" "dir" "divmod" "enumerate" "eval" "exec" - "filter" "float" "format" "frozenset" "getattr" "globals" "hasattr" "hash" "help" "hex" "id" - "input" "int" "isinstance" "issubclass" "iter" "len" "list" "locals" "map" "max" "memoryview" - "min" "next" "object" "oct" "open" "ord" "pow" "print" "property" "range" "repr" "reversed" - "round" "set" "setattr" "slice" "sorted" "staticmethod" "str" "sum" "super" "tuple" "type" - "vars" "zip" "__import__")) - -; Function definitions -(function_definition - name: (identifier) @function) - -(type - (identifier) @type) - -(type - (subscript - (identifier) @type)) ; type subscript: Tuple[int] - -((call - function: (identifier) @_isinstance - arguments: (argument_list - (_) - (identifier) @type)) - (#eq? @_isinstance "isinstance")) - -; Normal parameters -(parameters - (identifier) @variable.parameter) - -; Lambda parameters -(lambda_parameters - (identifier) @variable.parameter) - -(lambda_parameters - (tuple_pattern - (identifier) @variable.parameter)) - -; Default parameters -(keyword_argument - name: (identifier) @variable.parameter) - -; Naming parameters on call-site -(default_parameter - name: (identifier) @variable.parameter) - -(typed_parameter - (identifier) @variable.parameter) - -(typed_default_parameter - name: (identifier) @variable.parameter) - -; Variadic parameters *args, **kwargs -(parameters - (list_splat_pattern ; *args - (identifier) @variable.parameter)) - -(parameters - (dictionary_splat_pattern ; **kwargs - (identifier) @variable.parameter)) - -; Typed variadic parameters -(parameters - (typed_parameter - (list_splat_pattern ; *args: type - (identifier) @variable.parameter))) - -(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 - -[ - (true) - (false) -] @boolean - -((identifier) @variable.builtin - (#eq? @variable.builtin "self")) - -((identifier) @variable.builtin - (#eq? @variable.builtin "cls")) - -(integer) @number - -(float) @number.float - -(comment) @comment @spell - -((module - . - (comment) @keyword.directive @nospell) - (#lua-match? @keyword.directive "^#!/")) - -(string) @string - -[ - (escape_sequence) - (escape_interpolation) -] @string.escape - -; doc-strings -(module - . - (comment)* - . - (expression_statement - (string) @string.documentation)) - -(class_definition - body: (block - . - (expression_statement - (string) @string.documentation))) - -(function_definition - body: (block - . - (expression_statement - (string) @string.documentation))) - -(module - . - (comment)* - . - (expression_statement - (string - (string_content) @spell))) - -(class_definition - body: (block - . - (expression_statement - (string - (string_content) @spell)))) - -(function_definition - body: (block - . - (expression_statement - (string - (string_content) @spell)))) - -; Tokens -[ - "-" - "-=" - ":=" - "!=" - "*" - "**" - "**=" - "*=" - "/" - "//" - "//=" - "/=" - "&" - "&=" - "%" - "%=" - "^" - "^=" - "+" - "+=" - "<" - "<<" - "<<=" - "<=" - "<>" - "=" - "==" - ">" - ">=" - ">>" - ">>=" - "@" - "@=" - "|" - "|=" - "~" - "->" -] @operator - -; Keywords -[ - "and" - "in" - "is" - "not" - "or" - "is not" - "not in" - "del" -] @keyword.operator - -[ - "def" - "lambda" -] @keyword.function - -[ - "assert" - "exec" - "global" - "nonlocal" - "pass" - "print" - "with" - "as" -] @keyword - -[ - "type" - "class" -] @keyword.type - -[ - "async" - "await" -] @keyword.coroutine - -[ - "return" - "yield" -] @keyword.return - -(yield - "from" @keyword.return) - -(future_import_statement - "from" @keyword.import - "__future__" @constant.builtin) - -(import_from_statement - "from" @keyword.import) - -"import" @keyword.import - -(aliased_import - "as" @keyword.import) - -[ - "if" - "elif" - "else" - "match" - "case" -] @keyword.conditional - -[ - "for" - "while" - "break" - "continue" -] @keyword.repeat - -[ - "try" - "except" - "except*" - "raise" - "finally" -] @keyword.exception - -(raise_statement - "from" @keyword.exception) - -(try_statement - (else_clause - "else" @keyword.exception)) - -[ - "(" - ")" - "[" - "]" - "{" - "}" -] @punctuation.bracket - -(interpolation - "{" @punctuation.special - "}" @punctuation.special) - -(type_conversion) @function.macro - -[ - "," - "." - ":" - ";" - (ellipsis) -] @punctuation.delimiter - -; Class definitions -(class_definition - name: (identifier) @type) - -(class_definition - body: (block - (function_definition - name: (identifier) @function.method))) - -(class_definition - superclasses: (argument_list - (identifier) @type)) - -((class_definition - body: (block - (expression_statement - (assignment - left: (identifier) @variable.member)))) - (#lua-match? @variable.member "^[%l_].*$")) - -((class_definition - body: (block - (expression_statement - (assignment - left: (_ - (identifier) @variable.member))))) - (#lua-match? @variable.member "^[%l_].*$")) - -((class_definition - (block - (function_definition - name: (identifier) @constructor))) - (#any-of? @constructor "__new__" "__init__")) - -((identifier) @type.builtin - (#any-of? @type.builtin - ; https://docs.python.org/3/library/exceptions.html - "BaseException" "Exception" "ArithmeticError" "BufferError" "LookupError" "AssertionError" - "AttributeError" "EOFError" "FloatingPointError" "GeneratorExit" "ImportError" - "ModuleNotFoundError" "IndexError" "KeyError" "KeyboardInterrupt" "MemoryError" "NameError" - "NotImplementedError" "OSError" "OverflowError" "RecursionError" "ReferenceError" "RuntimeError" - "StopIteration" "StopAsyncIteration" "SyntaxError" "IndentationError" "TabError" "SystemError" - "SystemExit" "TypeError" "UnboundLocalError" "UnicodeError" "UnicodeEncodeError" - "UnicodeDecodeError" "UnicodeTranslateError" "ValueError" "ZeroDivisionError" "EnvironmentError" - "IOError" "WindowsError" "BlockingIOError" "ChildProcessError" "ConnectionError" - "BrokenPipeError" "ConnectionAbortedError" "ConnectionRefusedError" "ConnectionResetError" - "FileExistsError" "FileNotFoundError" "InterruptedError" "IsADirectoryError" - "NotADirectoryError" "PermissionError" "ProcessLookupError" "TimeoutError" "Warning" - "UserWarning" "DeprecationWarning" "PendingDeprecationWarning" "SyntaxWarning" "RuntimeWarning" - "FutureWarning" "ImportWarning" "UnicodeWarning" "BytesWarning" "ResourceWarning" - ; https://docs.python.org/3/library/stdtypes.html - "bool" "int" "float" "complex" "list" "tuple" "range" "str" "bytes" "bytearray" "memoryview" - "set" "frozenset" "dict" "type" "object")) - -; Regex from the `re` module -(call - function: (attribute - object: (identifier) @_re) - arguments: (argument_list - . - (string - (string_content) @string.regexp)) - (#eq? @_re "re")) diff --git a/runtime/queries/query/highlights.scm b/runtime/queries/query/highlights.scm index 210d03dc33..e459b44602 100644 --- a/runtime/queries/query/highlights.scm +++ b/runtime/queries/query/highlights.scm @@ -5,9 +5,6 @@ (capture (identifier) @type) -(anonymous_node - (identifier) @string) - (predicate name: (identifier) @function.call) @@ -15,7 +12,7 @@ name: (identifier) @variable) (field_definition - name: (identifier) @property) + name: (identifier) @variable.member) (negated_field "!" @operator @@ -36,7 +33,10 @@ ")" ] @punctuation.bracket -":" @punctuation.delimiter +[ + ":" + "/" +] @punctuation.delimiter [ "@" @@ -69,6 +69,15 @@ ((predicate name: (identifier) @_name parameters: (parameters + . + (capture)? + . + (identifier) @property)) + (#eq? @_name "set")) + +((predicate + name: (identifier) @_name + parameters: (parameters (string "\"" @string "\"" @string) @string.regexp)) diff --git a/runtime/queries/vimdoc/highlights.scm b/runtime/queries/vimdoc/highlights.scm index 70a3a2f206..1f809c2f60 100644 --- a/runtime/queries/vimdoc/highlights.scm +++ b/runtime/queries/vimdoc/highlights.scm @@ -1,13 +1,19 @@ -(h1) @markup.heading.1 +(h1 + (delimiter) @markup.heading.1.delimiter + (heading) @markup.heading.1) -(h2) @markup.heading.2 +(h2 + (delimiter) @markup.heading.2.delimiter + (heading) @markup.heading.2) -(h3) @markup.heading.3 +(h3 + (heading) @markup.heading.3) -(column_heading) @markup.heading.4 +(column_heading + (heading) @markup.heading.4) (column_heading - "~" @markup.heading.4 + (delimiter) @markup.heading.4 (#set! conceal "")) (tag @@ -35,7 +41,7 @@ text: (_) @markup.raw) ((codeblock) @markup.raw.block - (#set! "priority" 90)) + (#set! priority 90)) (codeblock ">" @markup.raw @@ -53,7 +59,8 @@ (keycode) @string.special -(url) @string.special.url +((url) @string.special.url + (#set! @string.special.url url @string.special.url)) (modeline) @keyword.directive |