From a82501244a75b3d59cdc42496e5ad841f31e4d6d Mon Sep 17 00:00:00 2001 From: Pham Huy Hoang Date: Sun, 9 Apr 2023 15:05:04 +0900 Subject: [PATCH 0001/2494] refactor(html_inject): use lua-match where possible --- queries/html_tags/injections.scm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/queries/html_tags/injections.scm b/queries/html_tags/injections.scm index ba6d35414..e8926b6b8 100644 --- a/queries/html_tags/injections.scm +++ b/queries/html_tags/injections.scm @@ -25,7 +25,8 @@ ( (script_element (start_tag) @_no_type_lang - (#not-match? @_no_type_lang "\\s(lang|type)\\s*\\=") + (#not-lua-match? @_no_type_lang "%slang%s*=") + (#not-lua-match? @_no_type_lang "%stype%s*=") (raw_text) @javascript)) ; +``` + +```query +(script_element + (raw_text) @injection.content + (#set! injection.language "javascript")) ; set the parser language for @injection.content region to javascript +``` + +For regions that don't have a corresponding `@injection.language`, you need to manually set the language +through `(#set injection.language "lang_name")` + +To combine all matches of a pattern as one single block of content, add `(#set! injection.combined)` to such pattern + ### Indents ```scheme diff --git a/lua/nvim-treesitter/query_predicates.lua b/lua/nvim-treesitter/query_predicates.lua index ff0e9999a..7f2b73c54 100644 --- a/lua/nvim-treesitter/query_predicates.lua +++ b/lua/nvim-treesitter/query_predicates.lua @@ -153,10 +153,10 @@ query.add_directive("set-lang-from-mimetype!", function(match, _, bufnr, pred, m local type_attr_value = vim.treesitter.get_node_text(node, bufnr) local configured = html_script_type_languages[type_attr_value] if configured then - metadata.language = configured + metadata["injection.language"] = configured else local parts = vim.split(type_attr_value, "/", {}) - metadata.language = parts[#parts] + metadata["injection.language"] = parts[#parts] end end, true) @@ -172,7 +172,7 @@ query.add_directive("set-lang-from-info-string!", function(match, _, bufnr, pred return end local injection_alias = vim.treesitter.get_node_text(node, bufnr) - metadata.language = get_parser_from_markdown_info_string(injection_alias) + metadata["injection.language"] = get_parser_from_markdown_info_string(injection_alias) end, true) -- Just avoid some annoying warnings for this directive @@ -211,37 +211,6 @@ query.add_directive("downcase!", function(match, _, bufnr, pred, metadata) end end, true) ----@param match (TSNode|nil)[] ----@param _pattern string ----@param _bufnr integer ----@param pred string[] ----@param metadata table ----@return boolean|nil -query.add_directive("exclude_children!", function(match, _pattern, _bufnr, pred, metadata) - local capture_id = pred[2] - local node = match[capture_id] - local start_row, start_col, end_row, end_col = node:range() - local ranges = {} - for i = 0, node:named_child_count() - 1 do - local child = node:named_child(i) ---@type TSNode - local child_start_row, child_start_col, child_end_row, child_end_col = child:range() - if child_start_row > start_row or child_start_col > start_col then - table.insert(ranges, { - start_row, - start_col, - child_start_row, - child_start_col, - }) - end - start_row = child_end_row - start_col = child_end_col - end - if end_row > start_row or end_col > start_col then - table.insert(ranges, { start_row, start_col, end_row, end_col }) - end - metadata.content = ranges -end, true) - -- Trim blank lines from end of the region -- Arguments are the captures to trim. ---@param match (TSNode|nil)[] diff --git a/queries/arduino/injections.scm b/queries/arduino/injections.scm index 240162b9b..15d3b1670 100644 --- a/queries/arduino/injections.scm +++ b/queries/arduino/injections.scm @@ -1,6 +1,15 @@ -((preproc_def (preproc_arg) @arduino) - (#lua-match? @arduino "\n")) -(preproc_function_def (preproc_arg) @arduino) -(preproc_call (preproc_arg) @arduino) +((preproc_def + (preproc_arg) @injection.content) + (#lua-match? @injection.content "\n") + (#set! injection.language "arduino")) -(comment) @comment +(preproc_function_def + (preproc_arg) @injection.content + (#set! injection.language "arduino")) + +(preproc_call + (preproc_arg) @injection.content + (#set! injection.language "arduino")) + +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/astro/injections.scm b/queries/astro/injections.scm index 60ea3f5c6..b8f1ccefc 100644 --- a/queries/astro/injections.scm +++ b/queries/astro/injections.scm @@ -1,19 +1,23 @@ -; inherits: html +; inherits: html_tags -((frontmatter - (raw_text) @typescript)) +(frontmatter + (raw_text) @injection.content + (#set! injection.language "typescript")) -((interpolation - (raw_text) @tsx)) +(interpolation + (raw_text) @injection.content + (#set! injection.language "tsx")) -((script_element - (raw_text) @typescript)) +(script_element + (raw_text) @injection.content + (#set! injection.language "typescript")) -((style_element - (start_tag - (attribute - (attribute_name) @_lang_attr - (quoted_attribute_value (attribute_value) @_lang_value))) - (raw_text) @scss) +(style_element + (start_tag + (attribute + (attribute_name) @_lang_attr + (quoted_attribute_value (attribute_value) @_lang_value))) + (raw_text) @injection.content (#eq? @_lang_attr "lang") - (#eq? @_lang_value "scss")) + (#eq? @_lang_value "scss") + (#set! injection.language "scss")) diff --git a/queries/awk/injections.scm b/queries/awk/injections.scm index 8cbffc623..e5e2b4d02 100644 --- a/queries/awk/injections.scm +++ b/queries/awk/injections.scm @@ -1,2 +1,5 @@ -(comment) @comment -(regex) @regex +((comment) @injection.content + (#set! injection.language "comment")) + +((regex) @injection.content + (#set! injection.language "regex")) diff --git a/queries/bash/injections.scm b/queries/bash/injections.scm index 86371b905..e5e2b4d02 100644 --- a/queries/bash/injections.scm +++ b/queries/bash/injections.scm @@ -1,3 +1,5 @@ -(comment) @comment +((comment) @injection.content + (#set! injection.language "comment")) -(regex) @regex +((regex) @injection.content + (#set! injection.language "regex")) diff --git a/queries/bass/injections.scm b/queries/bass/injections.scm index 4bb7d675d..6adae45a2 100644 --- a/queries/bass/injections.scm +++ b/queries/bass/injections.scm @@ -1 +1,2 @@ -(comment) @comment +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/bicep/injections.scm b/queries/bicep/injections.scm index c85cfe3b6..d3ff30b60 100644 --- a/queries/bicep/injections.scm +++ b/queries/bicep/injections.scm @@ -1,4 +1,5 @@ -[ - (comment) - (diagnostic_comment) -] @comment +([ + (comment) + (diagnostic_comment) + ] @injection.content + (#set! injection.language "comment")) diff --git a/queries/c/injections.scm b/queries/c/injections.scm index 2ef8f85c1..a1913e664 100644 --- a/queries/c/injections.scm +++ b/queries/c/injections.scm @@ -1,10 +1,21 @@ -((preproc_def (preproc_arg) @c) - (#lua-match? @c "\n")) -(preproc_function_def (preproc_arg) @c) -(preproc_call (preproc_arg) @c) +((preproc_def + (preproc_arg) @injection.content) + (#lua-match? @injection.content "\n") + (#set! injection.language "c")) -(comment) @comment +(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) @asm) -; (gnu_asm_expression assembly_code: (concatenated_string (string_literal) @asm)) +; (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")) diff --git a/queries/c_sharp/injections.scm b/queries/c_sharp/injections.scm index 4bb7d675d..6adae45a2 100644 --- a/queries/c_sharp/injections.scm +++ b/queries/c_sharp/injections.scm @@ -1 +1,2 @@ -(comment) @comment +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/capnp/injections.scm b/queries/capnp/injections.scm index 4bb7d675d..6adae45a2 100644 --- a/queries/capnp/injections.scm +++ b/queries/capnp/injections.scm @@ -1 +1,2 @@ -(comment) @comment +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/chatito/injections.scm b/queries/chatito/injections.scm index 4bb7d675d..6adae45a2 100644 --- a/queries/chatito/injections.scm +++ b/queries/chatito/injections.scm @@ -1 +1,2 @@ -(comment) @comment +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/clojure/injections.scm b/queries/clojure/injections.scm index 4bb7d675d..6adae45a2 100644 --- a/queries/clojure/injections.scm +++ b/queries/clojure/injections.scm @@ -1 +1,2 @@ -(comment) @comment +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/cpon/injections.scm b/queries/cpon/injections.scm index 4bb7d675d..6adae45a2 100644 --- a/queries/cpon/injections.scm +++ b/queries/cpon/injections.scm @@ -1 +1,2 @@ -(comment) @comment +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/cpp/injections.scm b/queries/cpp/injections.scm index 1d8e11cb3..2349c92bf 100644 --- a/queries/cpp/injections.scm +++ b/queries/cpp/injections.scm @@ -1,10 +1,19 @@ -((preproc_def (preproc_arg) @cpp) - (#lua-match? @cpp "\n")) -(preproc_function_def (preproc_arg) @cpp) -(preproc_call (preproc_arg) @cpp) +((preproc_def + (preproc_arg) @injection.content) + (#lua-match? @injection.content "\n") + (#set! injection.language "cpp")) -(comment) @comment +(preproc_function_def + (preproc_arg) @injection.content + (#set! injection.language "cpp")) + +(preproc_call + (preproc_arg) @injection.content + (#set! injection.language "cpp")) + +((comment) @injection.content + (#set! injection.language "comment")) (raw_string_literal - delimiter: (raw_string_delimiter) @language - (raw_string_content) @content) + delimiter: (raw_string_delimiter) @injection.language + (raw_string_content) @injection.content) diff --git a/queries/css/injections.scm b/queries/css/injections.scm index 4bb7d675d..6adae45a2 100644 --- a/queries/css/injections.scm +++ b/queries/css/injections.scm @@ -1 +1,2 @@ -(comment) @comment +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/cuda/injections.scm b/queries/cuda/injections.scm index 09deac468..bb37accb1 100644 --- a/queries/cuda/injections.scm +++ b/queries/cuda/injections.scm @@ -1,6 +1,15 @@ -((preproc_def (preproc_arg) @cuda) - (#lua-match? @cuda "\n")) -(preproc_function_def (preproc_arg) @cuda) -(preproc_call (preproc_arg) @cuda) +((preproc_def + (preproc_arg) @injection.content) + (#lua-match? @injection.content "\n") + (#set! injection.language "cuda")) -(comment) @comment +(preproc_function_def + (preproc_arg) @injection.content + (#set! injection.language "cuda")) + +(preproc_call + (preproc_arg) @injection.content + (#set! injection.language "cuda")) + +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/cue/injections.scm b/queries/cue/injections.scm index 4bb7d675d..6adae45a2 100644 --- a/queries/cue/injections.scm +++ b/queries/cue/injections.scm @@ -1 +1,2 @@ -(comment) @comment +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/d/injections.scm b/queries/d/injections.scm index d95514370..6dd8aeacf 100644 --- a/queries/d/injections.scm +++ b/queries/d/injections.scm @@ -1,7 +1,9 @@ -[ +([ (line_comment) (block_comment) (nesting_block_comment) -] @comment + ] @injection.content + (#set! injection.language "comment")) -(token_string_tokens) @d +((token_string_tokens) @injection.content + (#set! injection.language "d")) diff --git a/queries/dart/injections.scm b/queries/dart/injections.scm index 4bb7d675d..6adae45a2 100644 --- a/queries/dart/injections.scm +++ b/queries/dart/injections.scm @@ -1 +1,2 @@ -(comment) @comment +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/devicetree/injections.scm b/queries/devicetree/injections.scm index 4bb7d675d..6adae45a2 100644 --- a/queries/devicetree/injections.scm +++ b/queries/devicetree/injections.scm @@ -1 +1,2 @@ -(comment) @comment +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/dhall/injections.scm b/queries/dhall/injections.scm index e48ce9af3..43ae7287b 100644 --- a/queries/dhall/injections.scm +++ b/queries/dhall/injections.scm @@ -1,4 +1,5 @@ -[ +([ (line_comment) (block_comment) -] @comment + ] @injection.content + (#set! injection.language "comment")) diff --git a/queries/dockerfile/injections.scm b/queries/dockerfile/injections.scm index c1fdd3f99..2a48ec4f6 100644 --- a/queries/dockerfile/injections.scm +++ b/queries/dockerfile/injections.scm @@ -1,3 +1,5 @@ -(comment) @comment +((comment) @injection.content + (#set! injection.language "comment")) -(shell_command) @bash +((shell_command) @injection.content + (#set! injection.language "bash")) diff --git a/queries/dot/injections.scm b/queries/dot/injections.scm index 529d04d4a..ac41393ab 100644 --- a/queries/dot/injections.scm +++ b/queries/dot/injections.scm @@ -1,2 +1,5 @@ -(html_internal) @html -(comment) @comment +((html_internal) @injection.content + (#set! injection.language "html")) + +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/ecma/injections.scm b/queries/ecma/injections.scm index ba0ea4fa1..3b55295ce 100644 --- a/queries/ecma/injections.scm +++ b/queries/ecma/injections.scm @@ -1,59 +1,67 @@ (((comment) @_jsdoc_comment - (#lua-match? @_jsdoc_comment "^/[*][*][^*].*[*]/$")) @jsdoc) + (#lua-match? @_jsdoc_comment "^/[*][*][^*].*[*]/$")) @injection.content + (#set! injection.language "jsdoc")) -(comment) @comment +((comment) @injection.content + (#set! injection.language "comment")) ; html(`...`), html`...`, sql(...) etc (call_expression - function: ((identifier) @language) + function: ((identifier) @injection.language) arguments: [ (arguments - (template_string) @content) - (template_string) @content + (template_string) @injection.content) + (template_string) @injection.content ] - (#offset! @content 0 1 0 -1) - (#not-eq? @content "svg")) + (#offset! @injection.content 0 1 0 -1) + (#not-eq? @injection.language "svg")) ; svg`...` or svg(`...`), which uses the html parser, so is not included in the previous query (call_expression function: ((identifier) @_name (#eq? @_name "svg")) arguments: [ (arguments - (template_string) @html) - (template_string) @html + (template_string) @injection.content) + (template_string) @injection.content ] - (#offset! @html 0 1 0 -1)) + (#offset! @injection.content 0 1 0 -1) + (#set! injection.language "html")) (call_expression function: ((identifier) @_name (#eq? @_name "gql")) - arguments: ((template_string) @graphql - (#offset! @graphql 0 1 0 -1))) + arguments: ((template_string) @injection.content + (#offset! @injection.content 0 1 0 -1) + (#set! injection.language "graphql"))) (call_expression function: ((identifier) @_name (#eq? @_name "hbs")) - arguments: ((template_string) @glimmer - (#offset! @glimmer 0 1 0 -1))) + arguments: ((template_string) @injection.content + (#offset! @injection.content 0 1 0 -1) + (#set! injection.language "glimmer"))) -((glimmer_template) @glimmer) +((glimmer_template) @injection.content + (#set! injection.language "glimmer")) ; styled.div`` (call_expression function: (member_expression object: (identifier) @_name (#eq? @_name "styled")) - arguments: ((template_string) @css - (#offset! @css 0 1 0 -1))) + arguments: ((template_string) @injection.content + (#offset! @injection.content 0 1 0 -1) + (#set! injection.language "css"))) ; styled(Component)`` (call_expression function: (call_expression function: (identifier) @_name (#eq? @_name "styled")) - arguments: ((template_string) @css - (#offset! @css 0 1 0 -1))) + arguments: ((template_string) @injection.content + (#offset! @injection.content 0 1 0 -1) + (#set! injection.language "css"))) ; styled.div.attrs({ prop: "foo" })`` (call_expression @@ -62,8 +70,9 @@ object: (member_expression object: (identifier) @_name (#eq? @_name "styled")))) - arguments: ((template_string) @css - (#offset! @css 0 1 0 -1))) + arguments: ((template_string) @injection.content + (#offset! @injection.content 0 1 0 -1) + (#set! injection.language "css"))) ; styled(Component).attrs({ prop: "foo" })`` @@ -73,31 +82,34 @@ object: (call_expression function: (identifier) @_name (#eq? @_name "styled")))) - arguments: ((template_string) @css - (#offset! @css 0 1 0 -1))) + arguments: ((template_string) @injection.content + (#offset! @injection.content 0 1 0 -1) + (#set! injection.language "css"))) -(regex_pattern) @regex +((regex_pattern) @injection.content + (#set! injection.language "regex")) ; ((comment) @_gql_comment ; (#eq? @_gql_comment "/* GraphQL */") -; (template_string) @graphql) +; (template_string) @injection.content +; (#set! injection.language "graphql")) -((template_string) @graphql - (#lua-match? @graphql "^`#graphql") - (#offset! @graphql 0 1 0 -1)) +((template_string) @injection.content + (#lua-match? @injection.content "^`#graphql") + (#offset! @injection.content 0 1 0 -1) + (#set! injection.language "graphql")) ; el.innerHTML = `` -(assignment_expression - left: (member_expression - property: (property_identifier) @_prop - (#any-of? @_prop "innerHTML" "outerHTML")) - right: (template_string) @html - (#offset! @html 0 1 0 -1)) - ; el.innerHTML = '' (assignment_expression - left: (member_expression - property: (property_identifier) @_prop - (#any-of? @_prop "innerHTML" "outerHTML")) - right: (string) @html - (#offset! @html 0 1 0 -1)) + left: + (member_expression + property: (property_identifier) @_prop + (#any-of? @_prop "outerHTML" "innerHTML")) + right: + [ + (template_string) + (string) + ] @injection.content + (#offset! @injection.content 0 1 0 -1) + (#set! injection.language "html")) diff --git a/queries/eex/injections.scm b/queries/eex/injections.scm index f43206f55..9331f5925 100644 --- a/queries/eex/injections.scm +++ b/queries/eex/injections.scm @@ -1,5 +1,8 @@ ; EEx expressions are Elixir -(expression) @elixir +((expression) @injection.content + (#set! injection.language "elixir")) ; EEx expressions can span multiple interpolated lines -(partial_expression) @elixir @combined +((partial_expression) @injection.content + (#set! injection.language "elixir") + (#set! injection.combined)) diff --git a/queries/elixir/injections.scm b/queries/elixir/injections.scm index 423fddea7..1f0b31f07 100644 --- a/queries/elixir/injections.scm +++ b/queries/elixir/injections.scm @@ -1,5 +1,6 @@ ; Comments -(comment) @comment +((comment) @injection.content + (#set! injection.language "comment")) ; Documentation (unary_operator @@ -7,42 +8,49 @@ operand: (call target: ((identifier) @_identifier (#any-of? @_identifier "moduledoc" "typedoc" "shortdoc" "doc")) (arguments [ - (string (quoted_content) @markdown) - (sigil (quoted_content) @markdown) - ]))) + (string (quoted_content) @injection.content) + (sigil (quoted_content) @injection.content) + ]) + (#set! injection.language "markdown"))) ; HEEx (sigil (sigil_name) @_sigil_name - (quoted_content) @heex -(#eq? @_sigil_name "H")) + (quoted_content) @injection.content + (#eq? @_sigil_name "H") + (#set! injection.language "heex")) ; Surface (sigil (sigil_name) @_sigil_name - (quoted_content) @surface -(#eq? @_sigil_name "F")) + (quoted_content) @injection.content + (#eq? @_sigil_name "F") + (#set! injection.language "surface")) ; Zigler (sigil (sigil_name) @_sigil_name - (quoted_content) @eex -(#any-of? @_sigil_name "E" "L")) + (quoted_content) @injection.content + (#any-of? @_sigil_name "E" "L") + (#set! injection.language "eex")) (sigil (sigil_name) @_sigil_name - (quoted_content) @zig -(#any-of? @_sigil_name "z" "Z")) + (quoted_content) @injection.content + (#any-of? @_sigil_name "z" "Z") + (#set! injection.language "zig")) ; Regex (sigil (sigil_name) @_sigil_name - (quoted_content) @regex -(#any-of? @_sigil_name "r" "R")) + (quoted_content) @injection.content + (#any-of? @_sigil_name "r" "R") + (#set! injection.language "regex")) -; Jason +; Json (sigil (sigil_name) @_sigil_name - (quoted_content) @json -(#any-of? @_sigil_name "j" "J")) + (quoted_content) @injection.content + (#any-of? @_sigil_name "j" "J") + (#set! injection.language "json")) diff --git a/queries/elm/injections.scm b/queries/elm/injections.scm index 6395776e1..b8b3e9943 100644 --- a/queries/elm/injections.scm +++ b/queries/elm/injections.scm @@ -1,3 +1,8 @@ -[(line_comment) (block_comment)] @comment +([ + (line_comment) + (block_comment) + ] @injection.content + (#set! injection.language "comment")) -(glsl_content) @glsl +((glsl_content) @injection.content + (#set! injection.language "glsl")) diff --git a/queries/elsa/injections.scm b/queries/elsa/injections.scm index 4bb7d675d..6adae45a2 100644 --- a/queries/elsa/injections.scm +++ b/queries/elsa/injections.scm @@ -1 +1,2 @@ -(comment) @comment +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/elvish/injections.scm b/queries/elvish/injections.scm index 4bb7d675d..6adae45a2 100644 --- a/queries/elvish/injections.scm +++ b/queries/elvish/injections.scm @@ -1 +1,2 @@ -(comment) @comment +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/embedded_template/injections.scm b/queries/embedded_template/injections.scm index d55c87e09..2824f7a00 100644 --- a/queries/embedded_template/injections.scm +++ b/queries/embedded_template/injections.scm @@ -1,2 +1,7 @@ -(content) @html @combined -(code) @ruby @combined +((content) @injection.content + (#set! injection.language "html") + (#set! injection.combined)) + +((code) @injection.content + (#set! injection.language "ruby") + (#set! injection.combined)) diff --git a/queries/fennel/injections.scm b/queries/fennel/injections.scm index 4bb7d675d..6adae45a2 100644 --- a/queries/fennel/injections.scm +++ b/queries/fennel/injections.scm @@ -1 +1,2 @@ -(comment) @comment +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/firrtl/injections.scm b/queries/firrtl/injections.scm index 4bb7d675d..6adae45a2 100644 --- a/queries/firrtl/injections.scm +++ b/queries/firrtl/injections.scm @@ -1 +1,2 @@ -(comment) @comment +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/fish/injections.scm b/queries/fish/injections.scm index 4bb7d675d..6adae45a2 100644 --- a/queries/fish/injections.scm +++ b/queries/fish/injections.scm @@ -1 +1,2 @@ -(comment) @comment +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/foam/injections.scm b/queries/foam/injections.scm index 4afdb63b0..2d744f6af 100644 --- a/queries/foam/injections.scm +++ b/queries/foam/injections.scm @@ -1,12 +1,20 @@ ;; Pass code blocks to Cpp highlighter -(code (code_body) @cpp) +(code + (code_body) @injection.content + (#set! injection.language "cpp")) ;; Pass identifiers to Go highlighter (Cheating I know) -;;((identifier) @lua) +;; ((identifier) @injection.content +;; (#set! injection.language "lua") ;; Highlight regex syntax inside literal strings -((string_literal) @regex) +((string_literal) @injection.content + (#set! injection.language "regex")) ;; Highlight PyFoam syntax as Python statements -(pyfoam_variable code_body: (_) @python) -(pyfoam_expression code_body: (_) @python) +(pyfoam_variable + code_body: (_) @injection.content + (#set! injection.language "python")) +(pyfoam_expression + code_body: (_) @injection.content + (#set! injection.language "python")) diff --git a/queries/gdscript/injections.scm b/queries/gdscript/injections.scm index 4bb7d675d..6adae45a2 100644 --- a/queries/gdscript/injections.scm +++ b/queries/gdscript/injections.scm @@ -1 +1,2 @@ -(comment) @comment +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/git_rebase/injections.scm b/queries/git_rebase/injections.scm index 27388618e..8e6815a68 100644 --- a/queries/git_rebase/injections.scm +++ b/queries/git_rebase/injections.scm @@ -1,5 +1,6 @@ ((operation (command) @_command - (message) @bash) + (message) @injection.content) +(#set! injection.language "bash") (#any-of? @_command "exec" "x")) diff --git a/queries/gitattributes/injections.scm b/queries/gitattributes/injections.scm index 4bb7d675d..6adae45a2 100644 --- a/queries/gitattributes/injections.scm +++ b/queries/gitattributes/injections.scm @@ -1 +1,2 @@ -(comment) @comment +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/gitcommit/injections.scm b/queries/gitcommit/injections.scm index eecdeee47..5e56dfa5f 100644 --- a/queries/gitcommit/injections.scm +++ b/queries/gitcommit/injections.scm @@ -1,2 +1,5 @@ -((diff) @diff (#exclude_children! @diff)) -(rebase_command) @git_rebase +((diff) @injection.content + (#set! injection.language "diff")) + +((rebase_command) @injection.content + (#set! injection.language "git_rebase")) diff --git a/queries/gleam/injections.scm b/queries/gleam/injections.scm index ed4c2de91..378240e38 100644 --- a/queries/gleam/injections.scm +++ b/queries/gleam/injections.scm @@ -1,6 +1,7 @@ ; Comments -[ +([ (module_comment) (statement_comment) (comment) -] @comment + ] @injection.content + (#set! injection.language "comment")) diff --git a/queries/glsl/injections.scm b/queries/glsl/injections.scm index 6d022021d..f9061052c 100644 --- a/queries/glsl/injections.scm +++ b/queries/glsl/injections.scm @@ -1,6 +1,15 @@ -((preproc_def (preproc_arg) @glsl) - (#lua-match? @glsl "\n")) -(preproc_function_def (preproc_arg) @glsl) -(preproc_call (preproc_arg) @glsl) +((preproc_def + (preproc_arg) @injection.content) + (#lua-match? @injection.content "\n") + (#set! injection.language "glsl")) -(comment) @comment +(preproc_function_def + (preproc_arg) @injection.content + (#set! injection.language "glsl")) + +(preproc_call + (preproc_arg) @injection.content + (#set! injection.language "glsl")) + +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/go/injections.scm b/queries/go/injections.scm index e0bdc99b9..68aa552cd 100644 --- a/queries/go/injections.scm +++ b/queries/go/injections.scm @@ -1,4 +1,5 @@ -(comment) @comment +((comment) @injection.content + (#set! injection.language "comment")) (call_expression (selector_expression) @_function (#any-of? @_function @@ -10,4 +11,10 @@ "regexp.MustCompile" "regexp.MustCompilePOSIX") (argument_list - . [(raw_string_literal) (interpreted_string_literal)] @regex (#offset! @regex 0 1 0 -1))) + . + [ + (raw_string_literal) + (interpreted_string_literal) + ] @injection.content + (#offset! @injection.content 0 1 0 -1) + (#set! injection.language "regex"))) diff --git a/queries/gomod/injections.scm b/queries/gomod/injections.scm index 4bb7d675d..321c90add 100644 --- a/queries/gomod/injections.scm +++ b/queries/gomod/injections.scm @@ -1 +1,2 @@ -(comment) @comment +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/gowork/injections.scm b/queries/gowork/injections.scm index 4bb7d675d..321c90add 100644 --- a/queries/gowork/injections.scm +++ b/queries/gowork/injections.scm @@ -1 +1,2 @@ -(comment) @comment +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/graphql/injections.scm b/queries/graphql/injections.scm index 4bb7d675d..321c90add 100644 --- a/queries/graphql/injections.scm +++ b/queries/graphql/injections.scm @@ -1 +1,2 @@ -(comment) @comment +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/groovy/injections.scm b/queries/groovy/injections.scm index 0a63c9bfe..0f3127b6b 100644 --- a/queries/groovy/injections.scm +++ b/queries/groovy/injections.scm @@ -1,4 +1,5 @@ -[ - (block_comment) - (line_comment) -] @comment +((line_comment) @injection.content + (#set! injection.language "comment")) + +((block_comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/hare/injections.scm b/queries/hare/injections.scm index 2992a948d..d3befb39b 100644 --- a/queries/hare/injections.scm +++ b/queries/hare/injections.scm @@ -1,8 +1,10 @@ -(comment) @comment +((comment) @injection.content + (#set! injection.language "comment")) ((call_expression . (_) @_fnname . "(" - . (_ [(string_content) (raw_string_content)] @regex) + . (_ [(string_content) (raw_string_content)] @injection.content) . ")") - (#any-of? @_fnname "compile" "regex::compile")) + (#any-of? @_fnname "compile" "regex::compile") + (#set! injection.language "regex")) diff --git a/queries/haskell/injections.scm b/queries/haskell/injections.scm index f210566c4..bc70e012f 100644 --- a/queries/haskell/injections.scm +++ b/queries/haskell/injections.scm @@ -2,11 +2,12 @@ ;; General language injection (quasiquote - ((quoter) @language) - ((quasiquote_body) @content) + ((quoter) @injection.language) + ((quasiquote_body) @injection.content) ) -(comment) @comment +((comment) @injection.content + (#set! injection.language "comment")) ;; ----------------------------------------------------------------------------- ;; shakespeare library @@ -17,35 +18,36 @@ ; (quasiquote ; (quoter) @_name ; (#eq? @_name "coffee") -; ((quasiquote_body) @coffeescript) +; ((quasiquote_body) @injection.content +; (#set! injection.language "coffeescript"))) ; CSS: Text.Cassius, Text.Lucius (quasiquote (quoter) @_name (#any-of? @_name "cassius" "lucius") - ((quasiquote_body) @css) -) + ((quasiquote_body) @injection.content) + (#set! injection.language "css")) ; HTML: Text.Hamlet (quasiquote (quoter) @_name (#any-of? @_name "shamlet" "xshamlet" "hamlet" "xhamlet" "ihamlet") - ((quasiquote_body) @html) -) + ((quasiquote_body) @injection.content) + (#set! injection.language "html")) ; JS: Text.Julius (quasiquote (quoter) @_name (#any-of? @_name "js" "julius") - ((quasiquote_body) @javascript) -) + ((quasiquote_body) @injection.content) + (#set! injection.language "javascript")) ; TS: Text.TypeScript (quasiquote (quoter) @_name (#any-of? @_name "tsc" "tscJSX") - ((quasiquote_body) @typescript) -) + ((quasiquote_body) @injection.content) + (#set! injection.language "typescript")) ;; ----------------------------------------------------------------------------- @@ -54,8 +56,8 @@ (quasiquote (quoter) @_name (#eq? @_name "hsx") - ((quasiquote_body) @html) -) + ((quasiquote_body) @injection.content) + (#set! injection.language "html")) ;; ----------------------------------------------------------------------------- ;; Inline JSON from aeson @@ -63,8 +65,8 @@ (quasiquote (quoter) @_name (#eq? @_name "aesonQQ") - ((quasiquote_body) @json) -) + ((quasiquote_body) @injection.content) + (#set! injection.language "json")) ;; ----------------------------------------------------------------------------- @@ -72,14 +74,12 @@ ; postgresql-simple (quasiquote - (quoter) @_name - (#eq? @_name "sql") - ((quasiquote_body) @sql) -) + (quoter) @injection.language + (#eq? @injection.language "sql") + ((quasiquote_body) @injection.content)) -; persistent (quasiquote - (quoter) @_name - (#any-of? @_name "persistUpperCase" "persistLowerCase" "persistWith") - ((quasiquote_body) @haskell_persistent) -) + (quoter) @_name + (#any-of? @_name "persistUpperCase" "persistLowerCase" "persistWith") + ((quasiquote_body) @injection.content) + (#set! injection.language "haskell_persistent")) diff --git a/queries/hcl/injections.scm b/queries/hcl/injections.scm index 94451beb4..fd881d503 100644 --- a/queries/hcl/injections.scm +++ b/queries/hcl/injections.scm @@ -1,7 +1,7 @@ -(comment) @comment +((comment) @injection.content + (#set! injection.language "comment")) (heredoc_template - (template_literal) @content - (heredoc_identifier) @language - (#set! "language" @language) - (#downcase! "language")) + (template_literal) @injection.content + (heredoc_identifier) @injection.language + (#downcase! @injection.language)) diff --git a/queries/heex/injections.scm b/queries/heex/injections.scm index fffd1dc53..1aa822197 100644 --- a/queries/heex/injections.scm +++ b/queries/heex/injections.scm @@ -2,10 +2,15 @@ (directive [ (expression_value) (partial_expression_value) -] @elixir @combined) +] @injection.content + (#set! injection.language "elixir") + (#set! injection.combined)) ; HEEx Elixir expressions are always within a tag or component -(expression (expression_value) @elixir) +(expression + (expression_value) @injection.content + (#set! injection.language "elixir")) ; HEEx comments -(comment) @comment +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/hjson/injections.scm b/queries/hjson/injections.scm index 4bb7d675d..321c90add 100644 --- a/queries/hjson/injections.scm +++ b/queries/hjson/injections.scm @@ -1 +1,2 @@ -(comment) @comment +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/hlsl/injections.scm b/queries/hlsl/injections.scm index 52e88686c..9a9fcd6e8 100644 --- a/queries/hlsl/injections.scm +++ b/queries/hlsl/injections.scm @@ -1,6 +1,15 @@ -((preproc_def (preproc_arg) @hlsl) - (#lua-match? @hlsl "\n")) -(preproc_function_def (preproc_arg) @hlsl) -(preproc_call (preproc_arg) @hlsl) +((preproc_def + (preproc_arg) @injection.content) + (#lua-match? @injection.content "\n") + (#set! injection.language "hlsl")) -(comment) @comment +(preproc_function_def + (preproc_arg) @injection.content + (#set! injection.language "hlsl")) + +(preproc_call + (preproc_arg) @injection.content + (#set! injection.language "hlsl")) + +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/hocon/injections.scm b/queries/hocon/injections.scm index 4bb7d675d..321c90add 100644 --- a/queries/hocon/injections.scm +++ b/queries/hocon/injections.scm @@ -1 +1,2 @@ -(comment) @comment +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/html/injections.scm b/queries/html/injections.scm index 23981018c..eba8395a4 100644 --- a/queries/html/injections.scm +++ b/queries/html/injections.scm @@ -3,8 +3,10 @@ (element (start_tag (tag_name) @_py_script) - (text) @python - (#any-of? @_py_script "py-script" "py-repl")) + (text) @injection.content + (#any-of? @_py_script "py-script" "py-repl") + (#set! injection.language "python") + (#set! injection.include-children)) (script_element (start_tag @@ -12,13 +14,17 @@ (attribute_name) @_attr (quoted_attribute_value (attribute_value) @_type))) - (raw_text) @python + (raw_text) @injection.content (#eq? @_attr "type") ; not adding type="py" here as it's handled by html_tags - (#any-of? @_type "pyscript" "py-script")) + (#any-of? @_type "pyscript" "py-script") + (#set! injection.language "python") + (#set! injection.include-children)) (element (start_tag (tag_name) @_py_config) - (text) @toml - (#eq? @_py_config "py-config")) + (text) @injection.content + (#eq? @_py_config "py-config") + (#set! injection.language "toml") + (#set! injection.include-children)) diff --git a/queries/html_tags/injections.scm b/queries/html_tags/injections.scm index 29608a5a4..5b9e5350f 100644 --- a/queries/html_tags/injections.scm +++ b/queries/html_tags/injections.scm @@ -2,73 +2,84 @@ ; ; Add "lang" to predicate check so that vue/svelte can inherit this ; without having this element being captured twice -( - (style_element +((style_element (start_tag) @_no_type_lang - (#not-lua-match? @_no_type_lang "%slang%s*=") - (#not-lua-match? @_no_type_lang "%stype%s*=") - (raw_text) @css)) + (raw_text) @injection.content) + (#not-lua-match? @_no_type_lang "%slang%s*=") + (#not-lua-match? @_no_type_lang "%stype%s*=") + (#set! injection.language "css") + (#set! injection.include-children)) -( - (style_element - (start_tag - (attribute - (attribute_name) @_type - (quoted_attribute_value (attribute_value) @_css))) - (raw_text) @css) - (#eq? @_type "type") - (#eq? @_css "text/css") -) +((style_element + (start_tag + (attribute + (attribute_name) @_type + (quoted_attribute_value (attribute_value) @_css))) + (raw_text) @injection.content) + (#eq? @_type "type") + (#eq? @_css "text/css") + (#set! injection.language "css") + (#set! injection.include-children)) ; ; -( - (script_element - (start_tag) @_no_type_lang - (#not-lua-match? @_no_type_lang "%slang%s*=") - (#not-lua-match? @_no_type_lang "%stype%s*=") - (raw_text) @javascript)) +((script_element + (start_tag) @_no_type_lang + (raw_text) @injection.content) + (#not-lua-match? @_no_type_lang "%slang%s*=") + (#not-lua-match? @_no_type_lang "%stype%s*=") + (#set! injection.language "javascript") + (#set! injection.include-children)) ; ; @@ -28,8 +26,7 @@ (raw_text) @injection.content) (#not-lua-match? @_no_type_lang "%slang%s*=") (#not-lua-match? @_no_type_lang "%stype%s*=") - (#set! injection.language "javascript") - (#set! injection.include-children)) + (#set! injection.language "javascript")) ; From 96f55f304332ca6ea1b7dde32d3ec04b5298c316 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 6 Nov 2023 06:49:36 +0000 Subject: [PATCH 0632/2494] Update parsers: awk, janet_simple, markdown, markdown_inline, wing (#5633) Co-authored-by: GitHub --- lockfile.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lockfile.json b/lockfile.json index 47c9a4180..918e45f4a 100644 --- a/lockfile.json +++ b/lockfile.json @@ -18,7 +18,7 @@ "revision": "1dec7e1af96c56924e3322cd85fdce15d0a31d00" }, "awk": { - "revision": "fc5a51138717a5c766b30ad7438fcfc5ef291cb3" + "revision": "4b4b46c9a44ec7fb9e8c9ce4a010295edc5be8d5" }, "bash": { "revision": "7331995b19b8f8aba2d5e26deb51d2195c18bc94" @@ -279,7 +279,7 @@ "revision": "9b2f9aec2106b94b4e099fe75e73ebd8ae707c04" }, "janet_simple": { - "revision": "069a6d300e09c725fa4d6e3dfe0d6468fb16ca54" + "revision": "69d46e8a76f3c249e15652ac922be50ba39a2ee1" }, "java": { "revision": "2b57cd9541f9fd3a89207d054ce8fbe72657c444" @@ -354,10 +354,10 @@ "revision": "a4b9187417d6be349ee5fd4b6e77b4172c6827dd" }, "markdown": { - "revision": "85d0f22d9e1a4f92cfd26d0237b108f067e2761a" + "revision": "cd705f159127c947cd92ac163c6b17b5dcba7f94" }, "markdown_inline": { - "revision": "85d0f22d9e1a4f92cfd26d0237b108f067e2761a" + "revision": "cd705f159127c947cd92ac163c6b17b5dcba7f94" }, "matlab": { "revision": "6071891a8c39600203eba20513666cf93b4d650a" @@ -687,7 +687,7 @@ "revision": "a041228ae64632f59b9bd37346a0dbcb7817f36b" }, "wing": { - "revision": "b8056b854f933886e204e46a3001f007441ca1be" + "revision": "aa19914c881eccb97c73318638e2cea26557b8d2" }, "xml": { "revision": "9deacbfb79cb3527a0396255beb17e1bba3f2052" From e903dd54e9ec17ff1e817fd858a0756aa4bf0c34 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 7 Nov 2023 08:37:19 +0000 Subject: [PATCH 0633/2494] Update parsers: janet_simple, perl, swift, wing (#5634) Co-authored-by: GitHub --- lockfile.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lockfile.json b/lockfile.json index 918e45f4a..5e0079c62 100644 --- a/lockfile.json +++ b/lockfile.json @@ -279,7 +279,7 @@ "revision": "9b2f9aec2106b94b4e099fe75e73ebd8ae707c04" }, "janet_simple": { - "revision": "69d46e8a76f3c249e15652ac922be50ba39a2ee1" + "revision": "143b15e7a40b9fc2d9664d8357d3f2714bd8bf5f" }, "java": { "revision": "2b57cd9541f9fd3a89207d054ce8fbe72657c444" @@ -429,7 +429,7 @@ "revision": "e01767921df18142055d97407595329d7629e643" }, "perl": { - "revision": "e99bb5283805db4cb86c964722d709df21b0ac16" + "revision": "3911403cba497196fb867a6f1e286e3e1576f425" }, "php": { "revision": "33e30169e6f9bb29845c80afaa62a4a87f23f6d6" @@ -591,7 +591,7 @@ "revision": "697bb515471871e85ff799ea57a76298a71a9cca" }, "swift": { - "revision": "7e4ccc97a25315022a70b730085deccd5680a39b" + "revision": "b3bfaad89426a062c2a5d971cfebb7262f8cff62" }, "sxhkdrc": { "revision": "440d5f913d9465c9c776a1bd92334d32febcf065" @@ -687,7 +687,7 @@ "revision": "a041228ae64632f59b9bd37346a0dbcb7817f36b" }, "wing": { - "revision": "aa19914c881eccb97c73318638e2cea26557b8d2" + "revision": "cac0b1d1cf9d9c864da1f8ade48e1eeaf3720814" }, "xml": { "revision": "9deacbfb79cb3527a0396255beb17e1bba3f2052" From 9a746b4b6a1ef215943f07e6aa2ec35fb14097d4 Mon Sep 17 00:00:00 2001 From: ObserverOfTime Date: Fri, 3 Nov 2023 14:20:46 +0200 Subject: [PATCH 0634/2494] feat: add udev rules parser --- README.md | 1 + lockfile.json | 3 ++ lua/nvim-treesitter/parsers.lua | 9 ++++++ queries/udev/highlights.scm | 53 +++++++++++++++++++++++++++++++++ queries/udev/injections.scm | 12 ++++++++ 5 files changed, 78 insertions(+) create mode 100644 queries/udev/highlights.scm create mode 100644 queries/udev/injections.scm diff --git a/README.md b/README.md index 4ebdd4a15..745735c74 100644 --- a/README.md +++ b/README.md @@ -389,6 +389,7 @@ We are looking for maintainers to add more parsers and to write query files for - [x] [twig](https://github.com/gbprod/tree-sitter-twig) (maintained by @gbprod) - [x] [typescript](https://github.com/tree-sitter/tree-sitter-typescript) (maintained by @steelsojka) - [x] [typoscript](https://github.com/Teddytrombone/tree-sitter-typoscript) (maintained by @Teddytrombone) +- [x] [udev](https://github.com/ObserverOfTime/tree-sitter-udev) (maintained by @ObserverOfTime) - [x] [ungrammar](https://github.com/Philipp-M/tree-sitter-ungrammar) (maintained by @Philipp-M, @amaanq) - [x] [unison](https://github.com/kylegoetz/tree-sitter-unison) (maintained by @tapegram) - [x] [usd](https://github.com/ColinKennedy/tree-sitter-usd) (maintained by @ColinKennedy) diff --git a/lockfile.json b/lockfile.json index 5e0079c62..b67877270 100644 --- a/lockfile.json +++ b/lockfile.json @@ -647,6 +647,9 @@ "typoscript": { "revision": "43b221c0b76e77244efdaa9963e402a17c930fbc" }, + "udev": { + "revision": "e3ad4cb3c59e4c71a177cd4af62958749e53a8bd" + }, "ungrammar": { "revision": "debd26fed283d80456ebafa33a06957b0c52e451" }, diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index ac0cda658..17e59046a 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -1898,6 +1898,15 @@ list.typoscript = { maintainers = { "@Teddytrombone" }, } +list.udev = { + install_info = { + url = "https://github.com/ObserverOfTime/tree-sitter-udev", + files = { "src/parser.c" }, + }, + filetype = "udevrules", + maintainers = { "@ObserverOfTime" }, +} + list.ungrammar = { install_info = { url = "https://github.com/Philipp-M/tree-sitter-ungrammar", diff --git a/queries/udev/highlights.scm b/queries/udev/highlights.scm new file mode 100644 index 000000000..1a8514ea8 --- /dev/null +++ b/queries/udev/highlights.scm @@ -0,0 +1,53 @@ +(match key: _ @keyword) + +(assignment key: _ @property) + +(value) @string + +; NOTE: higher priorities override bash highlights + +((fmt_sub . _ @character.special) + (#set! "priority" 101)) + +((var_sub . _ @variable.builtin) + (#set! "priority" 101)) + +[ + (system_const) + (run_type) + (import_type) + (kernel_param) + (seclabel) +] @attribute + +((attribute) @attribute + (#set! "priority" 101)) + +((env_var) @constant + (#set! "priority" 101)) + +((pattern) @string.special + (#set! "priority" 101)) + +([ "\\\"" (c_escape) ] @string.escape + (#set! "priority" 101)) + +(octal) @number + +((number) @number + (#set! "priority" 101)) + +[ + (match_op) + (assignment_op) +] @operator + +("+" @punctuation.special + (#set! "priority" 101)) + +([ "{" "}" ] @punctuation.bracket + (#set! "priority" 101)) + +[ "," (linebreak) ] @punctuation.delimiter + +(comment) @comment @spell diff --git a/queries/udev/injections.scm b/queries/udev/injections.scm new file mode 100644 index 000000000..5618e65de --- /dev/null +++ b/queries/udev/injections.scm @@ -0,0 +1,12 @@ +((comment) @injection.content + (#set! injection.language "comment")) + +((match + key: "PROGRAM" + (value (content) @injection.content)) + (#set! injection.language "bash")) + +((assignment + key: "RUN" + (value (content) @injection.content)) + (#set! injection.language "bash")) From eacb5e9468665d842d2d25e857cad8f6d95c57fd Mon Sep 17 00:00:00 2001 From: Amaan Qureshi Date: Tue, 7 Nov 2023 22:51:33 -0500 Subject: [PATCH 0635/2494] chore(bitbake): update highlights from upstream --- lockfile.json | 2 +- queries/bitbake/highlights.scm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lockfile.json b/lockfile.json index b67877270..1b001ba12 100644 --- a/lockfile.json +++ b/lockfile.json @@ -36,7 +36,7 @@ "revision": "3604d8c961ab129d2bfc6dfca56419c236ccdb83" }, "bitbake": { - "revision": "6cb07d98f1cad180b8ea28965e59ee05023a5693" + "revision": "edcdb7dffd0e1680c60d489a625ab119e0d273a0" }, "blueprint": { "revision": "863cea9f83ad5637300478e0559262f1e791684b" diff --git a/queries/bitbake/highlights.scm b/queries/bitbake/highlights.scm index d61889acd..46eaf11e3 100644 --- a/queries/bitbake/highlights.scm +++ b/queries/bitbake/highlights.scm @@ -200,7 +200,7 @@ ; Namespace -(inherit_directive (identifier) @namespace) +(inherit_path) @namespace ;; Normal parameters (parameters From ec09e52d41a9546283fc291845481428c0c6cdc4 Mon Sep 17 00:00:00 2001 From: GitHub Date: Wed, 8 Nov 2023 07:09:21 +0000 Subject: [PATCH 0636/2494] Update parsers: janet_simple, wing --- lockfile.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lockfile.json b/lockfile.json index 1b001ba12..718450e15 100644 --- a/lockfile.json +++ b/lockfile.json @@ -279,7 +279,7 @@ "revision": "9b2f9aec2106b94b4e099fe75e73ebd8ae707c04" }, "janet_simple": { - "revision": "143b15e7a40b9fc2d9664d8357d3f2714bd8bf5f" + "revision": "77f8418fdba7b402350e4817bbb54816bbc627d2" }, "java": { "revision": "2b57cd9541f9fd3a89207d054ce8fbe72657c444" @@ -690,7 +690,7 @@ "revision": "a041228ae64632f59b9bd37346a0dbcb7817f36b" }, "wing": { - "revision": "cac0b1d1cf9d9c864da1f8ade48e1eeaf3720814" + "revision": "0dedb057b5c508971abd7fcc0b12fcbe823927b8" }, "xml": { "revision": "9deacbfb79cb3527a0396255beb17e1bba3f2052" From 629cae1f0fd0c18b4b8b203299d8b15378c6b860 Mon Sep 17 00:00:00 2001 From: Willem-J-an <51120533+Willem-J-an@users.noreply.github.com> Date: Wed, 8 Nov 2023 10:11:19 +0100 Subject: [PATCH 0637/2494] feat(kusto): add kusto parser and highlights (#5632) * feat(kusto): add kusto parser and highlights * feat(kusto): improve highlights * Update queries/kusto/highlights.scm Co-authored-by: ObserverOfTime * chore(kusto): remove unneeded filetype --------- Co-authored-by: Willem Jan Noort Co-authored-by: ObserverOfTime --- lockfile.json | 3 ++ lua/nvim-treesitter/parsers.lua | 8 +++++ queries/kusto/highlights.scm | 52 +++++++++++++++++++++++++++++++++ queries/kusto/injections.scm | 2 ++ 4 files changed, 65 insertions(+) create mode 100644 queries/kusto/highlights.scm create mode 100644 queries/kusto/injections.scm diff --git a/lockfile.json b/lockfile.json index 718450e15..0f623b2a9 100644 --- a/lockfile.json +++ b/lockfile.json @@ -317,6 +317,9 @@ "kotlin": { "revision": "494fb7644a9d2bbe4c7a0c5db2ef94d2aad6b0d8" }, + "kusto": { + "revision": "8353a1296607d6ba33db7c7e312226e5fc83e8ce" + }, "lalrpop": { "revision": "06ae1b6c26e23c77c7fb86d51dddad62b42e66b0" }, diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 17e59046a..9c4ac31f9 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -968,6 +968,14 @@ list.kotlin = { maintainers = { "@SalBakraa" }, } +list.kusto = { + install_info = { + url = "https://github.com/Willem-J-an/tree-sitter-kusto", + files = { "src/parser.c" }, + }, + maintainers = { "@Willem-J-an" }, +} + list.lalrpop = { install_info = { url = "https://github.com/traxys/tree-sitter-lalrpop", diff --git a/queries/kusto/highlights.scm b/queries/kusto/highlights.scm new file mode 100644 index 000000000..825f49b35 --- /dev/null +++ b/queries/kusto/highlights.scm @@ -0,0 +1,52 @@ +(identifier) @variable + +(let_keyword) @keyword + +(function_call + (identifier) @function.call) +[ + (type_cast_function) + (to_scalar_function) + (between_function) + (datatable_function) +] @function.call + +(typed_parameter + (identifier) @parameter) +(function_arguments (identifier) @parameter) + +[ + (binary_operator) + (compound_keywords) + (operator) + (range_operator) + (join_operator) + (sub_operator) + (to_operator) + (mv_apply_operator) + (sort_keyword) +] @keyword.operator + +(string) @string +(number) @number +(bool) @boolean +(null) @constant.builtin +(comment) @comment @spell + +(type) @type +(join_types) @type.qualifier + +[ + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket + +[ + "," + ":" + (pipe) +] @punctuation.delimiter diff --git a/queries/kusto/injections.scm b/queries/kusto/injections.scm new file mode 100644 index 000000000..321c90add --- /dev/null +++ b/queries/kusto/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) From 44d1684db35d4e2ee7c254fc06251035252006c9 Mon Sep 17 00:00:00 2001 From: Github Actions Date: Wed, 8 Nov 2023 09:11:30 +0000 Subject: [PATCH 0638/2494] Update README --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 745735c74..494810baf 100644 --- a/README.md +++ b/README.md @@ -279,6 +279,7 @@ We are looking for maintainers to add more parsers and to write query files for - [x] [kconfig](https://github.com/amaanq/tree-sitter-kconfig) (maintained by @amaanq) - [x] [kdl](https://github.com/amaanq/tree-sitter-kdl) (maintained by @amaanq) - [x] [kotlin](https://github.com/fwcd/tree-sitter-kotlin) (maintained by @SalBakraa) +- [x] [kusto](https://github.com/Willem-J-an/tree-sitter-kusto) (maintained by @Willem-J-an) - [x] [lalrpop](https://github.com/traxys/tree-sitter-lalrpop) (maintained by @traxys) - [x] [latex](https://github.com/latex-lsp/tree-sitter-latex) (maintained by @theHamsta, @clason) - [x] [ledger](https://github.com/cbarrete/tree-sitter-ledger) (maintained by @cbarrete) From bf18ff20ae4d7b667b5e7ede0244c6596427d69e Mon Sep 17 00:00:00 2001 From: postsolar <120750161+postsolar@users.noreply.github.com> Date: Wed, 8 Nov 2023 18:07:02 +0200 Subject: [PATCH 0639/2494] feat(purescript): add parser and queries (#5626) --- lockfile.json | 3 + lua/nvim-treesitter/parsers.lua | 8 ++ queries/purescript/highlights.scm | 152 ++++++++++++++++++++++++++++++ queries/purescript/injections.scm | 2 + queries/purescript/locals.scm | 4 + 5 files changed, 169 insertions(+) create mode 100644 queries/purescript/highlights.scm create mode 100644 queries/purescript/injections.scm create mode 100644 queries/purescript/locals.scm diff --git a/lockfile.json b/lockfile.json index 0f623b2a9..bbff16fa8 100644 --- a/lockfile.json +++ b/lockfile.json @@ -476,6 +476,9 @@ "puppet": { "revision": "9ce9a5f7d64528572aaa8d59459ba869e634086b" }, + "purescript": { + "revision": "e055b28b2f81db9fdd277b07bff3329c3680943e" + }, "pymanifest": { "revision": "8953f91d733dd92c1ac43b3d58a7a2f43fa62dae" }, diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 9c4ac31f9..2671a7ae7 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -1418,6 +1418,14 @@ list.puppet = { maintainers = { "@amaanq" }, } +list.purescript = { + install_info = { + url = "https://github.com/postsolar/tree-sitter-purescript", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@postsolar" }, +} + list.pymanifest = { install_info = { url = "https://github.com/ObserverOfTime/tree-sitter-pymanifest", diff --git a/queries/purescript/highlights.scm b/queries/purescript/highlights.scm new file mode 100644 index 000000000..3e3ec3cb8 --- /dev/null +++ b/queries/purescript/highlights.scm @@ -0,0 +1,152 @@ +; ---------------------------------------------------------------------------- +; Literals and comments + +[ + (integer) + (exp_negation) +] @number + (exp_literal (number)) @float + (char) @character + [ + (string) + (triple_quote_string) + ] @string + + (comment) @comment @spell + +; ---------------------------------------------------------------------------- +; Punctuation + + [ + "(" + ")" + "{" + "}" + "[" + "]" + ] @punctuation.bracket + + [ + (comma) + ";" + (qualified_module) ; grabs the `.` (dot), ex: import System.IO + "." + ] @punctuation.delimiter + + +; ---------------------------------------------------------------------------- +; Keywords, operators, includes + + [ + "if" + "then" + "else" + "case" + "of" + ] @conditional + + [ + "import" + "module" + ] @include + + [ + (operator) + (constructor_operator) + (type_operator) + (all_names) + + "=" + "|" + "::" + "∷" + "=>" + "⇒" + "<=" + "⇐" + "->" + "→" + "<-" + "←" + "\\" + "`" + "@" + ] @operator + + (qualified_module (module) @constructor) + (module) @namespace + (qualified_type (module) @namespace) + (qualified_variable (module) @namespace) + (import (module) @namespace) + + [ + (where) + "let" + "in" + "class" + "instance" + "derive" + "foreign" + "data" + "newtype" + "type" + "as" + "hiding" + "do" + "ado" + "forall" + "∀" + "infix" + "infixl" + "infixr" + ] @keyword + + (class_instance "else" @keyword) + + (type_role_declaration + "role" @keyword + role: (type_role) @type.qualifier) + + (hole) @character.special + + ; `_` wildcards in if-then-else and case-of expressions, + ; as well as record updates and operator sections + (wildcard) @parameter + +; ---------------------------------------------------------------------------- +; Functions and variables + + (variable) @variable + (exp_apply . (exp_name (variable) @function)) + (exp_apply . (exp_name (qualified_variable (variable) @function))) + + (row_field (field_name) @field) + (record_field (field_name) @field) + (record_accessor (variable) @field) + (exp_record_access (variable) @field) + + (signature name: (variable) @type) + (kind_declaration (class_name) @type) + (function name: (variable) @function) + (foreign_import (variable) @function) + (class_instance (instance_name) @function) + (derive_declaration (instance_name) @function) + + ; true or false + ((variable) @boolean + (#any-of? @boolean "true" "false")) + + ; The former one works for `tree-sitter highlight` but not in Helix/Kakoune. + ; The latter two work in Helix (but not Kakoune) and are a good compromise between not highlighting anything at all + ; as an operator and leaving it to the child nodes, and highlighting everything as an operator. + (exp_ticked (_) @operator) + (exp_ticked (exp_name (variable) @operator)) + (exp_ticked (exp_name (qualified_variable (variable) @operator))) + +; ---------------------------------------------------------------------------- +; Types + + (type) @type + + (constructor) @constructor + diff --git a/queries/purescript/injections.scm b/queries/purescript/injections.scm new file mode 100644 index 000000000..321c90add --- /dev/null +++ b/queries/purescript/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/purescript/locals.scm b/queries/purescript/locals.scm new file mode 100644 index 000000000..d8219bf43 --- /dev/null +++ b/queries/purescript/locals.scm @@ -0,0 +1,4 @@ +(signature name: (variable)) @definition.type +(function name: (variable)) @definition.function +(pat_name (variable)) @definition +(exp_name (variable)) @reference From 7b26b085880f5c99c9e6109c81ed3b08db90ce50 Mon Sep 17 00:00:00 2001 From: Github Actions Date: Wed, 8 Nov 2023 16:07:17 +0000 Subject: [PATCH 0640/2494] Update README --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 494810baf..97e9b7648 100644 --- a/README.md +++ b/README.md @@ -332,6 +332,7 @@ We are looking for maintainers to add more parsers and to write query files for - [x] [psv](https://github.com/amaanq/tree-sitter-csv) (maintained by @amaanq) - [x] [pug](https://github.com/zealot128/tree-sitter-pug) (experimental, maintained by @zealot128) - [x] [puppet](https://github.com/amaanq/tree-sitter-puppet) (maintained by @amaanq) +- [x] [purescript](https://github.com/postsolar/tree-sitter-purescript) (maintained by @postsolar) - [x] [PyPA manifest](https://github.com/ObserverOfTime/tree-sitter-pymanifest) (maintained by @ObserverOfTime) - [x] [python](https://github.com/tree-sitter/tree-sitter-python) (maintained by @stsewd, @theHamsta) - [x] [ql](https://github.com/tree-sitter/tree-sitter-ql) (maintained by @pwntester) From 8996612bfbebe1657e1bb55a95201c96cab945c6 Mon Sep 17 00:00:00 2001 From: GitHub Date: Thu, 9 Nov 2023 06:35:50 +0000 Subject: [PATCH 0641/2494] Update parsers: arduino, bitbake, chatito, dtd, erlang, gitattributes, gleam, kotlin, purescript, v, wing, xml --- lockfile.json | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lockfile.json b/lockfile.json index bbff16fa8..97d5a06c4 100644 --- a/lockfile.json +++ b/lockfile.json @@ -9,7 +9,7 @@ "revision": "a768c956b6aee72ffebb5df7f7c0b3702eaa2fbd" }, "arduino": { - "revision": "db929fc6822b9b9e1211678d508f187894ce0345" + "revision": "ff1045f5da90344d547022c50f1756be4adaf721" }, "astro": { "revision": "e122a8fcd07e808a7b873bfadc2667834067daf1" @@ -36,7 +36,7 @@ "revision": "3604d8c961ab129d2bfc6dfca56419c236ccdb83" }, "bitbake": { - "revision": "edcdb7dffd0e1680c60d489a625ab119e0d273a0" + "revision": "ffe6c2f3dbf30224479a28ca5d50df594b2486a9" }, "blueprint": { "revision": "863cea9f83ad5637300478e0559262f1e791684b" @@ -54,7 +54,7 @@ "revision": "dc28c9f4212809eab74d10996086297853eb34e5" }, "chatito": { - "revision": "c80c219da2086696202cec8fc2501c02f4819a3f" + "revision": "871622a3a483f0baf94923d8495c8e0bb2c09009" }, "clojure": { "revision": "6e41628e9d18b19caea1cb1d72aae4ccff5bdfe9" @@ -117,7 +117,7 @@ "revision": "a750758da90955c86fcc22fcbb6fa44a7d009865" }, "dtd": { - "revision": "9deacbfb79cb3527a0396255beb17e1bba3f2052" + "revision": "a3bfa1ae7e8400ab81a6358f5e8d2983f5dd0697" }, "ebnf": { "revision": "8e635b0b723c620774dfb8abf382a7f531894b40" @@ -144,7 +144,7 @@ "revision": "203f7bd3c1bbfbd98fc19add4b8fcb213c059205" }, "erlang": { - "revision": "bb06a83db4f0c176875d9d49756b760d15211134" + "revision": "35ae91b2e9f5514c0ad6d6887f9859f28907c7d5" }, "fennel": { "revision": "517195970428aacca60891b050aa53eabf4ba78d" @@ -183,7 +183,7 @@ "revision": "d8a4207ebbc47bd78bacdf48f883db58283f9fd8" }, "gitattributes": { - "revision": "f58a4a4bc55b9b43dfa7c4106257422764f97776" + "revision": "19d554d39e4a8491f7a77abcdb75bfbc1c19d0b5" }, "gitcommit": { "revision": "6856a5fd0ffeff17d83325a8ce4e57811010eff1" @@ -192,7 +192,7 @@ "revision": "f4685bf11ac466dd278449bcfe5fd014e94aa504" }, "gleam": { - "revision": "11b843da16cbc4c536213ab4ba03a48fff6e3e10" + "revision": "3f93cccaf278cc4c9cf9a373ea2f6389174d634c" }, "glimmer": { "revision": "f9746dc1d0707717fbba84cb5c22a71586af23e1" @@ -315,7 +315,7 @@ "revision": "e180e05132c4cb229a8ba679b298790ef1eca77c" }, "kotlin": { - "revision": "494fb7644a9d2bbe4c7a0c5db2ef94d2aad6b0d8" + "revision": "0ef87892401bb01c84b40916e1f150197bc134b1" }, "kusto": { "revision": "8353a1296607d6ba33db7c7e312226e5fc83e8ce" @@ -477,7 +477,7 @@ "revision": "9ce9a5f7d64528572aaa8d59459ba869e634086b" }, "purescript": { - "revision": "e055b28b2f81db9fdd277b07bff3329c3680943e" + "revision": "5ef5592674ea42de75fc2792972e4ea0b6e3da6c" }, "pymanifest": { "revision": "8953f91d733dd92c1ac43b3d58a7a2f43fa62dae" @@ -669,7 +669,7 @@ "revision": "4c5ecd6326ebd61f6f9a22a370cbd100e0d601da" }, "v": { - "revision": "e14fdf6e661b10edccc744102e4ccf0b187aa8ad" + "revision": "1ddb381210fbb54764710a644761ebb3afefefe8" }, "vala": { "revision": "8f690bfa639f2b83d1fb938ed3dd98a7ba453e8b" @@ -696,10 +696,10 @@ "revision": "a041228ae64632f59b9bd37346a0dbcb7817f36b" }, "wing": { - "revision": "0dedb057b5c508971abd7fcc0b12fcbe823927b8" + "revision": "8e6ae63a557c92d662161607d43c3a0bfbd76dec" }, "xml": { - "revision": "9deacbfb79cb3527a0396255beb17e1bba3f2052" + "revision": "a3bfa1ae7e8400ab81a6358f5e8d2983f5dd0697" }, "yaml": { "revision": "0e36bed171768908f331ff7dff9d956bae016efb" From b09d645098844d1fc250ef8c7087846e4bdae32f Mon Sep 17 00:00:00 2001 From: ObserverOfTime Date: Wed, 8 Nov 2023 15:00:36 +0200 Subject: [PATCH 0642/2494] fix(kotlin): improve highlights Co-authored-by: Anthony Shi <69449791+anthony-S93@users.noreply.github.com> --- queries/kotlin/highlights.scm | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/queries/kotlin/highlights.scm b/queries/kotlin/highlights.scm index f7b1b8c4d..36bf148f9 100644 --- a/queries/kotlin/highlights.scm +++ b/queries/kotlin/highlights.scm @@ -14,11 +14,15 @@ ((simple_identifier) @variable.builtin (#eq? @variable.builtin "field")) -; `this` this keyword inside classes -(this_expression) @variable.builtin +[ + "this" + "super" + "this@" + "super@" +] @variable.builtin -; `super` keyword inside classes -(super_expression) @variable.builtin +; NOTE: for consistency with "super@" +(super_expression "@" @variable.builtin) (class_parameter (simple_identifier) @property) @@ -114,8 +118,6 @@ (type_identifier) @function)? (#lua-match? @_import "^[a-z]")) -; TODO: Separate labeled returns/breaks/continue/super/this -; Must be implemented in the parser first (label) @label ;;; Function definitions @@ -309,14 +311,13 @@ ] @keyword [ - "suspend" -] @keyword.coroutine + "return" + "return@" +] @keyword.return -[ - "fun" -] @keyword.function +"suspend" @keyword.coroutine -(jump_expression) @keyword.return +"fun" @keyword.function [ "if" @@ -328,6 +329,10 @@ "for" "do" "while" + "continue" + "continue@" + "break" + "break@" ] @repeat [ @@ -412,6 +417,10 @@ "::" ] @punctuation.delimiter +(super_expression [ "<" ">" ] @punctuation.delimiter) +(type_arguments [ "<" ">" ] @punctuation.delimiter) +(type_parameters [ "<" ">" ] @punctuation.delimiter) + ; NOTE: `interpolated_identifier`s can be highlighted in any way (string_literal "$" @punctuation.special From 208504c7072ca81e8bf9fa2e666cf3436dfc0ef5 Mon Sep 17 00:00:00 2001 From: GitHub Date: Fri, 10 Nov 2023 06:36:57 +0000 Subject: [PATCH 0643/2494] Update parsers: go, gpg, poe_filter, ssh_config, tlaplus, udev, v, wing --- lockfile.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lockfile.json b/lockfile.json index 97d5a06c4..1cf2a030f 100644 --- a/lockfile.json +++ b/lockfile.json @@ -204,7 +204,7 @@ "revision": "bc06955bc1e3c9ff8e9b2b2a55b38b94da923c05" }, "go": { - "revision": "bbaa67a180cfe0c943e50c55130918be8efb20bd" + "revision": "ff86c7f1734873c8c4874ca4dd95603695686d7a" }, "godot_resource": { "revision": "b6ef0768711086a86b3297056f9ffb5cc1d77b4a" @@ -219,7 +219,7 @@ "revision": "949a8a470559543857a62102c84700d291fc984c" }, "gpg": { - "revision": "9c26b66d6bca0bd0520269e98241709806561bd5" + "revision": "18b2690a15f061a6ff48730589f7a4039af2d002" }, "graphql": { "revision": "5e66e961eee421786bdda8495ed1db045e06b5fe" @@ -450,7 +450,7 @@ "revision": "ea5d557cbd185cdcb5efcfdb6bc846fe909d86ae" }, "poe_filter": { - "revision": "d7b43b51f92fb19efe8af45c2246087c611c8f63" + "revision": "374f618de179498c2a821136bb86c3edbe221e10" }, "pony": { "revision": "16f930b250433cfcd4fb4144df92bb98ad344c20" @@ -579,7 +579,7 @@ "revision": "e8b5835296f931bcaa1477d3c5a68a0c5c2ba034" }, "ssh_config": { - "revision": "9dcfe0f30ccbde8115790c72acbde4c04ec8e74e" + "revision": "6ac08decae456ef2fc307977d9210f86d75d4eca" }, "starlark": { "revision": "c45ce2b39062bbd12ea1c210bd200db250efb24a" @@ -627,7 +627,7 @@ "revision": "a7f11d946b44244f71df41d2a78af0665d618dae" }, "tlaplus": { - "revision": "7ba226cf85280c7917d082940022006e6a3b7b6f" + "revision": "204e858899f7dd5713dea7b0148d6aa477d4a18f" }, "todotxt": { "revision": "0207f6a4ab6aeafc4b091914d31d8235049a2578" @@ -654,7 +654,7 @@ "revision": "43b221c0b76e77244efdaa9963e402a17c930fbc" }, "udev": { - "revision": "e3ad4cb3c59e4c71a177cd4af62958749e53a8bd" + "revision": "baeac48a999abb9384cdcce320f0182937aec8ba" }, "ungrammar": { "revision": "debd26fed283d80456ebafa33a06957b0c52e451" @@ -669,7 +669,7 @@ "revision": "4c5ecd6326ebd61f6f9a22a370cbd100e0d601da" }, "v": { - "revision": "1ddb381210fbb54764710a644761ebb3afefefe8" + "revision": "099a85fbd34a8b9db9f83da19f184bd4c1886e7c" }, "vala": { "revision": "8f690bfa639f2b83d1fb938ed3dd98a7ba453e8b" @@ -696,7 +696,7 @@ "revision": "a041228ae64632f59b9bd37346a0dbcb7817f36b" }, "wing": { - "revision": "8e6ae63a557c92d662161607d43c3a0bfbd76dec" + "revision": "a30e8eca90b7a7deb3a85503dbdd172a68ba0e05" }, "xml": { "revision": "a3bfa1ae7e8400ab81a6358f5e8d2983f5dd0697" From 04a9a90c2a60c86aa9451c539586326b337b03e5 Mon Sep 17 00:00:00 2001 From: ObserverOfTime Date: Fri, 10 Nov 2023 14:20:30 +0200 Subject: [PATCH 0644/2494] fix(htmldjango): improve highlights --- queries/html_tags/highlights.scm | 3 ++- queries/htmldjango/highlights.scm | 21 +++++++++++++++++---- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/queries/html_tags/highlights.scm b/queries/html_tags/highlights.scm index d51f9b27e..8d39afd49 100644 --- a/queries/html_tags/highlights.scm +++ b/queries/html_tags/highlights.scm @@ -2,8 +2,9 @@ (erroneous_end_tag_name) @error (comment) @comment @spell (attribute_name) @tag.attribute -(attribute +((attribute (quoted_attribute_value) @string) + (#set! "priority" 99)) (text) @text @spell ((element (start_tag (tag_name) @_tag) (text) @text.title) diff --git a/queries/htmldjango/highlights.scm b/queries/htmldjango/highlights.scm index 848b455dd..814c7c420 100644 --- a/queries/htmldjango/highlights.scm +++ b/queries/htmldjango/highlights.scm @@ -23,13 +23,26 @@ (keyword) @keyword -(operator) @operator -(variable "|" @operator) -(paired_statement "=" @operator) +[ + "|" + "=" + (operator) +] @operator (keyword_operator) @keyword.operator +(string) @string +(filter [ "'" "\"" ] . (filter_argument) @string) + (number) @number +((filter (filter_argument) @number) + (#lua-match? @number "^%d+$")) (boolean) @boolean +((filter (filter_argument) @boolean) + (#any-of? @boolean "True" "False")) -(string) @string +[ + ":" + "'" + "\"" +] @punctuation.delimiter From d4fb7557ba0ee203f18b3f290d80a8940f2d637d Mon Sep 17 00:00:00 2001 From: ObserverOfTime Date: Fri, 10 Nov 2023 00:23:42 +0200 Subject: [PATCH 0645/2494] feat: add xcompose parser --- README.md | 1 + lockfile.json | 3 +++ lua/nvim-treesitter/parsers.lua | 8 ++++++++ queries/xcompose/highlights.scm | 20 ++++++++++++++++++++ queries/xcompose/injections.scm | 2 ++ 5 files changed, 34 insertions(+) create mode 100644 queries/xcompose/highlights.scm create mode 100644 queries/xcompose/injections.scm diff --git a/README.md b/README.md index 97e9b7648..e1514e8ea 100644 --- a/README.md +++ b/README.md @@ -406,6 +406,7 @@ We are looking for maintainers to add more parsers and to write query files for - [x] [wgsl](https://github.com/szebniok/tree-sitter-wgsl) (maintained by @szebniok) - [x] [wgsl_bevy](https://github.com/theHamsta/tree-sitter-wgsl-bevy) (maintained by @theHamsta) - [x] [wing](https://github.com/winglang/wing) (experimental, maintained by @gshpychka) +- [x] [xcompose](https://github.com/ObserverOfTime/tree-sitter-xcompose) (maintained by @ObserverOfTime) - [x] [xml](https://github.com/ObserverOfTime/tree-sitter-xml) (maintained by @ObserverOfTime) - [x] [yaml](https://github.com/ikatyang/tree-sitter-yaml) (maintained by @stsewd) - [x] [yang](https://github.com/Hubro/tree-sitter-yang) (maintained by @Hubro) diff --git a/lockfile.json b/lockfile.json index 1cf2a030f..19971be49 100644 --- a/lockfile.json +++ b/lockfile.json @@ -698,6 +698,9 @@ "wing": { "revision": "a30e8eca90b7a7deb3a85503dbdd172a68ba0e05" }, + "xcompose": { + "revision": "01344fed31a3cd37a63f03357ec80cbc592a93b5" + }, "xml": { "revision": "a3bfa1ae7e8400ab81a6358f5e8d2983f5dd0697" }, diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 2671a7ae7..40491c7ff 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -2046,6 +2046,14 @@ list.wing = { experimental = true, } +list.xcompose = { + install_info = { + url = "https://github.com/ObserverOfTime/tree-sitter-xcompose", + files = { "src/parser.c" }, + }, + maintainers = { "@ObserverOfTime" }, +} + list.xml = { install_info = { url = "https://github.com/ObserverOfTime/tree-sitter-xml", diff --git a/queries/xcompose/highlights.scm b/queries/xcompose/highlights.scm new file mode 100644 index 000000000..48366985d --- /dev/null +++ b/queries/xcompose/highlights.scm @@ -0,0 +1,20 @@ +(keysym) @constant + +((keysym) @constant.builtin + (#eq? @constant.builtin "Multi_key")) + +(text) @string + +"include" @include + +[ (octal) (hex) ] @number + +[ (modifier) "None" ] @type.qualifier + +[ "%L" "%H" "%S" ] @string.special + +[ "!" "~" ] @operator + +[ ":" "<" ">" "\"" ] @punctuation.delimiter + +(comment) @comment @spell diff --git a/queries/xcompose/injections.scm b/queries/xcompose/injections.scm new file mode 100644 index 000000000..321c90add --- /dev/null +++ b/queries/xcompose/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) From f53e6e82df8efb17b9b04d2f6d5ad64755786b7e Mon Sep 17 00:00:00 2001 From: Amaan Qureshi Date: Fri, 10 Nov 2023 14:08:50 -0500 Subject: [PATCH 0646/2494] fix(cpp): highlight constexpr --- queries/cpp/highlights.scm | 1 + 1 file changed, 1 insertion(+) diff --git a/queries/cpp/highlights.scm b/queries/cpp/highlights.scm index bce3f9061..21c3c4e59 100644 --- a/queries/cpp/highlights.scm +++ b/queries/cpp/highlights.scm @@ -191,6 +191,7 @@ "using" "concept" "requires" + "constexpr" ] @keyword [ From c543ffae1c34a92fb647505f2165b35f68c113c4 Mon Sep 17 00:00:00 2001 From: Amaan Qureshi Date: Fri, 10 Nov 2023 16:04:40 -0500 Subject: [PATCH 0647/2494] fix(ecma): prioritize builtins --- queries/ecma/highlights.scm | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/queries/ecma/highlights.scm b/queries/ecma/highlights.scm index 2c921b2b2..664421701 100644 --- a/queries/ecma/highlights.scm +++ b/queries/ecma/highlights.scm @@ -74,22 +74,6 @@ "TypeError" "URIError")) -((identifier) @namespace.builtin - (#eq? @namespace.builtin "Intl")) - -((identifier) @function.builtin - (#any-of? @function.builtin - "eval" - "isFinite" - "isNaN" - "parseFloat" - "parseInt" - "decodeURI" - "decodeURIComponent" - "encodeURI" - "encodeURIComponent" - "require")) - ; Function and method definitions ;-------------------------------- @@ -147,6 +131,25 @@ function: (member_expression property: [(property_identifier) (private_property_identifier)] @method.call)) +; Builtins +;--------- + +((identifier) @namespace.builtin + (#eq? @namespace.builtin "Intl")) + +((identifier) @function.builtin + (#any-of? @function.builtin + "eval" + "isFinite" + "isNaN" + "parseFloat" + "parseInt" + "decodeURI" + "decodeURIComponent" + "encodeURI" + "encodeURIComponent" + "require")) + ; Constructor ;------------ From 42053b9db3275e1c17ace0da6beb57aa50023ae1 Mon Sep 17 00:00:00 2001 From: GitHub Date: Sat, 11 Nov 2023 06:35:43 +0000 Subject: [PATCH 0648/2494] Update parsers: bitbake, groovy, janet_simple, liquidsoap, markdown, markdown_inline, pymanifest, requirements, sql, wing --- lockfile.json | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lockfile.json b/lockfile.json index 19971be49..81a814f17 100644 --- a/lockfile.json +++ b/lockfile.json @@ -36,7 +36,7 @@ "revision": "3604d8c961ab129d2bfc6dfca56419c236ccdb83" }, "bitbake": { - "revision": "ffe6c2f3dbf30224479a28ca5d50df594b2486a9" + "revision": "10bacac929ff36a1e8f4056503fe4f8717b21b94" }, "blueprint": { "revision": "863cea9f83ad5637300478e0559262f1e791684b" @@ -225,7 +225,7 @@ "revision": "5e66e961eee421786bdda8495ed1db045e06b5fe" }, "groovy": { - "revision": "ae8aa51ec3275afb567a4a67df1a26d89feb135f" + "revision": "7e023227f46fee428b16a0288eeb0f65ee2523ec" }, "gstlaunch": { "revision": "2c0d9c94d35e37aa63fa5002163c8480985b3e5b" @@ -279,7 +279,7 @@ "revision": "9b2f9aec2106b94b4e099fe75e73ebd8ae707c04" }, "janet_simple": { - "revision": "77f8418fdba7b402350e4817bbb54816bbc627d2" + "revision": "51271e260346878e1a1aa6c506ce6a797b7c25e2" }, "java": { "revision": "2b57cd9541f9fd3a89207d054ce8fbe72657c444" @@ -333,7 +333,7 @@ "revision": "91d7aa606f524cf4f5df7f4aacb45b4056fac704" }, "liquidsoap": { - "revision": "cff1fea7c2ef9eed066a4d3de8af6cb4d7117056" + "revision": "b35882f2e1460867ddddcbe8af586e6807d4676f" }, "llvm": { "revision": "1b96e58faf558ce057d4dc664b904528aee743cb" @@ -357,10 +357,10 @@ "revision": "a4b9187417d6be349ee5fd4b6e77b4172c6827dd" }, "markdown": { - "revision": "cd705f159127c947cd92ac163c6b17b5dcba7f94" + "revision": "7ce4c69fe92d1c10225e3d1b3676c87dd9427b45" }, "markdown_inline": { - "revision": "cd705f159127c947cd92ac163c6b17b5dcba7f94" + "revision": "7ce4c69fe92d1c10225e3d1b3676c87dd9427b45" }, "matlab": { "revision": "6071891a8c39600203eba20513666cf93b4d650a" @@ -480,7 +480,7 @@ "revision": "5ef5592674ea42de75fc2792972e4ea0b6e3da6c" }, "pymanifest": { - "revision": "8953f91d733dd92c1ac43b3d58a7a2f43fa62dae" + "revision": "a77547018ada84ca4bc115c7650b19441120f065" }, "python": { "revision": "82f5c9937fe4300b4bec3ee0e788d642c77aab2c" @@ -516,7 +516,7 @@ "revision": "9ac75e71b2d791e0aadeef68098319d86a2a14cf" }, "requirements": { - "revision": "eda424eade0f2afbafbf0c89d18c77818fa19273" + "revision": "389dd46a39075ce36af6ee3af50393d9aa506d14" }, "rnoweb": { "revision": "502c1126dc6777f09af5bef16e72a42f75bd081e" @@ -573,7 +573,7 @@ "revision": "05f949d3c1c15e3261473a244d3ce87777374dec" }, "sql": { - "revision": "25be0b8f17e9189ad9e1b875869d025c5aec1286" + "revision": "5f928f404d2aa024abce8657778fc10c03f1511f" }, "squirrel": { "revision": "e8b5835296f931bcaa1477d3c5a68a0c5c2ba034" @@ -696,7 +696,7 @@ "revision": "a041228ae64632f59b9bd37346a0dbcb7817f36b" }, "wing": { - "revision": "a30e8eca90b7a7deb3a85503dbdd172a68ba0e05" + "revision": "238200d172538d5ff1228a929ea543465acfc410" }, "xcompose": { "revision": "01344fed31a3cd37a63f03357ec80cbc592a93b5" From 075a64addc33390028ea124a1046a43497f05cd1 Mon Sep 17 00:00:00 2001 From: Riley Bruins Date: Thu, 21 Sep 2023 14:28:01 -0700 Subject: [PATCH 0649/2494] feat: highlight regular latex text to maintain consistency with boldfaced and italic text --- queries/latex/highlights.scm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/queries/latex/highlights.scm b/queries/latex/highlights.scm index d0283c2e7..10e02ed1b 100644 --- a/queries/latex/highlights.scm +++ b/queries/latex/highlights.scm @@ -184,6 +184,9 @@ (#eq? @_name "\\frametitle")) ;; Formatting +(text_mode + content: (curly_group (_) @text)) + ((generic_command command: (command_name) @_name arg: (curly_group (_) @text.emphasis)) From 17e77749c1f14f7e2bbae8c92c1b1cad1c2f26a9 Mon Sep 17 00:00:00 2001 From: Mark McCulloh Date: Mon, 13 Nov 2023 14:04:27 -0500 Subject: [PATCH 0650/2494] fix(wing): update parser and queries, add maintainer (#5671) --- lockfile.json | 2 +- lua/nvim-treesitter/parsers.lua | 2 +- queries/wing/folds.scm | 1 - queries/wing/highlights.scm | 3 --- tests/query/highlights/wing/class.w | 4 ++-- 5 files changed, 4 insertions(+), 8 deletions(-) diff --git a/lockfile.json b/lockfile.json index 81a814f17..04b0b5592 100644 --- a/lockfile.json +++ b/lockfile.json @@ -696,7 +696,7 @@ "revision": "a041228ae64632f59b9bd37346a0dbcb7817f36b" }, "wing": { - "revision": "238200d172538d5ff1228a929ea543465acfc410" + "revision": "d6af9180bfbd82b01980e7e5307d77ed3939e2a7" }, "xcompose": { "revision": "01344fed31a3cd37a63f03357ec80cbc592a93b5" diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 40491c7ff..9bd3521ef 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -2042,7 +2042,7 @@ list.wing = { location = "libs/tree-sitter-wing", requires_generate_from_grammar = true, }, - maintainers = { "@gshpychka" }, + maintainers = { "@gshpychka", "@MarkMcCulloh" }, experimental = true, } diff --git a/queries/wing/folds.scm b/queries/wing/folds.scm index 538367db3..60de6116d 100644 --- a/queries/wing/folds.scm +++ b/queries/wing/folds.scm @@ -12,5 +12,4 @@ (enum_definition) (try_catch_statement) (method_definition) - (inflight_method_definition) ] @fold diff --git a/queries/wing/highlights.scm b/queries/wing/highlights.scm index 0e8bd6492..af5ef6ed6 100644 --- a/queries/wing/highlights.scm +++ b/queries/wing/highlights.scm @@ -11,8 +11,6 @@ name: (identifier) @type) (method_definition name: (identifier) @method) -(inflight_method_definition - name: (identifier) @method) ; Functions @@ -78,7 +76,6 @@ "for" "if" "in" - "init" "let" "new" "return" diff --git a/tests/query/highlights/wing/class.w b/tests/query/highlights/wing/class.w index 636cbc601..06160d741 100644 --- a/tests/query/highlights/wing/class.w +++ b/tests/query/highlights/wing/class.w @@ -9,9 +9,9 @@ class Foo { //^ field // ^ type.builtin // ^ punctuation.delimiter - init(name: str) { + new(name: str) { //^ keyword -// ^ variable +// ^ variable this.name = name; // ^ punctuation.delimiter // ^ operator From 31381e38854072686449bd7ad2044deeba609ab2 Mon Sep 17 00:00:00 2001 From: Github Actions Date: Mon, 13 Nov 2023 19:04:40 +0000 Subject: [PATCH 0651/2494] Update README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e1514e8ea..2932165ff 100644 --- a/README.md +++ b/README.md @@ -405,7 +405,7 @@ We are looking for maintainers to add more parsers and to write query files for - [x] [vue](https://github.com/ikatyang/tree-sitter-vue) (maintained by @WhyNotHugo) - [x] [wgsl](https://github.com/szebniok/tree-sitter-wgsl) (maintained by @szebniok) - [x] [wgsl_bevy](https://github.com/theHamsta/tree-sitter-wgsl-bevy) (maintained by @theHamsta) -- [x] [wing](https://github.com/winglang/wing) (experimental, maintained by @gshpychka) +- [x] [wing](https://github.com/winglang/wing) (experimental, maintained by @gshpychka, @MarkMcCulloh) - [x] [xcompose](https://github.com/ObserverOfTime/tree-sitter-xcompose) (maintained by @ObserverOfTime) - [x] [xml](https://github.com/ObserverOfTime/tree-sitter-xml) (maintained by @ObserverOfTime) - [x] [yaml](https://github.com/ikatyang/tree-sitter-yaml) (maintained by @stsewd) From 2241f81d74a3de7f8ae1517bbfc24c319218d9a0 Mon Sep 17 00:00:00 2001 From: GitHub Date: Mon, 13 Nov 2023 19:08:29 +0000 Subject: [PATCH 0652/2494] Update parsers: gleam, hcl, hlsl, ini, leo, markdown, markdown_inline, purescript, sql, terraform, tlaplus --- lockfile.json | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lockfile.json b/lockfile.json index 04b0b5592..2b17335ef 100644 --- a/lockfile.json +++ b/lockfile.json @@ -192,7 +192,7 @@ "revision": "f4685bf11ac466dd278449bcfe5fd014e94aa504" }, "gleam": { - "revision": "3f93cccaf278cc4c9cf9a373ea2f6389174d634c" + "revision": "b2afa4fd6bb41a7bf912b034c653c90af7ae5122" }, "glimmer": { "revision": "f9746dc1d0707717fbba84cb5c22a71586af23e1" @@ -243,7 +243,7 @@ "revision": "577259b4068b2c281c9ebf94c109bd50a74d5857" }, "hcl": { - "revision": "b5539065432c08e4118eb3ee7c94902fdda85708" + "revision": "fdf6463216f1a45d83ba911cdb9f57445a8d3b51" }, "heex": { "revision": "4a36c9a388505180da6ee0eda1d8afb8c83481c8" @@ -252,7 +252,7 @@ "revision": "02fa3b79b3ff9a296066da6277adfc3f26cbc9e0" }, "hlsl": { - "revision": "f2902bd614e3916bdf65e1bc9ad45ebd08417bba" + "revision": "ac65c934b3214e96e0f854be009a3bd51549bd14" }, "hocon": { "revision": "c390f10519ae69fdb03b3e5764f5592fb6924bcc" @@ -273,7 +273,7 @@ "revision": "cd1a0ada92cc73dd0f4d7eedc162be4ded758591" }, "ini": { - "revision": "7f11a02fb8891482068e0fe419965d7bade81a68" + "revision": "bcb84a2d4bcd6f55b911c42deade75c8f90cb0c5" }, "ispc": { "revision": "9b2f9aec2106b94b4e099fe75e73ebd8ae707c04" @@ -330,7 +330,7 @@ "revision": "8a841fb20ce683bfbb3469e6ba67f2851cfdf94a" }, "leo": { - "revision": "91d7aa606f524cf4f5df7f4aacb45b4056fac704" + "revision": "23a9534d09d523d0dcee7dbf89e7c819e6835f6f" }, "liquidsoap": { "revision": "b35882f2e1460867ddddcbe8af586e6807d4676f" @@ -357,10 +357,10 @@ "revision": "a4b9187417d6be349ee5fd4b6e77b4172c6827dd" }, "markdown": { - "revision": "7ce4c69fe92d1c10225e3d1b3676c87dd9427b45" + "revision": "f9820b2db958228f9be339b67d2de874d065866e" }, "markdown_inline": { - "revision": "7ce4c69fe92d1c10225e3d1b3676c87dd9427b45" + "revision": "f9820b2db958228f9be339b67d2de874d065866e" }, "matlab": { "revision": "6071891a8c39600203eba20513666cf93b4d650a" @@ -477,7 +477,7 @@ "revision": "9ce9a5f7d64528572aaa8d59459ba869e634086b" }, "purescript": { - "revision": "5ef5592674ea42de75fc2792972e4ea0b6e3da6c" + "revision": "f89bd149e44624342bf49f76245d3284f2beed9a" }, "pymanifest": { "revision": "a77547018ada84ca4bc115c7650b19441120f065" @@ -573,7 +573,7 @@ "revision": "05f949d3c1c15e3261473a244d3ce87777374dec" }, "sql": { - "revision": "5f928f404d2aa024abce8657778fc10c03f1511f" + "revision": "1dcf6bd933af6271c609566a3c1204c920efbca5" }, "squirrel": { "revision": "e8b5835296f931bcaa1477d3c5a68a0c5c2ba034" @@ -615,7 +615,7 @@ "revision": "33482c92a0dfa694491d34e167a1d2f52b0dccb1" }, "terraform": { - "revision": "b5539065432c08e4118eb3ee7c94902fdda85708" + "revision": "fdf6463216f1a45d83ba911cdb9f57445a8d3b51" }, "textproto": { "revision": "8dacf02aa402892c91079f8577998ed5148c0496" @@ -627,7 +627,7 @@ "revision": "a7f11d946b44244f71df41d2a78af0665d618dae" }, "tlaplus": { - "revision": "204e858899f7dd5713dea7b0148d6aa477d4a18f" + "revision": "d99cb5c77bb0e733176d607a0875ac30e17e1e72" }, "todotxt": { "revision": "0207f6a4ab6aeafc4b091914d31d8235049a2578" From c0da2013d1cef768c00f3f0b7f365fe19a10bca3 Mon Sep 17 00:00:00 2001 From: GitHub Date: Tue, 14 Nov 2023 06:36:25 +0000 Subject: [PATCH 0653/2494] Update parsers: objdump, sql, wing --- lockfile.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lockfile.json b/lockfile.json index 2b17335ef..a583f040d 100644 --- a/lockfile.json +++ b/lockfile.json @@ -405,7 +405,7 @@ "revision": "62e61b6f5c0289c376d61a8c91faf6435cde9012" }, "objdump": { - "revision": "64e4741d58345c36ded639f5a3bcd7811be7f8f8" + "revision": "28d3b2e25a0b1881d1b47ed1924ca276c7003d45" }, "ocaml": { "revision": "694c57718fd85d514f8b81176038e7a4cfabcaaf" @@ -573,7 +573,7 @@ "revision": "05f949d3c1c15e3261473a244d3ce87777374dec" }, "sql": { - "revision": "1dcf6bd933af6271c609566a3c1204c920efbca5" + "revision": "9fe5aeaa8d58d00cc31c20a3ae923ae695ce2ce7" }, "squirrel": { "revision": "e8b5835296f931bcaa1477d3c5a68a0c5c2ba034" @@ -696,7 +696,7 @@ "revision": "a041228ae64632f59b9bd37346a0dbcb7817f36b" }, "wing": { - "revision": "d6af9180bfbd82b01980e7e5307d77ed3939e2a7" + "revision": "c48ce7e07cf2834c538be9e8ec653a244245c8a6" }, "xcompose": { "revision": "01344fed31a3cd37a63f03357ec80cbc592a93b5" From 8b9f99660294dcd11d42572c84ee33a1e284f70d Mon Sep 17 00:00:00 2001 From: GitHub Date: Wed, 15 Nov 2023 06:37:26 +0000 Subject: [PATCH 0654/2494] Update parsers: cpp, wing --- lockfile.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lockfile.json b/lockfile.json index a583f040d..82429e8eb 100644 --- a/lockfile.json +++ b/lockfile.json @@ -78,7 +78,7 @@ "revision": "f4b3cbc8b0bd4e13035d39940fef09f1392e8739" }, "cpp": { - "revision": "a90f170f92d5d70e7c2d4183c146e61ba5f3a457" + "revision": "d153fe1c3385ee0521730ff4e0be9358e903b322" }, "css": { "revision": "fec7d3757ab8f46a0ffe298be99b16ad5b9fa229" @@ -696,7 +696,7 @@ "revision": "a041228ae64632f59b9bd37346a0dbcb7817f36b" }, "wing": { - "revision": "c48ce7e07cf2834c538be9e8ec653a244245c8a6" + "revision": "eacf704338661b981fcf4fdb5ee44d898f038144" }, "xcompose": { "revision": "01344fed31a3cd37a63f03357ec80cbc592a93b5" From da6646c3e51cf10b8da1cb89be9aaf60ab41c6a3 Mon Sep 17 00:00:00 2001 From: Vincent Rischmann Date: Thu, 16 Nov 2023 22:12:55 +0100 Subject: [PATCH 0655/2494] feat: add templ --------- Co-authored-by: ObserverOfTime --- lockfile.json | 3 +++ lua/nvim-treesitter/parsers.lua | 8 ++++++ queries/templ/highlights.scm | 47 +++++++++++++++++++++++++++++++++ queries/templ/injections.scm | 8 ++++++ 4 files changed, 66 insertions(+) create mode 100644 queries/templ/highlights.scm create mode 100644 queries/templ/injections.scm diff --git a/lockfile.json b/lockfile.json index 82429e8eb..9a89d29e6 100644 --- a/lockfile.json +++ b/lockfile.json @@ -715,5 +715,8 @@ }, "zig": { "revision": "0d08703e4c3f426ec61695d7617415fff97029bd" + }, + "templ": { + "revision": "94ea27668915ef8f084c9fd7174cfd384ac9a275" } } diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 9bd3521ef..9077bc8d4 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -2095,6 +2095,14 @@ list.zig = { maintainers = { "@maxxnino" }, } +list.templ = { + install_info = { + url = "https://github.com/vrischmann/tree-sitter-templ", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@vrischmann" }, +} + local M = { list = list, filetype_to_parsername = filetype_to_parsername, diff --git a/queries/templ/highlights.scm b/queries/templ/highlights.scm new file mode 100644 index 000000000..a7a0718e6 --- /dev/null +++ b/queries/templ/highlights.scm @@ -0,0 +1,47 @@ +; inherits: go + +(component_declaration + name: (component_identifier) @function) + +[ + (tag_start) + (tag_end) + (self_closing_tag) + (style_element) +] @tag + +(attribute + name: (attribute_name) @tag.attribute) +(attribute + value: (quoted_attribute_value) @string) + +[ + (element_text) + (style_element_text) +] @string.special + +(css_identifier) @function +(css_property + name: (css_property_name) @attribute) +(css_property + value: (css_property_value) @attribute) + +[ + (expression) + (dynamic_class_attribute_value) +] @method + +(component_import + name: (component_identifier) @function) + +(component_render) @function.call + +(element_comment) @comment @spell + +"@" @operator + +[ + "templ" + "css" + "script" +] @keyword diff --git a/queries/templ/injections.scm b/queries/templ/injections.scm new file mode 100644 index 000000000..54e8d6f68 --- /dev/null +++ b/queries/templ/injections.scm @@ -0,0 +1,8 @@ +; inherits: go + +((element_comment) @injection.content (#set! injection.language "comment")) + +((script_block_text) @injection.content (#set! injection.language "javascript")) +((script_element_text) @injection.content (#set! injection.language "javascript")) + +((style_element_text) @injection.content (#set! injection.language "css")) From 73287b794d428843f20f9ae004bef2ce67ab3dbc Mon Sep 17 00:00:00 2001 From: Github Actions Date: Thu, 16 Nov 2023 21:13:07 +0000 Subject: [PATCH 0656/2494] Update README --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 2932165ff..803db1a1a 100644 --- a/README.md +++ b/README.md @@ -378,6 +378,7 @@ We are looking for maintainers to add more parsers and to write query files for - [x] [t32](https://gitlab.com/xasc/tree-sitter-t32.git) (maintained by @xasc) - [x] [tablegen](https://github.com/amaanq/tree-sitter-tablegen) (maintained by @amaanq) - [x] [teal](https://github.com/euclidianAce/tree-sitter-teal) (maintained by @euclidianAce) +- [x] [templ](https://github.com/vrischmann/tree-sitter-templ) (maintained by @vrischmann) - [x] [terraform](https://github.com/MichaHoffmann/tree-sitter-hcl) (maintained by @MichaHoffmann) - [x] [textproto](https://github.com/PorterAtGoogle/tree-sitter-textproto) (maintained by @Porter) - [x] [thrift](https://github.com/duskmoon314/tree-sitter-thrift) (maintained by @amaanq, @duskmoon314) From 8199529bc42ab275786d2f2cc83903f35ff6db9e Mon Sep 17 00:00:00 2001 From: Pham Huy Hoang Date: Fri, 17 Nov 2023 17:56:11 +0900 Subject: [PATCH 0657/2494] chore(apex): Update queries --- lockfile.json | 6 +++--- queries/soql/highlights.scm | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lockfile.json b/lockfile.json index 9a89d29e6..5a3913759 100644 --- a/lockfile.json +++ b/lockfile.json @@ -6,7 +6,7 @@ "revision": "c21c3a0f996363ed17b8ac99d827fe5a4821f217" }, "apex": { - "revision": "a768c956b6aee72ffebb5df7f7c0b3702eaa2fbd" + "revision": "82ee140f4ee7652a4915ac9e9f60c4d66f7637d7" }, "arduino": { "revision": "ff1045f5da90344d547022c50f1756be4adaf721" @@ -564,10 +564,10 @@ "revision": "168020304759ad5d8b4a88a541a699134e3730c5" }, "soql": { - "revision": "a768c956b6aee72ffebb5df7f7c0b3702eaa2fbd" + "revision": "82ee140f4ee7652a4915ac9e9f60c4d66f7637d7" }, "sosl": { - "revision": "a768c956b6aee72ffebb5df7f7c0b3702eaa2fbd" + "revision": "82ee140f4ee7652a4915ac9e9f60c4d66f7637d7" }, "sparql": { "revision": "05f949d3c1c15e3261473a244d3ce87777374dec" diff --git a/queries/soql/highlights.scm b/queries/soql/highlights.scm index 907f3d891..2e89a86f9 100644 --- a/queries/soql/highlights.scm +++ b/queries/soql/highlights.scm @@ -33,7 +33,6 @@ (identifier) @label) (storage_identifier) @storageclass -(function_name) @function (date_literal) @string.special [ From 557561fbc17269cdd4e9e88ef0ca1a9ff0bbf7e6 Mon Sep 17 00:00:00 2001 From: Amaan Qureshi Date: Fri, 17 Nov 2023 07:18:04 -0500 Subject: [PATCH 0658/2494] chore(rust): update queries from upstream --- lockfile.json | 2 +- queries/rust/highlights.scm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lockfile.json b/lockfile.json index 5a3913759..706b6e6cf 100644 --- a/lockfile.json +++ b/lockfile.json @@ -534,7 +534,7 @@ "revision": "f257f3f57833d584050336921773738a3fd8ca22" }, "rust": { - "revision": "48e053397b587de97790b055a1097b7c8a4ef846" + "revision": "464df136755e81b54885ab18f8093f6ec9def8bb" }, "scala": { "revision": "1b4c2fa5c55c5fd83cbb0d2f818f916aba221a42" diff --git a/queries/rust/highlights.scm b/queries/rust/highlights.scm index 82fb966f7..cc629d5e7 100644 --- a/queries/rust/highlights.scm +++ b/queries/rust/highlights.scm @@ -32,7 +32,7 @@ (self) @variable.builtin -(loop_label ["'" (identifier)] @label) +(label ["'" (identifier)] @label) ; Function definitions From a9f4a916aaee2a3c6ad4b8b4fcdf6b63b401d0b0 Mon Sep 17 00:00:00 2001 From: Pham Huy Hoang Date: Sat, 18 Nov 2023 16:17:58 +0900 Subject: [PATCH 0659/2494] chore(apex): update apex queries --- queries/soql/highlights.scm | 1 + 1 file changed, 1 insertion(+) diff --git a/queries/soql/highlights.scm b/queries/soql/highlights.scm index 2e89a86f9..83736d9a7 100644 --- a/queries/soql/highlights.scm +++ b/queries/soql/highlights.scm @@ -33,6 +33,7 @@ (identifier) @label) (storage_identifier) @storageclass +(_ function_name: (identifier) @function) (date_literal) @string.special [ From 2b12560bc3d7331156c81b02ef7609fce85c1ef8 Mon Sep 17 00:00:00 2001 From: GitHub Date: Sat, 18 Nov 2023 10:59:06 +0000 Subject: [PATCH 0660/2494] Update parsers: c, cpp, cuda, glsl, liquidsoap, purescript, python, rust, sql, ssh_config, t32, templ, v, wing --- lockfile.json | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/lockfile.json b/lockfile.json index 706b6e6cf..cef380c0f 100644 --- a/lockfile.json +++ b/lockfile.json @@ -42,7 +42,7 @@ "revision": "863cea9f83ad5637300478e0559262f1e791684b" }, "c": { - "revision": "25371f9448b97c55b853a6ee8bb0bfb1bca6da9f" + "revision": "212a80f86452bb1316324fa0db730cf52f29e05a" }, "c_sharp": { "revision": "1648e21b4f087963abf0101ee5221bb413107b07" @@ -78,7 +78,7 @@ "revision": "f4b3cbc8b0bd4e13035d39940fef09f1392e8739" }, "cpp": { - "revision": "d153fe1c3385ee0521730ff4e0be9358e903b322" + "revision": "3502513c3c5371b1c1480015c5eec85755d7a880" }, "css": { "revision": "fec7d3757ab8f46a0ffe298be99b16ad5b9fa229" @@ -87,7 +87,7 @@ "revision": "6c1957405bd6f7751b050f61367f1094fab91444" }, "cuda": { - "revision": "3161aed045130c900f870ef53fad93a574317769" + "revision": "d33ee2caab572f7b46cef12e090331b9ed1c02e2" }, "cue": { "revision": "2df92e6755337e9234ad18ffef37f35d95e2ba9d" @@ -198,7 +198,7 @@ "revision": "f9746dc1d0707717fbba84cb5c22a71586af23e1" }, "glsl": { - "revision": "bea82d337801e472e35b5cd08038afdf13263768" + "revision": "c9082edab87b145e97090b133167cb53626d9f58" }, "gn": { "revision": "bc06955bc1e3c9ff8e9b2b2a55b38b94da923c05" @@ -333,7 +333,7 @@ "revision": "23a9534d09d523d0dcee7dbf89e7c819e6835f6f" }, "liquidsoap": { - "revision": "b35882f2e1460867ddddcbe8af586e6807d4676f" + "revision": "91d2708e12a5869154a85190b13ac89cb1414189" }, "llvm": { "revision": "1b96e58faf558ce057d4dc664b904528aee743cb" @@ -477,13 +477,13 @@ "revision": "9ce9a5f7d64528572aaa8d59459ba869e634086b" }, "purescript": { - "revision": "f89bd149e44624342bf49f76245d3284f2beed9a" + "revision": "85a90951c10f118f819c1137f669800246890db7" }, "pymanifest": { "revision": "a77547018ada84ca4bc115c7650b19441120f065" }, "python": { - "revision": "82f5c9937fe4300b4bec3ee0e788d642c77aab2c" + "revision": "4bfdd9033a2225cc95032ce77066b7aeca9e2efc" }, "ql": { "revision": "bd087020f0d8c183080ca615d38de0ec827aeeaf" @@ -534,7 +534,7 @@ "revision": "f257f3f57833d584050336921773738a3fd8ca22" }, "rust": { - "revision": "464df136755e81b54885ab18f8093f6ec9def8bb" + "revision": "c741c105c0df43664fcc978dac5bc27888c9558f" }, "scala": { "revision": "1b4c2fa5c55c5fd83cbb0d2f818f916aba221a42" @@ -573,13 +573,13 @@ "revision": "05f949d3c1c15e3261473a244d3ce87777374dec" }, "sql": { - "revision": "9fe5aeaa8d58d00cc31c20a3ae923ae695ce2ce7" + "revision": "d8fffdf0902bf55994fd2e8a0a46e221ca988589" }, "squirrel": { "revision": "e8b5835296f931bcaa1477d3c5a68a0c5c2ba034" }, "ssh_config": { - "revision": "6ac08decae456ef2fc307977d9210f86d75d4eca" + "revision": "1651e637d57c667708add5440d3726f07e97d953" }, "starlark": { "revision": "c45ce2b39062bbd12ea1c210bd200db250efb24a" @@ -606,7 +606,7 @@ "revision": "1af543a96d060b1f808982037bfc54cc02218edd" }, "t32": { - "revision": "884a034e0ae29ce72649041a603deacdfb4a3275" + "revision": "b904af353fb2f1df6ac45d8d3e3a5ee85a6cc306" }, "tablegen": { "revision": "300f6a490e71f895e644ed2deec6920860a2e107" @@ -614,6 +614,9 @@ "teal": { "revision": "33482c92a0dfa694491d34e167a1d2f52b0dccb1" }, + "templ": { + "revision": "6b9dff614d5bab902cb6989bfcaa180636218159" + }, "terraform": { "revision": "fdf6463216f1a45d83ba911cdb9f57445a8d3b51" }, @@ -669,7 +672,7 @@ "revision": "4c5ecd6326ebd61f6f9a22a370cbd100e0d601da" }, "v": { - "revision": "099a85fbd34a8b9db9f83da19f184bd4c1886e7c" + "revision": "2f24b0377ddb865eb4285634f6945cb4ee3f395c" }, "vala": { "revision": "8f690bfa639f2b83d1fb938ed3dd98a7ba453e8b" @@ -696,7 +699,7 @@ "revision": "a041228ae64632f59b9bd37346a0dbcb7817f36b" }, "wing": { - "revision": "eacf704338661b981fcf4fdb5ee44d898f038144" + "revision": "6e6f9d2632518be6702ffc29460455fa7b3e4196" }, "xcompose": { "revision": "01344fed31a3cd37a63f03357ec80cbc592a93b5" @@ -715,8 +718,5 @@ }, "zig": { "revision": "0d08703e4c3f426ec61695d7617415fff97029bd" - }, - "templ": { - "revision": "94ea27668915ef8f084c9fd7174cfd384ac9a275" } } From 0df364926d39f59471ebc5ca83054d74e457350e Mon Sep 17 00:00:00 2001 From: GitHub Date: Sat, 18 Nov 2023 13:02:13 +0000 Subject: [PATCH 0661/2494] Update parsers: hcl, terraform, wing --- lockfile.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lockfile.json b/lockfile.json index cef380c0f..eb68ef513 100644 --- a/lockfile.json +++ b/lockfile.json @@ -243,7 +243,7 @@ "revision": "577259b4068b2c281c9ebf94c109bd50a74d5857" }, "hcl": { - "revision": "fdf6463216f1a45d83ba911cdb9f57445a8d3b51" + "revision": "e135399cb31b95fac0760b094556d1d5ce84acf0" }, "heex": { "revision": "4a36c9a388505180da6ee0eda1d8afb8c83481c8" @@ -618,7 +618,7 @@ "revision": "6b9dff614d5bab902cb6989bfcaa180636218159" }, "terraform": { - "revision": "fdf6463216f1a45d83ba911cdb9f57445a8d3b51" + "revision": "e135399cb31b95fac0760b094556d1d5ce84acf0" }, "textproto": { "revision": "8dacf02aa402892c91079f8577998ed5148c0496" @@ -699,7 +699,7 @@ "revision": "a041228ae64632f59b9bd37346a0dbcb7817f36b" }, "wing": { - "revision": "6e6f9d2632518be6702ffc29460455fa7b3e4196" + "revision": "11c5e35ec0437492497a931ca631787851e88c9d" }, "xcompose": { "revision": "01344fed31a3cd37a63f03357ec80cbc592a93b5" From 5240574bcbd5e3ad793b96b3766693c2bc5c86a9 Mon Sep 17 00:00:00 2001 From: Marc Jakobi Date: Sun, 19 Nov 2023 01:02:29 +0100 Subject: [PATCH 0662/2494] feat(haskell): tweak highlights * add cases for `qualified_variable` * add function defined in terms of composition --- queries/haskell/highlights.scm | 10 +++++++++- tests/query/highlights/haskell/test.hs | 5 +++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/queries/haskell/highlights.scm b/queries/haskell/highlights.scm index bf9692136..1fea39b08 100644 --- a/queries/haskell/highlights.scm +++ b/queries/haskell/highlights.scm @@ -173,6 +173,7 @@ (exp_name [(constructor) (variable) + (qualified_variable) ])) (quasiquote) ((exp_name) . (operator)) @@ -186,6 +187,7 @@ (exp_name [(constructor) (variable) + (qualified_variable) ])) (quasiquote) ((exp_name) . (operator)) @@ -293,6 +295,12 @@ ]) (#any-of? @_op "." ">>>" "***" ">=>" "<=<" )) +; function defined in terms of a function composition +(function + name: (variable) @function + rhs: (exp_infix (_) . (operator) @_op . (_) + (#any-of? @_op "." ">>>" "***" ">=>" "<=<"))) + (exp_apply (exp_name [ ((variable) @function.call) @@ -325,7 +333,7 @@ . (variable) @variable . [ (exp_record) - (exp_name (variable)) + (exp_name [(variable) (qualified_variable)]) (exp_list) (exp_tuple) (exp_cond) diff --git a/tests/query/highlights/haskell/test.hs b/tests/query/highlights/haskell/test.hs index cd5db435e..bf7e939a0 100644 --- a/tests/query/highlights/haskell/test.hs +++ b/tests/query/highlights/haskell/test.hs @@ -171,6 +171,8 @@ someIOaction = do gunc x y = func x $ y + 7 -- ^ @variable -- ^ @variable + valueFromList = HashSet.fromList [] + -- ^ @variable when foo $ putStrLn $ T.showt =<< bar -- ^ @function.call -- ^ @variable @@ -325,3 +327,6 @@ lambdaAlias _ _ _ = undefined spec :: Spec spec = describe "test ns" $ it "test case" pending -- ^ @variable + +composed = f . g +-- ^ @function From 6498be930ea142b289abdec1e3c8298b490f2f67 Mon Sep 17 00:00:00 2001 From: ObserverOfTime Date: Fri, 10 Nov 2023 13:17:03 +0200 Subject: [PATCH 0663/2494] feat(xcompose): add locals queries --- queries/xcompose/locals.scm | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 queries/xcompose/locals.scm diff --git a/queries/xcompose/locals.scm b/queries/xcompose/locals.scm new file mode 100644 index 000000000..bd42d5fea --- /dev/null +++ b/queries/xcompose/locals.scm @@ -0,0 +1,3 @@ +(result (keysym) @definition) + +(event (keysym) @reference) From 78740f1895cd378655d55604f743d910651c6050 Mon Sep 17 00:00:00 2001 From: ObserverOfTime Date: Fri, 10 Nov 2023 13:17:16 +0200 Subject: [PATCH 0664/2494] feat(udev): add locals queries --- queries/udev/locals.scm | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 queries/udev/locals.scm diff --git a/queries/udev/locals.scm b/queries/udev/locals.scm new file mode 100644 index 000000000..33714d157 --- /dev/null +++ b/queries/udev/locals.scm @@ -0,0 +1,29 @@ +;; labels + +(assignment + key: "LABEL" + (value (content) @definition)) + +(assignment + key: "GOTO" + (value (content) @reference)) + +;; env vars + +(assignment + key: "ENV" + (env_var) @definition.var) + +(match + key: "ENV" + (env_var) @reference) + +(var_sub (env_var) @reference) + +;; misc + +[ + (attribute) + (kernel_param) + (seclabel) +] @reference From 2bd2c4ce235419aafb4dad40c43832acfad43351 Mon Sep 17 00:00:00 2001 From: ObserverOfTime Date: Fri, 10 Nov 2023 13:17:31 +0200 Subject: [PATCH 0665/2494] feat(ssh_config): add locals queries --- queries/ssh_config/locals.scm | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 queries/ssh_config/locals.scm diff --git a/queries/ssh_config/locals.scm b/queries/ssh_config/locals.scm new file mode 100644 index 000000000..d4ccbfdde --- /dev/null +++ b/queries/ssh_config/locals.scm @@ -0,0 +1,7 @@ +(parameter + keyword: "Tag" + argument: (string) @reference) + +(condition + criteria: "tagged" + argument: (pattern) @definition) From 9e5a34c2b906d46f6c5abd572f07bda848a94120 Mon Sep 17 00:00:00 2001 From: ObserverOfTime Date: Fri, 10 Nov 2023 13:17:47 +0200 Subject: [PATCH 0666/2494] feat(gitattributes): add locals queries --- queries/gitattributes/locals.scm | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 queries/gitattributes/locals.scm diff --git a/queries/gitattributes/locals.scm b/queries/gitattributes/locals.scm new file mode 100644 index 000000000..6a9aee1d5 --- /dev/null +++ b/queries/gitattributes/locals.scm @@ -0,0 +1,4 @@ +(macro_def (attr_name) @definition.macro) + +(attribute (attr_name) @reference) +(attribute (builtin_attr) @reference) From f1fc7c2e764db25569d9e899857c15cea0345a5c Mon Sep 17 00:00:00 2001 From: ObserverOfTime Date: Fri, 10 Nov 2023 13:18:00 +0200 Subject: [PATCH 0667/2494] feat(xml,dtd): add locals queries --- queries/dtd/locals.scm | 7 +++++++ queries/xml/locals.scm | 25 +++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 queries/dtd/locals.scm create mode 100644 queries/xml/locals.scm diff --git a/queries/dtd/locals.scm b/queries/dtd/locals.scm new file mode 100644 index 000000000..7efcdd030 --- /dev/null +++ b/queries/dtd/locals.scm @@ -0,0 +1,7 @@ +(elementdecl (Name) @definition.type) + +(elementdecl + (contentspec + (children (Name) @reference))) + +(AttlistDecl . (Name) @reference) diff --git a/queries/xml/locals.scm b/queries/xml/locals.scm new file mode 100644 index 000000000..05e162fbf --- /dev/null +++ b/queries/xml/locals.scm @@ -0,0 +1,25 @@ +;; tags + +(elementdecl (Name) @definition.type) + +(elementdecl + (contentspec + (children (Name) @reference))) + +(AttlistDecl . (Name) @reference) + +(STag (Name) @reference) +(ETag (Name) @reference) +(EmptyElemTag (Name) @reference) + +;; attributes + +(AttDef (Name) @definition.field) + +(Attribute (Name) @reference) + +;; entities + +(GEDecl (Name) @definition.macro) + +(EntityRef (Name) @reference) From f9999888eb3dc5918e3d511b69de0d5ab3373306 Mon Sep 17 00:00:00 2001 From: ObserverOfTime Date: Fri, 10 Nov 2023 13:43:26 +0200 Subject: [PATCH 0668/2494] feat(jq): add locals queries and highlight function calls --- queries/jq/highlights.scm | 2 ++ queries/jq/locals.scm | 7 +++++++ 2 files changed, 9 insertions(+) create mode 100644 queries/jq/locals.scm diff --git a/queries/jq/highlights.scm b/queries/jq/highlights.scm index 120cbe2eb..66acd26f4 100644 --- a/queries/jq/highlights.scm +++ b/queries/jq/highlights.scm @@ -55,6 +55,8 @@ "foreach" ] @function.builtin +((funcname) @function.call . "(") + ; jq -n 'builtins | map(split("/")[0]) | unique | .[]' ((funcname) @function.builtin (#any-of? @function.builtin diff --git a/queries/jq/locals.scm b/queries/jq/locals.scm new file mode 100644 index 000000000..b655a5e10 --- /dev/null +++ b/queries/jq/locals.scm @@ -0,0 +1,7 @@ +(funcdef (identifier) @definition.function) + +(funcdefargs (identifier) @definition.parameter) + +(funcname) @reference + +(index (identifier) @reference) From f2de95e30aac507bf7fa785e13a8edcbdc604605 Mon Sep 17 00:00:00 2001 From: Riley Bruins Date: Sat, 18 Nov 2023 17:20:51 -0800 Subject: [PATCH 0669/2494] feat(markdown): conceals for bullets, block quotes * feat(markdown): conceals for bullets, block quotes * fix: remove conceals for block quotes, change list minus to em dash * fix(markdown): allow empty bullets to be concealed --- queries/markdown/highlights.scm | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/queries/markdown/highlights.scm b/queries/markdown/highlights.scm index 23f1fb60f..085a1d827 100644 --- a/queries/markdown/highlights.scm +++ b/queries/markdown/highlights.scm @@ -34,6 +34,24 @@ (info_string (language) @conceal (#set! conceal ""))) +;; 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 "—")) + (code_fence_content) @none [ From e96a9b457714ffd4b649732c835080221981ae78 Mon Sep 17 00:00:00 2001 From: GitHub Date: Sun, 19 Nov 2023 06:35:25 +0000 Subject: [PATCH 0670/2494] Update parsers: cpp, php, rust, wing --- lockfile.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lockfile.json b/lockfile.json index eb68ef513..4f23fa692 100644 --- a/lockfile.json +++ b/lockfile.json @@ -78,7 +78,7 @@ "revision": "f4b3cbc8b0bd4e13035d39940fef09f1392e8739" }, "cpp": { - "revision": "3502513c3c5371b1c1480015c5eec85755d7a880" + "revision": "a71474021410973b29bfe99440d57bcd750246b1" }, "css": { "revision": "fec7d3757ab8f46a0ffe298be99b16ad5b9fa229" @@ -435,7 +435,7 @@ "revision": "3911403cba497196fb867a6f1e286e3e1576f425" }, "php": { - "revision": "33e30169e6f9bb29845c80afaa62a4a87f23f6d6" + "revision": "0a99deca13c4af1fb9adcb03c958bfc9f4c740a9" }, "phpdoc": { "revision": "915a527d5aafa81b31acf67fab31b0ac6b6319c0" @@ -534,7 +534,7 @@ "revision": "f257f3f57833d584050336921773738a3fd8ca22" }, "rust": { - "revision": "c741c105c0df43664fcc978dac5bc27888c9558f" + "revision": "79456e6080f50fc1ca7c21845794308fa5d35a51" }, "scala": { "revision": "1b4c2fa5c55c5fd83cbb0d2f818f916aba221a42" @@ -699,7 +699,7 @@ "revision": "a041228ae64632f59b9bd37346a0dbcb7817f36b" }, "wing": { - "revision": "11c5e35ec0437492497a931ca631787851e88c9d" + "revision": "f6423ecace1ef34f57dc77db031504ce21ebfaaf" }, "xcompose": { "revision": "01344fed31a3cd37a63f03357ec80cbc592a93b5" From b0162110574e4d21ead81fdc19746bd21f585759 Mon Sep 17 00:00:00 2001 From: Riley Bruins Date: Sat, 18 Nov 2023 14:43:12 -0800 Subject: [PATCH 0671/2494] feat(lua): folds for parameter, argument lists --- queries/lua/folds.scm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/queries/lua/folds.scm b/queries/lua/folds.scm index d8f0b42df..37c4947ed 100644 --- a/queries/lua/folds.scm +++ b/queries/lua/folds.scm @@ -6,5 +6,7 @@ (for_statement) (function_declaration) (function_definition) + (parameters) + (arguments) (table_constructor) ] @fold From d87629647614b779fb2aad8f0042fe2864253ea6 Mon Sep 17 00:00:00 2001 From: Amaan Qureshi Date: Sun, 19 Nov 2023 04:10:52 -0500 Subject: [PATCH 0672/2494] feat: add Linkerscript (#5693) --- README.md | 1 + lockfile.json | 3 + lua/nvim-treesitter/parsers.lua | 9 ++ queries/linkerscript/folds.scm | 6 ++ queries/linkerscript/highlights.scm | 146 ++++++++++++++++++++++++++++ queries/linkerscript/indents.scm | 11 +++ queries/linkerscript/injections.scm | 2 + queries/linkerscript/locals.scm | 15 +++ 8 files changed, 193 insertions(+) create mode 100644 queries/linkerscript/folds.scm create mode 100644 queries/linkerscript/highlights.scm create mode 100644 queries/linkerscript/indents.scm create mode 100644 queries/linkerscript/injections.scm create mode 100644 queries/linkerscript/locals.scm diff --git a/README.md b/README.md index 803db1a1a..559ae50da 100644 --- a/README.md +++ b/README.md @@ -284,6 +284,7 @@ We are looking for maintainers to add more parsers and to write query files for - [x] [latex](https://github.com/latex-lsp/tree-sitter-latex) (maintained by @theHamsta, @clason) - [x] [ledger](https://github.com/cbarrete/tree-sitter-ledger) (maintained by @cbarrete) - [x] [leo](https://github.com/r001/tree-sitter-leo) (maintained by @r001) +- [x] [linkerscript](https://github.com/amaanq/tree-sitter-linkerscript) (maintained by @amaanq) - [x] [liquidsoap](https://github.com/savonet/tree-sitter-liquidsoap) (maintained by @toots) - [x] [llvm](https://github.com/benwilliamgraham/tree-sitter-llvm) (maintained by @benwilliamgraham) - [x] [lua](https://github.com/MunifTanjim/tree-sitter-lua) (maintained by @muniftanjim) diff --git a/lockfile.json b/lockfile.json index 4f23fa692..4f268d678 100644 --- a/lockfile.json +++ b/lockfile.json @@ -332,6 +332,9 @@ "leo": { "revision": "23a9534d09d523d0dcee7dbf89e7c819e6835f6f" }, + "linkerscript": { + "revision": "f99011a3554213b654985a4b0a65b3b032ec4621" + }, "liquidsoap": { "revision": "91d2708e12a5869154a85190b13ac89cb1414189" }, diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 9077bc8d4..dc9135698 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -1017,6 +1017,15 @@ list.llvm = { maintainers = { "@benwilliamgraham" }, } +list.linkerscript = { + install_info = { + url = "https://github.com/amaanq/tree-sitter-linkerscript", + files = { "src/parser.c" }, + }, + filetype = "ld", + maintainers = { "@amaanq" }, +} + list.liquidsoap = { install_info = { url = "https://github.com/savonet/tree-sitter-liquidsoap", diff --git a/queries/linkerscript/folds.scm b/queries/linkerscript/folds.scm new file mode 100644 index 000000000..0fc77b1a7 --- /dev/null +++ b/queries/linkerscript/folds.scm @@ -0,0 +1,6 @@ +[ + (sections_command) + (output_section) + (memory_command) + (phdrs_command) +] @fold diff --git a/queries/linkerscript/highlights.scm b/queries/linkerscript/highlights.scm new file mode 100644 index 000000000..f933f31ca --- /dev/null +++ b/queries/linkerscript/highlights.scm @@ -0,0 +1,146 @@ +; Keywords + +[ + "ENTRY" + "SECTIONS" + "AT" + "OVERLAY" + "NOCROSSREFS" + "MEMORY" + "PHDRS" + "FILEHDR" +] @keyword + +; Conditionals + +(conditional_expression [ "?" ":" ] @conditional.ternary) + +; Variables + +(symbol) @variable + +(filename) @string.special @text.underline + +; Functions + +(call_expression + function: (symbol) @function.call) + +((call_expression + function: (symbol) @preproc) + (#eq? @preproc "DEFINED")) + +((call_expression + function: (symbol) @function.builtin) + (#any-of? @function.builtin + "ABSOLUTE" "ALIAS" "ADDR" "ALIGN" "ALIGNOF" "BASE" "BLOCK" "CHIP" "DATA_SEGMENT_ALIGN" + "DATA_SEGMENT_END" "DATA_SEGMENT_RELRO_END" "END" "LENGTH" "LOADADDR" "LOG2CEIL" "MAX" "MIN" + "NEXT" "ORIGIN" "SEGMENT_START" "SIZEOF" "BYTE" "FILL" "LONG" "SHORT" "QUAD" "SQUAD" "WORD")) + +[ + "KEEP" + "PROVIDE" + "PROVIDE_HIDDEN" +] @function.builtin + +; Types + +(section_type "(" [ "NOLOAD" "DSECT" "COPY" "INFO" "OVERLAY" ] @type.builtin ")") + +; Fields + +[ + "ORIGIN" "org" "o" + "LENGTH" "len" "l" +] @field.builtin + +; Constants + +((symbol) @constant + (#lua-match? @constant "^[%u_][%u%d_]+$")) + +; Labels + +(entry_command name: (symbol) @label) + +(output_section name: (symbol) @label) + +(memory_command name: (symbol) @label) + +(phdrs_command name: (symbol) @label) + +(region ">" (symbol) @label) + +(lma_region ">" (symbol) @label) + +(phdr ":" (symbol) @label) + +([(symbol) (filename)] @label + (#lua-match? @label "^%.")) + +; Exceptions + +"ASSERT" @exception + +[ + "/DISCARD/" + "." +] @variable.builtin + +; Operators + +[ + "+" + "-" + "*" + "/" + "%" + "||" + "&&" + "|" + "&" + "==" + "!=" + ">" + ">=" + "<=" + "<" + "<<" + ">>" + "!" + "~" + "=" + "+=" + "-=" + "*=" + "/=" + "<<=" + ">>=" + "&=" + "|=" +] @operator + +; Literals + +(number) @number + +(quoted_symbol) @string + +(wildcard_pattern [ "*" "[" "]" ] @character.special) + +(attributes) @character.special + +; Punctuation + +[ "{" "}" "(" ")" ] @punctuation.bracket + +[ + ":" + ";" +] @punctuation.delimiter + +">" @punctuation.special + +; Comments + +(comment) @comment @spell diff --git a/queries/linkerscript/indents.scm b/queries/linkerscript/indents.scm new file mode 100644 index 000000000..a636ba109 --- /dev/null +++ b/queries/linkerscript/indents.scm @@ -0,0 +1,11 @@ +[ + (sections_command) + (output_section) + (memory_command) + (phdrs_command) +] @indent.begin + +[ + "}" + ")" +] @indent.branch @indent.end diff --git a/queries/linkerscript/injections.scm b/queries/linkerscript/injections.scm new file mode 100644 index 000000000..51e6d1f6b --- /dev/null +++ b/queries/linkerscript/injections.scm @@ -0,0 +1,2 @@ +((comment) + (#set! injection.language "comment")) diff --git a/queries/linkerscript/locals.scm b/queries/linkerscript/locals.scm new file mode 100644 index 000000000..93ddb4357 --- /dev/null +++ b/queries/linkerscript/locals.scm @@ -0,0 +1,15 @@ +; References + +[ + (symbol) + (filename) + (quoted_symbol) +] @reference + +; Definitions + +(output_section name: (symbol) @definition.var) + +(memory_command name: (symbol) @definition.var) + +(phdrs_command name: (symbol) @definition.var) From 3da5cfb4a2505bc10d6fe3c193c69adac13423a8 Mon Sep 17 00:00:00 2001 From: GitHub Date: Mon, 20 Nov 2023 06:37:41 +0000 Subject: [PATCH 0673/2494] Update parsers: commonlisp, cuda, glsl, hlsl, pod, smithy, tlaplus, v, wing --- lockfile.json | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lockfile.json b/lockfile.json index 4f268d678..8548146f9 100644 --- a/lockfile.json +++ b/lockfile.json @@ -66,7 +66,7 @@ "revision": "aefcc2813392eb6ffe509aa0fc8b4e9b57413ee1" }, "commonlisp": { - "revision": "5153dbbc70e4cc2324320c1bdae020d31079c7c0" + "revision": "cf10fc38bc24faf0549d59217ff37c789973dfdc" }, "cooklang": { "revision": "5e113412aadb78955c27010daa4dbe1d202013cf" @@ -87,7 +87,7 @@ "revision": "6c1957405bd6f7751b050f61367f1094fab91444" }, "cuda": { - "revision": "d33ee2caab572f7b46cef12e090331b9ed1c02e2" + "revision": "2c6e806949197e7898910c78f514a3b7ff679068" }, "cue": { "revision": "2df92e6755337e9234ad18ffef37f35d95e2ba9d" @@ -198,7 +198,7 @@ "revision": "f9746dc1d0707717fbba84cb5c22a71586af23e1" }, "glsl": { - "revision": "c9082edab87b145e97090b133167cb53626d9f58" + "revision": "5bb58a6a5b0941d4e1256c6335e50d9780e74dde" }, "gn": { "revision": "bc06955bc1e3c9ff8e9b2b2a55b38b94da923c05" @@ -252,7 +252,7 @@ "revision": "02fa3b79b3ff9a296066da6277adfc3f26cbc9e0" }, "hlsl": { - "revision": "ac65c934b3214e96e0f854be009a3bd51549bd14" + "revision": "8b10faba024b536dc85f76e0c678f573b1776034" }, "hocon": { "revision": "c390f10519ae69fdb03b3e5764f5592fb6924bcc" @@ -450,7 +450,7 @@ "revision": "d6aed225290bc71a15ab6f06305cb11419360c56" }, "pod": { - "revision": "ea5d557cbd185cdcb5efcfdb6bc846fe909d86ae" + "revision": "39da859947b94abdee43e431368e1ae975c0a424" }, "poe_filter": { "revision": "374f618de179498c2a821136bb86c3edbe221e10" @@ -558,7 +558,7 @@ "revision": "72e334b2630f5852825ba5ff9dfd872447175eb5" }, "smithy": { - "revision": "cf8c7eb9faf7c7049839585eac19c94af231e6a0" + "revision": "8327eb84d55639ffbe08c9dc82da7fff72a1ad07" }, "snakemake": { "revision": "65a6c3b4671877821082164da0a310851b211953" @@ -633,7 +633,7 @@ "revision": "a7f11d946b44244f71df41d2a78af0665d618dae" }, "tlaplus": { - "revision": "d99cb5c77bb0e733176d607a0875ac30e17e1e72" + "revision": "c5fae9e4ad9f483fb6232a8688a2c940be6b496b" }, "todotxt": { "revision": "0207f6a4ab6aeafc4b091914d31d8235049a2578" @@ -675,7 +675,7 @@ "revision": "4c5ecd6326ebd61f6f9a22a370cbd100e0d601da" }, "v": { - "revision": "2f24b0377ddb865eb4285634f6945cb4ee3f395c" + "revision": "975f34bec1dfad391534c83a6df019c0c200887a" }, "vala": { "revision": "8f690bfa639f2b83d1fb938ed3dd98a7ba453e8b" @@ -702,7 +702,7 @@ "revision": "a041228ae64632f59b9bd37346a0dbcb7817f36b" }, "wing": { - "revision": "f6423ecace1ef34f57dc77db031504ce21ebfaaf" + "revision": "29894ffc9585f160b99f5b753dae07fcd319528f" }, "xcompose": { "revision": "01344fed31a3cd37a63f03357ec80cbc592a93b5" From 1610b1aafb9b7b3a7b54c853ed45c6cb1a3d0df2 Mon Sep 17 00:00:00 2001 From: Riley Bruins Date: Mon, 20 Nov 2023 08:26:18 -0800 Subject: [PATCH 0674/2494] feat(python): `@string.regex` capture, injection improvements (#5697) * feat(python): `@string.regex` capture, injection improvements * fix(python): match regex only for first argument of re module * chore(python): remove unneeded capture Co-authored-by: Santos Gallegos * fix(python): only highlight string content itself as regex --------- Co-authored-by: Santos Gallegos --- queries/python/highlights.scm | 8 ++++++++ queries/python/injections.scm | 5 ++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/queries/python/highlights.scm b/queries/python/highlights.scm index de98dccbf..b09122dd9 100644 --- a/queries/python/highlights.scm +++ b/queries/python/highlights.scm @@ -346,3 +346,11 @@ ;; 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.regex)) + (#eq? @_re "re")) diff --git a/queries/python/injections.scm b/queries/python/injections.scm index b836ea3f7..aa36a5af9 100644 --- a/queries/python/injections.scm +++ b/queries/python/injections.scm @@ -1,10 +1,9 @@ (call function: (attribute object: (identifier) @_re) - arguments: (argument_list (string - (string_content) @injection.content) @_string) + arguments: (argument_list . (string + (string_content) @injection.content)) (#eq? @_re "re") - (#lua-match? @_string "^r.*") (#set! injection.language "regex")) ((comment) @injection.content From 670e7aa84346ea0f0e66f6bed3bf464beca4e70a Mon Sep 17 00:00:00 2001 From: GitHub Date: Tue, 21 Nov 2023 06:37:13 +0000 Subject: [PATCH 0675/2494] Update parsers: devicetree, wing --- lockfile.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lockfile.json b/lockfile.json index 8548146f9..94ad3a190 100644 --- a/lockfile.json +++ b/lockfile.json @@ -99,7 +99,7 @@ "revision": "f71e310a93010863f4b17a2a501ea8e2032c345b" }, "devicetree": { - "revision": "cc26cbf2121a27eaa72a05a795ce38aba4e0f86e" + "revision": "e876e2aee525d98b2704ba75a05e1dd2b04aba76" }, "dhall": { "revision": "affb6ee38d629c9296749767ab832d69bb0d9ea8" @@ -702,7 +702,7 @@ "revision": "a041228ae64632f59b9bd37346a0dbcb7817f36b" }, "wing": { - "revision": "29894ffc9585f160b99f5b753dae07fcd319528f" + "revision": "bc272f53bed53520d78d08a21fb0b412336e22d4" }, "xcompose": { "revision": "01344fed31a3cd37a63f03357ec80cbc592a93b5" From 6b24db0c8fc1357522320e71c89069fdc66a4237 Mon Sep 17 00:00:00 2001 From: ObserverOfTime Date: Tue, 21 Nov 2023 02:19:07 +0200 Subject: [PATCH 0676/2494] feat: add properties parser --- README.md | 1 + lockfile.json | 3 +++ lua/nvim-treesitter/parsers.lua | 9 +++++++++ queries/properties/highlights.scm | 28 ++++++++++++++++++++++++++++ queries/properties/injections.scm | 2 ++ queries/properties/locals.scm | 3 +++ 6 files changed, 46 insertions(+) create mode 100644 queries/properties/highlights.scm create mode 100644 queries/properties/injections.scm create mode 100644 queries/properties/locals.scm diff --git a/README.md b/README.md index 559ae50da..bf96df17a 100644 --- a/README.md +++ b/README.md @@ -328,6 +328,7 @@ We are looking for maintainers to add more parsers and to write query files for - [x] [pony](https://github.com/amaanq/tree-sitter-pony) (maintained by @amaanq, @mfelsche) - [x] [prisma](https://github.com/victorhqc/tree-sitter-prisma) (maintained by @elianiva) - [x] [promql](https://github.com/MichaHoffmann/tree-sitter-promql) (maintained by @MichaHoffmann) +- [x] [properties](https://github.com/ObserverOfTime/tree-sitter-properties) (maintained by @ObserverOfTime) - [x] [proto](https://github.com/treywood/tree-sitter-proto) (maintained by @treywood) - [x] [prql](https://github.com/PRQL/tree-sitter-prql) (maintained by @matthias-Q) - [x] [psv](https://github.com/amaanq/tree-sitter-csv) (maintained by @amaanq) diff --git a/lockfile.json b/lockfile.json index 94ad3a190..9e1bf1ae3 100644 --- a/lockfile.json +++ b/lockfile.json @@ -464,6 +464,9 @@ "promql": { "revision": "77625d78eebc3ffc44d114a07b2f348dff3061b0" }, + "properties": { + "revision": "97253273bdf8b63546c8006e71ba155ecc27069e" + }, "proto": { "revision": "e9f6b43f6844bd2189b50a422d4e2094313f6aa3" }, diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index dc9135698..b012d514a 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -1385,6 +1385,15 @@ list.promql = { maintainers = { "@MichaHoffmann" }, } +list.properties = { + install_info = { + url = "https://github.com/ObserverOfTime/tree-sitter-properties", + files = { "src/parser.c" }, + }, + filetype = "jproperties", + maintainers = { "@ObserverOfTime" }, +} + list.proto = { install_info = { url = "https://github.com/treywood/tree-sitter-proto", diff --git a/queries/properties/highlights.scm b/queries/properties/highlights.scm new file mode 100644 index 000000000..3414294b7 --- /dev/null +++ b/queries/properties/highlights.scm @@ -0,0 +1,28 @@ +(comment) @comment @spell + +(key) @property + +(value) @string + +(value (escape) @string.escape) + +((value) @boolean + (#any-of? @boolean "true" "false")) + +((value) @number + (#lua-match? @number "^%d+$")) + +(index) @number + +(property [ "=" ":" ] @operator) + +[ "${" "}" ] @punctuation.special + +(substitution ":" @punctuation.special) + +[ "[" "]" ] @punctuation.bracket + +[ "." "\\" ] @punctuation.delimiter + +((substitution (key) @constant) + (#lua-match? @constant "^[A-Z_][A-Z0-9_]*$")) diff --git a/queries/properties/injections.scm b/queries/properties/injections.scm new file mode 100644 index 000000000..321c90add --- /dev/null +++ b/queries/properties/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/properties/locals.scm b/queries/properties/locals.scm new file mode 100644 index 000000000..d9360c465 --- /dev/null +++ b/queries/properties/locals.scm @@ -0,0 +1,3 @@ +(property (key) @definition) + +(substitution (key) @reference) From 7da3cb6323d1e1fbfc4d7dc05cac74946458b8a0 Mon Sep 17 00:00:00 2001 From: Riley Bruins Date: Sun, 19 Nov 2023 20:34:18 -0800 Subject: [PATCH 0677/2494] feat(regex): any_character, start end assertion hl differentiation --- queries/regex/highlights.scm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/queries/regex/highlights.scm b/queries/regex/highlights.scm index 8277d6d7e..7a5685844 100644 --- a/queries/regex/highlights.scm +++ b/queries/regex/highlights.scm @@ -25,10 +25,14 @@ (control_letter_escape) (character_class_escape) (control_escape) - (start_assertion) - (end_assertion) (boundary_assertion) (non_boundary_assertion) ] @string.escape -[ "*" "+" "?" "|" "=" "!" ] @operator +[ "*" "+" "?" "|" "=" "!" "-"] @operator + +[ + (any_character) + (start_assertion) + (end_assertion) +] @variable.builtin From cd583cfb5b492c4f81edc5e1916c9f59b7b0ef16 Mon Sep 17 00:00:00 2001 From: GitHub Date: Wed, 22 Nov 2023 06:37:29 +0000 Subject: [PATCH 0678/2494] Update parsers: devicetree, v, wing --- lockfile.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lockfile.json b/lockfile.json index 9e1bf1ae3..28895bfc7 100644 --- a/lockfile.json +++ b/lockfile.json @@ -99,7 +99,7 @@ "revision": "f71e310a93010863f4b17a2a501ea8e2032c345b" }, "devicetree": { - "revision": "e876e2aee525d98b2704ba75a05e1dd2b04aba76" + "revision": "53b4137bd37e726116ea918139767f982a1584d8" }, "dhall": { "revision": "affb6ee38d629c9296749767ab832d69bb0d9ea8" @@ -678,7 +678,7 @@ "revision": "4c5ecd6326ebd61f6f9a22a370cbd100e0d601da" }, "v": { - "revision": "975f34bec1dfad391534c83a6df019c0c200887a" + "revision": "20433e0d8ff5bb6e7bb28d12948773be2bdd983d" }, "vala": { "revision": "8f690bfa639f2b83d1fb938ed3dd98a7ba453e8b" @@ -705,7 +705,7 @@ "revision": "a041228ae64632f59b9bd37346a0dbcb7817f36b" }, "wing": { - "revision": "bc272f53bed53520d78d08a21fb0b412336e22d4" + "revision": "ade67c1dcfb7885dbbfdf7fa5be48550e107c382" }, "xcompose": { "revision": "01344fed31a3cd37a63f03357ec80cbc592a93b5" From 2a5f6c9eb733a5a847bb1890f620658547033515 Mon Sep 17 00:00:00 2001 From: Riley Bruins Date: Wed, 22 Nov 2023 14:53:56 -0800 Subject: [PATCH 0679/2494] fix(css): tweak operator keyword highlights --- queries/css/highlights.scm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/queries/css/highlights.scm b/queries/css/highlights.scm index 8a7cba160..383d6b7dc 100644 --- a/queries/css/highlights.scm +++ b/queries/css/highlights.scm @@ -34,11 +34,14 @@ "~=" "$=" "*=" + ] @operator + +[ "and" "or" "not" "only" - ] @operator + ] @keyword.operator (important) @type.qualifier From 6d45b3469719a9740a5ef6304bb6771516d19bd5 Mon Sep 17 00:00:00 2001 From: GitHub Date: Thu, 23 Nov 2023 06:36:39 +0000 Subject: [PATCH 0680/2494] Update parsers: sql, wing --- lockfile.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lockfile.json b/lockfile.json index 28895bfc7..5452493a3 100644 --- a/lockfile.json +++ b/lockfile.json @@ -579,7 +579,7 @@ "revision": "05f949d3c1c15e3261473a244d3ce87777374dec" }, "sql": { - "revision": "d8fffdf0902bf55994fd2e8a0a46e221ca988589" + "revision": "a3ea0e4143a617fc2c4ccf29c41e0ba7a1ff6ab9" }, "squirrel": { "revision": "e8b5835296f931bcaa1477d3c5a68a0c5c2ba034" @@ -705,7 +705,7 @@ "revision": "a041228ae64632f59b9bd37346a0dbcb7817f36b" }, "wing": { - "revision": "ade67c1dcfb7885dbbfdf7fa5be48550e107c382" + "revision": "635fa4b72ee913f3028bf6be54c40393edbc259d" }, "xcompose": { "revision": "01344fed31a3cd37a63f03357ec80cbc592a93b5" From 71bdf97bf6dafc776ad957169533f2f669a8c562 Mon Sep 17 00:00:00 2001 From: Patrick Haun Date: Thu, 23 Nov 2023 14:42:00 +0100 Subject: [PATCH 0681/2494] feat(hocon): add fold query (#5710) --- queries/hocon/folds.scm | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 queries/hocon/folds.scm diff --git a/queries/hocon/folds.scm b/queries/hocon/folds.scm new file mode 100644 index 000000000..cc8a231a4 --- /dev/null +++ b/queries/hocon/folds.scm @@ -0,0 +1,4 @@ +[ + (object) + (array) +] @fold From 649d137371e9214d30b20565e0574824fa3a3670 Mon Sep 17 00:00:00 2001 From: GitHub Date: Fri, 24 Nov 2023 06:36:51 +0000 Subject: [PATCH 0682/2494] Update parsers: erlang, ssh_config, wing --- lockfile.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lockfile.json b/lockfile.json index 5452493a3..06f10cc7b 100644 --- a/lockfile.json +++ b/lockfile.json @@ -144,7 +144,7 @@ "revision": "203f7bd3c1bbfbd98fc19add4b8fcb213c059205" }, "erlang": { - "revision": "35ae91b2e9f5514c0ad6d6887f9859f28907c7d5" + "revision": "b7969b5f12c44038379901a6f2094c31afa2ec2f" }, "fennel": { "revision": "517195970428aacca60891b050aa53eabf4ba78d" @@ -585,7 +585,7 @@ "revision": "e8b5835296f931bcaa1477d3c5a68a0c5c2ba034" }, "ssh_config": { - "revision": "1651e637d57c667708add5440d3726f07e97d953" + "revision": "9ff3cabeb738f94bfc3c2de4d3857133ad717e3f" }, "starlark": { "revision": "c45ce2b39062bbd12ea1c210bd200db250efb24a" @@ -705,7 +705,7 @@ "revision": "a041228ae64632f59b9bd37346a0dbcb7817f36b" }, "wing": { - "revision": "635fa4b72ee913f3028bf6be54c40393edbc259d" + "revision": "d483d21ad212bc9641e88deee0db2dad670eaaf3" }, "xcompose": { "revision": "01344fed31a3cd37a63f03357ec80cbc592a93b5" From d8a71826a20dfc9ed3d8a43e28a00611a302b456 Mon Sep 17 00:00:00 2001 From: GitHub Date: Sat, 25 Nov 2023 06:35:01 +0000 Subject: [PATCH 0683/2494] Update parsers: dtd, ssh_config, wing, xml --- lockfile.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lockfile.json b/lockfile.json index 06f10cc7b..ce3067474 100644 --- a/lockfile.json +++ b/lockfile.json @@ -117,7 +117,7 @@ "revision": "a750758da90955c86fcc22fcbb6fa44a7d009865" }, "dtd": { - "revision": "a3bfa1ae7e8400ab81a6358f5e8d2983f5dd0697" + "revision": "dd7ef38c74d8430da729b4da815e4c40776e03bb" }, "ebnf": { "revision": "8e635b0b723c620774dfb8abf382a7f531894b40" @@ -585,7 +585,7 @@ "revision": "e8b5835296f931bcaa1477d3c5a68a0c5c2ba034" }, "ssh_config": { - "revision": "9ff3cabeb738f94bfc3c2de4d3857133ad717e3f" + "revision": "096981397385f49833dfd66037fa98081bbd9ef9" }, "starlark": { "revision": "c45ce2b39062bbd12ea1c210bd200db250efb24a" @@ -705,13 +705,13 @@ "revision": "a041228ae64632f59b9bd37346a0dbcb7817f36b" }, "wing": { - "revision": "d483d21ad212bc9641e88deee0db2dad670eaaf3" + "revision": "cf025a5f727a2b4645dd332876e94cef80e5147f" }, "xcompose": { "revision": "01344fed31a3cd37a63f03357ec80cbc592a93b5" }, "xml": { - "revision": "a3bfa1ae7e8400ab81a6358f5e8d2983f5dd0697" + "revision": "dd7ef38c74d8430da729b4da815e4c40776e03bb" }, "yaml": { "revision": "0e36bed171768908f331ff7dff9d956bae016efb" From eafc0c2194842fe038e143b743e5a442ce5eac2c Mon Sep 17 00:00:00 2001 From: GitHub Date: Sun, 26 Nov 2023 06:35:13 +0000 Subject: [PATCH 0684/2494] Update parsers: swift, wing --- lockfile.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lockfile.json b/lockfile.json index ce3067474..903bbf405 100644 --- a/lockfile.json +++ b/lockfile.json @@ -603,7 +603,7 @@ "revision": "697bb515471871e85ff799ea57a76298a71a9cca" }, "swift": { - "revision": "b3bfaad89426a062c2a5d971cfebb7262f8cff62" + "revision": "f1a48a33a7ceaf8817f7a340ea4ef1b549ffa176" }, "sxhkdrc": { "revision": "440d5f913d9465c9c776a1bd92334d32febcf065" @@ -705,7 +705,7 @@ "revision": "a041228ae64632f59b9bd37346a0dbcb7817f36b" }, "wing": { - "revision": "cf025a5f727a2b4645dd332876e94cef80e5147f" + "revision": "be512815ce78a92e8a62fef9ca4bdf2fdaecd159" }, "xcompose": { "revision": "01344fed31a3cd37a63f03357ec80cbc592a93b5" From 9d91101f71cc64cdef923a3b14130db82985bac6 Mon Sep 17 00:00:00 2001 From: sheepwall Date: Sun, 26 Nov 2023 12:12:06 +0100 Subject: [PATCH 0685/2494] twig queries: add combined injections (#5721) Co-authored-by: August Svensson --- queries/twig/injections.scm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/queries/twig/injections.scm b/queries/twig/injections.scm index 663dc3b6c..29ba009a8 100644 --- a/queries/twig/injections.scm +++ b/queries/twig/injections.scm @@ -1,3 +1,4 @@ ((content) @injection.content - (#set! injection.language "html")) + (#set! injection.language "html") + (#set! injection.combined)) From 1e74c34b668d0bbdd14492fc220974e4fc38dc6b Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 24 Nov 2023 10:25:47 +0100 Subject: [PATCH 0686/2494] feat: add angular parser and queries --- lockfile.json | 3 ++ lua/nvim-treesitter/parsers.lua | 8 ++++ queries/angular/highlights.scm | 67 ++++++++++++++++++++++++++++++++ queries/html_tags/injections.scm | 21 ++++++++++ 4 files changed, 99 insertions(+) create mode 100644 queries/angular/highlights.scm diff --git a/lockfile.json b/lockfile.json index 903bbf405..01d9ad274 100644 --- a/lockfile.json +++ b/lockfile.json @@ -5,6 +5,9 @@ "agda": { "revision": "c21c3a0f996363ed17b8ac99d827fe5a4821f217" }, + "angular": { + "revision": "624ff108fe949727217cddb302f20e4f16997b1c" + }, "apex": { "revision": "82ee140f4ee7652a4915ac9e9f60c4d66f7637d7" }, diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index b012d514a..0c83e58f0 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -93,6 +93,14 @@ list.agda = { maintainers = { "@Decodetalkers" }, } +list.angular = { + install_info = { + url = "https://github.com/steelsojka/tree-sitter-angular", + files = { "src/parser.c" }, + }, + maintainers = {"@steelsojka"} +} + list.apex = { install_info = { url = "https://github.com/aheber/tree-sitter-sfapex", diff --git a/queries/angular/highlights.scm b/queries/angular/highlights.scm new file mode 100644 index 000000000..98c6f76e9 --- /dev/null +++ b/queries/angular/highlights.scm @@ -0,0 +1,67 @@ +(identifier) @variable +(pipe_sequence "|" @operator) +(string) @string +(number) @number +(pipe_call + name: (identifier) @function) +(pipe_call + arguments: (pipe_arguments + (identifier) @parameter)) + +(structural_assignment + operator: (identifier) @keyword) + +(member_expression + property: (identifier) @property) + +(call_expression + function: (identifier) @function) + +(call_expression + function: ((identifier) @function.builtin + (#eq? @function.builtin "$any"))) + +[ +"let" +"as" +] @keyword + +[ +"(" +")" +"[" +"]" +"{" +"}" +] @punctuation.bracket + +[ +";" +"." +"," +"?." +] @punctuation.delimiter + +((identifier) @boolean + (#vim-match? @boolean "^(true|false)$")) +((identifier) @variable.builtin + (#vim-match? @variable.builtin "^(this|\$event|null)$")) + +[ + "-" + "&&" + "+" + "<" + "<=" + "=" + "==" + "===" + "!=" + "!==" + ">" + ">=" + "*" + "/" + "||" + "%" +] @operator diff --git a/queries/html_tags/injections.scm b/queries/html_tags/injections.scm index 563e7453d..cef63ad8d 100644 --- a/queries/html_tags/injections.scm +++ b/queries/html_tags/injections.scm @@ -74,3 +74,24 @@ (#lua-match? @_name "^on[a-z]+$") (quoted_attribute_value (attribute_value) @injection.content) (#set! injection.language "javascript")) + +(attribute + ((attribute_name) @_name + (#lua-match? @_name "[%[%(].*[%)%]]")) + (quoted_attribute_value + (attribute_value) @injection.content) + (#set! injection.language "angular")) + +(attribute + ((attribute_name) @_name + (#lua-match? @_name "^%*")) + (quoted_attribute_value + ((attribute_value) @injection.content)) + (#set! injection.language "angular")) + +(element + ((text) @injection.content + (#lua-match? @injection.content "%{%{.*%}%}") + (#offset! @injection.content 0 2 0 -2)) + (#set! injection.language "angular")) + From 274370e703dcf478c80fa31ca3798ab2e90bf71b Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 24 Nov 2023 10:29:17 +0100 Subject: [PATCH 0687/2494] fixup: use any-of instead of vim-match --- queries/angular/highlights.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/queries/angular/highlights.scm b/queries/angular/highlights.scm index 98c6f76e9..dc926bb9a 100644 --- a/queries/angular/highlights.scm +++ b/queries/angular/highlights.scm @@ -43,9 +43,9 @@ ] @punctuation.delimiter ((identifier) @boolean - (#vim-match? @boolean "^(true|false)$")) + (#any-of? @boolean "true" "false")) ((identifier) @variable.builtin - (#vim-match? @variable.builtin "^(this|\$event|null)$")) + (#any-of? @variable.builtin "this" "\$event" "null")) [ "-" From de5197871e49130dd7f5642b5dff5353b79c45b8 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 24 Nov 2023 10:31:01 +0100 Subject: [PATCH 0688/2494] fixup: lint --- lua/nvim-treesitter/parsers.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 0c83e58f0..28e6f32b8 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -98,7 +98,7 @@ list.angular = { url = "https://github.com/steelsojka/tree-sitter-angular", files = { "src/parser.c" }, }, - maintainers = {"@steelsojka"} + maintainers = { "@steelsojka" }, } list.apex = { From 52b25c9a3f172abf986686c6382dae5f10786809 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 24 Nov 2023 12:04:08 +0100 Subject: [PATCH 0689/2494] fixup: parser requires generate (ABI) --- lua/nvim-treesitter/parsers.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 28e6f32b8..b606392b5 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -97,8 +97,9 @@ list.angular = { install_info = { url = "https://github.com/steelsojka/tree-sitter-angular", files = { "src/parser.c" }, + requires_generate_from_grammar = true, }, - maintainers = { "@steelsojka" }, + experimental = true, } list.apex = { From b056e4227b1c5d3ecfe96941352364c0c10668df Mon Sep 17 00:00:00 2001 From: Github Actions Date: Sun, 26 Nov 2023 14:24:40 +0000 Subject: [PATCH 0690/2494] Update README --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index bf96df17a..39c25a1dc 100644 --- a/README.md +++ b/README.md @@ -175,6 +175,7 @@ We are looking for maintainers to add more parsers and to write query files for - [x] [ada](https://github.com/briot/tree-sitter-ada) (maintained by @briot) - [x] [agda](https://github.com/tree-sitter/tree-sitter-agda) (maintained by @Decodetalkers) +- [ ] [angular](https://github.com/steelsojka/tree-sitter-angular) (experimental) - [x] [apex](https://github.com/aheber/tree-sitter-sfapex) (maintained by @aheber) - [x] [arduino](https://github.com/ObserverOfTime/tree-sitter-arduino) (maintained by @ObserverOfTime) - [x] [astro](https://github.com/virchau13/tree-sitter-astro) (maintained by @virchau13) From 482a2f15d37817e1201466d00c6539574ba34554 Mon Sep 17 00:00:00 2001 From: Tomas Sandven <597206+Hubro@users.noreply.github.com> Date: Sun, 19 Nov 2023 13:20:17 +0100 Subject: [PATCH 0691/2494] Fix robot parser metadata in parsers.lua --- lua/nvim-treesitter/parsers.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index b606392b5..ff1fe7660 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -1573,8 +1573,7 @@ list.robot = { url = "https://github.com/Hubro/tree-sitter-robot", files = { "src/parser.c" }, }, - maintainers = { "@ema2159" }, - experimental = true, + maintainers = { "@Hubro" }, } list.ron = { From 8189d91cf82b78fd765b28c674537688bce70c10 Mon Sep 17 00:00:00 2001 From: virchau13 Date: Mon, 27 Nov 2023 21:11:28 +0800 Subject: [PATCH 0692/2494] astro: add custom component highlighting (#5728) --- queries/astro/highlights.scm | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/queries/astro/highlights.scm b/queries/astro/highlights.scm index 62e8ed247..91ccbffb3 100644 --- a/queries/astro/highlights.scm +++ b/queries/astro/highlights.scm @@ -3,3 +3,11 @@ [ "---" ] @punctuation.delimiter [ "{" "}" ] @punctuation.special + +; custom components get `@type` highlighting +((start_tag (tag_name) @type) + (#lua-match? @type "^[A-Z]")) +((end_tag (tag_name) @type) + (#lua-match? @type "^[A-Z]")) +((erroneous_end_tag (erroneous_end_tag_name) @type) + (#lua-match? @type "^[A-Z]")) From b8fbd13277aae47fecdf7ec63731fa1f9918ac07 Mon Sep 17 00:00:00 2001 From: Github Actions Date: Mon, 27 Nov 2023 13:11:44 +0000 Subject: [PATCH 0693/2494] Update README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 39c25a1dc..fae63f196 100644 --- a/README.md +++ b/README.md @@ -350,7 +350,7 @@ We are looking for maintainers to add more parsers and to write query files for - [x] [rego](https://github.com/FallenAngel97/tree-sitter-rego) (maintained by @FallenAngel97) - [x] [pip requirements](https://github.com/ObserverOfTime/tree-sitter-requirements) (maintained by @ObserverOfTime) - [x] [rnoweb](https://github.com/bamonroe/tree-sitter-rnoweb) (maintained by @bamonroe) -- [x] [robot](https://github.com/Hubro/tree-sitter-robot) (experimental, maintained by @ema2159) +- [x] [robot](https://github.com/Hubro/tree-sitter-robot) (maintained by @Hubro) - [x] [ron](https://github.com/amaanq/tree-sitter-ron) (maintained by @amaanq) - [x] [rst](https://github.com/stsewd/tree-sitter-rst) (maintained by @stsewd) - [x] [ruby](https://github.com/tree-sitter/tree-sitter-ruby) (maintained by @TravonteD) From ba588ee0cf9df885f3f8698ae671330d82b4bdec Mon Sep 17 00:00:00 2001 From: HumblePresent <60856003+HumblePresent@users.noreply.github.com> Date: Mon, 27 Nov 2023 15:50:08 -0600 Subject: [PATCH 0694/2494] fix(cpp): remove `@field` for identifiers with `_` prefix (#5731) --- queries/cpp/highlights.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/queries/cpp/highlights.scm b/queries/cpp/highlights.scm index 21c3c4e59..b9a8cfec0 100644 --- a/queries/cpp/highlights.scm +++ b/queries/cpp/highlights.scm @@ -1,7 +1,7 @@ ; inherits: c ((identifier) @field - (#lua-match? @field "^m?_.*$")) + (#lua-match? @field "^m_.*$")) (parameter_declaration declarator: (reference_declarator) @parameter) From 582a92ee120532a603b75239f40cba06b9a5ec07 Mon Sep 17 00:00:00 2001 From: GitHub Date: Tue, 28 Nov 2023 06:36:40 +0000 Subject: [PATCH 0695/2494] Update parsers: erlang, wing --- lockfile.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lockfile.json b/lockfile.json index 01d9ad274..5963a7c46 100644 --- a/lockfile.json +++ b/lockfile.json @@ -147,7 +147,7 @@ "revision": "203f7bd3c1bbfbd98fc19add4b8fcb213c059205" }, "erlang": { - "revision": "b7969b5f12c44038379901a6f2094c31afa2ec2f" + "revision": "56942778b5791d07949e6c7b6093e01aba5b7ab4" }, "fennel": { "revision": "517195970428aacca60891b050aa53eabf4ba78d" @@ -708,7 +708,7 @@ "revision": "a041228ae64632f59b9bd37346a0dbcb7817f36b" }, "wing": { - "revision": "be512815ce78a92e8a62fef9ca4bdf2fdaecd159" + "revision": "97d7dd56bfd0e0642ef43bbb29cae2c78e6d520e" }, "xcompose": { "revision": "01344fed31a3cd37a63f03357ec80cbc592a93b5" From bf982eb7dc9d54af748ea1dd8b9db3a7724b9a99 Mon Sep 17 00:00:00 2001 From: Bryan Kenote <9691017+bryankenote@users.noreply.github.com> Date: Tue, 28 Nov 2023 17:24:43 +0000 Subject: [PATCH 0696/2494] feat: add facility --- README.md | 1 + lockfile.json | 3 ++ lua/nvim-treesitter/parsers.lua | 9 ++++ queries/facility/folds.scm | 6 +++ queries/facility/highlights.scm | 81 +++++++++++++++++++++++++++++++++ queries/facility/indents.scm | 8 ++++ queries/facility/injections.scm | 5 ++ 7 files changed, 113 insertions(+) create mode 100644 queries/facility/folds.scm create mode 100644 queries/facility/highlights.scm create mode 100644 queries/facility/indents.scm create mode 100644 queries/facility/injections.scm diff --git a/README.md b/README.md index fae63f196..3d0e495ef 100644 --- a/README.md +++ b/README.md @@ -223,6 +223,7 @@ We are looking for maintainers to add more parsers and to write query files for - [x] [elvish](https://github.com/elves/tree-sitter-elvish) (maintained by @elves) - [ ] [embedded_template](https://github.com/tree-sitter/tree-sitter-embedded-template) - [x] [erlang](https://github.com/WhatsApp/tree-sitter-erlang) (maintained by @filmor) +- [x] [facility](https://github.com/FacilityApi/tree-sitter-facility) (maintained by @bryankenote) - [x] [fennel](https://github.com/travonted/tree-sitter-fennel) (maintained by @TravonteD) - [x] [firrtl](https://github.com/amaanq/tree-sitter-firrtl) (maintained by @amaanq) - [x] [fish](https://github.com/ram02z/tree-sitter-fish) (maintained by @ram02z) diff --git a/lockfile.json b/lockfile.json index 5963a7c46..2a681c306 100644 --- a/lockfile.json +++ b/lockfile.json @@ -149,6 +149,9 @@ "erlang": { "revision": "56942778b5791d07949e6c7b6093e01aba5b7ab4" }, + "facility": { + "revision": "a2f90a0d4a3c41bcaa80cabb5f7467daefcd33f4" + }, "fennel": { "revision": "517195970428aacca60891b050aa53eabf4ba78d" }, diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index ff1fe7660..3945f1167 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -496,6 +496,15 @@ list.erlang = { maintainers = { "@filmor" }, } +list.facility = { + install_info = { + url = "https://github.com/FacilityApi/tree-sitter-facility", + files = { "src/parser.c" }, + }, + filetype = "fsd", + maintainers = { "@bryankenote" }, +} + list.fennel = { install_info = { url = "https://github.com/travonted/tree-sitter-fennel", diff --git a/queries/facility/folds.scm b/queries/facility/folds.scm new file mode 100644 index 000000000..7d8bafc80 --- /dev/null +++ b/queries/facility/folds.scm @@ -0,0 +1,6 @@ +[ + (service) + (method) + (dto) + (enum) +] @fold diff --git a/queries/facility/highlights.scm b/queries/facility/highlights.scm new file mode 100644 index 000000000..c10ff49be --- /dev/null +++ b/queries/facility/highlights.scm @@ -0,0 +1,81 @@ +[ + ";" + "." + "," +] @punctuation.delimiter + +[ + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket + +(comment) @comment @spell +(doc_comment) @comment.documentation @spell + +"method" @keyword.function + +[ + "service" + "errors" + "data" + "enum" + "extern" +] @type.builtin + +(type) @type.builtin + +(service + service_name: (identifier) @type) + +(error_set + (identifier) @property) + +(error_set + name: (identifier) @type) + +(dto + name: (identifier) @type) + +(external_dto + name: (identifier) @type) + +(enum + (values_block + (identifier) @constant)) + +(enum + name: (identifier) @type) + +(external_enum + name: (identifier) @type) + +(type + name: (identifier) @type) + +[ + "map" + "nullable" + "result" + "required" + "http" + "csharp" + "js" + "info" + "obsolete" +] @attribute.builtin + +(parameter + name: (identifier) @property) + +(field + name: (identifier) @variable) + +(method + name: (identifier) @method) + +(number_literal) @number +(string_literal) @string diff --git a/queries/facility/indents.scm b/queries/facility/indents.scm new file mode 100644 index 000000000..96a24f202 --- /dev/null +++ b/queries/facility/indents.scm @@ -0,0 +1,8 @@ +[ + (service_block) + (values_block) + (field_list) +] @indent.begin + +"}" @indent.branch + diff --git a/queries/facility/injections.scm b/queries/facility/injections.scm new file mode 100644 index 000000000..572849ab4 --- /dev/null +++ b/queries/facility/injections.scm @@ -0,0 +1,5 @@ +((remarks) @injection.content + (#set! injection.language "markdown")) + +([(comment) (doc_comment)] @injection.content + (#set! injection.language "comment")) From b04f990f92e41d0909de20a970a4a3c0fde5557e Mon Sep 17 00:00:00 2001 From: GitHub Date: Wed, 29 Nov 2023 06:37:42 +0000 Subject: [PATCH 0697/2494] Update parsers: css, facility, foam, wing --- lockfile.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lockfile.json b/lockfile.json index 2a681c306..fe6355734 100644 --- a/lockfile.json +++ b/lockfile.json @@ -84,7 +84,7 @@ "revision": "a71474021410973b29bfe99440d57bcd750246b1" }, "css": { - "revision": "fec7d3757ab8f46a0ffe298be99b16ad5b9fa229" + "revision": "98c7b3dceb24f1ee17f1322f3947e55638251c37" }, "csv": { "revision": "6c1957405bd6f7751b050f61367f1094fab91444" @@ -150,7 +150,7 @@ "revision": "56942778b5791d07949e6c7b6093e01aba5b7ab4" }, "facility": { - "revision": "a2f90a0d4a3c41bcaa80cabb5f7467daefcd33f4" + "revision": "a52579670e2b14ec03d410c3c980fafaf6d659c4" }, "fennel": { "revision": "517195970428aacca60891b050aa53eabf4ba78d" @@ -162,7 +162,7 @@ "revision": "f9176908c9eb2e11eb684d79e1d00f3b29bd65c9" }, "foam": { - "revision": "09e03445f49290450589c5d293610ab39434e3e4" + "revision": "df1c0759e101b26e536254ca45d1ea7ca976fd58" }, "forth": { "revision": "90189238385cf636b9ee99ce548b9e5b5e569d48" @@ -711,7 +711,7 @@ "revision": "a041228ae64632f59b9bd37346a0dbcb7817f36b" }, "wing": { - "revision": "97d7dd56bfd0e0642ef43bbb29cae2c78e6d520e" + "revision": "0c2c28b3227cd902bd54b1eb02908a967ab2f525" }, "xcompose": { "revision": "01344fed31a3cd37a63f03357ec80cbc592a93b5" From 10432e6b0fb22a0fbe7b8fa45f7fbee187029d90 Mon Sep 17 00:00:00 2001 From: Stephan Seitz Date: Sat, 18 Nov 2023 20:52:31 +0100 Subject: [PATCH 0698/2494] parsers: add tree-sitter-slang --- README.md | 1 + lockfile.json | 3 +++ lua/nvim-treesitter/parsers.lua | 11 +++++++++ queries/slang/folds.scm | 9 +++++++ queries/slang/highlights.scm | 42 +++++++++++++++++++++++++++++++++ queries/slang/indents.scm | 6 +++++ queries/slang/injections.scm | 5 ++++ queries/slang/locals.scm | 1 + 8 files changed, 78 insertions(+) create mode 100644 queries/slang/folds.scm create mode 100644 queries/slang/highlights.scm create mode 100644 queries/slang/indents.scm create mode 100644 queries/slang/injections.scm create mode 100644 queries/slang/locals.scm diff --git a/README.md b/README.md index 3d0e495ef..8a5c41651 100644 --- a/README.md +++ b/README.md @@ -360,6 +360,7 @@ We are looking for maintainers to add more parsers and to write query files for - [x] [scfg](https://git.sr.ht/~rockorager/tree-sitter-scfg) (maintained by @WhyNotHugo) - [ ] [scheme](https://github.com/6cdh/tree-sitter-scheme) - [x] [scss](https://github.com/serenadeai/tree-sitter-scss) (maintained by @elianiva) +- [x] [slang](https://github.com/theHamsta/tree-sitter-slang) (experimental, maintained by @theHamsta) - [x] [slint](https://github.com/jrmoulton/tree-sitter-slint) (experimental, maintained by @jrmoulton) - [x] [smali](https://git.sr.ht/~yotam/tree-sitter-smali) (maintained by @amaanq) - [x] [smithy](https://github.com/indoorvivants/tree-sitter-smithy) (maintained by @amaanq, @keynmol) diff --git a/lockfile.json b/lockfile.json index fe6355734..6ff0b40f9 100644 --- a/lockfile.json +++ b/lockfile.json @@ -560,6 +560,9 @@ "scss": { "revision": "c478c6868648eff49eb04a4df90d703dc45b312a" }, + "slang": { + "revision": "47415d3f9ed2b3df9b9fc5f5d0ee1a71be3c67e0" + }, "slint": { "revision": "00c8a2d3645766f68c0d0460086c0a994e5b0d85" }, diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 3945f1167..86bb7e358 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -1649,6 +1649,17 @@ list.scss = { maintainers = { "@elianiva" }, } +list.slang = { + install_info = { + url = "https://github.com/theHamsta/tree-sitter-slang", + files = { "src/parser.c", "src/scanner.c" }, + generate_requires_npm = true, + }, + filetype = "shaderslang", + maintainers = { "@theHamsta" }, + experimental = true, +} + list.slint = { install_info = { url = "https://github.com/jrmoulton/tree-sitter-slint", diff --git a/queries/slang/folds.scm b/queries/slang/folds.scm new file mode 100644 index 000000000..c8cc87643 --- /dev/null +++ b/queries/slang/folds.scm @@ -0,0 +1,9 @@ +; inherits: hlsl + +[ + (interface_specifier) + (extension_specifier) + (property_declaration) + (subscript_declaration) + (init_declaration) +] @fold diff --git a/queries/slang/highlights.scm b/queries/slang/highlights.scm new file mode 100644 index 000000000..6fd5f45ea --- /dev/null +++ b/queries/slang/highlights.scm @@ -0,0 +1,42 @@ +; inherits: hlsl + +[ + "var" + "let" + "This" +] @type.builtin + +[ + "interface" + "extension" + "property" +] @keyword + +[ + "__init" +] @constructor + +[ + "__subscript" + "get" + "set" +] @function.builtin + +(interface_requirements (identifier) @type) + +(binary_expression + ["is" "as"] + right: (identifier) @type) + +[ + "as" + "is" +] @keyword.operator + +[ + "__exported" + "import" +] @include + +(property_declaration + (identifier) @property) diff --git a/queries/slang/indents.scm b/queries/slang/indents.scm new file mode 100644 index 000000000..6175ac5bc --- /dev/null +++ b/queries/slang/indents.scm @@ -0,0 +1,6 @@ +; inherits: hlsl + +[ + (interface_specifier) + (extension_specifier) +] @indent.begin diff --git a/queries/slang/injections.scm b/queries/slang/injections.scm new file mode 100644 index 000000000..bf83e478a --- /dev/null +++ b/queries/slang/injections.scm @@ -0,0 +1,5 @@ +((preproc_arg) @injection.content + (#set! injection.language "slang")) + +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/slang/locals.scm b/queries/slang/locals.scm new file mode 100644 index 000000000..647bd1fef --- /dev/null +++ b/queries/slang/locals.scm @@ -0,0 +1 @@ +; inherits: hlsl From fb101ed49d4b9e0e6661a24b636a6d874f8de49d Mon Sep 17 00:00:00 2001 From: Riley Bruins Date: Mon, 27 Nov 2023 08:15:20 -0800 Subject: [PATCH 0699/2494] feat(make): give targets the function highlight --- queries/make/highlights.scm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/queries/make/highlights.scm b/queries/make/highlights.scm index 17a100edf..e4d0e7c44 100644 --- a/queries/make/highlights.scm +++ b/queries/make/highlights.scm @@ -10,6 +10,8 @@ ] @conditional) "endif" @conditional) +(rule (targets (word) @function)) + (rule (targets (word) @function.builtin (#any-of? @function.builtin From 8f16c39f5b439bd9540336c4d5da705d180e34b9 Mon Sep 17 00:00:00 2001 From: Riley Bruins Date: Mon, 27 Nov 2023 12:51:33 -0800 Subject: [PATCH 0700/2494] feat(make): highlight phony prerequisites as functions --- queries/make/highlights.scm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/queries/make/highlights.scm b/queries/make/highlights.scm index e4d0e7c44..b224a6765 100644 --- a/queries/make/highlights.scm +++ b/queries/make/highlights.scm @@ -12,6 +12,11 @@ (rule (targets (word) @function)) +(rule + (targets) @_target + (prerequisites (word) @function + (#eq? @_target ".PHONY"))) + (rule (targets (word) @function.builtin (#any-of? @function.builtin From e9acd01a4a1f6e584f76e736987f4c31401aa4b1 Mon Sep 17 00:00:00 2001 From: Riley Bruins Date: Wed, 29 Nov 2023 16:36:07 -0800 Subject: [PATCH 0701/2494] fix(markdown): revert bullet conceals due to spacing issues (#5742) --- queries/markdown/highlights.scm | 38 ++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/queries/markdown/highlights.scm b/queries/markdown/highlights.scm index 085a1d827..9ffc6ee86 100644 --- a/queries/markdown/highlights.scm +++ b/queries/markdown/highlights.scm @@ -34,23 +34,27 @@ (info_string (language) @conceal (#set! conceal ""))) -;; 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 "—")) +; 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 "—")) (code_fence_content) @none From 93750d388162f5658cfdb77bdcfe80711e637647 Mon Sep 17 00:00:00 2001 From: GitHub Date: Thu, 30 Nov 2023 06:36:35 +0000 Subject: [PATCH 0702/2494] Update parsers: c_sharp, foam, slang, v, wing --- lockfile.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lockfile.json b/lockfile.json index 6ff0b40f9..ad0480700 100644 --- a/lockfile.json +++ b/lockfile.json @@ -48,7 +48,7 @@ "revision": "212a80f86452bb1316324fa0db730cf52f29e05a" }, "c_sharp": { - "revision": "1648e21b4f087963abf0101ee5221bb413107b07" + "revision": "dd5e59721a5f8dae34604060833902b882023aaf" }, "cairo": { "revision": "6216c6ee5e9fc0649c4bd7b1aedd884a55bdd9ef" @@ -162,7 +162,7 @@ "revision": "f9176908c9eb2e11eb684d79e1d00f3b29bd65c9" }, "foam": { - "revision": "df1c0759e101b26e536254ca45d1ea7ca976fd58" + "revision": "04664b40c0dadb7ef37028acf3422c63271d377b" }, "forth": { "revision": "90189238385cf636b9ee99ce548b9e5b5e569d48" @@ -561,7 +561,7 @@ "revision": "c478c6868648eff49eb04a4df90d703dc45b312a" }, "slang": { - "revision": "47415d3f9ed2b3df9b9fc5f5d0ee1a71be3c67e0" + "revision": "11526ab1a2514c7302f3c4af60b0ebc992cee086" }, "slint": { "revision": "00c8a2d3645766f68c0d0460086c0a994e5b0d85" @@ -687,7 +687,7 @@ "revision": "4c5ecd6326ebd61f6f9a22a370cbd100e0d601da" }, "v": { - "revision": "20433e0d8ff5bb6e7bb28d12948773be2bdd983d" + "revision": "165ed9fda0be82ff26639dd8cf5d93fe7f7432a0" }, "vala": { "revision": "8f690bfa639f2b83d1fb938ed3dd98a7ba453e8b" @@ -714,7 +714,7 @@ "revision": "a041228ae64632f59b9bd37346a0dbcb7817f36b" }, "wing": { - "revision": "0c2c28b3227cd902bd54b1eb02908a967ab2f525" + "revision": "9573195e753fa0d303e65d8237d3902159708457" }, "xcompose": { "revision": "01344fed31a3cd37a63f03357ec80cbc592a93b5" From 00f9b1ffed50803b8653c32e9799bd027fe13405 Mon Sep 17 00:00:00 2001 From: Marc Jakobi Date: Mon, 30 Oct 2023 21:33:09 +0100 Subject: [PATCH 0703/2494] fix(luarocks): don't copy runtime data to share/ --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 139e6cb99..338c75463 100644 --- a/Makefile +++ b/Makefile @@ -4,4 +4,4 @@ build: install: mkdir -p $(INST_LUADIR) - cp -r autoload plugin queries lua $(INST_LUADIR) + cp -r lua/* $(INST_LUADIR) From 1e64838ff575405c32b447b68762649289e8d73c Mon Sep 17 00:00:00 2001 From: Marc Jakobi Date: Mon, 30 Oct 2023 21:45:31 +0100 Subject: [PATCH 0704/2494] fix(luarocks): enable automatic runtime path detection --- contrib/nvim-treesitter-luarocks.template | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/contrib/nvim-treesitter-luarocks.template b/contrib/nvim-treesitter-luarocks.template index 3bb15d3b2..8109f5f2b 100644 --- a/contrib/nvim-treesitter-luarocks.template +++ b/contrib/nvim-treesitter-luarocks.template @@ -37,9 +37,5 @@ build = { INST_LUADIR='$(LUADIR)', INST_CONFDIR='$(CONFDIR)', }, - copy_directories = { - 'autoload', - 'plugin', - 'queries' - } + copy_directories = $copy_directories, } From 36f81e698ee67cba76f698a5a86fb7c6ecdeb7b0 Mon Sep 17 00:00:00 2001 From: aMOPel <36712072+aMOPel@users.noreply.github.com> Date: Thu, 30 Nov 2023 16:21:43 +0100 Subject: [PATCH 0705/2494] feat(nim): added some captures and fixed some bugs (#5664) * fix(nim): literals in pragmas in types would be falsly highlighted as `@variable` * style(nim): removed trailing whitespace * fix(nim): identifiers in (type_expression (pragma_expression)) would be captured as `@type` * fix(nim): changed generic parameters when declaring from @type to @parameter * feat(nim): added @constant capture for (identifier)s x, y in `array[x..y, type]` * feat(nim): added @function.call capture for (identifier)s in second argument to `varargs[type, routine]` --- queries/nim/highlights.scm | 103 ++++++++++++++++++++++++++++--------- 1 file changed, 78 insertions(+), 25 deletions(-) diff --git a/queries/nim/highlights.scm b/queries/nim/highlights.scm index e3aa64d2c..a743c544b 100644 --- a/queries/nim/highlights.scm +++ b/queries/nim/highlights.scm @@ -10,6 +10,25 @@ ; capture nodes containing (identifier) as a whole, while overruling the ; @variable capture. +(type_expression) @type +; NOTE: has to be after +; ((identifier) @variable (#set! "priority" 99)) + +; overrule identifiers in pragmas in (proc_type)s and (pragma_expression)s +(proc_type + pragmas: + (pragma_list) @variable) +(iterator_type + pragmas: + (pragma_list) @variable) +(type_expression + (pragma_expression + right: + (pragma_list) @variable)) +; NOTE: has to be after +; (type_expression) @type +; and before @preproc and all literals + ; ============================================================================= ; @comment ; line and block comments @@ -22,8 +41,8 @@ ; @comment.documentation ; comments documenting code (documentation_comment "##" @comment.documentation) -(block_documentation_comment - "##[" @comment.documentation +(block_documentation_comment + "##[" @comment.documentation "]##" @comment.documentation) ; NOTE: leaving content uncaptured so markdown can be injected @@ -217,6 +236,22 @@ ]) ; NOTE: will double capture as @function.call if it also has argument_list +; function.calls in `varargs[type, routine]` +(bracket_expression + left: (identifier) @_varargs + right: + (argument_list + . + (_) + . + [ + (identifier) @function.call + (accent_quoted (identifier) @function.call) + (dot_expression right: (identifier) @function.call) + (dot_expression right: (accent_quoted (identifier) @function.call)) + ]) + (#eq? @_varargs "varargs")) + ; ============================================================================= ; @function.macro ; preprocessor macros @@ -405,26 +440,6 @@ ; ============================================================================= ; @type ; type or class definitions and annotations -(type_expression) @type - -; overrule identifiers in pragmas in (proc_type)s -(proc_type - pragmas: (pragma_list (_) @variable) - (#set! "priority" 101)) -(iterator_type - pragmas: (pragma_list (_) @variable) - (#set! "priority" 101)) - -; generic types when declaring -((generic_parameter_list - (parameter_declaration - (symbol_declaration_list - (symbol_declaration - name: [ - (identifier) @type - (accent_quoted (identifier) @type) - ]))))) - ; generic types when calling (call function: (bracket_expression @@ -432,8 +447,6 @@ ; NOTE: this also falsely matches ; when accessing and directly call elements from an array of routines ; eg `array_of_routines[index](arguments), but that is an uncommon case -; NOTE: this will falsly capture (identifier)s that aren't types as well, eg -; array[enum1..enum2, int] (dot_generic_call generic_arguments: (_) @type) @@ -491,6 +504,16 @@ ])))) ; NOTE: needs to be after @type +; generic types when declaring +((generic_parameter_list + (parameter_declaration + (symbol_declaration_list + (symbol_declaration + name: [ + (identifier) @parameter + (accent_quoted (identifier) @parameter) + ]))))) + ; for loop variables (for left: @@ -510,7 +533,7 @@ (#has-ancestor? @_tuple_decons for)) (concept_declaration - parameters: + parameters: (parameter_list [ (identifier) @parameter (accent_quoted (identifier) @parameter) @@ -665,6 +688,36 @@ ])) @_tuple_decons (#has-ancestor? @_tuple_decons const_section)) +; constants x and y in `array[x..y, type]` +(bracket_expression + left: (identifier) @_array + right: + (argument_list + . + (infix_expression + right: [ + (identifier) @constant + (accent_quoted (identifier) @constant) + (dot_expression right: (identifier) @constant) + (dot_expression right: (accent_quoted (identifier) @constant)) + ])) + (#any-of? @_array "array" "range")) +(bracket_expression + left: (identifier) @_array + right: + (argument_list + . + (infix_expression + left: [ + (identifier) @constant + (accent_quoted (identifier) @constant) + (dot_expression right: (identifier) @constant) + (dot_expression right: (accent_quoted (identifier) @constant)) + ])) + (#any-of? @_array "array" "range")) +; NOTE: can only do this for (infix_expression)s, since standalone identifiers +; could be ordinal types and constants + ; ============================================================================= ; @constant.builtin ; built-in constant values From b41bbcbb9a2c5543d3bfa4cf7e2b0948a5f61ce6 Mon Sep 17 00:00:00 2001 From: Tomohiro Hashidate Date: Fri, 1 Dec 2023 01:22:29 +0900 Subject: [PATCH 0706/2494] feat: add rbs parser support (#5745) --- README.md | 1 + lockfile.json | 3 + lua/nvim-treesitter/parsers.lua | 8 +++ queries/rbs/folds.scm | 5 ++ queries/rbs/highlights.scm | 117 ++++++++++++++++++++++++++++++++ queries/rbs/indents.scm | 24 +++++++ queries/rbs/injections.scm | 2 + 7 files changed, 160 insertions(+) create mode 100644 queries/rbs/folds.scm create mode 100644 queries/rbs/highlights.scm create mode 100644 queries/rbs/indents.scm create mode 100644 queries/rbs/injections.scm diff --git a/README.md b/README.md index 8a5c41651..5a334ca4e 100644 --- a/README.md +++ b/README.md @@ -346,6 +346,7 @@ We are looking for maintainers to add more parsers and to write query files for - [x] [r](https://github.com/r-lib/tree-sitter-r) (maintained by @echasnovski) - [ ] [racket](https://github.com/6cdh/tree-sitter-racket) - [x] [rasi](https://github.com/Fymyte/tree-sitter-rasi) (maintained by @Fymyte) +- [x] [rbs](https://github.com/joker1007/tree-sitter-rbs) (maintained by @joker1007) - [x] [re2c](https://github.com/amaanq/tree-sitter-re2c) (maintained by @amaanq) - [x] [regex](https://github.com/tree-sitter/tree-sitter-regex) (maintained by @theHamsta) - [x] [rego](https://github.com/FallenAngel97/tree-sitter-rego) (maintained by @FallenAngel97) diff --git a/lockfile.json b/lockfile.json index ad0480700..b6632930d 100644 --- a/lockfile.json +++ b/lockfile.json @@ -518,6 +518,9 @@ "rasi": { "revision": "371dac6bcce0df5566c1cfebde69d90ecbeefd2d" }, + "rbs": { + "revision": "192eda46774fd0281cdd41d372d5b4da86148780" + }, "re2c": { "revision": "47aa19cf5f7aba2ed30e2b377f7172df76e819a6" }, diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 86bb7e358..640018cff 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -1536,6 +1536,14 @@ list.rasi = { maintainers = { "@Fymyte" }, } +list.rbs = { + install_info = { + url = "https://github.com/joker1007/tree-sitter-rbs", + files = { "src/parser.c" }, + }, + maintainers = { "@joker1007" }, +} + list.re2c = { install_info = { url = "https://github.com/amaanq/tree-sitter-re2c", diff --git a/queries/rbs/folds.scm b/queries/rbs/folds.scm new file mode 100644 index 000000000..ff8e7c588 --- /dev/null +++ b/queries/rbs/folds.scm @@ -0,0 +1,5 @@ +[ + (class_decl) + (module_decl) + (interface_decl) +] @fold diff --git a/queries/rbs/highlights.scm b/queries/rbs/highlights.scm new file mode 100644 index 000000000..e985e8e0a --- /dev/null +++ b/queries/rbs/highlights.scm @@ -0,0 +1,117 @@ +; Use directive + +(use_clause + [ + (type_name) + (simple_type_name) + ] @type) + +; Buitin constants and Keywords + +[ + "true" + "false" +] @boolean + +"nil" @constant.builtin + +[ + "use" + "as" + "class" + "module" + "interface" + "type" + "def" + "attr_reader" + "attr_writer" + "attr_accessor" + "end" + "alias" +] @keyword + +"def" @keyword.function + +; Members of declaration + +[ + "include" + "extend" + "prepend" +] @function.method + +(visibility) @type.qualifier + +(comment) @comment @spell + +(method_member + (method_name + [ + (identifier) + (constant) + (operator) + (setter) + ] @method)) + +[(ivar_name) (cvar_name)] @property + +(alias_member (method_name) @function) + +(class_name (constant) @type) +(module_name (constant) @type) +(interface_name (interface) @type) +(alias_name (identifier) @type) +(type_variable) @constant +(namespace (constant) @namespace) + +(builtin_type) @type.builtin + +(const_name (constant) @constant) +(global_name) @property + +; Standard Arguments +(parameter (var_name) @parameter) + +; Keyword Arguments +(keyword) @parameter + +; Self +(self) @variable.builtin + +; Literal +(type (symbol_literal) @symbol) + +(type (string_literal (escape_sequence) @string.escape)) +(type (string_literal) @string) + +(type (integer_literal) @number) + +; Operators + +[ + "=" + "->" + "<" + "**" + "*" + "&" + "|" + "^" + ] @operator + +; Punctuation + +[ + "(" + ")" + "[" + "]" + "{" + "}" + ] @punctuation.bracket + + +[ + "," + "." + ] @punctuation.delimiter diff --git a/queries/rbs/indents.scm b/queries/rbs/indents.scm new file mode 100644 index 000000000..f6da5b10b --- /dev/null +++ b/queries/rbs/indents.scm @@ -0,0 +1,24 @@ +[ + (class_decl) + (module_decl) + (interface_decl) + (parameters) + (tuple_type) + (record_type) +] @indent.begin + +[ + "end" + ")" + "]" + "}" +] @indent.end + +[ + "end" + ")" + "}" + "]" +] @indent.branch + +(comment) @indent.auto diff --git a/queries/rbs/injections.scm b/queries/rbs/injections.scm new file mode 100644 index 000000000..321c90add --- /dev/null +++ b/queries/rbs/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) From 80a16deb5146a3eb4648effccda1ab9f45e43e76 Mon Sep 17 00:00:00 2001 From: GitHub Date: Fri, 1 Dec 2023 06:37:10 +0000 Subject: [PATCH 0707/2494] Update parsers: rbs --- lockfile.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lockfile.json b/lockfile.json index b6632930d..ad28ea03f 100644 --- a/lockfile.json +++ b/lockfile.json @@ -519,7 +519,7 @@ "revision": "371dac6bcce0df5566c1cfebde69d90ecbeefd2d" }, "rbs": { - "revision": "192eda46774fd0281cdd41d372d5b4da86148780" + "revision": "23c69a4fa9803abc9d87b235ca88d52418250041" }, "re2c": { "revision": "47aa19cf5f7aba2ed30e2b377f7172df76e819a6" From 0791b5ebb590a2d44e20640c52679df1fc42e8ab Mon Sep 17 00:00:00 2001 From: GitHub Date: Sun, 3 Dec 2023 06:34:44 +0000 Subject: [PATCH 0708/2494] Update parsers: elm --- lockfile.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lockfile.json b/lockfile.json index ad28ea03f..23abeb9dd 100644 --- a/lockfile.json +++ b/lockfile.json @@ -135,7 +135,7 @@ "revision": "a2861e88a730287a60c11ea9299c033c7d076e30" }, "elm": { - "revision": "debe14fad40a8100c679d95c66f599b48111742c" + "revision": "0ae8d475281a25e9d7ab1068a952ff9a1615c0df" }, "elsa": { "revision": "0a66b2b3f3c1915e67ad2ef9f7dbd2a84820d9d7" From 67536f4057e4901e37805708bcfdd3d9abacfd26 Mon Sep 17 00:00:00 2001 From: GitHub Date: Mon, 4 Dec 2023 06:38:17 +0000 Subject: [PATCH 0709/2494] Update parsers: elixir, qmljs, wing --- lockfile.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lockfile.json b/lockfile.json index 23abeb9dd..48b0e597b 100644 --- a/lockfile.json +++ b/lockfile.json @@ -132,7 +132,7 @@ "revision": "f742f2fe327463335e8671a87c0b9b396905d1d1" }, "elixir": { - "revision": "a2861e88a730287a60c11ea9299c033c7d076e30" + "revision": "11426c5fd20eef360d5ecaf10729191f6bc5d715" }, "elm": { "revision": "0ae8d475281a25e9d7ab1068a952ff9a1615c0df" @@ -504,7 +504,7 @@ "revision": "6b2b5e41734bd6f07ea4c36ac20fb6f14061c841" }, "qmljs": { - "revision": "35ead5b9955cdb29bcf709d622fa960ff33992b6" + "revision": "259133077f2fd854bcaa6f0149d3fc281fc8070b" }, "query": { "revision": "3a9808b22742d5bd906ef5d1a562f2f1ae57406d" @@ -717,7 +717,7 @@ "revision": "a041228ae64632f59b9bd37346a0dbcb7817f36b" }, "wing": { - "revision": "9573195e753fa0d303e65d8237d3902159708457" + "revision": "ee7bc3b0557a48cc22221f4ced5ca6c56cfe76db" }, "xcompose": { "revision": "01344fed31a3cd37a63f03357ec80cbc592a93b5" From 3065a928fc134167f439230b01216e45198be715 Mon Sep 17 00:00:00 2001 From: ObserverOfTime Date: Mon, 4 Dec 2023 20:37:26 +0200 Subject: [PATCH 0710/2494] fix(java): move attributes after constants --- queries/java/highlights.scm | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/queries/java/highlights.scm b/queries/java/highlights.scm index ae498a159..27f139ec2 100644 --- a/queries/java/highlights.scm +++ b/queries/java/highlights.scm @@ -32,15 +32,6 @@ (lambda_expression parameters: (identifier) @parameter) ; x -> ... -; Annotations - -(annotation - "@" @attribute - name: (identifier) @attribute) -(marker_annotation - "@" @attribute - name: (identifier) @attribute) - ; Operators [ @@ -135,6 +126,15 @@ (this) @variable.builtin +; Annotations + +(annotation + "@" @attribute + name: (identifier) @attribute) +(marker_annotation + "@" @attribute + name: (identifier) @attribute) + ; Literals (string_literal) @string From c203884c80ef31b6a3993398734fbe008addcb27 Mon Sep 17 00:00:00 2001 From: GitHub Date: Tue, 5 Dec 2023 06:36:57 +0000 Subject: [PATCH 0711/2494] Update parsers: liquidsoap, rbs, vhs, wing --- lockfile.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lockfile.json b/lockfile.json index 48b0e597b..32e32851d 100644 --- a/lockfile.json +++ b/lockfile.json @@ -342,7 +342,7 @@ "revision": "f99011a3554213b654985a4b0a65b3b032ec4621" }, "liquidsoap": { - "revision": "91d2708e12a5869154a85190b13ac89cb1414189" + "revision": "691484ae766c4eee2ac59ec09e621b27b9ed9add" }, "llvm": { "revision": "1b96e58faf558ce057d4dc664b904528aee743cb" @@ -519,7 +519,7 @@ "revision": "371dac6bcce0df5566c1cfebde69d90ecbeefd2d" }, "rbs": { - "revision": "23c69a4fa9803abc9d87b235ca88d52418250041" + "revision": "75b42d86e84f01bb3a367d7d7b9bd40de84d5ad7" }, "re2c": { "revision": "47aa19cf5f7aba2ed30e2b377f7172df76e819a6" @@ -699,7 +699,7 @@ "revision": "902031343056bc0b11f3e47b33f036a9cf59f58d" }, "vhs": { - "revision": "375b42e9845f704dd491c17c7e37f7c972e0faf3" + "revision": "9534865e614c95eb9418e5e73f061c32fa4d9540" }, "vim": { "revision": "32c76f150347c1cd044e90b8e2bc73c00677fa55" @@ -717,7 +717,7 @@ "revision": "a041228ae64632f59b9bd37346a0dbcb7817f36b" }, "wing": { - "revision": "ee7bc3b0557a48cc22221f4ced5ca6c56cfe76db" + "revision": "0ea8670963539fcf1b13a6a9c32e72179080e7d7" }, "xcompose": { "revision": "01344fed31a3cd37a63f03357ec80cbc592a93b5" From f861bc6148e7bc715f6a09bd34bb1f577b62a248 Mon Sep 17 00:00:00 2001 From: GitHub Date: Thu, 7 Dec 2023 06:37:00 +0000 Subject: [PATCH 0712/2494] Update parsers: gleam, wing --- lockfile.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lockfile.json b/lockfile.json index 32e32851d..edec3f779 100644 --- a/lockfile.json +++ b/lockfile.json @@ -198,7 +198,7 @@ "revision": "f4685bf11ac466dd278449bcfe5fd014e94aa504" }, "gleam": { - "revision": "b2afa4fd6bb41a7bf912b034c653c90af7ae5122" + "revision": "3479db3d2024406c2a35cc16c96e89f972c9a439" }, "glimmer": { "revision": "f9746dc1d0707717fbba84cb5c22a71586af23e1" @@ -717,7 +717,7 @@ "revision": "a041228ae64632f59b9bd37346a0dbcb7817f36b" }, "wing": { - "revision": "0ea8670963539fcf1b13a6a9c32e72179080e7d7" + "revision": "4f02229bc407bc678b52ba3c49a0b06447d2d8c3" }, "xcompose": { "revision": "01344fed31a3cd37a63f03357ec80cbc592a93b5" From 180e1ca385442e35e1d18420221a148c5e045671 Mon Sep 17 00:00:00 2001 From: GitHub Date: Fri, 8 Dec 2023 06:36:38 +0000 Subject: [PATCH 0713/2494] Update parsers: gitcommit, gleam, rbs, sql, wing --- lockfile.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lockfile.json b/lockfile.json index edec3f779..002684da3 100644 --- a/lockfile.json +++ b/lockfile.json @@ -192,13 +192,13 @@ "revision": "19d554d39e4a8491f7a77abcdb75bfbc1c19d0b5" }, "gitcommit": { - "revision": "6856a5fd0ffeff17d83325a8ce4e57811010eff1" + "revision": "7e3ad5fdc61cd701e146ef78e4fc6dcdf6dbca0e" }, "gitignore": { "revision": "f4685bf11ac466dd278449bcfe5fd014e94aa504" }, "gleam": { - "revision": "3479db3d2024406c2a35cc16c96e89f972c9a439" + "revision": "c9c7f0f01749d301b54e96ed8e0c47c7c415a196" }, "glimmer": { "revision": "f9746dc1d0707717fbba84cb5c22a71586af23e1" @@ -519,7 +519,7 @@ "revision": "371dac6bcce0df5566c1cfebde69d90ecbeefd2d" }, "rbs": { - "revision": "75b42d86e84f01bb3a367d7d7b9bd40de84d5ad7" + "revision": "b28e1819d434e95916d11fe48ee6e8959b69197b" }, "re2c": { "revision": "47aa19cf5f7aba2ed30e2b377f7172df76e819a6" @@ -591,7 +591,7 @@ "revision": "05f949d3c1c15e3261473a244d3ce87777374dec" }, "sql": { - "revision": "a3ea0e4143a617fc2c4ccf29c41e0ba7a1ff6ab9" + "revision": "1b7d451554f435d28c3217724acf00cdc627ee73" }, "squirrel": { "revision": "e8b5835296f931bcaa1477d3c5a68a0c5c2ba034" @@ -717,7 +717,7 @@ "revision": "a041228ae64632f59b9bd37346a0dbcb7817f36b" }, "wing": { - "revision": "4f02229bc407bc678b52ba3c49a0b06447d2d8c3" + "revision": "55f5626617726954a1a95aa93e363a6a04913fa1" }, "xcompose": { "revision": "01344fed31a3cd37a63f03357ec80cbc592a93b5" From bd5517989398145c36d859927fb4e76a45c66cf6 Mon Sep 17 00:00:00 2001 From: gbprod Date: Sat, 9 Dec 2023 04:36:17 +0100 Subject: [PATCH 0714/2494] feat(gitcommit): add highlight group for subject_prefix (#5774) --- queries/gitcommit/highlights.scm | 1 + 1 file changed, 1 insertion(+) diff --git a/queries/gitcommit/highlights.scm b/queries/gitcommit/highlights.scm index 15ba85ef8..9c70e19b5 100644 --- a/queries/gitcommit/highlights.scm +++ b/queries/gitcommit/highlights.scm @@ -9,6 +9,7 @@ (subject) @text.title @spell (subject (overflow) @text @spell) +(subject (subject_prefix) @function @nospell) (prefix (type) @keyword @nospell) (prefix (scope) @parameter @nospell) (prefix [ From 401ef01feb9228e6bd33a25bbae7c9e23127efff Mon Sep 17 00:00:00 2001 From: GitHub Date: Sat, 9 Dec 2023 06:35:28 +0000 Subject: [PATCH 0715/2494] Update parsers: nickel, v --- lockfile.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lockfile.json b/lockfile.json index 002684da3..37e79de71 100644 --- a/lockfile.json +++ b/lockfile.json @@ -390,7 +390,7 @@ "revision": "3bc691d2cfba44bea339a775ad496c8bc552c60d" }, "nickel": { - "revision": "b759233581fd8bae239e905c67a9ba453205da78" + "revision": "502a8746c82c616ed441e0ab2b8c09772ee7d114" }, "nim": { "revision": "1f9308c9e440ddbc67c0aaeb9396c992d266b281" @@ -690,7 +690,7 @@ "revision": "4c5ecd6326ebd61f6f9a22a370cbd100e0d601da" }, "v": { - "revision": "165ed9fda0be82ff26639dd8cf5d93fe7f7432a0" + "revision": "ce3481c10eabed0ba36cfa9f72957c4d3f88689d" }, "vala": { "revision": "8f690bfa639f2b83d1fb938ed3dd98a7ba453e8b" From 1b5bbb54b385c4eae217113f72df5284bc3cc94b Mon Sep 17 00:00:00 2001 From: ObserverOfTime Date: Wed, 6 Dec 2023 11:10:33 +0200 Subject: [PATCH 0716/2494] fix(vim): highlight 'scriptencoding' command --- queries/vim/highlights.scm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/queries/vim/highlights.scm b/queries/vim/highlights.scm index c5bd2e947..9bae16ae9 100644 --- a/queries/vim/highlights.scm +++ b/queries/vim/highlights.scm @@ -83,6 +83,7 @@ "delcommand" "comclear" "colorscheme" + "scriptencoding" "startinsert" "stopinsert" "global" @@ -194,6 +195,10 @@ (colorscheme_statement (name) @string) +;; Scriptencoding command + +(scriptencoding_statement (encoding) @string.special) + ;; Literals (string_literal) @string From 7958ff9ec7a2baea2842323d0e7ac67a509da4d2 Mon Sep 17 00:00:00 2001 From: ObserverOfTime Date: Sat, 9 Dec 2023 16:59:12 +0200 Subject: [PATCH 0717/2494] feat(poe_filter): add new Import statement --- lockfile.json | 2 +- queries/poe_filter/highlights.scm | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lockfile.json b/lockfile.json index 37e79de71..3f86074b7 100644 --- a/lockfile.json +++ b/lockfile.json @@ -459,7 +459,7 @@ "revision": "39da859947b94abdee43e431368e1ae975c0a424" }, "poe_filter": { - "revision": "374f618de179498c2a821136bb86c3edbe221e10" + "revision": "fa83292e04d27976ab5c354e0c980f2c67628a02" }, "pony": { "revision": "16f930b250433cfcd4fb4144df92bb98ad344c20" diff --git a/queries/poe_filter/highlights.scm b/queries/poe_filter/highlights.scm index 6914865a1..3b233a7d8 100644 --- a/queries/poe_filter/highlights.scm +++ b/queries/poe_filter/highlights.scm @@ -1,5 +1,7 @@ ["Show" "Hide" "Minimal"] @namespace +["Import" "Optional"] @include + (condition (name) @conditional) (action (name) @keyword) (continue) @label @@ -8,7 +10,7 @@ (string) @string -(file) @string +(file) @string.special [ (quality) @@ -33,6 +35,7 @@ "\"" @punctuation.delimiter +; conceal unnecessary quotes ("\"" @conceal (#not-has-parent? @conceal string file) (#set! conceal "")) From b6b9ca448b7f236e2e60f8393a729902511f9db9 Mon Sep 17 00:00:00 2001 From: r001 Date: Sun, 10 Dec 2023 11:16:24 +0400 Subject: [PATCH 0718/2494] indents added new language highlights added (#5777) --- lockfile.json | 2 +- queries/leo/highlights.scm | 2 ++ queries/leo/indents.scm | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 queries/leo/indents.scm diff --git a/lockfile.json b/lockfile.json index 3f86074b7..29d03c1a5 100644 --- a/lockfile.json +++ b/lockfile.json @@ -336,7 +336,7 @@ "revision": "8a841fb20ce683bfbb3469e6ba67f2851cfdf94a" }, "leo": { - "revision": "23a9534d09d523d0dcee7dbf89e7c819e6835f6f" + "revision": "304611b5eaf53aca07459a0a03803b83b6dfd3b3" }, "linkerscript": { "revision": "f99011a3554213b654985a4b0a65b3b032ec4621" diff --git a/queries/leo/highlights.scm b/queries/leo/highlights.scm index 86939e168..60f3fefeb 100644 --- a/queries/leo/highlights.scm +++ b/queries/leo/highlights.scm @@ -131,6 +131,7 @@ [ (block_height) (self_caller) + (self_signer) ] @constant.builtin (free_function_call @@ -172,6 +173,7 @@ [ (address_literal) + (signature_literal) ((affine_group_literal) (#set! "priority" 101)) (field_literal) (product_group_literal) diff --git a/queries/leo/indents.scm b/queries/leo/indents.scm new file mode 100644 index 000000000..a8de26ecd --- /dev/null +++ b/queries/leo/indents.scm @@ -0,0 +1,33 @@ +[ + (record_declaration) + (struct_declaration) + (mapping_declaration) + (constant_declaration) + (return_statement) + (expression_statement) + (variable_declaration) + (loop_statement) + (assignment_statement) + (assert_statement) + (struct_expression) + (array_expression) + (tuple_expression) + (parenthesized_expression) + (items_block) + (block) +] @indent.begin + +; if "if" statement and conditional statement are in separate lines +; conditional should be indented and when the conditional block +; starts dedented +(branch + (block "{" @indent.end)) @indent.begin + +((function_parameters) @indent.align + (#set! indent.open_delimiter "(") + (#set! indent.close_delimiter ")")) + +[ + (comment) + (ERROR) +] @indent.auto From a6c655629cad421e432aa84af32cbfe35375113a Mon Sep 17 00:00:00 2001 From: GitHub Date: Mon, 11 Dec 2023 06:37:56 +0000 Subject: [PATCH 0719/2494] Update parsers: nim, v, wing --- lockfile.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lockfile.json b/lockfile.json index 29d03c1a5..f280a58c3 100644 --- a/lockfile.json +++ b/lockfile.json @@ -393,7 +393,7 @@ "revision": "502a8746c82c616ed441e0ab2b8c09772ee7d114" }, "nim": { - "revision": "1f9308c9e440ddbc67c0aaeb9396c992d266b281" + "revision": "fe53e07e42fc6c8fab934ab3675d65b4247e9c29" }, "nim_format_string": { "revision": "d45f75022d147cda056e98bfba68222c9c8eca3a" @@ -690,7 +690,7 @@ "revision": "4c5ecd6326ebd61f6f9a22a370cbd100e0d601da" }, "v": { - "revision": "ce3481c10eabed0ba36cfa9f72957c4d3f88689d" + "revision": "012e7732614acf9ec75c0e5e774900da1313031e" }, "vala": { "revision": "8f690bfa639f2b83d1fb938ed3dd98a7ba453e8b" @@ -717,7 +717,7 @@ "revision": "a041228ae64632f59b9bd37346a0dbcb7817f36b" }, "wing": { - "revision": "55f5626617726954a1a95aa93e363a6a04913fa1" + "revision": "5feebac75906910415766f0aec55c24188e592c3" }, "xcompose": { "revision": "01344fed31a3cd37a63f03357ec80cbc592a93b5" From 78d75bce03f218ee30aedb6e24e3ec1189a3e9ff Mon Sep 17 00:00:00 2001 From: GitHub Date: Tue, 12 Dec 2023 06:36:49 +0000 Subject: [PATCH 0720/2494] Update parsers: gomod, haskell, hoon, nim, slang, sql, v, wing --- lockfile.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lockfile.json b/lockfile.json index f280a58c3..d21f79d81 100644 --- a/lockfile.json +++ b/lockfile.json @@ -216,7 +216,7 @@ "revision": "b6ef0768711086a86b3297056f9ffb5cc1d77b4a" }, "gomod": { - "revision": "f41a27386f1cfa1271122db5f0ff59b910520007" + "revision": "af4270aed18500af1d24e6de5f6e7d243e2c8b05" }, "gosum": { "revision": "e2ac513b2240c7ff1069ae33b2df29ce90777c11" @@ -243,7 +243,7 @@ "revision": "3d4af179414525a35dd069ba0208c9b71093d8b3" }, "haskell": { - "revision": "ca10c43a4c9bfe588c480d2941726c2fadcae699" + "revision": "d70b321b8b702939d722c2c15f4c28d14e91a400" }, "haskell_persistent": { "revision": "577259b4068b2c281c9ebf94c109bd50a74d5857" @@ -264,7 +264,7 @@ "revision": "c390f10519ae69fdb03b3e5764f5592fb6924bcc" }, "hoon": { - "revision": "1d5df35af3e0afe592832a67b9fb3feeeba1f7b6" + "revision": "0135187126370cbf112d759a50eab4a5c913a827" }, "html": { "revision": "d742025fa2d8e6100f134a6ea990443aa1f074b3" @@ -393,7 +393,7 @@ "revision": "502a8746c82c616ed441e0ab2b8c09772ee7d114" }, "nim": { - "revision": "fe53e07e42fc6c8fab934ab3675d65b4247e9c29" + "revision": "77762e3680cb7b0a4380580de7a8b95e00f0dc6b" }, "nim_format_string": { "revision": "d45f75022d147cda056e98bfba68222c9c8eca3a" @@ -564,7 +564,7 @@ "revision": "c478c6868648eff49eb04a4df90d703dc45b312a" }, "slang": { - "revision": "11526ab1a2514c7302f3c4af60b0ebc992cee086" + "revision": "b07419a4b9dda852b6d9bb05bbf8391150bcdd62" }, "slint": { "revision": "00c8a2d3645766f68c0d0460086c0a994e5b0d85" @@ -591,7 +591,7 @@ "revision": "05f949d3c1c15e3261473a244d3ce87777374dec" }, "sql": { - "revision": "1b7d451554f435d28c3217724acf00cdc627ee73" + "revision": "b599f6a1ca37cb5bae827a424cd98371a0d91bdc" }, "squirrel": { "revision": "e8b5835296f931bcaa1477d3c5a68a0c5c2ba034" @@ -690,7 +690,7 @@ "revision": "4c5ecd6326ebd61f6f9a22a370cbd100e0d601da" }, "v": { - "revision": "012e7732614acf9ec75c0e5e774900da1313031e" + "revision": "fdd137445c50d73767548c1b2386e5f560d5d042" }, "vala": { "revision": "8f690bfa639f2b83d1fb938ed3dd98a7ba453e8b" @@ -717,7 +717,7 @@ "revision": "a041228ae64632f59b9bd37346a0dbcb7817f36b" }, "wing": { - "revision": "5feebac75906910415766f0aec55c24188e592c3" + "revision": "76420bc5832e421fb7b0ade2262f19fdff005988" }, "xcompose": { "revision": "01344fed31a3cd37a63f03357ec80cbc592a93b5" From 42381aae7c1f785e4658cdb34a750be9851ba9af Mon Sep 17 00:00:00 2001 From: GitHub Date: Wed, 13 Dec 2023 06:36:47 +0000 Subject: [PATCH 0721/2494] Update parsers: nim, slang, wing --- lockfile.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lockfile.json b/lockfile.json index d21f79d81..e41624c76 100644 --- a/lockfile.json +++ b/lockfile.json @@ -393,7 +393,7 @@ "revision": "502a8746c82c616ed441e0ab2b8c09772ee7d114" }, "nim": { - "revision": "77762e3680cb7b0a4380580de7a8b95e00f0dc6b" + "revision": "d41fd3e4c1f83a0e6429c2d035209e107e80e6f8" }, "nim_format_string": { "revision": "d45f75022d147cda056e98bfba68222c9c8eca3a" @@ -564,7 +564,7 @@ "revision": "c478c6868648eff49eb04a4df90d703dc45b312a" }, "slang": { - "revision": "b07419a4b9dda852b6d9bb05bbf8391150bcdd62" + "revision": "ac07aa2c875ef6ada2ec468d8a4d0c7c5efd96d7" }, "slint": { "revision": "00c8a2d3645766f68c0d0460086c0a994e5b0d85" @@ -717,7 +717,7 @@ "revision": "a041228ae64632f59b9bd37346a0dbcb7817f36b" }, "wing": { - "revision": "76420bc5832e421fb7b0ade2262f19fdff005988" + "revision": "693ee4b3a995a9c305479b32c10e0a87013ff125" }, "xcompose": { "revision": "01344fed31a3cd37a63f03357ec80cbc592a93b5" From 30b5bdca1b534da71cdbc57fbbfe5693b4299e56 Mon Sep 17 00:00:00 2001 From: GitHub Date: Thu, 14 Dec 2023 06:37:46 +0000 Subject: [PATCH 0722/2494] Update parsers: v, wing --- lockfile.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lockfile.json b/lockfile.json index e41624c76..0ef81dd6c 100644 --- a/lockfile.json +++ b/lockfile.json @@ -690,7 +690,7 @@ "revision": "4c5ecd6326ebd61f6f9a22a370cbd100e0d601da" }, "v": { - "revision": "fdd137445c50d73767548c1b2386e5f560d5d042" + "revision": "20e9968fcb7c53686d588d8cd4ad294340a27732" }, "vala": { "revision": "8f690bfa639f2b83d1fb938ed3dd98a7ba453e8b" @@ -717,7 +717,7 @@ "revision": "a041228ae64632f59b9bd37346a0dbcb7817f36b" }, "wing": { - "revision": "693ee4b3a995a9c305479b32c10e0a87013ff125" + "revision": "b2a8767803a50d654e9bfbd90d55cc0414b6ca8f" }, "xcompose": { "revision": "01344fed31a3cd37a63f03357ec80cbc592a93b5" From 2583eb351ba5dab9ab06489d371987518e1d018f Mon Sep 17 00:00:00 2001 From: ObserverOfTime Date: Thu, 14 Dec 2023 11:37:34 +0200 Subject: [PATCH 0723/2494] fix(python): highlight variadic lambda parameters --- queries/python/highlights.scm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/queries/python/highlights.scm b/queries/python/highlights.scm index b09122dd9..cfe0ab3e2 100644 --- a/queries/python/highlights.scm +++ b/queries/python/highlights.scm @@ -137,6 +137,12 @@ (parameters (dictionary_splat_pattern ; **kwargs (identifier) @parameter)) +(lambda_parameters + (list_splat_pattern + (identifier) @parameter)) +(lambda_parameters + (dictionary_splat_pattern + (identifier) @parameter)) ;; Literals From ab818bf5a2ee21515ade9afcf428e98056b6197b Mon Sep 17 00:00:00 2001 From: ObserverOfTime Date: Thu, 14 Dec 2023 14:38:43 +0200 Subject: [PATCH 0724/2494] fix(python): restrict typed parameter highlight Only the name is a parameter and not the value --- queries/python/highlights.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/queries/python/highlights.scm b/queries/python/highlights.scm index cfe0ab3e2..5b0301d21 100644 --- a/queries/python/highlights.scm +++ b/queries/python/highlights.scm @@ -129,7 +129,7 @@ (typed_parameter (identifier) @parameter) (typed_default_parameter - (identifier) @parameter) + name: (identifier) @parameter) ; Variadic parameters *args, **kwargs (parameters (list_splat_pattern ; *args From 9bc1f1e6406933e9263456e5761e47b9cb1da71d Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 15 Dec 2023 10:00:18 +0100 Subject: [PATCH 0725/2494] fix(v): adapt to removed scanner.c --- lockfile.json | 2 +- lua/nvim-treesitter/parsers.lua | 2 +- queries/v/highlights.scm | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lockfile.json b/lockfile.json index 0ef81dd6c..a34b4b998 100644 --- a/lockfile.json +++ b/lockfile.json @@ -690,7 +690,7 @@ "revision": "4c5ecd6326ebd61f6f9a22a370cbd100e0d601da" }, "v": { - "revision": "20e9968fcb7c53686d588d8cd4ad294340a27732" + "revision": "f7c31c7578ebd35b95cfa85c6461ed6480697a9a" }, "vala": { "revision": "8f690bfa639f2b83d1fb938ed3dd98a7ba453e8b" diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 640018cff..5b10b79b9 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -2015,7 +2015,7 @@ list.uxntal = { list.v = { install_info = { url = "https://github.com/v-analyzer/v-analyzer", - files = { "src/parser.c", "src/scanner.c" }, + files = { "src/parser.c" }, location = "tree_sitter_v", }, filetype = "vlang", diff --git a/queries/v/highlights.scm b/queries/v/highlights.scm index b90749590..dbf059d8f 100644 --- a/queries/v/highlights.scm +++ b/queries/v/highlights.scm @@ -439,9 +439,9 @@ ] @string (string_interpolation - (braced_interpolation_opening) @punctuation.bracket - (interpolated_expression) @none - (braced_interpolation_closing) @punctuation.bracket) + (interpolation_opening) @punctuation.bracket + (interpolation_expression) @none + (interpolation_closing) @punctuation.bracket) (escape_sequence) @string.escape From 194b3f0047816132b08bcc2857b23a49fa967d04 Mon Sep 17 00:00:00 2001 From: GitHub Date: Fri, 15 Dec 2023 09:33:21 +0000 Subject: [PATCH 0726/2494] Update parsers: erlang, haskell, nim, wing --- lockfile.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lockfile.json b/lockfile.json index a34b4b998..4d79a3ed0 100644 --- a/lockfile.json +++ b/lockfile.json @@ -147,7 +147,7 @@ "revision": "203f7bd3c1bbfbd98fc19add4b8fcb213c059205" }, "erlang": { - "revision": "56942778b5791d07949e6c7b6093e01aba5b7ab4" + "revision": "08218898824c68fc8439cba1540042081e2da18d" }, "facility": { "revision": "a52579670e2b14ec03d410c3c980fafaf6d659c4" @@ -243,7 +243,7 @@ "revision": "3d4af179414525a35dd069ba0208c9b71093d8b3" }, "haskell": { - "revision": "d70b321b8b702939d722c2c15f4c28d14e91a400" + "revision": "23ad72f4b755269004a0a3f3796192705313643d" }, "haskell_persistent": { "revision": "577259b4068b2c281c9ebf94c109bd50a74d5857" @@ -393,7 +393,7 @@ "revision": "502a8746c82c616ed441e0ab2b8c09772ee7d114" }, "nim": { - "revision": "d41fd3e4c1f83a0e6429c2d035209e107e80e6f8" + "revision": "0fdb059ce7c1926a0287c3deb80e20186e4451d7" }, "nim_format_string": { "revision": "d45f75022d147cda056e98bfba68222c9c8eca3a" @@ -717,7 +717,7 @@ "revision": "a041228ae64632f59b9bd37346a0dbcb7817f36b" }, "wing": { - "revision": "b2a8767803a50d654e9bfbd90d55cc0414b6ca8f" + "revision": "698e645b30e871a58c7de68e0ecd6d2ebbdd0009" }, "xcompose": { "revision": "01344fed31a3cd37a63f03357ec80cbc592a93b5" From 000f71842bf08840df1e70004b17507fa92b2fb7 Mon Sep 17 00:00:00 2001 From: Vincent Rischmann Date: Fri, 15 Dec 2023 20:01:31 +0100 Subject: [PATCH 0727/2494] feat(gomod): highlight the `toolchain` directive (#5795) --- queries/gomod/highlights.scm | 1 + 1 file changed, 1 insertion(+) diff --git a/queries/gomod/highlights.scm b/queries/gomod/highlights.scm index 36a676414..76a2a4523 100644 --- a/queries/gomod/highlights.scm +++ b/queries/gomod/highlights.scm @@ -2,6 +2,7 @@ "require" "replace" "go" + "toolchain" "exclude" "retract" "module" From 5a713474e38a3999b85c6cb3f5cac3248a16c7d0 Mon Sep 17 00:00:00 2001 From: GitHub Date: Sat, 16 Dec 2023 06:35:10 +0000 Subject: [PATCH 0728/2494] Update parsers: erlang, nim, v, wing --- lockfile.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lockfile.json b/lockfile.json index 4d79a3ed0..909a05525 100644 --- a/lockfile.json +++ b/lockfile.json @@ -147,7 +147,7 @@ "revision": "203f7bd3c1bbfbd98fc19add4b8fcb213c059205" }, "erlang": { - "revision": "08218898824c68fc8439cba1540042081e2da18d" + "revision": "57e69513efd831f9cc8207d65d96bad917ca4aa4" }, "facility": { "revision": "a52579670e2b14ec03d410c3c980fafaf6d659c4" @@ -393,7 +393,7 @@ "revision": "502a8746c82c616ed441e0ab2b8c09772ee7d114" }, "nim": { - "revision": "0fdb059ce7c1926a0287c3deb80e20186e4451d7" + "revision": "482e2f4e1c2520db711c57f1899e926c3e81d4eb" }, "nim_format_string": { "revision": "d45f75022d147cda056e98bfba68222c9c8eca3a" @@ -690,7 +690,7 @@ "revision": "4c5ecd6326ebd61f6f9a22a370cbd100e0d601da" }, "v": { - "revision": "f7c31c7578ebd35b95cfa85c6461ed6480697a9a" + "revision": "7ab132568aa18af0f177d4476079d3c412741a9d" }, "vala": { "revision": "8f690bfa639f2b83d1fb938ed3dd98a7ba453e8b" @@ -717,7 +717,7 @@ "revision": "a041228ae64632f59b9bd37346a0dbcb7817f36b" }, "wing": { - "revision": "698e645b30e871a58c7de68e0ecd6d2ebbdd0009" + "revision": "f9ccaffe1f8ef68e56d403451c34429388f966f1" }, "xcompose": { "revision": "01344fed31a3cd37a63f03357ec80cbc592a93b5" From 25ddfde8d7167d7d81403d6809242439037d2b68 Mon Sep 17 00:00:00 2001 From: GitHub Date: Sun, 17 Dec 2023 06:35:10 +0000 Subject: [PATCH 0729/2494] Update parsers: elm, haskell, templ, wing --- lockfile.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lockfile.json b/lockfile.json index 909a05525..6135b7d44 100644 --- a/lockfile.json +++ b/lockfile.json @@ -135,7 +135,7 @@ "revision": "11426c5fd20eef360d5ecaf10729191f6bc5d715" }, "elm": { - "revision": "0ae8d475281a25e9d7ab1068a952ff9a1615c0df" + "revision": "ac2b629b3877ce22b3f171fee4517d8c2e6992e9" }, "elsa": { "revision": "0a66b2b3f3c1915e67ad2ef9f7dbd2a84820d9d7" @@ -243,7 +243,7 @@ "revision": "3d4af179414525a35dd069ba0208c9b71093d8b3" }, "haskell": { - "revision": "23ad72f4b755269004a0a3f3796192705313643d" + "revision": "5260f606ec353f156751473a0c203d67167c0ebe" }, "haskell_persistent": { "revision": "577259b4068b2c281c9ebf94c109bd50a74d5857" @@ -633,7 +633,7 @@ "revision": "33482c92a0dfa694491d34e167a1d2f52b0dccb1" }, "templ": { - "revision": "6b9dff614d5bab902cb6989bfcaa180636218159" + "revision": "671e9a957acd40088919ca17b30f4a39870784d4" }, "terraform": { "revision": "e135399cb31b95fac0760b094556d1d5ce84acf0" @@ -717,7 +717,7 @@ "revision": "a041228ae64632f59b9bd37346a0dbcb7817f36b" }, "wing": { - "revision": "f9ccaffe1f8ef68e56d403451c34429388f966f1" + "revision": "78da69154d39da9f0e3db2f07359e0ffbb5174fa" }, "xcompose": { "revision": "01344fed31a3cd37a63f03357ec80cbc592a93b5" From edacfa2eedd1d6099cd45e28ffe2892066b0b3ba Mon Sep 17 00:00:00 2001 From: aMOPel <36712072+aMOPel@users.noreply.github.com> Date: Mon, 18 Dec 2023 17:32:06 +0100 Subject: [PATCH 0730/2494] fix(nim): minor improvements to queries and parser (#5784) * fix(nim): bump parser again to include minor fix * fix(nim): shifting around for precedence * fix(nim): added new fields from recent parser version, improved support for (conditional_declaration) and (variant_declaration) --- queries/nim/folds.scm | 2 ++ queries/nim/highlights.scm | 58 ++++++++++++++++++++++---------------- queries/nim/locals.scm | 45 +++++++++++++---------------- 3 files changed, 54 insertions(+), 51 deletions(-) diff --git a/queries/nim/folds.scm b/queries/nim/folds.scm index 27c8d4669..466bcf5ae 100644 --- a/queries/nim/folds.scm +++ b/queries/nim/folds.scm @@ -12,6 +12,8 @@ (case) (if) (when) + (conditional_declaration) + (variant_declaration) (of_branch) (elif_branch) (else_branch) diff --git a/queries/nim/highlights.scm b/queries/nim/highlights.scm index a743c544b..a6e28038e 100644 --- a/queries/nim/highlights.scm +++ b/queries/nim/highlights.scm @@ -11,7 +11,7 @@ ; @variable capture. (type_expression) @type -; NOTE: has to be after +; NOTE: has to be after ; ((identifier) @variable (#set! "priority" 99)) ; overrule identifiers in pragmas in (proc_type)s and (pragma_expression)s @@ -25,10 +25,32 @@ (pragma_expression right: (pragma_list) @variable)) -; NOTE: has to be after +; NOTE: has to be after ; (type_expression) @type ; and before @preproc and all literals +; constants/enums in array construction +(array_construction + (colon_expression + left: (_) @constant)) +; NOTE: has to be before literals and punctuation etc. + +; identifiers in "case" "of" branches have to be enums +(case + alternative: + (of_branch + values: + (expression_list (_) @constant))) +; NOTE: has to be before literals and punctuation etc. + +; in variant objects with "case" "of" +(variant_declaration + alternative: + (of_branch + values: + (expression_list (_) @constant))) +; NOTE: has to be before literals and punctuation etc. + ; ============================================================================= ; @comment ; line and block comments @@ -239,9 +261,9 @@ ; function.calls in `varargs[type, routine]` (bracket_expression left: (identifier) @_varargs - right: + right: (argument_list - . + . (_) . [ @@ -448,6 +470,7 @@ ; when accessing and directly call elements from an array of routines ; eg `array_of_routines[index](arguments), but that is an uncommon case +; dot_generic_call `v.call[:type, type]() (dot_generic_call generic_arguments: (_) @type) @@ -643,16 +666,6 @@ ; ============================================================================= ; @constant ; constant identifiers -; identifiers in "case" "of" branches have to be enums -(case - (of_branch values: - (expression_list (_) @constant))) - -; in variant objects with "case" "of" -(variant_declaration - (of_branch values: - (expression_list (_) @constant))) - ; enum declaration (enum_field_declaration (symbol_declaration @@ -661,11 +674,6 @@ (accent_quoted (identifier) @constant) ])) -; constants/enums in array construction -(array_construction - (colon_expression - left: (_) @constant)) - ; constant declaration (const_section (variable_declaration @@ -691,10 +699,10 @@ ; constants x and y in `array[x..y, type]` (bracket_expression left: (identifier) @_array - right: + right: (argument_list - . - (infix_expression + . + (infix_expression right: [ (identifier) @constant (accent_quoted (identifier) @constant) @@ -704,10 +712,10 @@ (#any-of? @_array "array" "range")) (bracket_expression left: (identifier) @_array - right: + right: (argument_list - . - (infix_expression + . + (infix_expression left: [ (identifier) @constant (accent_quoted (identifier) @constant) diff --git a/queries/nim/locals.scm b/queries/nim/locals.scm index dd80b315b..5b70bac10 100644 --- a/queries/nim/locals.scm +++ b/queries/nim/locals.scm @@ -131,7 +131,7 @@ type: (type_expression)? @definition.associated) (concept_declaration - parameters: + parameters: (parameter_list [ (identifier) @definition.parameter (accent_quoted (identifier) @definition.parameter) @@ -193,28 +193,21 @@ ; ============================================================================== ; @definition.field ; fields or properties -(object_declaration - (field_declaration_list - (field_declaration - (symbol_declaration_list - (symbol_declaration - name: [ - (identifier) @definition.field - (accent_quoted) @definition.field - (exported_symbol (identifier) @definition.field) - (exported_symbol (accent_quoted) @definition.field) - ])) - type: (type_expression)? @definition.associated))) - -(tuple_type - (field_declaration - (symbol_declaration_list - (symbol_declaration - name: [ - (identifier) @definition.field - (accent_quoted) @definition.field - ])) - type: (type_expression)? @definition.associated)) +; object_declaration +; variant_declaration +; conditional_declaration +; tuple_type inline +; tuple_type multiline +(field_declaration + (symbol_declaration_list + (symbol_declaration + name: [ + (identifier) @definition.field + (accent_quoted) @definition.field + (exported_symbol (identifier) @definition.field) + (exported_symbol (accent_quoted) @definition.field) + ])) + type: (type_expression)? @definition.associated) ; ============================================================================== ; @definition.enum ; enumerations @@ -273,9 +266,9 @@ alternative: (else_branch)? @scope) (case - (of_branch)* @scope - (elif_branch)* @scope - (else_branch)? @scope) + alternative: (of_branch)* @scope + alternative: (elif_branch)* @scope + alternative: (else_branch)? @scope) (try body: (statement_list) @scope From 24be1534dbd062907842601ae1e2e953ba02472e Mon Sep 17 00:00:00 2001 From: Riley Bruins Date: Mon, 18 Dec 2023 08:19:22 -0800 Subject: [PATCH 0731/2494] fix(rust): highlight inline attributes properly --- queries/rust/highlights.scm | 1 + 1 file changed, 1 insertion(+) diff --git a/queries/rust/highlights.scm b/queries/rust/highlights.scm index cc629d5e7..60438bd72 100644 --- a/queries/rust/highlights.scm +++ b/queries/rust/highlights.scm @@ -172,6 +172,7 @@ ; Attribute macros (attribute_item (attribute (identifier) @function.macro)) +(inner_attribute_item (attribute (identifier) @function.macro)) (attribute (scoped_identifier (identifier) @function.macro .)) From 251c855236fd99174563fd01b60b1eeaaf8ea806 Mon Sep 17 00:00:00 2001 From: GitHub Date: Tue, 19 Dec 2023 06:37:27 +0000 Subject: [PATCH 0732/2494] Update parsers: elm, gomod, v, wing --- lockfile.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lockfile.json b/lockfile.json index 6135b7d44..f4711ddd2 100644 --- a/lockfile.json +++ b/lockfile.json @@ -135,7 +135,7 @@ "revision": "11426c5fd20eef360d5ecaf10729191f6bc5d715" }, "elm": { - "revision": "ac2b629b3877ce22b3f171fee4517d8c2e6992e9" + "revision": "44ffae46bb460820c3c3d6fde20378202bd4b0ab" }, "elsa": { "revision": "0a66b2b3f3c1915e67ad2ef9f7dbd2a84820d9d7" @@ -216,7 +216,7 @@ "revision": "b6ef0768711086a86b3297056f9ffb5cc1d77b4a" }, "gomod": { - "revision": "af4270aed18500af1d24e6de5f6e7d243e2c8b05" + "revision": "9b86399ab733fbd548ba0e817e732cb3351082d2" }, "gosum": { "revision": "e2ac513b2240c7ff1069ae33b2df29ce90777c11" @@ -690,7 +690,7 @@ "revision": "4c5ecd6326ebd61f6f9a22a370cbd100e0d601da" }, "v": { - "revision": "7ab132568aa18af0f177d4476079d3c412741a9d" + "revision": "eced04c473f3bcb49f9c8ac91744451a9ab40310" }, "vala": { "revision": "8f690bfa639f2b83d1fb938ed3dd98a7ba453e8b" @@ -717,7 +717,7 @@ "revision": "a041228ae64632f59b9bd37346a0dbcb7817f36b" }, "wing": { - "revision": "78da69154d39da9f0e3db2f07359e0ffbb5174fa" + "revision": "b5fa0cb75ee96d3ff19df59085d508240f5b0fd5" }, "xcompose": { "revision": "01344fed31a3cd37a63f03357ec80cbc592a93b5" From 79dcd0e24cbcabc06fc06e9dba4de8faeb0fedb5 Mon Sep 17 00:00:00 2001 From: Pham Huy Hoang Date: Tue, 19 Dec 2023 19:42:30 +0900 Subject: [PATCH 0733/2494] fix: remove 0-length range usage in indent.lua (#5805) --- lua/nvim-treesitter/indent.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/nvim-treesitter/indent.lua b/lua/nvim-treesitter/indent.lua index 80e0bc77b..18d239571 100644 --- a/lua/nvim-treesitter/indent.lua +++ b/lua/nvim-treesitter/indent.lua @@ -23,7 +23,7 @@ end ---@return TSNode local function get_first_node_at_line(root, lnum, col) col = col or vim.fn.indent(lnum) - return root:descendant_for_range(lnum - 1, col, lnum - 1, col) + return root:descendant_for_range(lnum - 1, col, lnum - 1, col + 1) end ---@param root TSNode @@ -32,7 +32,7 @@ end ---@return TSNode local function get_last_node_at_line(root, lnum, col) col = col or (#getline(lnum) - 1) - return root:descendant_for_range(lnum - 1, col, lnum - 1, col) + return root:descendant_for_range(lnum - 1, col, lnum - 1, col + 1) end ---@param node TSNode @@ -124,7 +124,7 @@ function M.get_indent(lnum) -- some languages like Python will actually have worse results when re-parsing at opened new line if not M.avoid_force_reparsing[root_lang] then -- Reparse in case we got triggered by ":h indentkeys" - parser:parse { vim.fn.line "w0" - 1, vim.fn.line "w$" - 1 } + parser:parse { vim.fn.line "w0" - 1, vim.fn.line "w$" } end -- Get language tree with smallest range around node that's not a comment parser From a0b815497b55a8572301506e01dbd2ec24f1813f Mon Sep 17 00:00:00 2001 From: Mark Skelton Date: Tue, 19 Dec 2023 06:53:00 -0600 Subject: [PATCH 0734/2494] feat: add tree-sitter-styled (#5735) * Add styled parser * Add queries * Update highlights * Remove unnecessary highlights * Update injections to use the styled grammar * Remove requires npm --- lockfile.json | 3 +++ lua/nvim-treesitter/parsers.lua | 8 ++++++++ queries/ecma/injections.scm | 8 ++++---- queries/styled/folds.scm | 1 + queries/styled/highlights.scm | 1 + queries/styled/indents.scm | 1 + queries/styled/injections.scm | 1 + 7 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 queries/styled/folds.scm create mode 100644 queries/styled/highlights.scm create mode 100644 queries/styled/indents.scm create mode 100644 queries/styled/injections.scm diff --git a/lockfile.json b/lockfile.json index f4711ddd2..354324895 100644 --- a/lockfile.json +++ b/lockfile.json @@ -605,6 +605,9 @@ "strace": { "revision": "d819cdd5dbe455bd3c859193633c8d91c0df7c36" }, + "styled": { + "revision": "e51e673efc860373167680b4bcbf418a11e4ed26" + }, "supercollider": { "revision": "3b35bd0fded4423c8fb30e9585c7bacbcd0e8095" }, diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 5b10b79b9..2ad741f3f 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -1779,6 +1779,14 @@ list.strace = { maintainers = { "@amaanq" }, } +list.styled = { + install_info = { + url = "https://github.com/mskelton/tree-sitter-styled", + files = { "src/parser.c", "src/scanner.c" }, + }, + maintainers = { "@mskelton" }, +} + list.supercollider = { install_info = { url = "https://github.com/madskjeldgaard/tree-sitter-supercollider", diff --git a/queries/ecma/injections.scm b/queries/ecma/injections.scm index 1e0a478df..97dbbb628 100644 --- a/queries/ecma/injections.scm +++ b/queries/ecma/injections.scm @@ -53,7 +53,7 @@ (#eq? @_name "styled")) arguments: ((template_string) @injection.content (#offset! @injection.content 0 1 0 -1) - (#set! injection.language "css"))) + (#set! injection.language "styled"))) ; styled(Component)`` (call_expression @@ -62,7 +62,7 @@ (#eq? @_name "styled")) arguments: ((template_string) @injection.content (#offset! @injection.content 0 1 0 -1) - (#set! injection.language "css"))) + (#set! injection.language "styled"))) ; styled.div.attrs({ prop: "foo" })`` (call_expression @@ -73,7 +73,7 @@ (#eq? @_name "styled")))) arguments: ((template_string) @injection.content (#offset! @injection.content 0 1 0 -1) - (#set! injection.language "css"))) + (#set! injection.language "styled"))) ; styled(Component).attrs({ prop: "foo" })`` @@ -85,7 +85,7 @@ (#eq? @_name "styled")))) arguments: ((template_string) @injection.content (#offset! @injection.content 0 1 0 -1) - (#set! injection.language "css"))) + (#set! injection.language "styled"))) ((regex_pattern) @injection.content (#set! injection.language "regex")) diff --git a/queries/styled/folds.scm b/queries/styled/folds.scm new file mode 100644 index 000000000..cbe41875e --- /dev/null +++ b/queries/styled/folds.scm @@ -0,0 +1 @@ +; inherits: css diff --git a/queries/styled/highlights.scm b/queries/styled/highlights.scm new file mode 100644 index 000000000..cbe41875e --- /dev/null +++ b/queries/styled/highlights.scm @@ -0,0 +1 @@ +; inherits: css diff --git a/queries/styled/indents.scm b/queries/styled/indents.scm new file mode 100644 index 000000000..cbe41875e --- /dev/null +++ b/queries/styled/indents.scm @@ -0,0 +1 @@ +; inherits: css diff --git a/queries/styled/injections.scm b/queries/styled/injections.scm new file mode 100644 index 000000000..cbe41875e --- /dev/null +++ b/queries/styled/injections.scm @@ -0,0 +1 @@ +; inherits: css From 0dfbf5e48e8551212c2a9f1c74cb080c8e76b5d1 Mon Sep 17 00:00:00 2001 From: Github Actions Date: Tue, 19 Dec 2023 12:53:13 +0000 Subject: [PATCH 0735/2494] Update README --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 5a334ca4e..675add8b5 100644 --- a/README.md +++ b/README.md @@ -375,6 +375,7 @@ We are looking for maintainers to add more parsers and to write query files for - [x] [ssh_config](https://github.com/ObserverOfTime/tree-sitter-ssh-config) (maintained by @ObserverOfTime) - [x] [starlark](https://github.com/amaanq/tree-sitter-starlark) (maintained by @amaanq) - [x] [strace](https://github.com/sigmaSd/tree-sitter-strace) (maintained by @amaanq) +- [x] [styled](https://github.com/mskelton/tree-sitter-styled) (maintained by @mskelton) - [x] [supercollider](https://github.com/madskjeldgaard/tree-sitter-supercollider) (maintained by @madskjeldgaard) - [x] [surface](https://github.com/connorlay/tree-sitter-surface) (maintained by @connorlay) - [x] [svelte](https://github.com/Himujjal/tree-sitter-svelte) (maintained by @elianiva) From cdb2ec999c1fb173500e2f9ab4dcd9aa62506c72 Mon Sep 17 00:00:00 2001 From: GitHub Date: Wed, 20 Dec 2023 06:35:45 +0000 Subject: [PATCH 0736/2494] Update parsers: gleam, styled, v, wing --- lockfile.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lockfile.json b/lockfile.json index 354324895..eb899e743 100644 --- a/lockfile.json +++ b/lockfile.json @@ -198,7 +198,7 @@ "revision": "f4685bf11ac466dd278449bcfe5fd014e94aa504" }, "gleam": { - "revision": "c9c7f0f01749d301b54e96ed8e0c47c7c415a196" + "revision": "2b49c49ef632928b5c52bb0a7269ff797d5d1414" }, "glimmer": { "revision": "f9746dc1d0707717fbba84cb5c22a71586af23e1" @@ -606,7 +606,7 @@ "revision": "d819cdd5dbe455bd3c859193633c8d91c0df7c36" }, "styled": { - "revision": "e51e673efc860373167680b4bcbf418a11e4ed26" + "revision": "5e52758b32e02adca16bb93f95b3f9c050c72b56" }, "supercollider": { "revision": "3b35bd0fded4423c8fb30e9585c7bacbcd0e8095" @@ -693,7 +693,7 @@ "revision": "4c5ecd6326ebd61f6f9a22a370cbd100e0d601da" }, "v": { - "revision": "eced04c473f3bcb49f9c8ac91744451a9ab40310" + "revision": "f0336bb8847393ba4d5905a94642acf0dc3d5ebd" }, "vala": { "revision": "8f690bfa639f2b83d1fb938ed3dd98a7ba453e8b" @@ -720,7 +720,7 @@ "revision": "a041228ae64632f59b9bd37346a0dbcb7817f36b" }, "wing": { - "revision": "b5fa0cb75ee96d3ff19df59085d508240f5b0fd5" + "revision": "e6e06a05eeb894001d3c24e1db72f5cd2f35bdae" }, "xcompose": { "revision": "01344fed31a3cd37a63f03357ec80cbc592a93b5" From 96e01877b82760a1852344f6ffd3a51bd6d36c0e Mon Sep 17 00:00:00 2001 From: Marc Jakobi Date: Fri, 15 Dec 2023 00:05:27 +0100 Subject: [PATCH 0737/2494] highlights(haskell): namespaced string quasiquote --- queries/haskell/highlights.scm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/queries/haskell/highlights.scm b/queries/haskell/highlights.scm index 1fea39b08..eb6380ea0 100644 --- a/queries/haskell/highlights.scm +++ b/queries/haskell/highlights.scm @@ -378,8 +378,16 @@ (quoter) @function.call (quasiquote - (quoter) @_name (#eq? @_name "qq") + [ + (quoter) @_name + (_ (variable) @_name) + ](#eq? @_name "qq") (quasiquote_body) @string) + +(quasiquote + ((_ (variable) @_name)) (#eq? @_name "qq") + (quasiquote_body) @string) + ;; namespaced quasi-quoter (quasiquote (_ From 732c8cb0b43b7336525c3cecb2e28db153994e62 Mon Sep 17 00:00:00 2001 From: Marc Jakobi Date: Mon, 4 Dec 2023 18:39:26 +0100 Subject: [PATCH 0738/2494] highlights(haskell): add `fail` to exception highlights --- queries/haskell/highlights.scm | 1 + 1 file changed, 1 insertion(+) diff --git a/queries/haskell/highlights.scm b/queries/haskell/highlights.scm index eb6380ea0..2c2189c38 100644 --- a/queries/haskell/highlights.scm +++ b/queries/haskell/highlights.scm @@ -425,6 +425,7 @@ "bracket_" "bracketOnErrorSource" "finally" + "fail" "onException" "expectationFailure")) From 23cc2cd85c077df1d9582957e99701809f2256c1 Mon Sep 17 00:00:00 2001 From: GitHub Date: Thu, 21 Dec 2023 06:36:36 +0000 Subject: [PATCH 0739/2494] Update parsers: beancount, wing --- lockfile.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lockfile.json b/lockfile.json index eb899e743..b4da6a21a 100644 --- a/lockfile.json +++ b/lockfile.json @@ -30,7 +30,7 @@ "revision": "27f110dfe79620993f5493ffa0d0f2fe12d250ed" }, "beancount": { - "revision": "484f50849bcce887c86451f532bf778689ca8523" + "revision": "cd08aefa20dc0f3d5984b08b5d468f75bf4fd096" }, "bibtex": { "revision": "ccfd77db0ed799b6c22c214fe9d2937f47bc8b34" @@ -720,7 +720,7 @@ "revision": "a041228ae64632f59b9bd37346a0dbcb7817f36b" }, "wing": { - "revision": "e6e06a05eeb894001d3c24e1db72f5cd2f35bdae" + "revision": "55514ae0d9d0d7c4170e98e9ab50a46f0887053f" }, "xcompose": { "revision": "01344fed31a3cd37a63f03357ec80cbc592a93b5" From c153019e11052f38cdf2bdd338750cd103877eba Mon Sep 17 00:00:00 2001 From: Ahnaf Rafi Date: Wed, 20 Dec 2023 16:03:45 -0600 Subject: [PATCH 0740/2494] Add @nospell annotation to label definitions and references --- queries/latex/highlights.scm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/queries/latex/highlights.scm b/queries/latex/highlights.scm index 10e02ed1b..bcba33eb2 100644 --- a/queries/latex/highlights.scm +++ b/queries/latex/highlights.scm @@ -249,3 +249,6 @@ (citation keys: _ @nospell) (command_name) @nospell +(label_definition) @nospell +(label_reference) @nospell +(label_reference_range) @nospell From d2d3df8613ba0b733cc21ed150e3687fad147316 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Thu, 21 Dec 2023 14:29:31 +0100 Subject: [PATCH 0741/2494] vimdoc: add note, warning, deprecated (#5817) --- lockfile.json | 2 +- queries/vimdoc/highlights.scm | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lockfile.json b/lockfile.json index b4da6a21a..e60a56af1 100644 --- a/lockfile.json +++ b/lockfile.json @@ -708,7 +708,7 @@ "revision": "32c76f150347c1cd044e90b8e2bc73c00677fa55" }, "vimdoc": { - "revision": "60045f7d717eba85fa8abd996e0bb50eed5a3d8e" + "revision": "4f8ba9e39c8b3fbaf0bb5f70ac255474a9099359" }, "vue": { "revision": "91fe2754796cd8fba5f229505a23fa08f3546c06" diff --git a/queries/vimdoc/highlights.scm b/queries/vimdoc/highlights.scm index c52333df1..78ae9dab9 100644 --- a/queries/vimdoc/highlights.scm +++ b/queries/vimdoc/highlights.scm @@ -23,3 +23,9 @@ (argument) @parameter (keycode) @string.special (url) @text.uri +((note) @text.note + (#any-of? @text.note "Note:" "NOTE:" "Notes:")) +((note) @text.warning + (#any-of? @text.warning "Warning:" "WARNING:")) +((note) @text.danger + (#any-of? @text.danger "Deprecated:" "DEPRECATED:")) From d496c5e08e853dadedc7f5d0a6541288d0441fd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Boczar?= Date: Thu, 21 Dec 2023 21:49:13 +0100 Subject: [PATCH 0742/2494] fix(cpp): incorrect indent of class with opening { on new line (#5811) --- queries/cpp/indents.scm | 2 -- tests/indent/cpp/class_newline.cpp | 9 +++++++++ 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 tests/indent/cpp/class_newline.cpp diff --git a/queries/cpp/indents.scm b/queries/cpp/indents.scm index 7df9aea0c..6faa6f144 100644 --- a/queries/cpp/indents.scm +++ b/queries/cpp/indents.scm @@ -1,11 +1,9 @@ ; inherits: c [ - (class_specifier) (condition_clause) ] @indent.begin ((field_initializer_list) @indent.begin (#set! indent.start_at_same_line 1)) (access_specifier) @indent.branch - diff --git a/tests/indent/cpp/class_newline.cpp b/tests/indent/cpp/class_newline.cpp new file mode 100644 index 000000000..084d3026b --- /dev/null +++ b/tests/indent/cpp/class_newline.cpp @@ -0,0 +1,9 @@ +class Foo +{ + int x; + class Bar + { + int y; + }; + Bar z; +}; From d5842ebca8e0f048a5c2de6f467a8f22fa2187ed Mon Sep 17 00:00:00 2001 From: GitHub Date: Fri, 22 Dec 2023 06:37:10 +0000 Subject: [PATCH 0743/2494] Update parsers: apex, scala, soql, sosl, tlaplus, wing --- lockfile.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lockfile.json b/lockfile.json index e60a56af1..09aece86a 100644 --- a/lockfile.json +++ b/lockfile.json @@ -9,7 +9,7 @@ "revision": "624ff108fe949727217cddb302f20e4f16997b1c" }, "apex": { - "revision": "82ee140f4ee7652a4915ac9e9f60c4d66f7637d7" + "revision": "ca70b2347a79615cd749517f6c6c2352e50a7ce9" }, "arduino": { "revision": "ff1045f5da90344d547022c50f1756be4adaf721" @@ -552,7 +552,7 @@ "revision": "79456e6080f50fc1ca7c21845794308fa5d35a51" }, "scala": { - "revision": "1b4c2fa5c55c5fd83cbb0d2f818f916aba221a42" + "revision": "866f94551cd03f9055d04dba20465b84e7e693f3" }, "scfg": { "revision": "6deae0cbb458c849a4d1e2985093e9c9c32d7fd0" @@ -582,10 +582,10 @@ "revision": "168020304759ad5d8b4a88a541a699134e3730c5" }, "soql": { - "revision": "82ee140f4ee7652a4915ac9e9f60c4d66f7637d7" + "revision": "ca70b2347a79615cd749517f6c6c2352e50a7ce9" }, "sosl": { - "revision": "82ee140f4ee7652a4915ac9e9f60c4d66f7637d7" + "revision": "ca70b2347a79615cd749517f6c6c2352e50a7ce9" }, "sparql": { "revision": "05f949d3c1c15e3261473a244d3ce87777374dec" @@ -651,7 +651,7 @@ "revision": "a7f11d946b44244f71df41d2a78af0665d618dae" }, "tlaplus": { - "revision": "c5fae9e4ad9f483fb6232a8688a2c940be6b496b" + "revision": "aeb2e8fdc417c32ae7d1149cfa2a8ddc3b293600" }, "todotxt": { "revision": "0207f6a4ab6aeafc4b091914d31d8235049a2578" @@ -720,7 +720,7 @@ "revision": "a041228ae64632f59b9bd37346a0dbcb7817f36b" }, "wing": { - "revision": "55514ae0d9d0d7c4170e98e9ab50a46f0887053f" + "revision": "66962f2a87db24bb63fe8282ce76fb64c0a2e20b" }, "xcompose": { "revision": "01344fed31a3cd37a63f03357ec80cbc592a93b5" From 454c3a9ba86f841dc3b5bb17d150a873a16b77b4 Mon Sep 17 00:00:00 2001 From: Christian Degnbol Madsen Date: Fri, 22 Dec 2023 21:24:04 +1100 Subject: [PATCH 0744/2494] fix(julia): pipe function highlight (#5815) In Julia when piping into a function the function should be highlighted as a function call, and not a variable. --- queries/julia/highlights.scm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/queries/julia/highlights.scm b/queries/julia/highlights.scm index fbf97acd7..8b7ee45e9 100644 --- a/queries/julia/highlights.scm +++ b/queries/julia/highlights.scm @@ -47,6 +47,12 @@ (broadcast_call_expression (field_expression (identifier) @function.call .)) +(binary_expression + (_) + (operator) @_pipe + (identifier) @function.call + (#eq? @_pipe "|>")) + ;; Builtins ((identifier) @function.builtin From 1c619f5f20f33684b7b27a0c2c30143be7c44baa Mon Sep 17 00:00:00 2001 From: Riley Bruins Date: Sat, 23 Dec 2023 01:40:10 -0800 Subject: [PATCH 0745/2494] feat(luap): highlights more consistent with regex (#5819) --- queries/luap/highlights.scm | 15 ++++++++------- queries/regex/highlights.scm | 5 +++-- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/queries/luap/highlights.scm b/queries/luap/highlights.scm index 62d2b3182..87e6c6908 100644 --- a/queries/luap/highlights.scm +++ b/queries/luap/highlights.scm @@ -1,9 +1,10 @@ -"." @character - [ (anchor_begin) (anchor_end) -] @string.escape +] @punctuation.delimiter + +(pattern + (character "." @variable.builtin)) [ "[" "]" @@ -19,17 +20,17 @@ (range from: (character) @constant - "-" @punctuation.delimiter + "-" @operator to: (character) @constant) (set (character) @constant) +(negated_set + (character) @constant) (class) @keyword -(negated_set - "^" @operator - (character) @constant) +(negated_set "^" @operator) (balanced_match (character) @parameter) diff --git a/queries/regex/highlights.scm b/queries/regex/highlights.scm index 7a5685844..3aa4af909 100644 --- a/queries/regex/highlights.scm +++ b/queries/regex/highlights.scm @@ -32,7 +32,8 @@ [ "*" "+" "?" "|" "=" "!" "-"] @operator [ - (any_character) (start_assertion) (end_assertion) -] @variable.builtin +] @punctuation.delimiter + +(any_character) @variable.builtin From c4da7945641b2e74915313cd1e608b43877a56b7 Mon Sep 17 00:00:00 2001 From: GitHub Date: Sat, 23 Dec 2023 06:35:14 +0000 Subject: [PATCH 0746/2494] Update parsers: elm, wing --- lockfile.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lockfile.json b/lockfile.json index 09aece86a..ab9defe74 100644 --- a/lockfile.json +++ b/lockfile.json @@ -135,7 +135,7 @@ "revision": "11426c5fd20eef360d5ecaf10729191f6bc5d715" }, "elm": { - "revision": "44ffae46bb460820c3c3d6fde20378202bd4b0ab" + "revision": "c26afd7f2316f689410a1622f1780eff054994b1" }, "elsa": { "revision": "0a66b2b3f3c1915e67ad2ef9f7dbd2a84820d9d7" @@ -720,7 +720,7 @@ "revision": "a041228ae64632f59b9bd37346a0dbcb7817f36b" }, "wing": { - "revision": "66962f2a87db24bb63fe8282ce76fb64c0a2e20b" + "revision": "785c54e35a6a45826ff7228aa9662c19ca92ad57" }, "xcompose": { "revision": "01344fed31a3cd37a63f03357ec80cbc592a93b5" From 92572c0dfd53b0e74bf436ef968ecc5b5a7e2b76 Mon Sep 17 00:00:00 2001 From: Riley Bruins Date: Thu, 21 Dec 2023 15:31:40 -0800 Subject: [PATCH 0747/2494] feat: more `@string.regex` highlights --- queries/lua/highlights.scm | 20 ++++++++++++++++++++ queries/luau/highlights.scm | 26 ++++++++++++++++++++++++++ queries/query/highlights.scm | 16 ++++++++++++++++ 3 files changed, 62 insertions(+) diff --git a/queries/lua/highlights.scm b/queries/lua/highlights.scm index 1af8e9aec..2f12d3ce2 100644 --- a/queries/lua/highlights.scm +++ b/queries/lua/highlights.scm @@ -247,3 +247,23 @@ (string) @string (escape_sequence) @string.escape + +; string.match("123", "%d+") +(function_call + (dot_index_expression + field: (identifier) @_method + (#any-of? @_method "find" "match" "gmatch" "gsub")) + arguments: (arguments + . (_) + . + (string + content: (string_content) @string.regex))) + +;("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.regex))) diff --git a/queries/luau/highlights.scm b/queries/luau/highlights.scm index 7a6bc2e35..a175276a7 100644 --- a/queries/luau/highlights.scm +++ b/queries/luau/highlights.scm @@ -246,3 +246,29 @@ ((comment) @comment.documentation (#lua-match? @comment.documentation "^[-][-](%s?)@")) + +; string.match("123", "%d+") +(function_call + (dot_index_expression + field: (identifier) @_method + (#any-of? @_method "find" "format" "match")) + arguments: (arguments (_) . (string content: _ @string.regex))) + +(function_call + (dot_index_expression + field: (identifier) @_method + (#any-of? @_method "gmatch" "gsub")) + arguments: (arguments (_) (string content: _ @string.regex))) + +; ("123"):match("%d+") +(function_call + (method_index_expression + method: (identifier) @_method + (#any-of? @_method "find" "format" "match")) + arguments: (arguments . (string content: _ @string.regex))) + +(function_call + (method_index_expression + method: (identifier) @_method + (#any-of? @_method "gmatch" "gsub")) + arguments: (arguments (string content: _ @string.regex))) diff --git a/queries/query/highlights.scm b/queries/query/highlights.scm index c7f0d891a..ccf13a6c8 100644 --- a/queries/query/highlights.scm +++ b/queries/query/highlights.scm @@ -32,3 +32,19 @@ ((program . (comment)* . (comment) @preproc) (#lua-match? @preproc "^;+ *extends *$")) + +((predicate + name: (identifier) @_name + parameters: (parameters (string "\"" @string "\"" @string) @string.regex)) + (#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.regex . (string) .)) + (#any-of? @_name "gsub" "not-gsub")) From cd4de5f7b14b878ac8f5c459c9d579cc58ba1ac5 Mon Sep 17 00:00:00 2001 From: Riley Bruins Date: Sat, 23 Dec 2023 13:01:41 -0800 Subject: [PATCH 0748/2494] fix: cleanup luap injection queries --- queries/lua/injections.scm | 26 ++------------------------ queries/luau/injections.scm | 20 +++----------------- 2 files changed, 5 insertions(+), 41 deletions(-) diff --git a/queries/lua/injections.scm b/queries/lua/injections.scm index 6f7b97267..57ea527d4 100644 --- a/queries/lua/injections.scm +++ b/queries/lua/injections.scm @@ -114,19 +114,7 @@ (function_call (dot_index_expression field: (identifier) @_method - (#any-of? @_method "find" "match")) - arguments: (arguments - . (_) - . - (string - content: (string_content) @injection.content - (#set! injection.language "luap") - (#set! injection.include-children)))) - -(function_call - (dot_index_expression - field: (identifier) @_method - (#any-of? @_method "gmatch" "gsub")) + (#any-of? @_method "find" "match" "gmatch" "gsub")) arguments: (arguments . (_) . @@ -140,23 +128,13 @@ (function_call (method_index_expression method: (identifier) @_method - (#any-of? @_method "find" "match")) + (#any-of? @_method "find" "match" "gmatch" "gsub")) arguments: (arguments . (string content: (string_content) @injection.content (#set! injection.language "luap") (#set! injection.include-children)))) -(function_call - (method_index_expression - method: (identifier) @_method - (#any-of? @_method "gmatch" "gsub")) - arguments: (arguments - . (string - content: (string_content) @injection.content - (#set! injection.language "luap") - (#set! injection.include-children)))) - (comment content: (_) @injection.content (#set! injection.language "comment")) diff --git a/queries/luau/injections.scm b/queries/luau/injections.scm index e70e0274b..4edc7f5e4 100644 --- a/queries/luau/injections.scm +++ b/queries/luau/injections.scm @@ -16,31 +16,17 @@ (function_call (dot_index_expression field: (identifier) @_method - (#any-of? @_method "find" "format" "match")) - arguments: (arguments (_) . (string content: _ @injection.content)) - (#set! injection.language "luap")) - -(function_call - (dot_index_expression - field: (identifier) @_method - (#any-of? @_method "gmatch" "gsub")) - arguments: (arguments (_) (string content: _ @injection.content)) + (#any-of? @_method "find" "format" "match" "gmatch" "gsub")) + arguments: (arguments . (_) . (string content: _ @injection.content)) (#set! injection.language "luap")) ; ("123"):match("%d+") (function_call (method_index_expression method: (identifier) @_method - (#any-of? @_method "find" "format" "match")) + (#any-of? @_method "find" "format" "match" "gmatch" "gsub")) arguments: (arguments . (string content: _ @injection.content)) (#set! injection.language "luap")) -(function_call - (method_index_expression - method: (identifier) @_method - (#any-of? @_method "gmatch" "gsub")) - arguments: (arguments (string content: _ @injection.content)) - (#set! injection.language "luap")) - ((comment) @injection.content (#set! injection.language "comment")) From 374966b25c9bcbe29944267128cb78bf857e189a Mon Sep 17 00:00:00 2001 From: Riley Bruins Date: Sat, 23 Dec 2023 21:00:32 -0800 Subject: [PATCH 0749/2494] fixup(luau): align `@string.regex` to the injections (#5829) --- queries/luau/highlights.scm | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/queries/luau/highlights.scm b/queries/luau/highlights.scm index a175276a7..4cd0b443c 100644 --- a/queries/luau/highlights.scm +++ b/queries/luau/highlights.scm @@ -251,24 +251,12 @@ (function_call (dot_index_expression field: (identifier) @_method - (#any-of? @_method "find" "format" "match")) - arguments: (arguments (_) . (string content: _ @string.regex))) - -(function_call - (dot_index_expression - field: (identifier) @_method - (#any-of? @_method "gmatch" "gsub")) - arguments: (arguments (_) (string content: _ @string.regex))) + (#any-of? @_method "find" "format" "match" "gmatch" "gsub")) + arguments: (arguments . (_) . (string content: _ @string.regex))) ; ("123"):match("%d+") (function_call (method_index_expression method: (identifier) @_method - (#any-of? @_method "find" "format" "match")) + (#any-of? @_method "find" "format" "match" "gmatch" "gsub")) arguments: (arguments . (string content: _ @string.regex))) - -(function_call - (method_index_expression - method: (identifier) @_method - (#any-of? @_method "gmatch" "gsub")) - arguments: (arguments (string content: _ @string.regex))) From 27f68c0b6a87cbad900b3d016425450af8268026 Mon Sep 17 00:00:00 2001 From: GitHub Date: Sun, 24 Dec 2023 06:34:42 +0000 Subject: [PATCH 0750/2494] Update parsers: haskell, templ --- lockfile.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lockfile.json b/lockfile.json index ab9defe74..4acd95107 100644 --- a/lockfile.json +++ b/lockfile.json @@ -243,7 +243,7 @@ "revision": "3d4af179414525a35dd069ba0208c9b71093d8b3" }, "haskell": { - "revision": "5260f606ec353f156751473a0c203d67167c0ebe" + "revision": "dd924b8df1eb76261f009e149fc6f3291c5081c2" }, "haskell_persistent": { "revision": "577259b4068b2c281c9ebf94c109bd50a74d5857" @@ -636,7 +636,7 @@ "revision": "33482c92a0dfa694491d34e167a1d2f52b0dccb1" }, "templ": { - "revision": "671e9a957acd40088919ca17b30f4a39870784d4" + "revision": "8793137e669949e72ac1d877ba9cadfbb5062fc0" }, "terraform": { "revision": "e135399cb31b95fac0760b094556d1d5ce84acf0" From 7d0b4756aba3b220d38ec0443c6cc10944060dd7 Mon Sep 17 00:00:00 2001 From: GitHub Date: Wed, 27 Dec 2023 06:36:29 +0000 Subject: [PATCH 0751/2494] Update parsers: nickel, nix, scala, v, wing --- lockfile.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lockfile.json b/lockfile.json index 4acd95107..a11b546d3 100644 --- a/lockfile.json +++ b/lockfile.json @@ -390,7 +390,7 @@ "revision": "3bc691d2cfba44bea339a775ad496c8bc552c60d" }, "nickel": { - "revision": "502a8746c82c616ed441e0ab2b8c09772ee7d114" + "revision": "091b5dcc7d138901bcc162da9409c0bb626c0d27" }, "nim": { "revision": "482e2f4e1c2520db711c57f1899e926c3e81d4eb" @@ -402,7 +402,7 @@ "revision": "0a95cfdc0745b6ae82f60d3a339b37f19b7b9267" }, "nix": { - "revision": "66e3e9ce9180ae08fc57372061006ef83f0abde7" + "revision": "763168fa916a333a459434f1424b5d30645f015d" }, "norg": { "revision": "014073fe8016d1ac440c51d22c77e3765d8f6855" @@ -552,7 +552,7 @@ "revision": "79456e6080f50fc1ca7c21845794308fa5d35a51" }, "scala": { - "revision": "866f94551cd03f9055d04dba20465b84e7e693f3" + "revision": "2b79741be78858bd65c605b6fc6e9c2641d5be50" }, "scfg": { "revision": "6deae0cbb458c849a4d1e2985093e9c9c32d7fd0" @@ -693,7 +693,7 @@ "revision": "4c5ecd6326ebd61f6f9a22a370cbd100e0d601da" }, "v": { - "revision": "f0336bb8847393ba4d5905a94642acf0dc3d5ebd" + "revision": "583aad0a90da099708607b2aaf7450a1b1801535" }, "vala": { "revision": "8f690bfa639f2b83d1fb938ed3dd98a7ba453e8b" @@ -720,7 +720,7 @@ "revision": "a041228ae64632f59b9bd37346a0dbcb7817f36b" }, "wing": { - "revision": "785c54e35a6a45826ff7228aa9662c19ca92ad57" + "revision": "6d98fb7d428c4c2620209f41af8828e87f34c230" }, "xcompose": { "revision": "01344fed31a3cd37a63f03357ec80cbc592a93b5" From 7a2c6211d6f550988fccd8800de8426d5e480a2d Mon Sep 17 00:00:00 2001 From: GitHub Date: Thu, 28 Dec 2023 06:36:15 +0000 Subject: [PATCH 0752/2494] Update parsers: perl, scala, wing --- lockfile.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lockfile.json b/lockfile.json index a11b546d3..83d55a838 100644 --- a/lockfile.json +++ b/lockfile.json @@ -441,7 +441,7 @@ "revision": "e01767921df18142055d97407595329d7629e643" }, "perl": { - "revision": "3911403cba497196fb867a6f1e286e3e1576f425" + "revision": "d4e5cb9b3f725aa9598c7eb800966e3a8417b88c" }, "php": { "revision": "0a99deca13c4af1fb9adcb03c958bfc9f4c740a9" @@ -552,7 +552,7 @@ "revision": "79456e6080f50fc1ca7c21845794308fa5d35a51" }, "scala": { - "revision": "2b79741be78858bd65c605b6fc6e9c2641d5be50" + "revision": "696965ee3bafd47f4b5204d1e63b4ea4b52d9f9b" }, "scfg": { "revision": "6deae0cbb458c849a4d1e2985093e9c9c32d7fd0" @@ -720,7 +720,7 @@ "revision": "a041228ae64632f59b9bd37346a0dbcb7817f36b" }, "wing": { - "revision": "6d98fb7d428c4c2620209f41af8828e87f34c230" + "revision": "d97fa32273e21272cca40af291538ffcf0af082f" }, "xcompose": { "revision": "01344fed31a3cd37a63f03357ec80cbc592a93b5" From 362ebd3a210f20aab80be05557f216cbaf4531e6 Mon Sep 17 00:00:00 2001 From: GitHub Date: Fri, 29 Dec 2023 06:36:22 +0000 Subject: [PATCH 0753/2494] Update parsers: perl, rst, v, wing --- lockfile.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lockfile.json b/lockfile.json index 83d55a838..f5ec27311 100644 --- a/lockfile.json +++ b/lockfile.json @@ -441,7 +441,7 @@ "revision": "e01767921df18142055d97407595329d7629e643" }, "perl": { - "revision": "d4e5cb9b3f725aa9598c7eb800966e3a8417b88c" + "revision": "655632fa7f9174acbdbf1ad2abdac90ad3aa57a1" }, "php": { "revision": "0a99deca13c4af1fb9adcb03c958bfc9f4c740a9" @@ -543,7 +543,7 @@ "revision": "ce6086b2c9e8e71065b8129d6c2289c5f66d1879" }, "rst": { - "revision": "3c03a4bb2c27f1fa76f1ca5563c1fc10187e4028" + "revision": "3ba9eb9b5a47aadb1f2356a3cab0dd3d2bd00b4b" }, "ruby": { "revision": "f257f3f57833d584050336921773738a3fd8ca22" @@ -693,7 +693,7 @@ "revision": "4c5ecd6326ebd61f6f9a22a370cbd100e0d601da" }, "v": { - "revision": "583aad0a90da099708607b2aaf7450a1b1801535" + "revision": "b59edeac4a819999ebc5a78bbd384bd30bf6fa30" }, "vala": { "revision": "8f690bfa639f2b83d1fb938ed3dd98a7ba453e8b" @@ -720,7 +720,7 @@ "revision": "a041228ae64632f59b9bd37346a0dbcb7817f36b" }, "wing": { - "revision": "d97fa32273e21272cca40af291538ffcf0af082f" + "revision": "339fec8a7671f8c4f0ff69adea9e14815616e8dd" }, "xcompose": { "revision": "01344fed31a3cd37a63f03357ec80cbc592a93b5" From e49f1e8ef3e8450a8446cb1f2bbb53c919f60b6d Mon Sep 17 00:00:00 2001 From: GitHub Date: Sat, 30 Dec 2023 06:35:35 +0000 Subject: [PATCH 0754/2494] Update parsers: nim, templ, wing --- lockfile.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lockfile.json b/lockfile.json index f5ec27311..07c93a90e 100644 --- a/lockfile.json +++ b/lockfile.json @@ -393,7 +393,7 @@ "revision": "091b5dcc7d138901bcc162da9409c0bb626c0d27" }, "nim": { - "revision": "482e2f4e1c2520db711c57f1899e926c3e81d4eb" + "revision": "70ceee835e033acbc7092cd7f4f6a251789af121" }, "nim_format_string": { "revision": "d45f75022d147cda056e98bfba68222c9c8eca3a" @@ -636,7 +636,7 @@ "revision": "33482c92a0dfa694491d34e167a1d2f52b0dccb1" }, "templ": { - "revision": "8793137e669949e72ac1d877ba9cadfbb5062fc0" + "revision": "14d105789af342f7f0c32bff2fec1a6edec59f60" }, "terraform": { "revision": "e135399cb31b95fac0760b094556d1d5ce84acf0" @@ -720,7 +720,7 @@ "revision": "a041228ae64632f59b9bd37346a0dbcb7817f36b" }, "wing": { - "revision": "339fec8a7671f8c4f0ff69adea9e14815616e8dd" + "revision": "d85ef04bb7e75e2627348b45a5f357a2c7fbee91" }, "xcompose": { "revision": "01344fed31a3cd37a63f03357ec80cbc592a93b5" From 65ef62092ef997d2ecf68ede01a0afbda17808c3 Mon Sep 17 00:00:00 2001 From: Christian Degnbol Madsen Date: Thu, 28 Dec 2023 17:57:49 +1100 Subject: [PATCH 0755/2494] fix(julia): add missing capture of ":" in selected import If writing a selected import, e.g. `using BSON: @load`, the colon isn't currently captured. This change captures it as `@punctuation.delimiter`. --- queries/julia/highlights.scm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/queries/julia/highlights.scm b/queries/julia/highlights.scm index 8b7ee45e9..c1245f4d8 100644 --- a/queries/julia/highlights.scm +++ b/queries/julia/highlights.scm @@ -398,6 +398,8 @@ "as" @include) (export_statement "export" @include) +(selected_import + ":" @punctuation.delimiter) (struct_definition ["struct" "end"] @keyword) From 3ef514b10b9557e3905b9817ca632e7506dd384a Mon Sep 17 00:00:00 2001 From: GitHub Date: Wed, 3 Jan 2024 06:36:32 +0000 Subject: [PATCH 0756/2494] Update parsers: scala, templ, v, wing --- lockfile.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lockfile.json b/lockfile.json index 07c93a90e..23d0d6014 100644 --- a/lockfile.json +++ b/lockfile.json @@ -552,7 +552,7 @@ "revision": "79456e6080f50fc1ca7c21845794308fa5d35a51" }, "scala": { - "revision": "696965ee3bafd47f4b5204d1e63b4ea4b52d9f9b" + "revision": "7891815f42dca9ed6aeb464c2edc39d479ab965c" }, "scfg": { "revision": "6deae0cbb458c849a4d1e2985093e9c9c32d7fd0" @@ -636,7 +636,7 @@ "revision": "33482c92a0dfa694491d34e167a1d2f52b0dccb1" }, "templ": { - "revision": "14d105789af342f7f0c32bff2fec1a6edec59f60" + "revision": "f5c56b4739ea3303d125f6b7363645af631b85a1" }, "terraform": { "revision": "e135399cb31b95fac0760b094556d1d5ce84acf0" @@ -693,7 +693,7 @@ "revision": "4c5ecd6326ebd61f6f9a22a370cbd100e0d601da" }, "v": { - "revision": "b59edeac4a819999ebc5a78bbd384bd30bf6fa30" + "revision": "9ac84e62396bb13c8f1d11f967f0c0f2dec1a448" }, "vala": { "revision": "8f690bfa639f2b83d1fb938ed3dd98a7ba453e8b" @@ -720,7 +720,7 @@ "revision": "a041228ae64632f59b9bd37346a0dbcb7817f36b" }, "wing": { - "revision": "d85ef04bb7e75e2627348b45a5f357a2c7fbee91" + "revision": "95006d1c99d597abc7b0264fd9773527031db53a" }, "xcompose": { "revision": "01344fed31a3cd37a63f03357ec80cbc592a93b5" From 0da349ed303bea955942f409d29059cdb89dbe2c Mon Sep 17 00:00:00 2001 From: GitHub Date: Wed, 3 Jan 2024 17:14:33 +0000 Subject: [PATCH 0757/2494] Update parsers: ada, ocaml, ocaml_interface, sql, wing --- lockfile.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lockfile.json b/lockfile.json index 23d0d6014..b2f4bf24f 100644 --- a/lockfile.json +++ b/lockfile.json @@ -1,6 +1,6 @@ { "ada": { - "revision": "f21f13afe0410311be1f78959a25aee393c569c9" + "revision": "a1e54e4e0347db6a37099822181e5cdf0d180198" }, "agda": { "revision": "c21c3a0f996363ed17b8ac99d827fe5a4821f217" @@ -417,10 +417,10 @@ "revision": "28d3b2e25a0b1881d1b47ed1924ca276c7003d45" }, "ocaml": { - "revision": "694c57718fd85d514f8b81176038e7a4cfabcaaf" + "revision": "4abfdc1c7af2c6c77a370aee974627be1c285b3b" }, "ocaml_interface": { - "revision": "694c57718fd85d514f8b81176038e7a4cfabcaaf" + "revision": "4abfdc1c7af2c6c77a370aee974627be1c285b3b" }, "ocamllex": { "revision": "4b9898ccbf198602bb0dec9cd67cc1d2c0a4fad2" @@ -591,7 +591,7 @@ "revision": "05f949d3c1c15e3261473a244d3ce87777374dec" }, "sql": { - "revision": "b599f6a1ca37cb5bae827a424cd98371a0d91bdc" + "revision": "fd70fb358d164cd93fbe2674a9cca276dc5203f7" }, "squirrel": { "revision": "e8b5835296f931bcaa1477d3c5a68a0c5c2ba034" @@ -720,7 +720,7 @@ "revision": "a041228ae64632f59b9bd37346a0dbcb7817f36b" }, "wing": { - "revision": "95006d1c99d597abc7b0264fd9773527031db53a" + "revision": "6437741d19632ae502fc335441c895cd94729db3" }, "xcompose": { "revision": "01344fed31a3cd37a63f03357ec80cbc592a93b5" From 8ae4080c5ba59d81b4e49525d4168807bc098e73 Mon Sep 17 00:00:00 2001 From: Riley Bruins Date: Thu, 4 Jan 2024 10:57:18 -0800 Subject: [PATCH 0758/2494] fix(latex): highlight text functions --- queries/latex/highlights.scm | 1 + 1 file changed, 1 insertion(+) diff --git a/queries/latex/highlights.scm b/queries/latex/highlights.scm index bcba33eb2..ea66645e5 100644 --- a/queries/latex/highlights.scm +++ b/queries/latex/highlights.scm @@ -1,6 +1,7 @@ ;; General syntax (command_name) @function +(text_mode "\\text" @function) (caption command: _ @function) From e277ca9dec0dfd830133d1d82e79ad3f2cf026a1 Mon Sep 17 00:00:00 2001 From: Zhuofeng Wang Date: Fri, 5 Jan 2024 10:36:32 +0800 Subject: [PATCH 0759/2494] fix(markdown_inline): latex highlight injection (#5397) The `injection.include-children` is needed in markdown_inline parser. --- queries/markdown_inline/injections.scm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/queries/markdown_inline/injections.scm b/queries/markdown_inline/injections.scm index 33b97c481..d665574ff 100644 --- a/queries/markdown_inline/injections.scm +++ b/queries/markdown_inline/injections.scm @@ -3,4 +3,5 @@ (#set! injection.combined)) ((latex_block) @injection.content - (#set! injection.language "latex")) + (#set! injection.language "latex") + (#set! injection.include-children)) From adf423a493f9e91d5dc4369b46e5a7e83e4c783e Mon Sep 17 00:00:00 2001 From: GitHub Date: Fri, 5 Jan 2024 06:36:22 +0000 Subject: [PATCH 0760/2494] Update parsers: astro, php, ruby, templ, wing --- lockfile.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lockfile.json b/lockfile.json index b2f4bf24f..9881176ad 100644 --- a/lockfile.json +++ b/lockfile.json @@ -15,7 +15,7 @@ "revision": "ff1045f5da90344d547022c50f1756be4adaf721" }, "astro": { - "revision": "e122a8fcd07e808a7b873bfadc2667834067daf1" + "revision": "a092afa5c330495fdfbc652766c29c66ec6880f4" }, "authzed": { "revision": "1dec7e1af96c56924e3322cd85fdce15d0a31d00" @@ -444,7 +444,7 @@ "revision": "655632fa7f9174acbdbf1ad2abdac90ad3aa57a1" }, "php": { - "revision": "0a99deca13c4af1fb9adcb03c958bfc9f4c740a9" + "revision": "594b8bad093abe739c3d2a2cae5abae33c5fb23d" }, "phpdoc": { "revision": "915a527d5aafa81b31acf67fab31b0ac6b6319c0" @@ -546,7 +546,7 @@ "revision": "3ba9eb9b5a47aadb1f2356a3cab0dd3d2bd00b4b" }, "ruby": { - "revision": "f257f3f57833d584050336921773738a3fd8ca22" + "revision": "1ba5af1bf41b09c7c0d2630700ba593635581811" }, "rust": { "revision": "79456e6080f50fc1ca7c21845794308fa5d35a51" @@ -636,7 +636,7 @@ "revision": "33482c92a0dfa694491d34e167a1d2f52b0dccb1" }, "templ": { - "revision": "f5c56b4739ea3303d125f6b7363645af631b85a1" + "revision": "64f3ded2bbc5cbc83f1b52bae1680a08fda435d5" }, "terraform": { "revision": "e135399cb31b95fac0760b094556d1d5ce84acf0" @@ -720,7 +720,7 @@ "revision": "a041228ae64632f59b9bd37346a0dbcb7817f36b" }, "wing": { - "revision": "6437741d19632ae502fc335441c895cd94729db3" + "revision": "8d6b514bdc76dfc96827a62150bf85098c3fe429" }, "xcompose": { "revision": "01344fed31a3cd37a63f03357ec80cbc592a93b5" From 9288d9b5059e6b409b5077399dc0b377a112d9f2 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 5 Jan 2024 12:51:53 +0100 Subject: [PATCH 0761/2494] ci: bump actions to latest --- .github/workflows/lint.yml | 4 ++-- .github/workflows/release.yml | 2 +- .github/workflows/test-queries.yml | 4 ++-- .github/workflows/tests.yml | 4 ++-- .github/workflows/update-lockfile.yml | 2 +- .github/workflows/update-readme.yml | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 121526c60..a643f796d 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -9,7 +9,7 @@ jobs: name: Luacheck runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Prepare run: | @@ -24,7 +24,7 @@ jobs: name: StyLua runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Lint with stylua uses: JohnnyMorganz/stylua-action@v3 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3c36b33db..11f3ffc14 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,7 +12,7 @@ jobs: luarocks-upload: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: nvim-neorocks/luarocks-tag-release@v5 env: LUAROCKS_API_KEY: ${{ secrets.LUAROCKS_API_KEY }} diff --git a/.github/workflows/test-queries.yml b/.github/workflows/test-queries.yml index 5376c739c..768bab089 100644 --- a/.github/workflows/test-queries.yml +++ b/.github/workflows/test-queries.yml @@ -54,9 +54,9 @@ jobs: NVIM: ${{ matrix.os == 'windows-2022' && 'nvim-win64\\bin\\nvim.exe' || 'nvim' }} ALLOWED_INSTALLATION_FAILURES: ${{ matrix.os == 'windows-2022' && 'rnoweb' }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: ilammy/msvc-dev-cmd@v1 - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 - name: Install tree-sitter CLI run: npm i -g tree-sitter-cli diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2393a78dc..3beda4631 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -26,8 +26,8 @@ jobs: env: CC: ${{ matrix.cc }} steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 - name: Install tree-sitter CLI run: npm i -g tree-sitter-cli diff --git a/.github/workflows/update-lockfile.yml b/.github/workflows/update-lockfile.yml index a29189b48..e44d7c954 100644 --- a/.github/workflows/update-lockfile.yml +++ b/.github/workflows/update-lockfile.yml @@ -10,7 +10,7 @@ jobs: name: Update lockfile runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: ref: master diff --git a/.github/workflows/update-readme.yml b/.github/workflows/update-readme.yml index 7b2c80102..6708ad103 100644 --- a/.github/workflows/update-readme.yml +++ b/.github/workflows/update-readme.yml @@ -11,7 +11,7 @@ jobs: name: Update README runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Prepare env: From 49f1b9a7efc794be143f7ddcd60ce18e8164a7f8 Mon Sep 17 00:00:00 2001 From: Calum Smith Date: Thu, 4 Jan 2024 12:54:45 -0500 Subject: [PATCH 0762/2494] highlights(html): character references (a.k.a. entities) --- queries/html/highlights.scm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/queries/html/highlights.scm b/queries/html/highlights.scm index 6da261c0a..4e2371d64 100644 --- a/queries/html/highlights.scm +++ b/queries/html/highlights.scm @@ -3,3 +3,5 @@ (doctype) @constant " Date: Sat, 6 Jan 2024 06:35:46 +0000 Subject: [PATCH 0763/2494] Update parsers: ada, ruby --- lockfile.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lockfile.json b/lockfile.json index 9881176ad..580774b36 100644 --- a/lockfile.json +++ b/lockfile.json @@ -1,6 +1,6 @@ { "ada": { - "revision": "a1e54e4e0347db6a37099822181e5cdf0d180198" + "revision": "ba0894efa03beb70780156b91e28c716b7a4764d" }, "agda": { "revision": "c21c3a0f996363ed17b8ac99d827fe5a4821f217" @@ -546,7 +546,7 @@ "revision": "3ba9eb9b5a47aadb1f2356a3cab0dd3d2bd00b4b" }, "ruby": { - "revision": "1ba5af1bf41b09c7c0d2630700ba593635581811" + "revision": "4d9ad3f010fdc47a8433adcf9ae30c8eb8475ae7" }, "rust": { "revision": "79456e6080f50fc1ca7c21845794308fa5d35a51" From f6483d11940feed26110228281fc0a403bc370b0 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 7 Jan 2024 12:14:46 +0100 Subject: [PATCH 0764/2494] fix(php): adjust to parser refactor --- lockfile.json | 2 +- lua/nvim-treesitter/parsers.lua | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lockfile.json b/lockfile.json index 580774b36..cdea75243 100644 --- a/lockfile.json +++ b/lockfile.json @@ -444,7 +444,7 @@ "revision": "655632fa7f9174acbdbf1ad2abdac90ad3aa57a1" }, "php": { - "revision": "594b8bad093abe739c3d2a2cae5abae33c5fb23d" + "revision": "2f791d9d83c35b11e9a14daf9a58dd7e23566041" }, "phpdoc": { "revision": "915a527d5aafa81b31acf67fab31b0ac6b6319c0" diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 2ad741f3f..bfadf5239 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -1326,6 +1326,7 @@ list.perl = { list.php = { install_info = { url = "https://github.com/tree-sitter/tree-sitter-php", + location = "php", files = { "src/parser.c", "src/scanner.c" }, }, maintainers = { "@tk-shirasaka" }, From 8cd2b230174efbf7b5d9f49fe2f90bda6b5eb16e Mon Sep 17 00:00:00 2001 From: GitHub Date: Sun, 7 Jan 2024 12:14:20 +0000 Subject: [PATCH 0765/2494] Update parsers: templ, tlaplus --- lockfile.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lockfile.json b/lockfile.json index cdea75243..27ca33a95 100644 --- a/lockfile.json +++ b/lockfile.json @@ -636,7 +636,7 @@ "revision": "33482c92a0dfa694491d34e167a1d2f52b0dccb1" }, "templ": { - "revision": "64f3ded2bbc5cbc83f1b52bae1680a08fda435d5" + "revision": "f8fbc1558e45b72c05cd55a02907ba9bc0df505a" }, "terraform": { "revision": "e135399cb31b95fac0760b094556d1d5ce84acf0" @@ -651,7 +651,7 @@ "revision": "a7f11d946b44244f71df41d2a78af0665d618dae" }, "tlaplus": { - "revision": "aeb2e8fdc417c32ae7d1149cfa2a8ddc3b293600" + "revision": "aaf5bb5c1df0a6e583bb51efa519a9ac788b2ad8" }, "todotxt": { "revision": "0207f6a4ab6aeafc4b091914d31d8235049a2578" From fcf843bf14adaeee53aad1b28fabba1d3b62fc8d Mon Sep 17 00:00:00 2001 From: GitHub Date: Sun, 14 Jan 2024 14:11:18 +0000 Subject: [PATCH 0766/2494] Update parsers: erlang, php, templ, wing --- lockfile.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lockfile.json b/lockfile.json index 27ca33a95..5f7394cba 100644 --- a/lockfile.json +++ b/lockfile.json @@ -147,7 +147,7 @@ "revision": "203f7bd3c1bbfbd98fc19add4b8fcb213c059205" }, "erlang": { - "revision": "57e69513efd831f9cc8207d65d96bad917ca4aa4" + "revision": "54b6f814f43c4eac81eeedefaa7cc8762fec6683" }, "facility": { "revision": "a52579670e2b14ec03d410c3c980fafaf6d659c4" @@ -444,7 +444,7 @@ "revision": "655632fa7f9174acbdbf1ad2abdac90ad3aa57a1" }, "php": { - "revision": "2f791d9d83c35b11e9a14daf9a58dd7e23566041" + "revision": "b569a5f2c0d592e67430520d1a0e1f765d83ceb0" }, "phpdoc": { "revision": "915a527d5aafa81b31acf67fab31b0ac6b6319c0" @@ -636,7 +636,7 @@ "revision": "33482c92a0dfa694491d34e167a1d2f52b0dccb1" }, "templ": { - "revision": "f8fbc1558e45b72c05cd55a02907ba9bc0df505a" + "revision": "c3baaab33f1f1032eedd3613cd932284975bd21f" }, "terraform": { "revision": "e135399cb31b95fac0760b094556d1d5ce84acf0" @@ -720,7 +720,7 @@ "revision": "a041228ae64632f59b9bd37346a0dbcb7817f36b" }, "wing": { - "revision": "8d6b514bdc76dfc96827a62150bf85098c3fe429" + "revision": "7624e16278478db4499e3b439e0c70e4ba98a1b0" }, "xcompose": { "revision": "01344fed31a3cd37a63f03357ec80cbc592a93b5" From 0746b1a13d53367e5b03cfd412b52dc612ef44ff Mon Sep 17 00:00:00 2001 From: GitHub Date: Mon, 15 Jan 2024 06:38:07 +0000 Subject: [PATCH 0767/2494] Update parsers: awk --- lockfile.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lockfile.json b/lockfile.json index 5f7394cba..dceffd692 100644 --- a/lockfile.json +++ b/lockfile.json @@ -21,7 +21,7 @@ "revision": "1dec7e1af96c56924e3322cd85fdce15d0a31d00" }, "awk": { - "revision": "4b4b46c9a44ec7fb9e8c9ce4a010295edc5be8d5" + "revision": "dcf4ac4eaff601d87cc15604765a7ae329c1b2ee" }, "bash": { "revision": "7331995b19b8f8aba2d5e26deb51d2195c18bc94" From 295ab1da52f4c9e0978a95c21dd359afdd0a11b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20=C5=81uka?= Date: Fri, 12 Jan 2024 15:13:30 +0100 Subject: [PATCH 0768/2494] fix: link type in pattern matching correctly --- queries/c_sharp/highlights.scm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/queries/c_sharp/highlights.scm b/queries/c_sharp/highlights.scm index c67d29eb8..bc74a16ff 100644 --- a/queries/c_sharp/highlights.scm +++ b/queries/c_sharp/highlights.scm @@ -13,6 +13,9 @@ (method_declaration type: (identifier) @type) +(declaration_pattern + type: (identifier) @type) + (local_function_statement type: (identifier) @type) From 59d4c14a1a4262cf637ff2420032593afa062749 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Mon, 15 Jan 2024 12:51:58 +0100 Subject: [PATCH 0769/2494] feat!: bump minimum Nvim version to 0.9.2 required for empty injection fix --- README.md | 2 +- lua/nvim-treesitter/health.lua | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 675add8b5..6db64faee 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ For more detailed information on setting these up, see ["Advanced setup"](#advan ## Requirements -- **Neovim 0.9.1** or later ([nightly](https://github.com/neovim/neovim#install-from-source) recommended) +- **Neovim 0.9.2** or later ([nightly](https://github.com/neovim/neovim#install-from-source) recommended) - `tar` and `curl` in your path (or alternatively `git`) - A C compiler in your path and libstdc++ installed ([Windows users please read this!](https://github.com/nvim-treesitter/nvim-treesitter/wiki/Windows-support)). diff --git a/lua/nvim-treesitter/health.lua b/lua/nvim-treesitter/health.lua index a71cbf5cd..be265f7d0 100644 --- a/lua/nvim-treesitter/health.lua +++ b/lua/nvim-treesitter/health.lua @@ -23,8 +23,8 @@ local NVIM_TREESITTER_MINIMUM_ABI = 13 local function install_health() _start "Installation" - if fn.has "nvim-0.9.1" ~= 1 then - _error "Nvim-treesitter requires Neovim 0.9.1+" + if fn.has "nvim-0.9.2" ~= 1 then + _error "Nvim-treesitter requires Nvim 0.9.2 or newer" end if fn.executable "tree-sitter" == 0 then From 842507a578704157e6c8f8f26befcb3b3a880efb Mon Sep 17 00:00:00 2001 From: GitHub Date: Tue, 16 Jan 2024 06:37:25 +0000 Subject: [PATCH 0770/2494] Update parsers: perl, todotxt --- lockfile.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lockfile.json b/lockfile.json index dceffd692..41c096799 100644 --- a/lockfile.json +++ b/lockfile.json @@ -441,7 +441,7 @@ "revision": "e01767921df18142055d97407595329d7629e643" }, "perl": { - "revision": "655632fa7f9174acbdbf1ad2abdac90ad3aa57a1" + "revision": "9c0cea7720f65a5e832c4d924356d7793f519e36" }, "php": { "revision": "b569a5f2c0d592e67430520d1a0e1f765d83ceb0" @@ -654,7 +654,7 @@ "revision": "aaf5bb5c1df0a6e583bb51efa519a9ac788b2ad8" }, "todotxt": { - "revision": "0207f6a4ab6aeafc4b091914d31d8235049a2578" + "revision": "3937c5cd105ec4127448651a21aef45f52d19609" }, "toml": { "revision": "8bd2056818b21860e3d756b5a58c4f6e05fb744e" From fe89bf17197fc5daead3878fb1328911b30fb022 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Wed, 10 Jan 2024 18:25:34 +0100 Subject: [PATCH 0771/2494] fix(config)!: always install parsers bundled with nvim --- lua/nvim-treesitter/configs.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/nvim-treesitter/configs.lua b/lua/nvim-treesitter/configs.lua index a3ec30fb2..88d20cae8 100644 --- a/lua/nvim-treesitter/configs.lua +++ b/lua/nvim-treesitter/configs.lua @@ -20,7 +20,7 @@ local M = {} local config = { modules = {}, sync_install = false, - ensure_installed = {}, + ensure_installed = { "lua", "query", "vimdoc", "vim", "c", "python", "bash", "markdown", "markdown_inline" }, auto_install = false, ignore_install = {}, parser_install_dir = nil, @@ -421,6 +421,7 @@ function M.setup(user_data) end local ensure_installed = user_data.ensure_installed or {} + vim.list_extend(ensure_installed, config.ensure_installed) if #ensure_installed > 0 then if user_data.sync_install then require("nvim-treesitter.install").ensure_installed_sync(ensure_installed) From 97ba59c6f532072e456b3d1f2413560e689c132b Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 16 Jan 2024 19:05:28 +0100 Subject: [PATCH 0772/2494] fixup: ensure_installed can be 'all' --- lua/nvim-treesitter/configs.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/nvim-treesitter/configs.lua b/lua/nvim-treesitter/configs.lua index 88d20cae8..8d720cd96 100644 --- a/lua/nvim-treesitter/configs.lua +++ b/lua/nvim-treesitter/configs.lua @@ -421,7 +421,9 @@ function M.setup(user_data) end local ensure_installed = user_data.ensure_installed or {} - vim.list_extend(ensure_installed, config.ensure_installed) + if type(ensure_installed) == "table" then + vim.list_extend(ensure_installed, config.ensure_installed) + end if #ensure_installed > 0 then if user_data.sync_install then require("nvim-treesitter.install").ensure_installed_sync(ensure_installed) From 94cb036ba7bd2b4086c04c945da5e983b5e8b322 Mon Sep 17 00:00:00 2001 From: GitHub Date: Wed, 17 Jan 2024 06:37:15 +0000 Subject: [PATCH 0773/2494] Update parsers: gleam, gomod, wing --- lockfile.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lockfile.json b/lockfile.json index 41c096799..a081ce384 100644 --- a/lockfile.json +++ b/lockfile.json @@ -198,7 +198,7 @@ "revision": "f4685bf11ac466dd278449bcfe5fd014e94aa504" }, "gleam": { - "revision": "2b49c49ef632928b5c52bb0a7269ff797d5d1414" + "revision": "62c5388a7badb4e29315690358267a76a734bf83" }, "glimmer": { "revision": "f9746dc1d0707717fbba84cb5c22a71586af23e1" @@ -216,7 +216,7 @@ "revision": "b6ef0768711086a86b3297056f9ffb5cc1d77b4a" }, "gomod": { - "revision": "9b86399ab733fbd548ba0e817e732cb3351082d2" + "revision": "bbe2fe3be4b87e06a613e685250f473d2267f430" }, "gosum": { "revision": "e2ac513b2240c7ff1069ae33b2df29ce90777c11" @@ -720,7 +720,7 @@ "revision": "a041228ae64632f59b9bd37346a0dbcb7817f36b" }, "wing": { - "revision": "7624e16278478db4499e3b439e0c70e4ba98a1b0" + "revision": "fd7adb7c776f2f3656b8a1839d8ee1e6636412f3" }, "xcompose": { "revision": "01344fed31a3cd37a63f03357ec80cbc592a93b5" From 7b326a096241267bdb3412457a97d3ae834b0a7c Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Wed, 17 Jan 2024 11:01:24 +0100 Subject: [PATCH 0774/2494] fixup: don't extend _with_ 'all' --- lua/nvim-treesitter/configs.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/nvim-treesitter/configs.lua b/lua/nvim-treesitter/configs.lua index 8d720cd96..d4f87a539 100644 --- a/lua/nvim-treesitter/configs.lua +++ b/lua/nvim-treesitter/configs.lua @@ -421,7 +421,7 @@ function M.setup(user_data) end local ensure_installed = user_data.ensure_installed or {} - if type(ensure_installed) == "table" then + if type(ensure_installed) == "table" and type(config.ensure_installed) == "table" then vim.list_extend(ensure_installed, config.ensure_installed) end if #ensure_installed > 0 then From 07c8c3d84f67b1530f636dcad31971f569a3df5f Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Wed, 17 Jan 2024 11:07:20 +0100 Subject: [PATCH 0775/2494] fixup: empty ensure_installed --- lua/nvim-treesitter/configs.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/nvim-treesitter/configs.lua b/lua/nvim-treesitter/configs.lua index d4f87a539..e64dc28e4 100644 --- a/lua/nvim-treesitter/configs.lua +++ b/lua/nvim-treesitter/configs.lua @@ -420,7 +420,7 @@ function M.setup(user_data) require("nvim-treesitter.install").setup_auto_install() end - local ensure_installed = user_data.ensure_installed or {} + local ensure_installed = user_data.ensure_installed or config.ensure_installed if type(ensure_installed) == "table" and type(config.ensure_installed) == "table" then vim.list_extend(ensure_installed, config.ensure_installed) end From 503d0ccdee762bb4b2758c391288768fafe39861 Mon Sep 17 00:00:00 2001 From: GitHub Date: Thu, 18 Jan 2024 06:37:49 +0000 Subject: [PATCH 0776/2494] Update parsers: gitcommit, markdown, markdown_inline, vimdoc, wing --- lockfile.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lockfile.json b/lockfile.json index a081ce384..2ecba3e8e 100644 --- a/lockfile.json +++ b/lockfile.json @@ -192,7 +192,7 @@ "revision": "19d554d39e4a8491f7a77abcdb75bfbc1c19d0b5" }, "gitcommit": { - "revision": "7e3ad5fdc61cd701e146ef78e4fc6dcdf6dbca0e" + "revision": "e8d9eda4e5ea0b08aa39d48dab0f6553058fbe0f" }, "gitignore": { "revision": "f4685bf11ac466dd278449bcfe5fd014e94aa504" @@ -366,10 +366,10 @@ "revision": "a4b9187417d6be349ee5fd4b6e77b4172c6827dd" }, "markdown": { - "revision": "f9820b2db958228f9be339b67d2de874d065866e" + "revision": "28aa3baef73bd458d053b613b8bd10fd102b4405" }, "markdown_inline": { - "revision": "f9820b2db958228f9be339b67d2de874d065866e" + "revision": "28aa3baef73bd458d053b613b8bd10fd102b4405" }, "matlab": { "revision": "6071891a8c39600203eba20513666cf93b4d650a" @@ -708,7 +708,7 @@ "revision": "32c76f150347c1cd044e90b8e2bc73c00677fa55" }, "vimdoc": { - "revision": "4f8ba9e39c8b3fbaf0bb5f70ac255474a9099359" + "revision": "ed8695ad8de39c3f073da130156f00b1148e2891" }, "vue": { "revision": "91fe2754796cd8fba5f229505a23fa08f3546c06" @@ -720,7 +720,7 @@ "revision": "a041228ae64632f59b9bd37346a0dbcb7817f36b" }, "wing": { - "revision": "fd7adb7c776f2f3656b8a1839d8ee1e6636412f3" + "revision": "40b84b0c8e27df07c9ca8fad97b36820e3e9ce12" }, "xcompose": { "revision": "01344fed31a3cd37a63f03357ec80cbc592a93b5" From 5037721ec5870990db16dcbf06513a78a6a81641 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Thu, 18 Jan 2024 17:08:20 +0100 Subject: [PATCH 0777/2494] fixup: proper union of tables --- lua/nvim-treesitter/configs.lua | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lua/nvim-treesitter/configs.lua b/lua/nvim-treesitter/configs.lua index e64dc28e4..6be0c0148 100644 --- a/lua/nvim-treesitter/configs.lua +++ b/lua/nvim-treesitter/configs.lua @@ -405,6 +405,18 @@ function M.is_enabled(mod, lang, bufnr) return true end +---Combine two list-like tables without duplicates +local union = function(x, y) + local map = {} + for _, v in ipairs(x) do + map[v] = true + end + for _, v in ipairs(y) do + map[v] = true + end + return vim.tbl_keys(map) +end + ---Setup call for users to override module configurations. ---@param user_data TSConfig module overrides function M.setup(user_data) @@ -422,7 +434,7 @@ function M.setup(user_data) local ensure_installed = user_data.ensure_installed or config.ensure_installed if type(ensure_installed) == "table" and type(config.ensure_installed) == "table" then - vim.list_extend(ensure_installed, config.ensure_installed) + union(ensure_installed, config.ensure_installed) end if #ensure_installed > 0 then if user_data.sync_install then From 090880c0f1fec219f7de838cb51b8dc07ce74a6d Mon Sep 17 00:00:00 2001 From: GitHub Date: Fri, 19 Jan 2024 06:37:19 +0000 Subject: [PATCH 0778/2494] Update parsers: scala, wing --- lockfile.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lockfile.json b/lockfile.json index 2ecba3e8e..7c92b385e 100644 --- a/lockfile.json +++ b/lockfile.json @@ -552,7 +552,7 @@ "revision": "79456e6080f50fc1ca7c21845794308fa5d35a51" }, "scala": { - "revision": "7891815f42dca9ed6aeb464c2edc39d479ab965c" + "revision": "0c63ada18d34ac83eec6c7a2fba9a47e65cda48a" }, "scfg": { "revision": "6deae0cbb458c849a4d1e2985093e9c9c32d7fd0" @@ -720,7 +720,7 @@ "revision": "a041228ae64632f59b9bd37346a0dbcb7817f36b" }, "wing": { - "revision": "40b84b0c8e27df07c9ca8fad97b36820e3e9ce12" + "revision": "ee58533169c654b8d7fd47fde01241e528674d8a" }, "xcompose": { "revision": "01344fed31a3cd37a63f03357ec80cbc592a93b5" From f197a15b0d1e8d555263af20add51450e5aaa1f0 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 19 Jan 2024 16:45:58 +0100 Subject: [PATCH 0779/2494] revert "fix(config)!: always install parsers bundled with nvim" --- lua/nvim-treesitter/configs.lua | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/lua/nvim-treesitter/configs.lua b/lua/nvim-treesitter/configs.lua index 6be0c0148..a3ec30fb2 100644 --- a/lua/nvim-treesitter/configs.lua +++ b/lua/nvim-treesitter/configs.lua @@ -20,7 +20,7 @@ local M = {} local config = { modules = {}, sync_install = false, - ensure_installed = { "lua", "query", "vimdoc", "vim", "c", "python", "bash", "markdown", "markdown_inline" }, + ensure_installed = {}, auto_install = false, ignore_install = {}, parser_install_dir = nil, @@ -405,18 +405,6 @@ function M.is_enabled(mod, lang, bufnr) return true end ----Combine two list-like tables without duplicates -local union = function(x, y) - local map = {} - for _, v in ipairs(x) do - map[v] = true - end - for _, v in ipairs(y) do - map[v] = true - end - return vim.tbl_keys(map) -end - ---Setup call for users to override module configurations. ---@param user_data TSConfig module overrides function M.setup(user_data) @@ -432,10 +420,7 @@ function M.setup(user_data) require("nvim-treesitter.install").setup_auto_install() end - local ensure_installed = user_data.ensure_installed or config.ensure_installed - if type(ensure_installed) == "table" and type(config.ensure_installed) == "table" then - union(ensure_installed, config.ensure_installed) - end + local ensure_installed = user_data.ensure_installed or {} if #ensure_installed > 0 then if user_data.sync_install then require("nvim-treesitter.install").ensure_installed_sync(ensure_installed) From 5b90ea2abaa4303b9205b5c9002a8cdd0acd11a5 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sat, 22 Jul 2023 15:29:32 +0200 Subject: [PATCH 0780/2494] feat(locals)!: switch to upstream captures --- CONTRIBUTING.md | 44 +++--- lua/nvim-treesitter/locals.lua | 12 +- queries/ada/locals.scm | 54 +++---- queries/apex/locals.scm | 50 +++---- queries/bash/locals.scm | 10 +- queries/bass/locals.scm | 12 +- queries/bicep/locals.scm | 34 ++--- queries/bitbake/locals.scm | 60 ++++---- queries/c/locals.scm | 38 ++--- queries/c_sharp/locals.scm | 26 ++-- queries/cairo/locals.scm | 30 ++-- queries/capnp/locals.scm | 44 +++--- queries/chatito/locals.scm | 10 +- queries/commonlisp/locals.scm | 40 ++--- queries/corn/locals.scm | 6 +- queries/cpon/locals.scm | 2 +- queries/cpp/locals.scm | 50 +++---- queries/cue/locals.scm | 16 +- queries/dart/locals.scm | 16 +- queries/devicetree/locals.scm | 2 +- queries/dtd/locals.scm | 6 +- queries/ecma/locals.scm | 30 ++-- queries/elixir/locals.scm | 240 +++++++++++++++--------------- queries/elsa/locals.scm | 10 +- queries/fennel/locals.scm | 16 +- queries/firrtl/locals.scm | 26 ++-- queries/fish/locals.scm | 8 +- queries/foam/locals.scm | 8 +- queries/forth/locals.scm | 4 +- queries/fusion/locals.scm | 18 +-- queries/gdscript/locals.scm | 52 +++---- queries/gitattributes/locals.scm | 6 +- queries/gleam/locals.scm | 18 +-- queries/glimmer/locals.scm | 6 +- queries/gn/locals.scm | 4 +- queries/go/locals.scm | 54 +++---- queries/godot_resource/locals.scm | 2 +- queries/hare/locals.scm | 22 +-- queries/heex/locals.scm | 4 +- queries/hoon/locals.scm | 4 +- queries/html/locals.scm | 2 +- queries/ispc/locals.scm | 10 +- queries/java/locals.scm | 68 ++++----- queries/javascript/locals.scm | 22 +-- queries/jq/locals.scm | 8 +- queries/json/locals.scm | 2 +- queries/jsonnet/locals.scm | 20 +-- queries/julia/locals.scm | 42 +++--- queries/kconfig/locals.scm | 10 +- queries/kdl/locals.scm | 14 +- queries/kotlin/locals.scm | 28 ++-- queries/lalrpop/locals.scm | 4 +- queries/linkerscript/locals.scm | 8 +- queries/liquidsoap/locals.scm | 22 +-- queries/lua/locals.scm | 20 +-- queries/luau/locals.scm | 20 +-- queries/m68k/locals.scm | 18 +-- queries/matlab/locals.scm | 22 +-- queries/mlir/locals.scm | 10 +- queries/nim/locals.scm | 216 +++++++++++++-------------- queries/nix/locals.scm | 16 +- queries/ocaml/locals.scm | 34 ++--- queries/odin/locals.scm | 30 ++-- queries/pascal/locals.scm | 40 ++--- queries/php/locals.scm | 38 ++--- queries/pony/locals.scm | 38 ++--- queries/properties/locals.scm | 4 +- queries/puppet/locals.scm | 20 +-- queries/purescript/locals.scm | 8 +- queries/python/locals.scm | 64 ++++---- queries/ql/locals.scm | 32 ++-- queries/query/locals.scm | 16 +- queries/r/locals.scm | 12 +- queries/rasi/locals.scm | 6 +- queries/re2c/locals.scm | 2 +- queries/ron/locals.scm | 18 +-- queries/rst/locals.scm | 20 +-- queries/ruby/locals.scm | 46 +++--- queries/rust/locals.scm | 52 +++---- queries/scala/locals.scm | 26 ++-- queries/smali/locals.scm | 22 +-- queries/sparql/locals.scm | 8 +- queries/squirrel/locals.scm | 24 +-- queries/ssh_config/locals.scm | 4 +- queries/starlark/locals.scm | 50 +++---- queries/supercollider/locals.scm | 12 +- queries/swift/locals.scm | 6 +- queries/systemtap/locals.scm | 20 +-- queries/t32/locals.scm | 16 +- queries/tablegen/locals.scm | 24 +-- queries/teal/locals.scm | 26 ++-- queries/thrift/locals.scm | 34 ++--- queries/tiger/locals.scm | 14 +- queries/tlaplus/locals.scm | 86 +++++------ queries/toml/locals.scm | 2 +- queries/turtle/locals.scm | 6 +- queries/typescript/locals.scm | 14 +- queries/udev/locals.scm | 12 +- queries/ungrammar/locals.scm | 8 +- queries/usd/locals.scm | 2 +- queries/uxntal/locals.scm | 8 +- queries/v/locals.scm | 24 +-- queries/verilog/locals.scm | 24 +-- queries/vim/locals.scm | 10 +- queries/wing/locals.scm | 4 +- queries/xcompose/locals.scm | 4 +- queries/xml/locals.scm | 20 +-- queries/yaml/locals.scm | 6 +- queries/yuck/locals.scm | 10 +- 109 files changed, 1341 insertions(+), 1341 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 43beeb04e..209886d54 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -253,29 +253,29 @@ highlighting (such as diagnostics or LSP semantic tokens). ### Locals -Note: pay specific attention to the captures here as they are a bit different to -those listed in the upstream [Local Variables -docs](https://tree-sitter.github.io/tree-sitter/syntax-highlighting#local-variables). -Some of these docs didn't exist when `nvim-treesitter` was created and the -upstream captures are more limiting than what we have here. +Locals are used to keep track of definitions and references in local or global +scopes, see [upstream +documentation](https://tree-sitter.github.io/tree-sitter/syntax-highlighting#local-variables). +Note that nvim-treesitter uses more specific subcaptures for definitions and +**does not use locals for highlighting**. ```scheme -@definition ; various definitions -@definition.constant ; constants -@definition.function ; functions -@definition.method ; methods -@definition.var ; variables -@definition.parameter ; parameters -@definition.macro ; preprocessor macros -@definition.type ; types or classes -@definition.field ; fields or properties -@definition.enum ; enumerations -@definition.namespace ; modules or namespaces -@definition.import ; imported names -@definition.associated ; the associated type of a variable +@local.definition ; various definitions +@local.definition.constant ; constants +@local.definition.function ; functions +@local.definition.method ; methods +@local.definition.var ; variables +@local.definition.parameter ; parameters +@local.definition.macro ; preprocessor macros +@local.definition.type ; types or classes +@local.definition.field ; fields or properties +@local.definition.enum ; enumerations +@local.definition.namespace ; modules or namespaces +@local.definition.import ; imported names +@local.definition.associated ; the associated type of a variable -@scope ; scope block -@reference ; identifier reference +@local.scope ; scope block +@local.reference ; identifier reference ``` #### Definition Scope @@ -294,7 +294,7 @@ doSomething(); // Should point to the declaration as the definition ```query (function_declaration - ((identifier) @definition.var) + ((identifier) @local.definition.var) (#set! "definition.var.scope" "parent")) ``` @@ -312,7 +312,7 @@ You can define folds for a given language by adding a `folds.scm` query : @fold ; fold this node ``` -If the `folds.scm` query is not present, this will fall back to the `@scope` captures in the `locals` +If the `folds.scm` query is not present, this will fall back to the `@local.scope` captures in the `locals` query. ### Injections diff --git a/lua/nvim-treesitter/locals.lua b/lua/nvim-treesitter/locals.lua index cc69d5621..ab0f89fc1 100644 --- a/lua/nvim-treesitter/locals.lua +++ b/lua/nvim-treesitter/locals.lua @@ -41,8 +41,8 @@ function M.get_definitions(bufnr) local defs = {} for _, loc in ipairs(locals) do - if loc.definition then - table.insert(defs, loc.definition) + if loc["local.definition"] then + table.insert(defs, loc["local.definition"]) end end @@ -55,8 +55,8 @@ function M.get_scopes(bufnr) local scopes = {} for _, loc in ipairs(locals) do - if loc.scope and loc.scope.node then - table.insert(scopes, loc.scope.node) + if loc["local.scope"] and loc["local.scope"].node then + table.insert(scopes, loc["local.scope"].node) end end @@ -69,8 +69,8 @@ function M.get_references(bufnr) local refs = {} for _, loc in ipairs(locals) do - if loc.reference and loc.reference.node then - table.insert(refs, loc.reference.node) + if loc["local.reference"] and loc["local.reference"].node then + table.insert(refs, loc["local.reference"].node) end end diff --git a/queries/ada/locals.scm b/queries/ada/locals.scm index b36d3718c..2d61b3123 100644 --- a/queries/ada/locals.scm +++ b/queries/ada/locals.scm @@ -2,32 +2,32 @@ ;; references. However, this is not yet supported by neovim ;; See https://tree-sitter.github.io/tree-sitter/syntax-highlighting#local-variables -(compilation) @scope -(package_declaration) @scope -(package_body) @scope -(subprogram_declaration) @scope -(subprogram_body) @scope -(block_statement) @scope +(compilation) @local.scope +(package_declaration) @local.scope +(package_body) @local.scope +(subprogram_declaration) @local.scope +(subprogram_body) @local.scope +(block_statement) @local.scope -(with_clause (identifier) @definition.import) -(procedure_specification name: (_) @definition.function) -(function_specification name: (_) @definition.function) -(package_declaration name: (_) @definition.var) -(package_body name: (_) @definition.var) -(generic_instantiation . name: (_) @definition.var) -(component_declaration . (identifier) @definition.var) -(exception_declaration . (identifier) @definition.var) -(formal_object_declaration . (identifier) @definition.var) -(object_declaration . (identifier) @definition.var) -(parameter_specification . (identifier) @definition.var) -(full_type_declaration . (identifier) @definition.type) -(private_type_declaration . (identifier) @definition.type) -(private_extension_declaration . (identifier) @definition.type) -(incomplete_type_declaration . (identifier) @definition.type) -(protected_type_declaration . (identifier) @definition.type) -(formal_complete_type_declaration . (identifier) @definition.type) -(formal_incomplete_type_declaration . (identifier) @definition.type) -(task_type_declaration . (identifier) @definition.type) -(subtype_declaration . (identifier) @definition.type) +(with_clause (identifier) @local.definition.import) +(procedure_specification name: (_) @local.definition.function) +(function_specification name: (_) @local.definition.function) +(package_declaration name: (_) @local.definition.var) +(package_body name: (_) @local.definition.var) +(generic_instantiation . name: (_) @local.definition.var) +(component_declaration . (identifier) @local.definition.var) +(exception_declaration . (identifier) @local.definition.var) +(formal_object_declaration . (identifier) @local.definition.var) +(object_declaration . (identifier) @local.definition.var) +(parameter_specification . (identifier) @local.definition.var) +(full_type_declaration . (identifier) @local.definition.type) +(private_type_declaration . (identifier) @local.definition.type) +(private_extension_declaration . (identifier) @local.definition.type) +(incomplete_type_declaration . (identifier) @local.definition.type) +(protected_type_declaration . (identifier) @local.definition.type) +(formal_complete_type_declaration . (identifier) @local.definition.type) +(formal_incomplete_type_declaration . (identifier) @local.definition.type) +(task_type_declaration . (identifier) @local.definition.type) +(subtype_declaration . (identifier) @local.definition.type) -(identifier) @reference +(identifier) @local.reference diff --git a/queries/apex/locals.scm b/queries/apex/locals.scm index c7213601b..6ffa8648f 100644 --- a/queries/apex/locals.scm +++ b/queries/apex/locals.scm @@ -1,66 +1,66 @@ ; declarations -(class_declaration) @scope -(method_declaration) @scope -(constructor_declaration) @scope -(enum_declaration) @scope -(enhanced_for_statement) @scope +(class_declaration) @local.scope +(method_declaration) @local.scope +(constructor_declaration) @local.scope +(enum_declaration) @local.scope +(enhanced_for_statement) @local.scope ; if/else -(if_statement) @scope +(if_statement) @local.scope (if_statement - consequence: (_) @scope) ; if body in case there are no braces + consequence: (_) @local.scope) ; if body in case there are no braces (if_statement - alternative: (_) @scope) ; else body in case there are no braces + alternative: (_) @local.scope) ; else body in case there are no braces ; try/catch -(try_statement) @scope ; covers try+catch, individual try and catch are covered by (block) -(catch_clause) @scope ; needed because `Exception` variable +(try_statement) @local.scope ; covers try+catch, individual try and catch are covered by (block) +(catch_clause) @local.scope ; needed because `Exception` variable ; loops -(for_statement) @scope +(for_statement) @local.scope (for_statement ; "for" body in case there are no braces - body: (_) @scope) + body: (_) @local.scope) (do_statement - body: (_) @scope) + body: (_) @local.scope) (while_statement - body: (_) @scope) + body: (_) @local.scope) ; Functions -(constructor_declaration) @scope -(method_declaration) @scope +(constructor_declaration) @local.scope +(method_declaration) @local.scope ;; definitions (enum_declaration - name: (identifier) @definition.enum) + name: (identifier) @local.definition.enum) (method_declaration - name: (identifier) @definition.method) + name: (identifier) @local.definition.method) (local_variable_declaration declarator: (variable_declarator - name: (identifier) @definition.var)) + name: (identifier) @local.definition.var)) (enhanced_for_statement - name: (identifier) @definition.var) + name: (identifier) @local.definition.var) (formal_parameter - name: (identifier) @definition.parameter) + name: (identifier) @local.definition.parameter) (catch_formal_parameter - name: (identifier) @definition.parameter) + name: (identifier) @local.definition.parameter) (field_declaration declarator: (variable_declarator - name: (identifier) @definition.field)) + name: (identifier) @local.definition.field)) ;; REFERENCES -(identifier) @reference +(identifier) @local.reference -(type_identifier) @reference +(type_identifier) @local.reference diff --git a/queries/bash/locals.scm b/queries/bash/locals.scm index a03bc3a56..2b9cfec70 100644 --- a/queries/bash/locals.scm +++ b/queries/bash/locals.scm @@ -1,13 +1,13 @@ ; Scopes -(function_definition) @scope +(function_definition) @local.scope ; Definitions (variable_assignment - name: (variable_name) @definition.var) + name: (variable_name) @local.definition.var) (function_definition - name: (word) @definition.function) + name: (word) @local.definition.function) ; References -(variable_name) @reference -(word) @reference +(variable_name) @local.reference +(word) @local.reference diff --git a/queries/bass/locals.scm b/queries/bass/locals.scm index 5a94e7532..c28a78dd5 100644 --- a/queries/bass/locals.scm +++ b/queries/bass/locals.scm @@ -4,22 +4,22 @@ (list) (scope) (cons) -] @scope +] @local.scope ; References -(symbol) @reference +(symbol) @local.reference ; Definitions ((list . (symbol) @_fnkw - . (symbol) @definition.function - (symbol)? @definition.parameter) + . (symbol) @local.definition.function + (symbol)? @local.definition.parameter) (#any-of? @_fnkw "def" "defop" "defn" "fn")) ((cons . (symbol) @_fnkw - . (symbol) @definition.function - (symbol)? @definition.parameter) + . (symbol) @local.definition.function + (symbol)? @local.definition.parameter) (#any-of? @_fnkw "def" "defop" "defn" "fn")) diff --git a/queries/bicep/locals.scm b/queries/bicep/locals.scm index 361be94fb..c28987051 100644 --- a/queries/bicep/locals.scm +++ b/queries/bicep/locals.scm @@ -13,62 +13,62 @@ (array) (object) (interpolation) -] @scope +] @local.scope ; References -(property_identifier) @reference +(property_identifier) @local.reference (call_expression - (identifier) @reference) + (identifier) @local.reference) (object_property (_) ":" - (identifier) @reference) + (identifier) @local.reference) (resource_expression - (identifier) @reference) + (identifier) @local.reference) ; Definitions -(type) @definition.associated +(type) @local.definition.associated (object_property - (identifier) @definition.field + (identifier) @local.definition.field (_)) (object_property - (compatible_identifier) @definition.field + (compatible_identifier) @local.definition.field (_)) -(import_name) @definition.import +(import_name) @local.definition.import (module_declaration - (identifier) @definition.namespace) + (identifier) @local.definition.namespace) (parameter_declaration - (identifier) @definition.parameter + (identifier) @local.definition.parameter (_)) (type_declaration - (identifier) @definition.type + (identifier) @local.definition.type (_)) (variable_declaration - (identifier) @definition.var + (identifier) @local.definition.var (_)) (metadata_declaration - (identifier) @definition.var + (identifier) @local.definition.var (_)) (output_declaration - (identifier) @definition.var + (identifier) @local.definition.var (_)) (for_statement "for" (for_loop_parameters - (loop_variable) @definition.var - (loop_enumerator) @definition.var)) + (loop_variable) @local.definition.var + (loop_enumerator) @local.definition.var)) diff --git a/queries/bitbake/locals.scm b/queries/bitbake/locals.scm index baf835cc5..27e85f02a 100644 --- a/queries/bitbake/locals.scm +++ b/queries/bitbake/locals.scm @@ -2,98 +2,98 @@ [ (python_identifier) (identifier) -] @reference +] @local.reference ; Imports (aliased_import - alias: (python_identifier) @definition.import) + alias: (python_identifier) @local.definition.import) (import_statement - name: (dotted_name ((python_identifier) @definition.import))) + name: (dotted_name ((python_identifier) @local.definition.import))) (import_from_statement - name: (dotted_name ((python_identifier) @definition.import))) + name: (dotted_name ((python_identifier) @local.definition.import))) ; Function with parameters, defines parameters (parameters - (python_identifier) @definition.parameter) + (python_identifier) @local.definition.parameter) (default_parameter - (python_identifier) @definition.parameter) + (python_identifier) @local.definition.parameter) (typed_parameter - (python_identifier) @definition.parameter) + (python_identifier) @local.definition.parameter) (typed_default_parameter - (python_identifier) @definition.parameter) + (python_identifier) @local.definition.parameter) ; *args parameter (parameters (list_splat_pattern - (python_identifier) @definition.parameter)) + (python_identifier) @local.definition.parameter)) ; **kwargs parameter (parameters (dictionary_splat_pattern - (python_identifier) @definition.parameter)) + (python_identifier) @local.definition.parameter)) ; Function defines function and scope ((python_function_definition - name: (python_identifier) @definition.function) @scope + name: (python_identifier) @local.definition.function) @local.scope (#set! definition.function.scope "parent")) -(function_definition (identifier) @definition.function) +(function_definition (identifier) @local.definition.function) -(anonymous_python_function (identifier) @definition.function) +(anonymous_python_function (identifier) @local.definition.function) ;;; Loops ; not a scope! (for_statement left: (pattern_list - (python_identifier) @definition.var)) + (python_identifier) @local.definition.var)) (for_statement left: (tuple_pattern - (python_identifier) @definition.var)) + (python_identifier) @local.definition.var)) (for_statement - left: (python_identifier) @definition.var) + left: (python_identifier) @local.definition.var) ; not a scope! -;(while_statement) @scope +;(while_statement) @local.scope ; for in list comprehension (for_in_clause - left: (python_identifier) @definition.var) + left: (python_identifier) @local.definition.var) (for_in_clause left: (tuple_pattern - (python_identifier) @definition.var)) + (python_identifier) @local.definition.var)) (for_in_clause left: (pattern_list - (python_identifier) @definition.var)) + (python_identifier) @local.definition.var)) -(dictionary_comprehension) @scope -(list_comprehension) @scope -(set_comprehension) @scope +(dictionary_comprehension) @local.scope +(list_comprehension) @local.scope +(set_comprehension) @local.scope ;;; Assignments (assignment - left: (python_identifier) @definition.var) + left: (python_identifier) @local.definition.var) (assignment left: (pattern_list - (python_identifier) @definition.var)) + (python_identifier) @local.definition.var)) (assignment left: (tuple_pattern - (python_identifier) @definition.var)) + (python_identifier) @local.definition.var)) (assignment left: (attribute (python_identifier) - (python_identifier) @definition.field)) + (python_identifier) @local.definition.field)) -(variable_assignment (identifier) operator: [ "=" "?=" "??=" ":=" ] @definition.var) +(variable_assignment (identifier) operator: [ "=" "?=" "??=" ":=" ] @local.definition.var) ; Walrus operator x := 1 (named_expression - (python_identifier) @definition.var) + (python_identifier) @local.definition.var) (as_pattern - alias: (as_pattern_target) @definition.var) + alias: (as_pattern_target) @local.definition.var) diff --git a/queries/c/locals.scm b/queries/c/locals.scm index b59f8f37a..3756bc4a5 100644 --- a/queries/c/locals.scm +++ b/queries/c/locals.scm @@ -1,45 +1,45 @@ ;; Functions definitions (function_declarator - declarator: (identifier) @definition.function) + declarator: (identifier) @local.definition.function) (preproc_function_def - name: (identifier) @definition.macro) @scope + name: (identifier) @local.definition.macro) @local.scope (preproc_def - name: (identifier) @definition.macro) + name: (identifier) @local.definition.macro) (pointer_declarator - declarator: (identifier) @definition.var) + declarator: (identifier) @local.definition.var) (parameter_declaration - declarator: (identifier) @definition.parameter) + declarator: (identifier) @local.definition.parameter) (init_declarator - declarator: (identifier) @definition.var) + declarator: (identifier) @local.definition.var) (array_declarator - declarator: (identifier) @definition.var) + declarator: (identifier) @local.definition.var) (declaration - declarator: (identifier) @definition.var) + declarator: (identifier) @local.definition.var) (enum_specifier - name: (_) @definition.type + name: (_) @local.definition.type (enumerator_list - (enumerator name: (identifier) @definition.var))) + (enumerator name: (identifier) @local.definition.var))) ;; Type / Struct / Enum (field_declaration - declarator: (field_identifier) @definition.field) + declarator: (field_identifier) @local.definition.field) (type_definition - declarator: (type_identifier) @definition.type) + declarator: (type_identifier) @local.definition.type) (struct_specifier - name: (type_identifier) @definition.type) + name: (type_identifier) @local.definition.type) ;; goto -(labeled_statement (statement_identifier) @definition) +(labeled_statement (statement_identifier) @local.definition) ;; References -(identifier) @reference -((field_identifier) @reference +(identifier) @local.reference +((field_identifier) @local.reference (#set! reference.kind "field")) -((type_identifier) @reference +((type_identifier) @local.reference (#set! reference.kind "type")) -(goto_statement (statement_identifier) @reference) +(goto_statement (statement_identifier) @local.reference) ;; Scope [ @@ -50,4 +50,4 @@ (function_definition) (compound_statement) ; a block in curly braces (struct_specifier) -] @scope +] @local.scope diff --git a/queries/c_sharp/locals.scm b/queries/c_sharp/locals.scm index c53eb1a19..1d1665d9d 100644 --- a/queries/c_sharp/locals.scm +++ b/queries/c_sharp/locals.scm @@ -1,41 +1,41 @@ ;; Definitions (variable_declarator - . (identifier) @definition.var) + . (identifier) @local.definition.var) (variable_declarator (tuple_pattern - (identifier) @definition.var)) + (identifier) @local.definition.var)) (declaration_expression - name: (identifier) @definition.var) + name: (identifier) @local.definition.var) (for_each_statement - left: (identifier) @definition.var) + left: (identifier) @local.definition.var) (for_each_statement left: (tuple_pattern - (identifier) @definition.var)) + (identifier) @local.definition.var)) (parameter - (identifier) @definition.parameter) + (identifier) @local.definition.parameter) (method_declaration - name: (identifier) @definition.method) + name: (identifier) @local.definition.method) (local_function_statement - name: (identifier) @definition.method) + name: (identifier) @local.definition.method) (property_declaration - name: (identifier) @definition) + name: (identifier) @local.definition) (type_parameter - (identifier) @definition.type) + (identifier) @local.definition.type) (class_declaration - name: (identifier) @definition) + name: (identifier) @local.definition) ;; References -(identifier) @reference +(identifier) @local.reference ;; Scope -(block) @scope +(block) @local.scope diff --git a/queries/cairo/locals.scm b/queries/cairo/locals.scm index 53b33c01d..a92991f26 100644 --- a/queries/cairo/locals.scm +++ b/queries/cairo/locals.scm @@ -1,9 +1,9 @@ ; References -(identifier) @reference -((type_identifier) @reference +(identifier) @local.reference +((type_identifier) @local.reference (#set! reference.kind "type")) -((field_identifier) @reference +((field_identifier) @local.reference (#set! reference.kind "field")) ; Scopes @@ -20,49 +20,49 @@ (struct_item) (enum_item) (impl_item) -] @scope +] @local.scope (use_declaration argument: (scoped_identifier - name: (identifier) @definition.import)) + name: (identifier) @local.definition.import)) (use_as_clause - alias: (identifier) @definition.import) + alias: (identifier) @local.definition.import) (use_list - (identifier) @definition.import) ; use std::process::{Child, Command, Stdio}; + (identifier) @local.definition.import) ; use std::process::{Child, Command, Stdio}; ; Functions (function_definition - (identifier) @definition.function) + (identifier) @local.definition.function) (function_definition - (identifier) @definition.method + (identifier) @local.definition.method (parameter (self))) ; Function with parameters, defines parameters (parameter - [ (identifier) (self) ] @definition.parameter) + [ (identifier) (self) ] @local.definition.parameter) ; Types (struct_item - name: (type_identifier) @definition.type) + name: (type_identifier) @local.definition.type) (constrained_type_parameter - left: (type_identifier) @definition.type) ; the P in remove_file>(path: P) + left: (type_identifier) @local.definition.type) ; the P in remove_file>(path: P) (enum_item - name: (type_identifier) @definition.type) + name: (type_identifier) @local.definition.type) ; Module (mod_item - name: (identifier) @definition.namespace) + name: (identifier) @local.definition.namespace) ; Variables (assignment_expression - left: (identifier) @definition.var) + left: (identifier) @local.definition.var) diff --git a/queries/capnp/locals.scm b/queries/capnp/locals.scm index fb436bf06..d0025100e 100644 --- a/queries/capnp/locals.scm +++ b/queries/capnp/locals.scm @@ -12,79 +12,79 @@ (struct) (struct_shorthand) (union) -] @scope +] @local.scope [ (extend_type) (field_type) -] @reference -(custom_type (type_identifier) @reference) +] @local.reference +(custom_type (type_identifier) @local.reference) (custom_type (generics (generic_parameters - (generic_identifier) @reference))) + (generic_identifier) @local.reference))) -(annotation_definition_identifier) @definition +(annotation_definition_identifier) @local.definition -(const_identifier) @definition.constant +(const_identifier) @local.definition.constant -(enum (enum_identifier) @definition.enum) +(enum (enum_identifier) @local.definition.enum) [ (enum_member) (field_identifier) -] @definition.field +] @local.definition.field -(method_identifier) @definition.method +(method_identifier) @local.definition.method -(namespace) @definition.namespace +(namespace) @local.definition.namespace [ (param_identifier) (return_identifier) -] @definition.parameter +] @local.definition.parameter -(group (type_identifier) @definition.type) +(group (type_identifier) @local.definition.type) -(struct (type_identifier) @definition.type) +(struct (type_identifier) @local.definition.type) -(union (type_identifier) @definition.type) +(union (type_identifier) @local.definition.type) -(interface (type_identifier) @definition.type) +(interface (type_identifier) @local.definition.type) ; Generics Related (don't know how to combine these) (struct (generics (generic_parameters - (generic_identifier) @definition.parameter))) + (generic_identifier) @local.definition.parameter))) (interface (generics (generic_parameters - (generic_identifier) @definition.parameter))) + (generic_identifier) @local.definition.parameter))) (method (implicit_generics (implicit_generic_parameters - (generic_identifier) @definition.parameter))) + (generic_identifier) @local.definition.parameter))) (method (generics (generic_parameters - (generic_identifier) @definition.parameter))) + (generic_identifier) @local.definition.parameter))) (annotation (generics (generic_parameters - (generic_identifier) @definition.type))) + (generic_identifier) @local.definition.type))) (replace_using (generics (generic_parameters - (generic_identifier) @definition.type))) + (generic_identifier) @local.definition.type))) (return_type (generics (generic_parameters - (generic_identifier) @definition.type))) + (generic_identifier) @local.definition.type))) diff --git a/queries/chatito/locals.scm b/queries/chatito/locals.scm index 4d7a6c1a0..fd8bb9da0 100644 --- a/queries/chatito/locals.scm +++ b/queries/chatito/locals.scm @@ -1,10 +1,10 @@ ;; Definitions -(intent_def (intent) @definition) -(slot_def (slot) @definition) -(alias_def (alias) @definition) +(intent_def (intent) @local.definition) +(slot_def (slot) @local.definition) +(alias_def (alias) @local.definition) ;; References -(slot_ref (slot) @reference) -(alias_ref (alias) @reference) +(slot_ref (slot) @local.reference) +(alias_ref (alias) @local.reference) diff --git a/queries/commonlisp/locals.scm b/queries/commonlisp/locals.scm index 471fad408..647d1007f 100644 --- a/queries/commonlisp/locals.scm +++ b/queries/commonlisp/locals.scm @@ -1,72 +1,72 @@ (defun_header - function_name: (sym_lit) @definition.function (#set! definition.function.scope "parent")) + function_name: (sym_lit) @local.definition.function (#set! definition.function.scope "parent")) (defun_header - lambda_list: (list_lit (sym_lit) @definition.parameter)) + lambda_list: (list_lit (sym_lit) @local.definition.parameter)) (defun_header keyword: (defun_keyword "defmethod") - lambda_list: (list_lit (list_lit . (sym_lit) . (sym_lit) @definition.type))) + lambda_list: (list_lit (list_lit . (sym_lit) . (sym_lit) @local.definition.type))) (defun_header - lambda_list: (list_lit (list_lit . (sym_lit) @definition.parameter . (_)))) + lambda_list: (list_lit (list_lit . (sym_lit) @local.definition.parameter . (_)))) -(sym_lit) @reference +(sym_lit) @local.reference -(defun) @scope +(defun) @local.scope -((list_lit . (sym_lit) @_defvar . (sym_lit) @definition.var) +((list_lit . (sym_lit) @_defvar . (sym_lit) @local.definition.var) (#match? @_defvar "^(cl:)?(defvar|defparameter)$")) (list_lit . (sym_lit) @_deftest . - (sym_lit) @definition.function - (#eq? @_deftest "deftest")) @scope + (sym_lit) @local.definition.function + (#eq? @_deftest "deftest")) @local.scope (list_lit . (sym_lit) @_deftest . - (sym_lit) @definition.function - (#eq? @_deftest "deftest")) @scope + (sym_lit) @local.definition.function + (#eq? @_deftest "deftest")) @local.scope -(for_clause . (sym_lit) @definition.var) -(with_clause . (sym_lit) @definition.var) -(loop_macro) @scope +(for_clause . (sym_lit) @local.definition.var) +(with_clause . (sym_lit) @local.definition.var) +(loop_macro) @local.scope (list_lit . (sym_lit) @_let (#match? @_let "(cl:|cffi:)?(with-accessors|with-foreign-objects|let[*]?)") . - (list_lit (list_lit . (sym_lit) @definition.var))) @scope + (list_lit (list_lit . (sym_lit) @local.definition.var))) @local.scope (list_lit . (sym_lit) @_let (#match? @_let "(cl:|alexandria:)?(with-gensyms|dotimes|with-foreign-object)") . - (list_lit . (sym_lit) @definition.var)) @scope + (list_lit . (sym_lit) @local.definition.var)) @local.scope (list_lit . (kwd_lit) @_import_from (#eq? @_import_from ":import-from") . (_) - (kwd_lit (kwd_symbol) @definition.import)) + (kwd_lit (kwd_symbol) @local.definition.import)) (list_lit . (kwd_lit) @_import_from (#eq? @_import_from ":import-from") . (_) - (sym_lit) @definition.import) + (sym_lit) @local.definition.import) (list_lit . (kwd_lit) @_use (#eq? @_use ":use") - (kwd_lit (kwd_symbol) @definition.import)) + (kwd_lit (kwd_symbol) @local.definition.import)) (list_lit . (kwd_lit) @_use (#eq? @_use ":use") - (sym_lit) @definition.import) + (sym_lit) @local.definition.import) diff --git a/queries/corn/locals.scm b/queries/corn/locals.scm index f6b0d4c70..009d29202 100644 --- a/queries/corn/locals.scm +++ b/queries/corn/locals.scm @@ -3,14 +3,14 @@ [ (object) (array) -] @scope +] @local.scope ; definitions (assign_block (assignment (input) - @definition.constant)) + @local.definition.constant)) -(value (input) @reference) +(value (input) @local.reference) diff --git a/queries/cpon/locals.scm b/queries/cpon/locals.scm index c1854af91..8341b9725 100644 --- a/queries/cpon/locals.scm +++ b/queries/cpon/locals.scm @@ -4,4 +4,4 @@ (meta_map) (map) (array) -] @scope +] @local.scope diff --git a/queries/cpp/locals.scm b/queries/cpp/locals.scm index 570a22af0..d8bb18c05 100644 --- a/queries/cpp/locals.scm +++ b/queries/cpp/locals.scm @@ -3,73 +3,73 @@ ;; Parameters (variadic_parameter_declaration declarator: (variadic_declarator - (identifier) @definition.parameter)) + (identifier) @local.definition.parameter)) (optional_parameter_declaration - declarator: (identifier) @definition.parameter) + declarator: (identifier) @local.definition.parameter) ;; Class / struct definitions -(class_specifier) @scope +(class_specifier) @local.scope (reference_declarator - (identifier) @definition.var) + (identifier) @local.definition.var) (variadic_declarator - (identifier) @definition.var) + (identifier) @local.definition.var) (struct_specifier name: (qualified_identifier - name: (type_identifier) @definition.type)) + name: (type_identifier) @local.definition.type)) (class_specifier - name: (type_identifier) @definition.type) + name: (type_identifier) @local.definition.type) (concept_definition - name: (identifier) @definition.type) + name: (identifier) @local.definition.type) (class_specifier name: (qualified_identifier - name: (type_identifier) @definition.type)) + name: (type_identifier) @local.definition.type)) (alias_declaration - name: (type_identifier) @definition.type) + name: (type_identifier) @local.definition.type) ;template (type_parameter_declaration - (type_identifier) @definition.type) -(template_declaration) @scope + (type_identifier) @local.definition.type) +(template_declaration) @local.scope ;; Namespaces (namespace_definition - name: (namespace_identifier) @definition.namespace - body: (_) @scope) + name: (namespace_identifier) @local.definition.namespace + body: (_) @local.scope) (namespace_definition - name: (nested_namespace_specifier) @definition.namespace - body: (_) @scope) + name: (nested_namespace_specifier) @local.definition.namespace + body: (_) @local.scope) -((namespace_identifier) @reference +((namespace_identifier) @local.reference (#set! reference.kind "namespace")) ;; Function definitions (template_function - name: (identifier) @definition.function) @scope + name: (identifier) @local.definition.function) @local.scope (template_method - name: (field_identifier) @definition.method) @scope + name: (field_identifier) @local.definition.method) @local.scope (function_declarator declarator: (qualified_identifier - name: (identifier) @definition.function)) @scope + name: (identifier) @local.definition.function)) @local.scope (field_declaration declarator: (function_declarator - (field_identifier) @definition.method)) + (field_identifier) @local.definition.method)) -(lambda_expression) @scope +(lambda_expression) @local.scope ;; Control structures (try_statement - body: (_) @scope) + body: (_) @local.scope) -(catch_clause) @scope +(catch_clause) @local.scope -(requires_expression) @scope +(requires_expression) @local.scope diff --git a/queries/cue/locals.scm b/queries/cue/locals.scm index b99a4fca8..bdc4a56a2 100644 --- a/queries/cue/locals.scm +++ b/queries/cue/locals.scm @@ -4,31 +4,31 @@ (source_file) (field) (for_clause) -] @scope +] @local.scope ; References -(identifier) @reference +(identifier) @local.reference ; Definitions (import_spec - path: (string) @definition.import) + path: (string) @local.definition.import) (field (label - (identifier) @definition.field)) + (identifier) @local.definition.field)) -(package_identifier) @definition.namespace +(package_identifier) @local.definition.namespace (for_clause - (identifier) @definition.variable + (identifier) @local.definition.variable (expression)) (for_clause (identifier) - (identifier) @definition.variable + (identifier) @local.definition.variable (expression)) (let_clause - (identifier) @definition.variable) + (identifier) @local.definition.variable) diff --git a/queries/dart/locals.scm b/queries/dart/locals.scm index 2184bab1d..f7faa26ac 100644 --- a/queries/dart/locals.scm +++ b/queries/dart/locals.scm @@ -1,28 +1,28 @@ ;; Definitions (function_signature - name: (identifier) @definition.function) + name: (identifier) @local.definition.function) (formal_parameter - name: (identifier) @definition.parameter) + name: (identifier) @local.definition.parameter) (initialized_variable_definition - name: (identifier) @definition.var) + name: (identifier) @local.definition.var) (initialized_identifier - (identifier) @definition.var) + (identifier) @local.definition.var) (static_final_declaration - (identifier) @definition.var) + (identifier) @local.definition.var) ;; References -(identifier) @reference +(identifier) @local.reference ;; Scopes (class_definition - body: (_) @scope) + body: (_) @local.scope) [ (block) (if_statement) @@ -31,4 +31,4 @@ (try_statement) (catch_clause) (finally_clause) -] @scope +] @local.scope diff --git a/queries/devicetree/locals.scm b/queries/devicetree/locals.scm index 95b124bd1..88b266ec2 100644 --- a/queries/devicetree/locals.scm +++ b/queries/devicetree/locals.scm @@ -1,4 +1,4 @@ [ (node) (integer_cells) -]@scope +]@local.scope diff --git a/queries/dtd/locals.scm b/queries/dtd/locals.scm index 7efcdd030..6f64c6791 100644 --- a/queries/dtd/locals.scm +++ b/queries/dtd/locals.scm @@ -1,7 +1,7 @@ -(elementdecl (Name) @definition.type) +(elementdecl (Name) @local.definition.type) (elementdecl (contentspec - (children (Name) @reference))) + (children (Name) @local.reference))) -(AttlistDecl . (Name) @reference) +(AttlistDecl . (Name) @local.reference) diff --git a/queries/ecma/locals.scm b/queries/ecma/locals.scm index 4c035d269..86e565490 100644 --- a/queries/ecma/locals.scm +++ b/queries/ecma/locals.scm @@ -1,37 +1,37 @@ ; Scopes ;------- -(statement_block) @scope -(function) @scope -(arrow_function) @scope -(function_declaration) @scope -(method_definition) @scope -(for_statement) @scope -(for_in_statement) @scope -(catch_clause) @scope +(statement_block) @local.scope +(function) @local.scope +(arrow_function) @local.scope +(function_declaration) @local.scope +(method_definition) @local.scope +(for_statement) @local.scope +(for_in_statement) @local.scope +(catch_clause) @local.scope ; Definitions ;------------ (variable_declarator - name: (identifier) @definition.var) + name: (identifier) @local.definition.var) (import_specifier - (identifier) @definition.import) + (identifier) @local.definition.import) (namespace_import - (identifier) @definition.import) + (identifier) @local.definition.import) (function_declaration - ((identifier) @definition.function) + ((identifier) @local.definition.function) (#set! definition.var.scope parent)) (method_definition - ((property_identifier) @definition.function) + ((property_identifier) @local.definition.function) (#set! definition.var.scope parent)) ; References ;------------ -(identifier) @reference -(shorthand_property_identifier) @reference +(identifier) @local.reference +(shorthand_property_identifier) @local.reference diff --git a/queries/elixir/locals.scm b/queries/elixir/locals.scm index 79a9676df..ae37b9ca8 100644 --- a/queries/elixir/locals.scm +++ b/queries/elixir/locals.scm @@ -1,86 +1,86 @@ ; References -(identifier) @reference -(alias) @reference +(identifier) @local.reference +(alias) @local.reference ; Module Definitions (call target: ((identifier) @_identifier (#eq? @_identifier "defmodule")) - (arguments (alias) @definition.type)) + (arguments (alias) @local.definition.type)) ; Pattern Match Definitions (binary_operator left: [ - (identifier) @definition.var - (_ (identifier) @definition.var) - (_ (_ (identifier) @definition.var)) - (_ (_ (_ (identifier) @definition.var))) - (_ (_ (_ (_ (identifier) @definition.var)))) - (_ (_ (_ (_ (_ (identifier) @definition.var))))) - (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))) - (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))))))))))))))) + (identifier) @local.definition.var + (_ (identifier) @local.definition.var) + (_ (_ (identifier) @local.definition.var)) + (_ (_ (_ (identifier) @local.definition.var))) + (_ (_ (_ (_ (identifier) @local.definition.var)))) + (_ (_ (_ (_ (_ (identifier) @local.definition.var))))) + (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))) + (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))))))))) ] operator: "=") ; Stab Clause Definitions (stab_clause left: [ (arguments [ - (identifier) @definition.var - (_ (identifier) @definition.var) - (_ (_ (identifier) @definition.var)) - (_ (_ (_ (identifier) @definition.var))) - (_ (_ (_ (_ (identifier) @definition.var)))) - (_ (_ (_ (_ (_ (identifier) @definition.var))))) - (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))) - (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))))))))))))))) + (identifier) @local.definition.var + (_ (identifier) @local.definition.var) + (_ (_ (identifier) @local.definition.var)) + (_ (_ (_ (identifier) @local.definition.var))) + (_ (_ (_ (_ (identifier) @local.definition.var)))) + (_ (_ (_ (_ (_ (identifier) @local.definition.var))))) + (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))) + (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))))))))) ]) (binary_operator left: (arguments [ - (identifier) @definition.var - (_ (identifier) @definition.var) - (_ (_ (identifier) @definition.var)) - (_ (_ (_ (identifier) @definition.var))) - (_ (_ (_ (_ (identifier) @definition.var)))) - (_ (_ (_ (_ (_ (identifier) @definition.var))))) - (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))) - (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var))))))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.var)))))))))))))))))))) + (identifier) @local.definition.var + (_ (identifier) @local.definition.var) + (_ (_ (identifier) @local.definition.var)) + (_ (_ (_ (identifier) @local.definition.var))) + (_ (_ (_ (_ (identifier) @local.definition.var)))) + (_ (_ (_ (_ (_ (identifier) @local.definition.var))))) + (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))) + (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))))))))) ]) operator: "when") ]) @@ -88,11 +88,11 @@ (call target: ((identifier) @_identifier (#any-of? @_identifier "require" "alias" "use" "import")) (arguments [ - (alias) @definition.import - (_ (alias) @definition.import) - (_ (_ (alias) @definition.import)) - (_ (_ (_ (alias) @definition.import))) - (_ (_ (_ (_ (alias) @definition.import)))) + (alias) @local.definition.import + (_ (alias) @local.definition.import) + (_ (_ (alias) @local.definition.import)) + (_ (_ (_ (alias) @local.definition.import))) + (_ (_ (_ (_ (alias) @local.definition.import)))) ] )) @@ -100,35 +100,35 @@ (call target: ((identifier) @_identifier (#any-of? @_identifier "def" "defp" "defmacro" "defmacrop" "defguard" "defguardp" "defn" "defnp" "for")) (arguments [ - (identifier) @definition.function - (binary_operator left: (identifier) @definition.function operator: "when") - (binary_operator (identifier) @definition.parameter) - (call target: (identifier) @definition.function (arguments [ - (identifier) @definition.parameter - (_ (identifier) @definition.parameter) - (_ (_ (identifier) @definition.parameter)) - (_ (_ (_ (identifier) @definition.parameter))) - (_ (_ (_ (_ (identifier) @definition.parameter)))) - (_ (_ (_ (_ (_ (identifier) @definition.parameter))))) - (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter)))))) - (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter)))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter)))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter)))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter)))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter)))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter))))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter)))))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter))))))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter)))))))))))))))))))) + (identifier) @local.definition.function + (binary_operator left: (identifier) @local.definition.function operator: "when") + (binary_operator (identifier) @local.definition.parameter) + (call target: (identifier) @local.definition.function (arguments [ + (identifier) @local.definition.parameter + (_ (identifier) @local.definition.parameter) + (_ (_ (identifier) @local.definition.parameter)) + (_ (_ (_ (identifier) @local.definition.parameter))) + (_ (_ (_ (_ (identifier) @local.definition.parameter)))) + (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))) + (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))) + (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))))))))))) ])) ]?) (#set! definition.function.scope parent) (do_block)? -) @scope +) @local.scope ; ExUnit Test Definitions & Scopes (call @@ -136,29 +136,29 @@ (arguments [ (string) ((string) . "," . [ - (identifier) @definition.parameter - (_ (identifier) @definition.parameter) - (_ (_ (identifier) @definition.parameter)) - (_ (_ (_ (identifier) @definition.parameter))) - (_ (_ (_ (_ (identifier) @definition.parameter)))) - (_ (_ (_ (_ (_ (identifier) @definition.parameter))))) - (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter)))))) - (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter)))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter)))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter)))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter)))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter)))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter))))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter)))))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter))))))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @definition.parameter)))))))))))))))))))) + (identifier) @local.definition.parameter + (_ (identifier) @local.definition.parameter) + (_ (_ (identifier) @local.definition.parameter)) + (_ (_ (_ (identifier) @local.definition.parameter))) + (_ (_ (_ (_ (identifier) @local.definition.parameter)))) + (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))) + (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))) + (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))))))))))) ]) -]) (do_block)?) @scope +]) (do_block)?) @local.scope ; Stab Clause Scopes -(stab_clause) @scope +(stab_clause) @local.scope diff --git a/queries/elsa/locals.scm b/queries/elsa/locals.scm index de7030796..3e8197ae7 100644 --- a/queries/elsa/locals.scm +++ b/queries/elsa/locals.scm @@ -1,12 +1,12 @@ [ (source_file) (reduction) -] @scope +] @local.scope -(identifier) @reference +(identifier) @local.reference -(function) @definition.function +(function) @local.definition.function -(method) @definition.method +(method) @local.definition.method -(parameter) @definition.parameter +(parameter) @local.definition.parameter diff --git a/queries/fennel/locals.scm b/queries/fennel/locals.scm index 3018732f9..38e54bf6d 100644 --- a/queries/fennel/locals.scm +++ b/queries/fennel/locals.scm @@ -6,21 +6,21 @@ (each) (for) (match) -] @scope +] @local.scope ( - (list . (symbol) @_special) @scope + (list . (symbol) @_special) @local.scope (#any-of? @_special "while" "if" "when" "do" "collect" "icollect" "accumulate") ) -(fn name: (symbol) @definition.function +(fn name: (symbol) @local.definition.function (#set! definition.function.scope "parent")) -(lambda name: (symbol) @definition.function +(lambda name: (symbol) @local.definition.function (#set! definition.function.scope "parent")) -; TODO: use @definition.parameter for parameters -(binding (symbol) @definition.var) -(for_clause . (symbol) @definition.var) +; TODO: use @local.definition.parameter for parameters +(binding (symbol) @local.definition.var) +(for_clause . (symbol) @local.definition.var) -(symbol) @reference +(symbol) @local.reference diff --git a/queries/firrtl/locals.scm b/queries/firrtl/locals.scm index bb7fc56bd..aa0e294cd 100644 --- a/queries/firrtl/locals.scm +++ b/queries/firrtl/locals.scm @@ -7,32 +7,32 @@ (else) (when) -] @scope +] @local.scope ; References -(identifier) @reference +(identifier) @local.reference ; Definitions -(port (identifier) @definition.field) +(port (identifier) @local.definition.field) -(wire (identifier) @definition.field) +(wire (identifier) @local.definition.field) -(cmem (identifier) @definition.field) +(cmem (identifier) @local.definition.field) -(smem (identifier) @definition.field) +(smem (identifier) @local.definition.field) -(memory (identifier) @definition.field) +(memory (identifier) @local.definition.field) -(register (identifier) @definition.field) +(register (identifier) @local.definition.field) -(circuit (identifier) @definition.namespace) +(circuit (identifier) @local.definition.namespace) -(module (identifier) @definition.namespace) +(module (identifier) @local.definition.namespace) -(parameter (identifier) @definition.parameter) +(parameter (identifier) @local.definition.parameter) -(rdwr (identifier) @definition.var) +(rdwr (identifier) @local.definition.var) -(node (identifier) @definition.var) +(node (identifier) @local.definition.var) diff --git a/queries/fish/locals.scm b/queries/fish/locals.scm index a522c78dc..15c3aac1d 100644 --- a/queries/fish/locals.scm +++ b/queries/fish/locals.scm @@ -7,12 +7,12 @@ (begin_statement) (while_statement) (switch_statement) -] @scope +] @local.scope ;; Definitions (function_definition - name: (word) @definition.function) + name: (word) @local.definition.function) ;; References -(variable_name) @reference -(word) @reference +(variable_name) @local.reference +(word) @local.reference diff --git a/queries/foam/locals.scm b/queries/foam/locals.scm index 2abe743dd..c1f635036 100644 --- a/queries/foam/locals.scm +++ b/queries/foam/locals.scm @@ -1,6 +1,6 @@ -(dict) @scope +(dict) @local.scope -(dict key: (_) @definition.type) +(dict key: (_) @local.definition.type) -(key_value keyword: (_) @definition.parameter) -(key_value value: (macro (identifier)*)* @reference) +(key_value keyword: (_) @local.definition.parameter) +(key_value value: (macro (identifier)*)* @local.reference) diff --git a/queries/forth/locals.scm b/queries/forth/locals.scm index 3a5e191d2..d91d3aa98 100644 --- a/queries/forth/locals.scm +++ b/queries/forth/locals.scm @@ -1,3 +1,3 @@ -(word) @reference +(word) @local.reference -(word_definition) @scope +(word_definition) @local.scope diff --git a/queries/fusion/locals.scm b/queries/fusion/locals.scm index 24dc57bbe..19afce078 100644 --- a/queries/fusion/locals.scm +++ b/queries/fusion/locals.scm @@ -1,21 +1,21 @@ ;; Fusion base -(block) @scope +(block) @local.scope (namespace_declaration - (alias_namespace) @definition.namespace) + (alias_namespace) @local.definition.namespace) (property - (path (path_part) @definition.field)) + (path (path_part) @local.definition.field)) (type - namespace: (package_name)? @definition.namespace - name: (type_name) @definition.type + namespace: (package_name)? @local.definition.namespace + name: (type_name) @local.definition.type ) ;; Eel Expressions -(eel_arrow_function) @scope -(eel_object) @scope +(eel_arrow_function) @local.scope +(eel_object) @local.scope -(eel_parameter) @definition.parameter +(eel_parameter) @local.definition.parameter (eel_object_pair - key: (eel_property_name) @definition.field) + key: (eel_property_name) @local.definition.field) diff --git a/queries/gdscript/locals.scm b/queries/gdscript/locals.scm index 2c352b4a3..ebcda4f7d 100644 --- a/queries/gdscript/locals.scm +++ b/queries/gdscript/locals.scm @@ -14,79 +14,79 @@ (lambda) (get_body) (set_body) -] @scope +] @local.scope ;; Parameters -(parameters (identifier) @definition.parameter) -(default_parameter (identifier) @definition.parameter) -(typed_parameter (identifier) @definition.parameter) -(typed_default_parameter (identifier) @definition.parameter) +(parameters (identifier) @local.definition.parameter) +(default_parameter (identifier) @local.definition.parameter) +(typed_parameter (identifier) @local.definition.parameter) +(typed_default_parameter (identifier) @local.definition.parameter) ;; Signals ; Can gdscript 2 signals be considered fields? -(signal_statement (name) @definition.field) +(signal_statement (name) @local.definition.field) ;; Variable Definitions -(const_statement (name) @definition.constant) +(const_statement (name) @local.definition.constant) ; onready and export variations are only properties. -(variable_statement (name) @definition.var) +(variable_statement (name) @local.definition.var) -(setter) @reference -(getter) @reference +(setter) @local.reference +(getter) @local.reference ;; Function Definition -((function_definition (name) @definition.function) +((function_definition (name) @local.definition.function) (#set! "definition.function.scope" "parent")) ;; Lambda ; lambda names are not accessible and are only for debugging. -(lambda (name) @definition.function) +(lambda (name) @local.definition.function) ;; Source -(class_name_statement (name) @definition.type) +(class_name_statement (name) @local.definition.type) -(source (variable_statement (name) @definition.field)) -(source (onready_variable_statement (name) @definition.field)) -(source (export_variable_statement (name) @definition.field)) +(source (variable_statement (name) @local.definition.field)) +(source (onready_variable_statement (name) @local.definition.field)) +(source (export_variable_statement (name) @local.definition.field)) ;; Class -((class_definition (name) @definition.type) +((class_definition (name) @local.definition.type) (#set! "definition.type.scope" "parent")) (class_definition - (body (variable_statement (name) @definition.field))) + (body (variable_statement (name) @local.definition.field))) (class_definition - (body (onready_variable_statement (name) @definition.field))) + (body (onready_variable_statement (name) @local.definition.field))) (class_definition - (body (export_variable_statement (name) @definition.field))) + (body (export_variable_statement (name) @local.definition.field))) (class_definition - (body (signal_statement (name) @definition.field))) + (body (signal_statement (name) @local.definition.field))) ; Although a script is also a class, let's only define functions in an inner class as ; methods. ((class_definition - (body (function_definition (name) @definition.method))) + (body (function_definition (name) @local.definition.method))) (#set! "definition.method.scope" "parent")) ;; Enum -((enum_definition (name) @definition.enum)) +((enum_definition (name) @local.definition.enum)) ;; Repeat -(for_statement . (identifier) @definition.var) +(for_statement . (identifier) @local.definition.var) ;; Match Statement -(pattern_binding (identifier) @definition.var) +(pattern_binding (identifier) @local.definition.var) ;; References -(identifier) @reference +(identifier) @local.reference diff --git a/queries/gitattributes/locals.scm b/queries/gitattributes/locals.scm index 6a9aee1d5..43082a43d 100644 --- a/queries/gitattributes/locals.scm +++ b/queries/gitattributes/locals.scm @@ -1,4 +1,4 @@ -(macro_def (attr_name) @definition.macro) +(macro_def (attr_name) @local.definition.macro) -(attribute (attr_name) @reference) -(attribute (builtin_attr) @reference) +(attribute (attr_name) @local.reference) +(attribute (builtin_attr) @local.reference) diff --git a/queries/gleam/locals.scm b/queries/gleam/locals.scm index 8872e51f0..43328ce1b 100644 --- a/queries/gleam/locals.scm +++ b/queries/gleam/locals.scm @@ -1,24 +1,24 @@ ; Let Binding Definition -(let pattern: (identifier) @definition) +(let pattern: (identifier) @local.definition) ; List Pattern Definitions -(list_pattern (identifier) @definition) -(list_pattern assign: (identifier) @definition) +(list_pattern (identifier) @local.definition) +(list_pattern assign: (identifier) @local.definition) ; Tuple Pattern Definition -(tuple_pattern (identifier) @definition) +(tuple_pattern (identifier) @local.definition) ; Record Pattern Definition -(record_pattern_argument pattern: (identifier) @definition) +(record_pattern_argument pattern: (identifier) @local.definition) ; Function Parameter Definition -(function_parameter name: (identifier) @definition) +(function_parameter name: (identifier) @local.definition) ; References -(identifier) @reference +(identifier) @local.reference ; Function Body Scope -(function_body) @scope +(function_body) @local.scope ; Case Scope -(case_clause) @scope +(case_clause) @local.scope diff --git a/queries/glimmer/locals.scm b/queries/glimmer/locals.scm index c371162bc..705382aa9 100644 --- a/queries/glimmer/locals.scm +++ b/queries/glimmer/locals.scm @@ -1,7 +1,7 @@ [ (element_node) (block_statement) -] @scope +] @local.scope -(identifier) @reference -(block_params (identifier) @definition.var) +(identifier) @local.reference +(block_params (identifier) @local.definition.var) diff --git a/queries/gn/locals.scm b/queries/gn/locals.scm index 1350a2318..eecb3426a 100644 --- a/queries/gn/locals.scm +++ b/queries/gn/locals.scm @@ -1,6 +1,6 @@ [ (source_file) (block) -] @scope +] @local.scope -(identifier) @reference +(identifier) @local.reference diff --git a/queries/go/locals.scm b/queries/go/locals.scm index b027c217a..37d72b2be 100644 --- a/queries/go/locals.scm +++ b/queries/go/locals.scm @@ -1,79 +1,79 @@ ( (function_declaration - name: (identifier) @definition.function) ;@function + name: (identifier) @local.definition.function) ;@function ) ( (method_declaration - name: (field_identifier) @definition.method); @method + name: (field_identifier) @local.definition.method); @method ) (short_var_declaration left: (expression_list - (identifier) @definition.var)) + (identifier) @local.definition.var)) (var_spec - name: (identifier) @definition.var) + name: (identifier) @local.definition.var) -(parameter_declaration (identifier) @definition.var) -(variadic_parameter_declaration (identifier) @definition.var) +(parameter_declaration (identifier) @local.definition.var) +(variadic_parameter_declaration (identifier) @local.definition.var) (for_statement (range_clause left: (expression_list - (identifier) @definition.var))) + (identifier) @local.definition.var))) (const_declaration (const_spec - name: (identifier) @definition.var)) + name: (identifier) @local.definition.var)) (type_declaration (type_spec - name: (type_identifier) @definition.type)) + name: (type_identifier) @local.definition.type)) ;; reference -(identifier) @reference -(type_identifier) @reference -(field_identifier) @reference -((package_identifier) @reference +(identifier) @local.reference +(type_identifier) @local.reference +(field_identifier) @local.reference +((package_identifier) @local.reference (#set! reference.kind "namespace")) (package_clause - (package_identifier) @definition.namespace) + (package_identifier) @local.definition.namespace) (import_spec_list (import_spec - name: (package_identifier) @definition.namespace)) + name: (package_identifier) @local.definition.namespace)) ;; Call references ((call_expression - function: (identifier) @reference) + function: (identifier) @local.reference) (#set! reference.kind "call" )) ((call_expression function: (selector_expression - field: (field_identifier) @reference)) + field: (field_identifier) @local.reference)) (#set! reference.kind "call" )) ((call_expression function: (parenthesized_expression - (identifier) @reference)) + (identifier) @local.reference)) (#set! reference.kind "call" )) ((call_expression function: (parenthesized_expression (selector_expression - field: (field_identifier) @reference))) + field: (field_identifier) @local.reference))) (#set! reference.kind "call" )) ;; Scopes -(func_literal) @scope -(source_file) @scope -(function_declaration) @scope -(if_statement) @scope -(block) @scope -(expression_switch_statement) @scope -(for_statement) @scope -(method_declaration) @scope +(func_literal) @local.scope +(source_file) @local.scope +(function_declaration) @local.scope +(if_statement) @local.scope +(block) @local.scope +(expression_switch_statement) @local.scope +(for_statement) @local.scope +(method_declaration) @local.scope diff --git a/queries/godot_resource/locals.scm b/queries/godot_resource/locals.scm index 1dce04f0c..53982b713 100644 --- a/queries/godot_resource/locals.scm +++ b/queries/godot_resource/locals.scm @@ -1,3 +1,3 @@ [ (section) -] @scope +] @local.scope diff --git a/queries/hare/locals.scm b/queries/hare/locals.scm index 62eb6665b..bf606b9b1 100644 --- a/queries/hare/locals.scm +++ b/queries/hare/locals.scm @@ -7,41 +7,41 @@ (for_statement) (match_expression) (switch_expression) -] @scope +] @local.scope ; References [ (identifier) (scoped_type_identifier) -] @reference +] @local.reference ; Definitions (global_binding - (identifier) @definition.constant . ":" (_)) + (identifier) @local.definition.constant . ":" (_)) (const_declaration - "const" (identifier) @definition.constant . "=") + "const" (identifier) @local.definition.constant . "=") (field - . (identifier) @definition.field) + . (identifier) @local.definition.field) (field_assignment - . (identifier) @definition.field) + . (identifier) @local.definition.field) (function_declaration - "fn" . (identifier) @definition.function) + "fn" . (identifier) @local.definition.function) (parameter - (_) @definition.parameter . ":") + (_) @local.definition.parameter . ":") (type_declaration - "type" (identifier) @definition.type . "=") + "type" (identifier) @local.definition.type . "=") (type_declaration - "type" (identifier) @definition.enum . "=" (enum_type)) + "type" (identifier) @local.definition.enum . "=" (enum_type)) (let_declaration - "let" . (identifier) @definition.variable ","?) + "let" . (identifier) @local.definition.variable ","?) diff --git a/queries/heex/locals.scm b/queries/heex/locals.scm index 4371bc979..cfa239e5f 100644 --- a/queries/heex/locals.scm +++ b/queries/heex/locals.scm @@ -3,11 +3,11 @@ (component_name) (slot_name) (tag_name) -] @reference +] @local.reference ; Create a new scope within each HEEx tag, component, and slot [ (component) (slot) (tag) -] @scope +] @local.scope diff --git a/queries/hoon/locals.scm b/queries/hoon/locals.scm index 159783fd0..f8cb5f857 100644 --- a/queries/hoon/locals.scm +++ b/queries/hoon/locals.scm @@ -1,4 +1,4 @@ (tisfasTall - name: (name) @definition.var) + name: (name) @local.definition.var) -(name) @reference +(name) @local.reference diff --git a/queries/html/locals.scm b/queries/html/locals.scm index 04d296a23..4e3325db8 100644 --- a/queries/html/locals.scm +++ b/queries/html/locals.scm @@ -1 +1 @@ -(element) @scope +(element) @local.scope diff --git a/queries/ispc/locals.scm b/queries/ispc/locals.scm index 8eca18c67..e2e5a9663 100644 --- a/queries/ispc/locals.scm +++ b/queries/ispc/locals.scm @@ -1,17 +1,17 @@ ; inherits: c (reference_declarator - (identifier) @definition.var) + (identifier) @local.definition.var) (type_parameter_declaration - (type_identifier) @definition.type) -(template_declaration) @scope + (type_identifier) @local.definition.type) +(template_declaration) @local.scope (template_function - name: (identifier) @definition.function) @scope + name: (identifier) @local.definition.function) @local.scope [ (foreach_statement) (foreach_instance_statement) (unmasked_statement) -] @scope +] @local.scope diff --git a/queries/java/locals.scm b/queries/java/locals.scm index 1d59fee90..0e8758b6d 100644 --- a/queries/java/locals.scm +++ b/queries/java/locals.scm @@ -2,88 +2,88 @@ ; declarations -(program) @scope +(program) @local.scope (class_declaration - body: (_) @scope) + body: (_) @local.scope) (record_declaration - body: (_) @scope) + body: (_) @local.scope) (enum_declaration - body: (_) @scope) -(lambda_expression) @scope -(enhanced_for_statement) @scope + body: (_) @local.scope) +(lambda_expression) @local.scope +(enhanced_for_statement) @local.scope ; block -(block) @scope +(block) @local.scope ; if/else -(if_statement) @scope ; if+else +(if_statement) @local.scope ; if+else (if_statement - consequence: (_) @scope) ; if body in case there are no braces + consequence: (_) @local.scope) ; if body in case there are no braces (if_statement - alternative: (_) @scope) ; else body in case there are no braces + alternative: (_) @local.scope) ; else body in case there are no braces ; try/catch -(try_statement) @scope ; covers try+catch, individual try and catch are covered by (block) -(catch_clause) @scope ; needed because `Exception` variable +(try_statement) @local.scope ; covers try+catch, individual try and catch are covered by (block) +(catch_clause) @local.scope ; needed because `Exception` variable ; loops -(for_statement) @scope ; whole for_statement because loop iterator variable +(for_statement) @local.scope ; whole for_statement because loop iterator variable (for_statement ; "for" body in case there are no braces - body: (_) @scope) + body: (_) @local.scope) (do_statement - body: (_) @scope) + body: (_) @local.scope) (while_statement - body: (_) @scope) + body: (_) @local.scope) ; Functions -(constructor_declaration) @scope -(method_declaration) @scope +(constructor_declaration) @local.scope +(method_declaration) @local.scope ;; DEFINITIONS (package_declaration - (identifier) @definition.namespace) + (identifier) @local.definition.namespace) (class_declaration - name: (identifier) @definition.type) + name: (identifier) @local.definition.type) (record_declaration - name: (identifier) @definition.type) + name: (identifier) @local.definition.type) (enum_declaration - name: (identifier) @definition.enum) + name: (identifier) @local.definition.enum) (method_declaration - name: (identifier) @definition.method) + name: (identifier) @local.definition.method) (local_variable_declaration declarator: (variable_declarator - name: (identifier) @definition.var)) + name: (identifier) @local.definition.var)) (enhanced_for_statement ; for (var item : items) { - name: (identifier) @definition.var) + name: (identifier) @local.definition.var) (formal_parameter - name: (identifier) @definition.parameter) + name: (identifier) @local.definition.parameter) (catch_formal_parameter - name: (identifier) @definition.parameter) -(inferred_parameters (identifier) @definition.parameter) ; (x,y) -> ... + name: (identifier) @local.definition.parameter) +(inferred_parameters (identifier) @local.definition.parameter) ; (x,y) -> ... (lambda_expression - parameters: (identifier) @definition.parameter) ; x -> ... + parameters: (identifier) @local.definition.parameter) ; x -> ... ((scoped_identifier - (identifier) @definition.import) - (#has-ancestor? @definition.import import_declaration)) + (identifier) @local.definition.import) + (#has-ancestor? @local.definition.import import_declaration)) (field_declaration declarator: (variable_declarator - name: (identifier) @definition.field)) + name: (identifier) @local.definition.field)) ;; REFERENCES -(identifier) @reference +(identifier) @local.reference -(type_identifier) @reference +(type_identifier) @local.reference diff --git a/queries/javascript/locals.scm b/queries/javascript/locals.scm index 098f18af6..278702dfc 100644 --- a/queries/javascript/locals.scm +++ b/queries/javascript/locals.scm @@ -7,45 +7,45 @@ ; this.quuz = "qux"; ; } (field_definition - property: [(property_identifier) (private_property_identifier)] @definition.var) + property: [(property_identifier) (private_property_identifier)] @local.definition.var) ; this.foo = "bar" (assignment_expression left: (member_expression object: (this) - property: (property_identifier) @definition.var)) + property: (property_identifier) @local.definition.var)) (formal_parameters - (identifier) @definition.parameter) + (identifier) @local.definition.parameter) ; function(arg = []) { (formal_parameters (assignment_pattern - left: (identifier) @definition.parameter)) + left: (identifier) @local.definition.parameter)) ; x => x (arrow_function - parameter: (identifier) @definition.parameter) + parameter: (identifier) @local.definition.parameter) ;; ({ a }) => null (formal_parameters (object_pattern - (shorthand_property_identifier_pattern) @definition.parameter)) + (shorthand_property_identifier_pattern) @local.definition.parameter)) ;; ({ a: b }) => null (formal_parameters (object_pattern (pair_pattern - value: (identifier) @definition.parameter))) + value: (identifier) @local.definition.parameter))) ;; ([ a ]) => null (formal_parameters (array_pattern - (identifier) @definition.parameter)) + (identifier) @local.definition.parameter)) (formal_parameters (rest_pattern - (identifier) @definition.parameter)) + (identifier) @local.definition.parameter)) ; Both methods are matched here. ; @@ -54,10 +54,10 @@ ; baz(y) { y } ; } (method_definition - ([(property_identifier) (private_property_identifier)] @definition.function) + ([(property_identifier) (private_property_identifier)] @local.definition.function) (#set! definition.var.scope parent)) ; this.foo() (member_expression object: (this) - property: (property_identifier) @reference) + property: (property_identifier) @local.reference) diff --git a/queries/jq/locals.scm b/queries/jq/locals.scm index b655a5e10..369bcb4eb 100644 --- a/queries/jq/locals.scm +++ b/queries/jq/locals.scm @@ -1,7 +1,7 @@ -(funcdef (identifier) @definition.function) +(funcdef (identifier) @local.definition.function) -(funcdefargs (identifier) @definition.parameter) +(funcdefargs (identifier) @local.definition.parameter) -(funcname) @reference +(funcname) @local.reference -(index (identifier) @reference) +(index (identifier) @local.reference) diff --git a/queries/json/locals.scm b/queries/json/locals.scm index 6609a2d22..aaeee38ca 100644 --- a/queries/json/locals.scm +++ b/queries/json/locals.scm @@ -1,4 +1,4 @@ [ (object) (array) -] @scope +] @local.scope diff --git a/queries/jsonnet/locals.scm b/queries/jsonnet/locals.scm index 5e1f1acc2..583c89e03 100644 --- a/queries/jsonnet/locals.scm +++ b/queries/jsonnet/locals.scm @@ -1,17 +1,17 @@ -(parenthesis) @scope -(anonymous_function) @scope -(object) @scope -(field) @scope -(local_bind) @scope +(parenthesis) @local.scope +(anonymous_function) @local.scope +(object) @local.scope +(field) @local.scope +(local_bind) @local.scope (field - function: (fieldname (id) @definition.function) + function: (fieldname (id) @local.definition.function) (#set! "definition.function.scope" "parent")) -(bind (id) @definition.var) -(bind function: (id) @definition.function) +(bind (id) @local.definition.var) +(bind function: (id) @local.definition.function) -(param (id) @definition.parameter) +(param (id) @local.definition.parameter) -(id) @reference +(id) @local.reference ;(fieldname (id) (#is-not? local)) ; (#is-not?) not supported yet diff --git a/queries/julia/locals.scm b/queries/julia/locals.scm index 8540268cb..dd00f8a9b 100644 --- a/queries/julia/locals.scm +++ b/queries/julia/locals.scm @@ -1,71 +1,71 @@ ;;; Variables (assignment - (identifier) @definition.var) + (identifier) @local.definition.var) (assignment (tuple_expression - (identifier) @definition.var)) + (identifier) @local.definition.var)) ;;; let/const bindings (let_binding - (identifier) @definition.var) + (identifier) @local.definition.var) (let_binding (tuple_expression - (identifier) @definition.var)) + (identifier) @local.definition.var)) ;;; For bindings (for_binding - (identifier) @definition.var) + (identifier) @local.definition.var) (for_binding (tuple_expression - (identifier) @definition.var)) + (identifier) @local.definition.var)) ;;; Types (struct_definition - name: (identifier) @definition.type) + name: (identifier) @local.definition.type) (abstract_definition - name: (identifier) @definition.type) + name: (identifier) @local.definition.type) (abstract_definition - name: (identifier) @definition.type) + name: (identifier) @local.definition.type) (type_parameter_list - (identifier) @definition.type) + (identifier) @local.definition.type) ;;; Module imports (import_statement - (identifier) @definition.import) + (identifier) @local.definition.import) ;;; Parameters (parameter_list - (identifier) @definition.parameter) + (identifier) @local.definition.parameter) (optional_parameter . - (identifier) @definition.parameter) + (identifier) @local.definition.parameter) (slurp_parameter - (identifier) @definition.parameter) + (identifier) @local.definition.parameter) (typed_parameter - parameter: (identifier) @definition.parameter + parameter: (identifier) @local.definition.parameter (_)) (function_expression - . (identifier) @definition.parameter) ;; Single parameter arrow function + . (identifier) @local.definition.parameter) ;; Single parameter arrow function ;;; Function/macro definitions (function_definition - name: (identifier) @definition.function) @scope + name: (identifier) @local.definition.function) @local.scope (short_function_definition - name: (identifier) @definition.function) @scope + name: (identifier) @local.definition.function) @local.scope (macro_definition - name: (identifier) @definition.macro) @scope + name: (identifier) @local.definition.macro) @local.scope -(identifier) @reference +(identifier) @local.reference [ (for_statement) @@ -76,4 +76,4 @@ (let_statement) (quote_statement) (do_clause) -] @scope +] @local.scope diff --git a/queries/kconfig/locals.scm b/queries/kconfig/locals.scm index 3727cd94f..cce3a7f0e 100644 --- a/queries/kconfig/locals.scm +++ b/queries/kconfig/locals.scm @@ -1,7 +1,7 @@ [ (symbol) (prompt) -] @reference +] @local.reference [ (config) @@ -10,8 +10,8 @@ (comment_entry) (menu) (if) -] @scope +] @local.scope -(type_definition (prompt) @definition.var) -(type_definition (input_prompt (prompt) @definition.var)) -(type_definition_default (expression (prompt) @definition.var)) +(type_definition (prompt) @local.definition.var) +(type_definition (input_prompt (prompt) @local.definition.var)) +(type_definition_default (expression (prompt) @local.definition.var)) diff --git a/queries/kdl/locals.scm b/queries/kdl/locals.scm index 9190cab69..2c7ec5150 100644 --- a/queries/kdl/locals.scm +++ b/queries/kdl/locals.scm @@ -1,10 +1,10 @@ -(document) @scope -(node (node_children) @scope) -(node_children (node) @scope) +(document) @local.scope +(node (node_children) @local.scope) +(node_children (node) @local.scope) -(identifier) @reference +(identifier) @local.reference -(node_field) @definition.field +(node_field) @local.definition.field -(node (identifier) @definition.type) -(type) @definition.type +(node (identifier) @local.definition.type) +(type) @local.definition.type diff --git a/queries/kotlin/locals.scm b/queries/kotlin/locals.scm index 0dea64618..0f95d65c6 100644 --- a/queries/kotlin/locals.scm +++ b/queries/kotlin/locals.scm @@ -1,23 +1,23 @@ ;;; Imports (package_header - . (identifier) @definition.namespace) + . (identifier) @local.definition.namespace) (import_header (identifier - (simple_identifier) @definition.import .) + (simple_identifier) @local.definition.import .) (import_alias - (type_identifier) @definition.import)?) + (type_identifier) @local.definition.import)?) ;;; Functions (function_declaration - . (simple_identifier) @definition.function + . (simple_identifier) @local.definition.function (#set! "definition.function.scope" "parent")) (class_body (function_declaration - . (simple_identifier) @definition.method) + . (simple_identifier) @local.definition.method) (#set! "definition.method.scope" "parent")) ;;; Variables @@ -25,38 +25,38 @@ (function_declaration (function_value_parameters (parameter - (simple_identifier) @definition.parameter))) + (simple_identifier) @local.definition.parameter))) (lambda_literal (lambda_parameters (variable_declaration - (simple_identifier) @definition.parameter))) + (simple_identifier) @local.definition.parameter))) (class_body (property_declaration (variable_declaration - (simple_identifier) @definition.field))) + (simple_identifier) @local.definition.field))) (class_declaration (primary_constructor (class_parameter - (simple_identifier) @definition.field))) + (simple_identifier) @local.definition.field))) (enum_class_body (enum_entry - (simple_identifier) @definition.field)) + (simple_identifier) @local.definition.field)) (variable_declaration - (simple_identifier) @definition.var) + (simple_identifier) @local.definition.var) ;;; Types (class_declaration - (type_identifier) @definition.type + (type_identifier) @local.definition.type (#set! "definition.type.scope" "parent")) (type_alias - (type_identifier) @definition.type + (type_identifier) @local.definition.type (#set! "definition.type.scope" "parent")) ;;; Scopes @@ -81,4 +81,4 @@ (enum_entry) (interpolated_expression) -] @scope +] @local.scope diff --git a/queries/lalrpop/locals.scm b/queries/lalrpop/locals.scm index 7a30cce9f..bd44c897c 100644 --- a/queries/lalrpop/locals.scm +++ b/queries/lalrpop/locals.scm @@ -1,5 +1,5 @@ (nonterminal_name - (macro_id) @definition.function) + (macro_id) @local.definition.function) (nonterminal_name - (identifier) @definition.function) + (identifier) @local.definition.function) diff --git a/queries/linkerscript/locals.scm b/queries/linkerscript/locals.scm index 93ddb4357..7b45dcef2 100644 --- a/queries/linkerscript/locals.scm +++ b/queries/linkerscript/locals.scm @@ -4,12 +4,12 @@ (symbol) (filename) (quoted_symbol) -] @reference +] @local.reference ; Definitions -(output_section name: (symbol) @definition.var) +(output_section name: (symbol) @local.definition.var) -(memory_command name: (symbol) @definition.var) +(memory_command name: (symbol) @local.definition.var) -(phdrs_command name: (symbol) @definition.var) +(phdrs_command name: (symbol) @local.definition.var) diff --git a/queries/liquidsoap/locals.scm b/queries/liquidsoap/locals.scm index 1d67bc55a..d4727114a 100644 --- a/queries/liquidsoap/locals.scm +++ b/queries/liquidsoap/locals.scm @@ -1,15 +1,15 @@ -[(anonymous_function) (binding) (def) (let)] @scope +[(anonymous_function) (binding) (def) (let)] @local.scope -(anonymous_argument (var) @definition.parameter) -(labeled_argument label: (var) @definition.parameter) +(anonymous_argument (var) @local.definition.parameter) +(labeled_argument label: (var) @local.definition.parameter) (binding - defined: (var) @definition.var) -(def defined: (var) @definition.var) -(let defined: (var) @definition.var) -(meth_pattern (var) @definition.var) -(list_pattern (var) @definition.var) -(tuple_pattern (var) @definition.var) -(spread (var) @definition.var) + defined: (var) @local.definition.var) +(def defined: (var) @local.definition.var) +(let defined: (var) @local.definition.var) +(meth_pattern (var) @local.definition.var) +(list_pattern (var) @local.definition.var) +(tuple_pattern (var) @local.definition.var) +(spread (var) @local.definition.var) -(var) @reference +(var) @local.reference diff --git a/queries/lua/locals.scm b/queries/lua/locals.scm index ae6a6aa6e..ef927e517 100644 --- a/queries/lua/locals.scm +++ b/queries/lua/locals.scm @@ -9,43 +9,43 @@ (for_statement) (function_declaration) (function_definition) -] @scope +] @local.scope ; Definitions (assignment_statement (variable_list - (identifier) @definition.var)) + (identifier) @local.definition.var)) (assignment_statement (variable_list - (dot_index_expression . (_) @definition.associated (identifier) @definition.var))) + (dot_index_expression . (_) @local.definition.associated (identifier) @local.definition.var))) ((function_declaration - name: (identifier) @definition.function) + name: (identifier) @local.definition.function) (#set! definition.function.scope "parent")) ((function_declaration name: (dot_index_expression - . (_) @definition.associated (identifier) @definition.function)) + . (_) @local.definition.associated (identifier) @local.definition.function)) (#set! definition.method.scope "parent")) ((function_declaration name: (method_index_expression - . (_) @definition.associated (identifier) @definition.method)) + . (_) @local.definition.associated (identifier) @local.definition.method)) (#set! definition.method.scope "parent")) (for_generic_clause (variable_list - (identifier) @definition.var)) + (identifier) @local.definition.var)) (for_numeric_clause - name: (identifier) @definition.var) + name: (identifier) @local.definition.var) -(parameters (identifier) @definition.parameter) +(parameters (identifier) @local.definition.parameter) ; References [ (identifier) -] @reference +] @local.reference diff --git a/queries/luau/locals.scm b/queries/luau/locals.scm index b57ef5802..d0581b890 100644 --- a/queries/luau/locals.scm +++ b/queries/luau/locals.scm @@ -9,43 +9,43 @@ (for_statement) (function_declaration) (function_definition) -] @scope +] @local.scope ; References [ (identifier) -] @reference +] @local.reference ; Definitions (assignment_statement (variable_list - (identifier) @definition.var)) + (identifier) @local.definition.var)) (assignment_statement (variable_list - (dot_index_expression . (_) @definition.associated (identifier) @definition.var))) + (dot_index_expression . (_) @local.definition.associated (identifier) @local.definition.var))) ((function_declaration - name: (identifier) @definition.function) + name: (identifier) @local.definition.function) (#set! definition.function.scope "parent")) ((function_declaration name: (dot_index_expression - . (_) @definition.associated (identifier) @definition.function)) + . (_) @local.definition.associated (identifier) @local.definition.function)) (#set! definition.method.scope "parent")) ((function_declaration name: (method_index_expression - . (_) @definition.associated (identifier) @definition.method)) + . (_) @local.definition.associated (identifier) @local.definition.method)) (#set! definition.method.scope "parent")) (for_generic_clause (variable_list - (identifier) @definition.var)) + (identifier) @local.definition.var)) (for_numeric_clause - name: (identifier) @definition.var) + name: (identifier) @local.definition.var) -(parameter (identifier) @definition.parameter) +(parameter (identifier) @local.definition.parameter) diff --git a/queries/m68k/locals.scm b/queries/m68k/locals.scm index e1a1ed31d..737352e87 100644 --- a/queries/m68k/locals.scm +++ b/queries/m68k/locals.scm @@ -1,22 +1,22 @@ (macro_definition - name: (symbol) @definition.macro) + name: (symbol) @local.definition.macro) (symbol_assignment - name: (symbol) @definition.var) + name: (symbol) @local.definition.var) (label - name: (symbol) @definition.constant) + name: (symbol) @local.definition.constant) (symbol_definition - name: (symbol) @definition.constant) + name: (symbol) @local.definition.constant) (offset_definition - name: (symbol) @definition.constant) + name: (symbol) @local.definition.constant) (register_definition - name: (symbol) @definition.constant) + name: (symbol) @local.definition.constant) (register_list_definition - name: (symbol) @definition.constant) + name: (symbol) @local.definition.constant) (external_reference symbols: (symbol_list - (symbol) @definition.import)) + (symbol) @local.definition.import)) -(symbol) @reference +(symbol) @local.reference diff --git a/queries/matlab/locals.scm b/queries/matlab/locals.scm index a6ca6aeb5..ec2d8d52a 100644 --- a/queries/matlab/locals.scm +++ b/queries/matlab/locals.scm @@ -1,20 +1,20 @@ ; References -(identifier) @reference +(identifier) @local.reference ; Definitions (function_definition - name: (identifier) @definition.function + name: (identifier) @local.definition.function (function_arguments - (identifier)* @definition.parameter - ("," (identifier) @definition.parameter)*)?) @scope + (identifier)* @local.definition.parameter + ("," (identifier) @local.definition.parameter)*)?) @local.scope -(assignment left: (identifier) @definition.var) -(multioutput_variable (identifier) @definition.var) +(assignment left: (identifier) @local.definition.var) +(multioutput_variable (identifier) @local.definition.var) -(iterator . (identifier) @definition.var) -(lambda (arguments (identifier) @definition.parameter)) -(global_operator (identifier) @definition.var) -(persistent_operator (identifier) @definition.var) -(catch_clause (identifier) @definition) +(iterator . (identifier) @local.definition.var) +(lambda (arguments (identifier) @local.definition.parameter)) +(global_operator (identifier) @local.definition.var) +(persistent_operator (identifier) @local.definition.var) +(catch_clause (identifier) @local.definition) diff --git a/queries/mlir/locals.scm b/queries/mlir/locals.scm index 7d96fe9e3..8e569e8e6 100644 --- a/queries/mlir/locals.scm +++ b/queries/mlir/locals.scm @@ -1,7 +1,7 @@ -(region) @scope +(region) @local.scope -(func_arg_list (value_use) @definition.var) -(block_arg_list (value_use) @definition.var) -(op_result (value_use) @definition.var) +(func_arg_list (value_use) @local.definition.var) +(block_arg_list (value_use) @local.definition.var) +(op_result (value_use) @local.definition.var) -(value_use) @reference +(value_use) @local.reference diff --git a/queries/nim/locals.scm b/queries/nim/locals.scm index 5b70bac10..4ca6f6d44 100644 --- a/queries/nim/locals.scm +++ b/queries/nim/locals.scm @@ -1,112 +1,112 @@ ; ============================================================================== -; @definition ; various definitions +; @local.definition ; various definitions (block label: [ - (identifier) @definition - (accent_quoted) @definition + (identifier) @local.definition + (accent_quoted) @local.definition ]) ; ============================================================================== -; @definition.constant ; constants +; @local.definition.constant ; constants (const_section (variable_declaration (symbol_declaration_list (symbol_declaration name: [ - (identifier) @definition.constant - (accent_quoted) @definition.constant - (exported_symbol (identifier) @definition.constant) - (exported_symbol (accent_quoted) @definition.constant) + (identifier) @local.definition.constant + (accent_quoted) @local.definition.constant + (exported_symbol (identifier) @local.definition.constant) + (exported_symbol (accent_quoted) @local.definition.constant) ])) - type: (type_expression)? @definition.associated)) + type: (type_expression)? @local.definition.associated)) ; ============================================================================== -; @definition.function ; functions +; @local.definition.function ; functions (proc_declaration name: [ - (identifier) @definition.function - (accent_quoted) @definition.function - (exported_symbol (identifier) @definition.function) - (exported_symbol (accent_quoted) @definition.function) + (identifier) @local.definition.function + (accent_quoted) @local.definition.function + (exported_symbol (identifier) @local.definition.function) + (exported_symbol (accent_quoted) @local.definition.function) ] (#set! "definition.function.scope" "parent")) (func_declaration name: [ - (identifier) @definition.function - (accent_quoted) @definition.function - (exported_symbol (identifier) @definition.function) - (exported_symbol (accent_quoted) @definition.function) + (identifier) @local.definition.function + (accent_quoted) @local.definition.function + (exported_symbol (identifier) @local.definition.function) + (exported_symbol (accent_quoted) @local.definition.function) ] (#set! "definition.function.scope" "parent")) (iterator_declaration name: [ - (identifier) @definition.function - (accent_quoted) @definition.function - (exported_symbol (identifier) @definition.function) - (exported_symbol (accent_quoted) @definition.function) + (identifier) @local.definition.function + (accent_quoted) @local.definition.function + (exported_symbol (identifier) @local.definition.function) + (exported_symbol (accent_quoted) @local.definition.function) ] (#set! "definition.function.scope" "parent")) (converter_declaration name: [ - (identifier) @definition.function - (accent_quoted) @definition.function - (exported_symbol (identifier) @definition.function) - (exported_symbol (accent_quoted) @definition.function) + (identifier) @local.definition.function + (accent_quoted) @local.definition.function + (exported_symbol (identifier) @local.definition.function) + (exported_symbol (accent_quoted) @local.definition.function) ] (#set! "definition.function.scope" "parent")) ; ============================================================================== -; @definition.method ; methods +; @local.definition.method ; methods (method_declaration name: [ - (identifier) @definition.method - (accent_quoted) @definition.method - (exported_symbol (identifier) @definition.method) - (exported_symbol (accent_quoted) @definition.method) + (identifier) @local.definition.method + (accent_quoted) @local.definition.method + (exported_symbol (identifier) @local.definition.method) + (exported_symbol (accent_quoted) @local.definition.method) ] (#set! "definition.method.scope" "parent")) ; ============================================================================== -; @definition.var ; variables +; @local.definition.var ; variables (var_section (variable_declaration (symbol_declaration_list (symbol_declaration name: [ - (identifier) @definition.var - (accent_quoted) @definition.var - (exported_symbol (identifier) @definition.var) - (exported_symbol (accent_quoted) @definition.var) + (identifier) @local.definition.var + (accent_quoted) @local.definition.var + (exported_symbol (identifier) @local.definition.var) + (exported_symbol (accent_quoted) @local.definition.var) ])) - type: (type_expression)? @definition.associated)) + type: (type_expression)? @local.definition.associated)) (let_section (variable_declaration (symbol_declaration_list (symbol_declaration name: [ - (identifier) @definition.var - (accent_quoted) @definition.var - (exported_symbol (identifier) @definition.var) - (exported_symbol (accent_quoted) @definition.var) + (identifier) @local.definition.var + (accent_quoted) @local.definition.var + (exported_symbol (identifier) @local.definition.var) + (exported_symbol (accent_quoted) @local.definition.var) ])) - type: (type_expression)? @definition.associated)) + type: (type_expression)? @local.definition.associated)) (for (symbol_declaration_list (symbol_declaration name: [ - (identifier) @definition.var - (accent_quoted) @definition.var + (identifier) @local.definition.var + (accent_quoted) @local.definition.var ]))) (try @@ -114,84 +114,84 @@ values: (expression_list (infix_expression right: [ - (identifier) @definition.var - (accent_quoted) @definition.var + (identifier) @local.definition.var + (accent_quoted) @local.definition.var ])))) ; ============================================================================== -; @definition.parameter ; parameters +; @local.definition.parameter ; parameters (parameter_declaration (symbol_declaration_list (symbol_declaration name: [ - (identifier) @definition.parameter - (accent_quoted) @definition.parameter + (identifier) @local.definition.parameter + (accent_quoted) @local.definition.parameter ])) - type: (type_expression)? @definition.associated) + type: (type_expression)? @local.definition.associated) (concept_declaration parameters: (parameter_list [ - (identifier) @definition.parameter - (accent_quoted (identifier) @definition.parameter) + (identifier) @local.definition.parameter + (accent_quoted (identifier) @local.definition.parameter) ])) (var_parameter [ - (identifier) @definition.parameter - (accent_quoted (identifier) @definition.parameter) + (identifier) @local.definition.parameter + (accent_quoted (identifier) @local.definition.parameter) ]) (type_parameter [ - (identifier) @definition.parameter - (accent_quoted (identifier) @definition.parameter) + (identifier) @local.definition.parameter + (accent_quoted (identifier) @local.definition.parameter) ]) (static_parameter [ - (identifier) @definition.parameter - (accent_quoted (identifier) @definition.parameter) + (identifier) @local.definition.parameter + (accent_quoted (identifier) @local.definition.parameter) ]) (ref_parameter [ - (identifier) @definition.parameter - (accent_quoted (identifier) @definition.parameter) + (identifier) @local.definition.parameter + (accent_quoted (identifier) @local.definition.parameter) ]) (pointer_parameter [ - (identifier) @definition.parameter - (accent_quoted (identifier) @definition.parameter) + (identifier) @local.definition.parameter + (accent_quoted (identifier) @local.definition.parameter) ]) ; ============================================================================== -; @definition.macro ; preprocessor macros +; @local.definition.macro ; preprocessor macros (template_declaration name: [ - (identifier) @definition.macro - (accent_quoted) @definition.macro - (exported_symbol (identifier) @definition.macro) - (exported_symbol (accent_quoted) @definition.macro) + (identifier) @local.definition.macro + (accent_quoted) @local.definition.macro + (exported_symbol (identifier) @local.definition.macro) + (exported_symbol (accent_quoted) @local.definition.macro) ] (#set! "definition.macro.scope" "parent")) (macro_declaration name: [ - (identifier) @definition.macro - (accent_quoted) @definition.macro - (exported_symbol (identifier) @definition.macro) - (exported_symbol (accent_quoted) @definition.macro) + (identifier) @local.definition.macro + (accent_quoted) @local.definition.macro + (exported_symbol (identifier) @local.definition.macro) + (exported_symbol (accent_quoted) @local.definition.macro) ] (#set! "definition.macro.scope" "parent")) ; ============================================================================== -; @definition.type ; types or classes +; @local.definition.type ; types or classes (type_declaration (type_symbol_declaration name: [ - (identifier) @definition.type - (accent_quoted) @definition.type - (exported_symbol (identifier) @definition.type) - (exported_symbol (accent_quoted) @definition.type) + (identifier) @local.definition.type + (accent_quoted) @local.definition.type + (exported_symbol (identifier) @local.definition.type) + (exported_symbol (accent_quoted) @local.definition.type) ])) ; ============================================================================== -; @definition.field ; fields or properties +; @local.definition.field ; fields or properties ; object_declaration ; variant_declaration @@ -202,78 +202,78 @@ (symbol_declaration_list (symbol_declaration name: [ - (identifier) @definition.field - (accent_quoted) @definition.field - (exported_symbol (identifier) @definition.field) - (exported_symbol (accent_quoted) @definition.field) + (identifier) @local.definition.field + (accent_quoted) @local.definition.field + (exported_symbol (identifier) @local.definition.field) + (exported_symbol (accent_quoted) @local.definition.field) ])) - type: (type_expression)? @definition.associated) + type: (type_expression)? @local.definition.associated) ; ============================================================================== -; @definition.enum ; enumerations +; @local.definition.enum ; enumerations (enum_declaration (enum_field_declaration (symbol_declaration name: [ - (identifier) @definition.enum - (accent_quoted) @definition.enum + (identifier) @local.definition.enum + (accent_quoted) @local.definition.enum ]))) ; ============================================================================== -; @definition.namespace ; modules or namespaces -; @definition.import ; imported names +; @local.definition.namespace ; modules or namespaces +; @local.definition.import ; imported names (import_statement (expression_list - (identifier) @definition.namespace)) + (identifier) @local.definition.namespace)) (import_statement (expression_list (infix_expression operator: "as" - right: (identifier) @definition.namespace))) + right: (identifier) @local.definition.namespace))) (import_statement (expression_list (infix_expression operator: (operator) @_operator right: [ - (identifier) @definition.namespace - (array_construction (identifier) @definition.namespace) + (identifier) @local.definition.namespace + (array_construction (identifier) @local.definition.namespace) ])) (#eq? @_operator "/")) (import_from_statement module: (infix_expression operator: (operator) @_operator - right: (identifier) @definition.namespace) + right: (identifier) @local.definition.namespace) (expression_list [ - (identifier) @definition.import - (accent_quoted) @definition.import + (identifier) @local.definition.import + (accent_quoted) @local.definition.import ]) (#eq? @_operator "/")) ; ============================================================================== -; @scope ; scope block +; @local.scope ; scope block ; (when) ; NOTE: `when` does actually not create a scope (if - consequence: (statement_list) @scope - alternative: (elif_branch)* @scope - alternative: (else_branch)? @scope) + consequence: (statement_list) @local.scope + alternative: (elif_branch)* @local.scope + alternative: (else_branch)? @local.scope) (case - alternative: (of_branch)* @scope - alternative: (elif_branch)* @scope - alternative: (else_branch)? @scope) + alternative: (of_branch)* @local.scope + alternative: (elif_branch)* @local.scope + alternative: (else_branch)? @local.scope) (try - body: (statement_list) @scope - (except_branch) @scope - (finally_branch)? @scope) + body: (statement_list) @local.scope + (except_branch) @local.scope + (finally_branch)? @local.scope) [ (for) @@ -294,10 +294,10 @@ (iterator_expression) (concept_declaration) -] @scope +] @local.scope ; ============================================================================== -; @reference ; identifier reference +; @local.reference ; identifier reference -(identifier) @reference -(accent_quoted) @reference +(identifier) @local.reference +(accent_quoted) @local.reference diff --git a/queries/nix/locals.scm b/queries/nix/locals.scm index 1fc06d8bd..1871f0404 100644 --- a/queries/nix/locals.scm +++ b/queries/nix/locals.scm @@ -1,15 +1,15 @@ ; let bindings -(let_expression (binding_set (binding . (attrpath) @definition.var))) @scope +(let_expression (binding_set (binding . (attrpath) @local.definition.var))) @local.scope ; rec attrsets -(rec_attrset_expression (binding_set (binding . (attrpath) @definition.field))) @scope +(rec_attrset_expression (binding_set (binding . (attrpath) @local.definition.field))) @local.scope ; functions and parameters (function_expression . [ - (identifier) @definition.parameter - (formals (formal . (identifier) @definition.parameter)) -]) @scope -((formals) "@" (identifier) @definition.parameter) ; I couldn't get this to work properly inside the (function) + (identifier) @local.definition.parameter + (formals (formal . (identifier) @local.definition.parameter)) +]) @local.scope +((formals) "@" (identifier) @local.definition.parameter) ; I couldn't get this to work properly inside the (function) -(variable_expression (identifier) @reference) -(inherited_attrs attr: (identifier) @reference) +(variable_expression (identifier) @local.reference) +(inherited_attrs attr: (identifier) @local.reference) diff --git a/queries/ocaml/locals.scm b/queries/ocaml/locals.scm index 1e543fd13..1230bd013 100644 --- a/queries/ocaml/locals.scm +++ b/queries/ocaml/locals.scm @@ -18,60 +18,60 @@ (let_class_expression) (object_expression) (attribute_payload) -] @scope +] @local.scope ; Definitions ;------------ -(value_pattern) @definition.var +(value_pattern) @local.definition.var (let_binding - pattern: (value_name) @definition.var + pattern: (value_name) @local.definition.var (#set! definition.var.scope "parent")) (let_binding - pattern: (tuple_pattern (value_name) @definition.var) + pattern: (tuple_pattern (value_name) @local.definition.var) (#set! definition.var.scope "parent")) (let_binding - pattern: (record_pattern (field_pattern (value_name) @definition.var)) + pattern: (record_pattern (field_pattern (value_name) @local.definition.var)) (#set! definition.var.scope "parent")) -(external (value_name) @definition.var) +(external (value_name) @local.definition.var) -(type_binding (type_constructor) @definition.type) +(type_binding (type_constructor) @local.definition.type) -(abstract_type (type_constructor) @definition.type) +(abstract_type (type_constructor) @local.definition.type) -(method_definition (method_name) @definition.method) +(method_definition (method_name) @local.definition.method) (module_binding - (module_name) @definition.namespace + (module_name) @local.definition.namespace (#set! definition.namespace.scope "parent")) -(module_parameter (module_name) @definition.namespace) +(module_parameter (module_name) @local.definition.namespace) -(module_type_definition (module_type_name) @definition.type) +(module_type_definition (module_type_name) @local.definition.type) ; References ;------------ (value_path . - (value_name) @reference + (value_name) @local.reference (#set! reference.kind "var")) (type_constructor_path . - (type_constructor) @reference + (type_constructor) @local.reference (#set! reference.kind "type")) (method_invocation - (method_name) @reference + (method_name) @local.reference (#set! reference.kind "method")) (module_path . - (module_name) @reference + (module_name) @local.reference (#set! reference.kind "type")) (module_type_path . - (module_type_name) @reference + (module_type_name) @local.reference (#set! reference.kind "type")) diff --git a/queries/odin/locals.scm b/queries/odin/locals.scm index eb28ab952..845a08a48 100644 --- a/queries/odin/locals.scm +++ b/queries/odin/locals.scm @@ -4,36 +4,36 @@ (block) (declaration) (statement) -] @scope +] @local.scope ; References -(identifier) @reference +(identifier) @local.reference ; Definitions -(package_declaration (identifier) @definition.namespace) +(package_declaration (identifier) @local.definition.namespace) -(import_declaration alias: (identifier) @definition.namespace) +(import_declaration alias: (identifier) @local.definition.namespace) -(procedure_declaration (identifier) @definition.function) +(procedure_declaration (identifier) @local.definition.function) -(struct_declaration (identifier) @definition.type "::") +(struct_declaration (identifier) @local.definition.type "::") -(enum_declaration (identifier) @definition.enum "::") +(enum_declaration (identifier) @local.definition.enum "::") -(union_declaration (identifier) @definition.type "::") +(union_declaration (identifier) @local.definition.type "::") -(variable_declaration (identifier) @definition.var ":=") +(variable_declaration (identifier) @local.definition.var ":=") -(const_declaration (identifier) @definition.constant "::") +(const_declaration (identifier) @local.definition.constant "::") -(const_type_declaration (identifier) @definition.type ":") +(const_type_declaration (identifier) @local.definition.type ":") -(parameter (identifier) @definition.parameter ":"?) +(parameter (identifier) @local.definition.parameter ":"?) -(default_parameter (identifier) @definition.parameter ":=") +(default_parameter (identifier) @local.definition.parameter ":=") -(field (identifier) @definition.field ":") +(field (identifier) @local.definition.field ":") -(label_statement (identifier) @definition ":") +(label_statement (identifier) @local.definition ":") diff --git a/queries/pascal/locals.scm b/queries/pascal/locals.scm index b97cb096f..7147a1086 100644 --- a/queries/pascal/locals.scm +++ b/queries/pascal/locals.scm @@ -1,25 +1,25 @@ -(root) @scope +(root) @local.scope -(defProc) @scope -(lambda) @scope -(interface (declProc) @scope) -(declSection (declProc) @scope) -(declClass (declProc) @scope) -(declHelper (declProc) @scope) -(declProcRef) @scope +(defProc) @local.scope +(lambda) @local.scope +(interface (declProc) @local.scope) +(declSection (declProc) @local.scope) +(declClass (declProc) @local.scope) +(declHelper (declProc) @local.scope) +(declProcRef) @local.scope -(exceptionHandler) @scope -(exceptionHandler variable: (identifier) @definition) +(exceptionHandler) @local.scope +(exceptionHandler variable: (identifier) @local.definition) -(declArg name: (identifier) @definition) -(declVar name: (identifier) @definition) -(declConst name: (identifier) @definition) -(declLabel name: (identifier) @definition) -(genericArg name: (identifier) @definition) -(declEnumValue name: (identifier) @definition) -(declType name: (identifier) @definition) -(declType name: (genericTpl entity: (identifier) @definition)) +(declArg name: (identifier) @local.definition) +(declVar name: (identifier) @local.definition) +(declConst name: (identifier) @local.definition) +(declLabel name: (identifier) @local.definition) +(genericArg name: (identifier) @local.definition) +(declEnumValue name: (identifier) @local.definition) +(declType name: (identifier) @local.definition) +(declType name: (genericTpl entity: (identifier) @local.definition)) -(declProc name: (identifier) @definition) -(identifier) @reference +(declProc name: (identifier) @local.definition) +(identifier) @local.reference diff --git a/queries/php/locals.scm b/queries/php/locals.scm index 0bb7a89db..c1403e40b 100644 --- a/queries/php/locals.scm +++ b/queries/php/locals.scm @@ -2,86 +2,86 @@ ;------- ((class_declaration - name: (name) @definition.type) @scope + name: (name) @local.definition.type) @local.scope (#set! definition.type.scope "parent")) ((method_declaration - name: (name) @definition.method) @scope + name: (name) @local.definition.method) @local.scope (#set! definition.method.scope "parent")) ((function_definition - name: (name) @definition.function) @scope + name: (name) @local.definition.function) @local.scope (#set! definition.function.scope "parent")) (anonymous_function_creation_expression (anonymous_function_use_clause (variable_name - (name) @definition.var))) @scope + (name) @local.definition.var))) @local.scope ; Definitions ;------------ (simple_parameter (variable_name - (name) @definition.var)) + (name) @local.definition.var)) (foreach_statement (pair (variable_name - (name) @definition.var))) + (name) @local.definition.var))) (foreach_statement (variable_name - (name) @reference + (name) @local.reference (#set! reference.kind "var")) (variable_name - (name) @definition.var)) + (name) @local.definition.var)) (property_declaration (property_element (variable_name - (name) @definition.field))) + (name) @local.definition.field))) (namespace_use_clause (qualified_name - (name) @definition.type)) + (name) @local.definition.type)) ; References ;------------ (named_type - (name) @reference + (name) @local.reference (#set! reference.kind "type")) (named_type - (qualified_name) @reference + (qualified_name) @local.reference (#set! reference.kind "type")) (variable_name - (name) @reference + (name) @local.reference (#set! reference.kind "var")) (member_access_expression - name: (name) @reference + name: (name) @local.reference (#set! reference.kind "field")) (member_call_expression - name: (name) @reference + name: (name) @local.reference (#set! reference.kind "method")) (function_call_expression function: (qualified_name - (name) @reference + (name) @local.reference (#set! reference.kind "function"))) (object_creation_expression (qualified_name - (name) @reference + (name) @local.reference (#set! reference.kind "type"))) (scoped_call_expression scope: (qualified_name - (name) @reference + (name) @local.reference (#set! reference.kind "type")) - name: (name) @reference + name: (name) @local.reference (#set! reference.kind "method")) diff --git a/queries/pony/locals.scm b/queries/pony/locals.scm index b12f2a04c..033dcb257 100644 --- a/queries/pony/locals.scm +++ b/queries/pony/locals.scm @@ -31,61 +31,61 @@ (array_literal) (object_literal) -] @scope +] @local.scope ; References -(identifier) @reference +(identifier) @local.reference ; Definitions (field - name: (identifier) @definition.field) + name: (identifier) @local.definition.field) (use_statement - (identifier) @definition.import) + (identifier) @local.definition.import) (constructor - (identifier) @definition.method) + (identifier) @local.definition.method) (method - (identifier) @definition.method) + (identifier) @local.definition.method) (behavior - (identifier) @definition.method) + (identifier) @local.definition.method) (actor_definition - (identifier) @definition.type) + (identifier) @local.definition.type) (type_alias - (identifier) @definition.type) + (identifier) @local.definition.type) (class_definition - (identifier) @definition.type) + (identifier) @local.definition.type) (primitive_definition - (identifier) @definition.type) + (identifier) @local.definition.type) (interface_definition - (identifier) @definition.type) + (identifier) @local.definition.type) (trait_definition - (identifier) @definition.type) + (identifier) @local.definition.type) (struct_definition - (identifier) @definition.type) + (identifier) @local.definition.type) (parameter - name: (identifier) @definition.parameter) + name: (identifier) @local.definition.parameter) (variable_declaration - (identifier) @definition.var) + (identifier) @local.definition.var) (for_statement [ - (identifier) @definition.var - (tuple_expression (identifier) @definition.var) + (identifier) @local.definition.var + (tuple_expression (identifier) @local.definition.var) ]) (with_elem - (identifier) @definition.var) + (identifier) @local.definition.var) diff --git a/queries/properties/locals.scm b/queries/properties/locals.scm index d9360c465..f70e953db 100644 --- a/queries/properties/locals.scm +++ b/queries/properties/locals.scm @@ -1,3 +1,3 @@ -(property (key) @definition) +(property (key) @local.definition) -(substitution (key) @reference) +(substitution (key) @local.reference) diff --git a/queries/puppet/locals.scm b/queries/puppet/locals.scm index d9d903a46..cc13bc77b 100644 --- a/queries/puppet/locals.scm +++ b/queries/puppet/locals.scm @@ -13,7 +13,7 @@ (case_statement) (hash) (array) -] @scope +] @local.scope ; References @@ -21,26 +21,26 @@ (identifier) (class_identifier) (variable) -] @reference +] @local.reference ; Definitions -(attribute [(identifier) (variable)] @definition.field) +(attribute [(identifier) (variable)] @local.definition.field) (function_declaration - [(identifier) (class_identifier)] @definition.function) + [(identifier) (class_identifier)] @local.definition.function) -(include_statement [(identifier) (class_identifier)] @definition.import) +(include_statement [(identifier) (class_identifier)] @local.definition.import) -(parameter (variable) @definition.parameter) +(parameter (variable) @local.definition.parameter) (class_definition - [(identifier) (class_identifier)] @definition.type) + [(identifier) (class_identifier)] @local.definition.type) (node_definition - (node_name (identifier) @definition.type)) + (node_name (identifier) @local.definition.type)) (resource_declaration - [(identifier) (class_identifier)] @definition.type) + [(identifier) (class_identifier)] @local.definition.type) -(assignment . (variable) @definition.var) +(assignment . (variable) @local.definition.var) diff --git a/queries/purescript/locals.scm b/queries/purescript/locals.scm index d8219bf43..0d42125e2 100644 --- a/queries/purescript/locals.scm +++ b/queries/purescript/locals.scm @@ -1,4 +1,4 @@ -(signature name: (variable)) @definition.type -(function name: (variable)) @definition.function -(pat_name (variable)) @definition -(exp_name (variable)) @reference +(signature name: (variable)) @local.definition.type +(function name: (variable)) @local.definition.function +(pat_name (variable)) @local.definition +(exp_name (variable)) @local.reference diff --git a/queries/python/locals.scm b/queries/python/locals.scm index 76a14fef5..40c57dd44 100644 --- a/queries/python/locals.scm +++ b/queries/python/locals.scm @@ -1,115 +1,115 @@ ;;; Program structure -(module) @scope +(module) @local.scope (class_definition body: (block (expression_statement (assignment - left: (identifier) @definition.field)))) @scope + left: (identifier) @local.definition.field)))) @local.scope (class_definition body: (block (expression_statement (assignment left: (_ - (identifier) @definition.field))))) @scope + (identifier) @local.definition.field))))) @local.scope ; Imports (aliased_import - alias: (identifier) @definition.import) + alias: (identifier) @local.definition.import) (import_statement - name: (dotted_name ((identifier) @definition.import))) + name: (dotted_name ((identifier) @local.definition.import))) (import_from_statement - name: (dotted_name ((identifier) @definition.import))) + name: (dotted_name ((identifier) @local.definition.import))) ; Function with parameters, defines parameters (parameters - (identifier) @definition.parameter) + (identifier) @local.definition.parameter) (default_parameter - (identifier) @definition.parameter) + (identifier) @local.definition.parameter) (typed_parameter - (identifier) @definition.parameter) + (identifier) @local.definition.parameter) (typed_default_parameter - (identifier) @definition.parameter) + (identifier) @local.definition.parameter) ; *args parameter (parameters (list_splat_pattern - (identifier) @definition.parameter)) + (identifier) @local.definition.parameter)) ; **kwargs parameter (parameters (dictionary_splat_pattern - (identifier) @definition.parameter)) + (identifier) @local.definition.parameter)) ; Function defines function and scope ((function_definition - name: (identifier) @definition.function) @scope + name: (identifier) @local.definition.function) @local.scope (#set! definition.function.scope "parent")) ((class_definition - name: (identifier) @definition.type) @scope + name: (identifier) @local.definition.type) @local.scope (#set! definition.type.scope "parent")) (class_definition body: (block (function_definition - name: (identifier) @definition.method))) + name: (identifier) @local.definition.method))) ;;; Loops ; not a scope! (for_statement left: (pattern_list - (identifier) @definition.var)) + (identifier) @local.definition.var)) (for_statement left: (tuple_pattern - (identifier) @definition.var)) + (identifier) @local.definition.var)) (for_statement - left: (identifier) @definition.var) + left: (identifier) @local.definition.var) ; not a scope! -;(while_statement) @scope +;(while_statement) @local.scope ; for in list comprehension (for_in_clause - left: (identifier) @definition.var) + left: (identifier) @local.definition.var) (for_in_clause left: (tuple_pattern - (identifier) @definition.var)) + (identifier) @local.definition.var)) (for_in_clause left: (pattern_list - (identifier) @definition.var)) + (identifier) @local.definition.var)) -(dictionary_comprehension) @scope -(list_comprehension) @scope -(set_comprehension) @scope +(dictionary_comprehension) @local.scope +(list_comprehension) @local.scope +(set_comprehension) @local.scope ;;; Assignments (assignment - left: (identifier) @definition.var) + left: (identifier) @local.definition.var) (assignment left: (pattern_list - (identifier) @definition.var)) + (identifier) @local.definition.var)) (assignment left: (tuple_pattern - (identifier) @definition.var)) + (identifier) @local.definition.var)) (assignment left: (attribute (identifier) - (identifier) @definition.field)) + (identifier) @local.definition.field)) ; Walrus operator x := 1 (named_expression - (identifier) @definition.var) + (identifier) @local.definition.var) (as_pattern - alias: (as_pattern_target) @definition.var) + alias: (as_pattern_target) @local.definition.var) ;;; REFERENCES -(identifier) @reference +(identifier) @local.reference diff --git a/queries/ql/locals.scm b/queries/ql/locals.scm index e5fcb1698..f9b1195ae 100644 --- a/queries/ql/locals.scm +++ b/queries/ql/locals.scm @@ -1,30 +1,30 @@ ; SCOPES -(module) @scope -(dataclass) @scope -(datatype) @scope +(module) @local.scope +(dataclass) @local.scope +(datatype) @local.scope ;; TODO does not work -;(classMember (body) @scope) -(memberPredicate (body) @scope) -(classlessPredicate (body) @scope) -(quantified (conjunction) @scope) -(select) @scope +;(classMember (body) @local.scope) +(memberPredicate (body) @local.scope) +(classlessPredicate (body) @local.scope) +(quantified (conjunction) @local.scope) +(select) @local.scope ; DEFINITIONS ; module -(module name: (moduleName) @definition.namespace) +(module name: (moduleName) @local.definition.namespace) ; classes -(dataclass name: (className) @definition.type) -(datatype name: (className) @definition.type) +(dataclass name: (className) @local.definition.type) +(datatype name: (className) @local.definition.type) ; predicates -(charpred (className) @definition.method) -(memberPredicate name: (predicateName) @definition.method) -(classlessPredicate name: (predicateName) @definition.function) +(charpred (className) @local.definition.method) +(memberPredicate name: (predicateName) @local.definition.method) +(classlessPredicate name: (predicateName) @local.definition.function) ; variables -(varDecl (varName (simpleId) @definition.var)) +(varDecl (varName (simpleId) @local.definition.var)) ; REFERENCES -(simpleId) @reference +(simpleId) @local.reference diff --git a/queries/query/locals.scm b/queries/query/locals.scm index 29ab9fe0d..21d5fd7c9 100644 --- a/queries/query/locals.scm +++ b/queries/query/locals.scm @@ -1,15 +1,15 @@ -(program) @scope -(program (named_node) @scope) -(program (anonymous_node) @scope) -(program (grouping) @scope) +(program) @local.scope +(program (named_node) @local.scope) +(program (anonymous_node) @local.scope) +(program (grouping) @local.scope) -(identifier) @reference +(identifier) @local.reference (named_node - (capture) @definition.var) + (capture) @local.definition.var) (anonymous_node - (capture) @definition.var) + (capture) @local.definition.var) (grouping - (capture) @definition.var) + (capture) @local.definition.var) diff --git a/queries/r/locals.scm b/queries/r/locals.scm index 394a23dfc..38977b7b7 100755 --- a/queries/r/locals.scm +++ b/queries/r/locals.scm @@ -1,11 +1,11 @@ ; locals.scm -(function_definition) @scope +(function_definition) @local.scope -(formal_parameters (identifier) @definition.parameter) +(formal_parameters (identifier) @local.definition.parameter) -(left_assignment name: (identifier) @definition) -(equals_assignment name: (identifier) @definition) -(right_assignment name: (identifier) @definition) +(left_assignment name: (identifier) @local.definition) +(equals_assignment name: (identifier) @local.definition) +(right_assignment name: (identifier) @local.definition) -(identifier) @reference +(identifier) @local.reference diff --git a/queries/rasi/locals.scm b/queries/rasi/locals.scm index a658e2477..b8e221252 100644 --- a/queries/rasi/locals.scm +++ b/queries/rasi/locals.scm @@ -1,5 +1,5 @@ -(rule_set (selectors (id_selector))) @scope +(rule_set (selectors (id_selector))) @local.scope -(block (declaration (property_name) @definition.var)) +(block (declaration (property_name) @local.definition.var)) -(reference_value name:(identifier) @reference) +(reference_value name:(identifier) @local.reference) diff --git a/queries/re2c/locals.scm b/queries/re2c/locals.scm index 0a77995d5..eea1ede89 100644 --- a/queries/re2c/locals.scm +++ b/queries/re2c/locals.scm @@ -1 +1 @@ -(body) @scope +(body) @local.scope diff --git a/queries/ron/locals.scm b/queries/ron/locals.scm index de90d35fd..62ccbf09f 100644 --- a/queries/ron/locals.scm +++ b/queries/ron/locals.scm @@ -1,12 +1,12 @@ -(source_file) @scope -(source_file (array) @scope) -(source_file (map) @scope) -(source_file (struct) @scope) -(source_file (tuple) @scope) +(source_file) @local.scope +(source_file (array) @local.scope) +(source_file (map) @local.scope) +(source_file (struct) @local.scope) +(source_file (tuple) @local.scope) -(identifier) @reference +(identifier) @local.reference -(struct_entry (identifier) @definition.field) -(struct_entry (identifier) @definition.enum (enum_variant)) +(struct_entry (identifier) @local.definition.field) +(struct_entry (identifier) @local.definition.enum (enum_variant)) -(struct (struct_name) @definition.type) +(struct (struct_name) @local.definition.type) diff --git a/queries/rst/locals.scm b/queries/rst/locals.scm index bf8bd0417..3091064cb 100644 --- a/queries/rst/locals.scm +++ b/queries/rst/locals.scm @@ -1,32 +1,32 @@ ;; Scopes -(document) @scope +(document) @local.scope -(directive) @scope +(directive) @local.scope ;; Definitions -(title) @definition +(title) @local.definition (substitution_definition - name: (substitution) @definition) + name: (substitution) @local.definition) (footnote - name: (label) @definition) + name: (label) @local.definition) (citation - name: (label) @definition) + name: (label) @local.definition) (target - name: (name) @definition) + name: (name) @local.definition) ; Inline targets -(inline_target) @definition +(inline_target) @local.definition ; The role directive can define a new role ((directive name: (type) @_type - body: (body (arguments) @definition)) + body: (body (arguments) @local.definition)) (#eq? @_type "role")) ;; References @@ -37,4 +37,4 @@ (citation_reference) (reference) (role) -] @reference +] @local.reference diff --git a/queries/ruby/locals.scm b/queries/ruby/locals.scm index dacc46994..f08dcd49f 100644 --- a/queries/ruby/locals.scm +++ b/queries/ruby/locals.scm @@ -21,35 +21,35 @@ ; SOFTWARE. ;;; DECLARATIONS AND SCOPES -(method) @scope -(class) @scope +(method) @local.scope +(class) @local.scope [ (block) (do_block) - ] @scope + ] @local.scope -(identifier) @reference -(constant) @reference -(instance_variable) @reference +(identifier) @local.reference +(constant) @local.reference +(instance_variable) @local.reference -(module name: (constant) @definition.namespace) -(class name: (constant) @definition.type) -(method name: [(identifier) (constant)] @definition.function) -(singleton_method name: [(identifier) (constant)] @definition.function) +(module name: (constant) @local.definition.namespace) +(class name: (constant) @local.definition.type) +(method name: [(identifier) (constant)] @local.definition.function) +(singleton_method name: [(identifier) (constant)] @local.definition.function) -(method_parameters (identifier) @definition.var) -(lambda_parameters (identifier) @definition.var) -(block_parameters (identifier) @definition.var) -(splat_parameter (identifier) @definition.var) -(hash_splat_parameter (identifier) @definition.var) -(optional_parameter name: (identifier) @definition.var) -(destructured_parameter (identifier) @definition.var) -(block_parameter name: (identifier) @definition.var) -(keyword_parameter name: (identifier) @definition.var) +(method_parameters (identifier) @local.definition.var) +(lambda_parameters (identifier) @local.definition.var) +(block_parameters (identifier) @local.definition.var) +(splat_parameter (identifier) @local.definition.var) +(hash_splat_parameter (identifier) @local.definition.var) +(optional_parameter name: (identifier) @local.definition.var) +(destructured_parameter (identifier) @local.definition.var) +(block_parameter name: (identifier) @local.definition.var) +(keyword_parameter name: (identifier) @local.definition.var) -(assignment left: (_) @definition.var) +(assignment left: (_) @local.definition.var) -(left_assignment_list (identifier) @definition.var) -(rest_assignment (identifier) @definition.var) -(destructured_left_assignment (identifier) @definition.var) +(left_assignment_list (identifier) @local.definition.var) +(rest_assignment (identifier) @local.definition.var) +(destructured_left_assignment (identifier) @local.definition.var) diff --git a/queries/rust/locals.scm b/queries/rust/locals.scm index c5f4c187e..24e2ffb0a 100644 --- a/queries/rust/locals.scm +++ b/queries/rust/locals.scm @@ -1,88 +1,88 @@ ; Imports (extern_crate_declaration - name: (identifier) @definition.import) + name: (identifier) @local.definition.import) (use_declaration argument: (scoped_identifier - name: (identifier) @definition.import)) + name: (identifier) @local.definition.import)) (use_as_clause - alias: (identifier) @definition.import) + alias: (identifier) @local.definition.import) (use_list - (identifier) @definition.import) ; use std::process::{Child, Command, Stdio}; + (identifier) @local.definition.import) ; use std::process::{Child, Command, Stdio}; ; Functions (function_item - name: (identifier) @definition.function) + name: (identifier) @local.definition.function) (function_item - name: (identifier) @definition.method + name: (identifier) @local.definition.method parameters: (parameters (self_parameter))) ; Variables (parameter - pattern: (identifier) @definition.var) + pattern: (identifier) @local.definition.var) (let_declaration - pattern: (identifier) @definition.var) + pattern: (identifier) @local.definition.var) (const_item - name: (identifier) @definition.var) + name: (identifier) @local.definition.var) (tuple_pattern - (identifier) @definition.var) + (identifier) @local.definition.var) (let_condition pattern: (_ - (identifier) @definition.var)) + (identifier) @local.definition.var)) (tuple_struct_pattern - (identifier) @definition.var) + (identifier) @local.definition.var) (closure_parameters - (identifier) @definition.var) + (identifier) @local.definition.var) (self_parameter - (self) @definition.var) + (self) @local.definition.var) (for_expression - pattern: (identifier) @definition.var) + pattern: (identifier) @local.definition.var) ; Types (struct_item - name: (type_identifier) @definition.type) + name: (type_identifier) @local.definition.type) (constrained_type_parameter - left: (type_identifier) @definition.type) ; the P in remove_file>(path: P) + left: (type_identifier) @local.definition.type) ; the P in remove_file>(path: P) (enum_item - name: (type_identifier) @definition.type) + name: (type_identifier) @local.definition.type) ; Fields (field_declaration - name: (field_identifier) @definition.field) + name: (field_identifier) @local.definition.field) (enum_variant - name: (identifier) @definition.field) + name: (identifier) @local.definition.field) ; References -(identifier) @reference -((type_identifier) @reference +(identifier) @local.reference +((type_identifier) @local.reference (#set! reference.kind "type")) -((field_identifier) @reference +((field_identifier) @local.reference (#set! reference.kind "field")) ; Macros (macro_definition - name: (identifier) @definition.macro) + name: (identifier) @local.definition.macro) ; Module (mod_item - name: (identifier) @definition.namespace) + name: (identifier) @local.definition.namespace) ; Scopes [ @@ -99,5 +99,5 @@ (struct_item) (enum_item) (impl_item) -] @scope +] @local.scope diff --git a/queries/scala/locals.scm b/queries/scala/locals.scm index 9f81e2859..689b140b3 100644 --- a/queries/scala/locals.scm +++ b/queries/scala/locals.scm @@ -6,47 +6,47 @@ (function_definition) (block) (for_expression) -] @scope +] @local.scope ; References -(identifier) @reference +(identifier) @local.reference ; Definitions (function_declaration - name: (identifier) @definition.function) + name: (identifier) @local.definition.function) (function_definition - name: ((identifier) @definition.function) + name: ((identifier) @local.definition.function) (#set! definition.var.scope parent)) (parameter - name: (identifier) @definition.parameter) + name: (identifier) @local.definition.parameter) (class_parameter - name: (identifier) @definition.parameter) + name: (identifier) @local.definition.parameter) (lambda_expression - parameters: (identifier) @definition.var) + parameters: (identifier) @local.definition.var) (binding - name: (identifier) @definition.var) + name: (identifier) @local.definition.var) (val_definition - pattern: (identifier) @definition.var) + pattern: (identifier) @local.definition.var) (var_definition - pattern: (identifier) @definition.var) + pattern: (identifier) @local.definition.var) (val_declaration - name: (identifier) @definition.var) + name: (identifier) @local.definition.var) (var_declaration - name: (identifier) @definition.var) + name: (identifier) @local.definition.var) (for_expression enumerators: (enumerators (enumerator (tuple_pattern - (identifier) @definition.var)))) + (identifier) @local.definition.var)))) diff --git a/queries/smali/locals.scm b/queries/smali/locals.scm index fcb3b631c..77852a21d 100644 --- a/queries/smali/locals.scm +++ b/queries/smali/locals.scm @@ -7,36 +7,36 @@ (packed_switch_directive) (sparse_switch_directive) (subannotation_directive) -] @scope +] @local.scope [ (identifier) (class_identifier) (label) (jmp_label) -] @reference +] @local.reference (enum_reference - (field_identifier) @definition.enum) + (field_identifier) @local.definition.enum) ((field_definition (access_modifiers) @_mod - (field_identifier) @definition.enum) + (field_identifier) @local.definition.enum) (#eq? @_mod "enum")) (field_definition - (field_identifier) @definition.field - (field_type) @definition.associated) + (field_identifier) @local.definition.field + (field_type) @local.definition.associated) -(annotation_key) @definition.field +(annotation_key) @local.definition.field (method_definition - (method_signature (method_identifier) @definition.method)) + (method_signature (method_identifier) @local.definition.method)) -(param_identifier) @definition.parameter +(param_identifier) @local.definition.parameter (annotation_directive - (class_identifier) @definition.type) + (class_identifier) @local.definition.type) (class_directive - (class_identifier) @definition.type) + (class_identifier) @local.definition.type) diff --git a/queries/sparql/locals.scm b/queries/sparql/locals.scm index 107aaeb75..ba157a4d5 100644 --- a/queries/sparql/locals.scm +++ b/queries/sparql/locals.scm @@ -1,8 +1,8 @@ -(group_graph_pattern (triples_block) @scope) +(group_graph_pattern (triples_block) @local.scope) -((sub_select (select_clause (var) @definition.var)) +((sub_select (select_clause (var) @local.definition.var)) (#set! "definition.var.scope" "parent")) -((select_query (select_clause (var) @definition.var)) +((select_query (select_clause (var) @local.definition.var)) (#set! "definition.var.scope" "parent")) -(var) @reference +(var) @local.reference diff --git a/queries/squirrel/locals.scm b/queries/squirrel/locals.scm index 11486d1e4..3e3b9da3e 100644 --- a/queries/squirrel/locals.scm +++ b/queries/squirrel/locals.scm @@ -22,7 +22,7 @@ (foreach_statement) (try_statement) (catch_statement) -] @scope +] @local.scope ; References @@ -30,38 +30,38 @@ [ (identifier) (global_variable) -] @reference +] @local.reference ; Definitions (const_declaration - . (identifier) @definition.constant) + . (identifier) @local.definition.constant) (enum_declaration - . (identifier) @definition.enum) + . (identifier) @local.definition.enum) (member_declaration - (identifier) @definition.field + (identifier) @local.definition.field . "=") (table_slot - . (identifier) @definition.field + . (identifier) @local.definition.field . ["=" ":"]) ((function_declaration - . (identifier) @definition.function) - (#not-has-ancestor? @definition.function member_declaration)) + . (identifier) @local.definition.function) + (#not-has-ancestor? @local.definition.function member_declaration)) (member_declaration (function_declaration - . (identifier) @definition.method)) + . (identifier) @local.definition.method)) (class_declaration - . (identifier) @definition.type) + . (identifier) @local.definition.type) (var_statement - "var" . (identifier) @definition.variable) + "var" . (identifier) @local.definition.variable) (local_declaration - (identifier) @definition.variable + (identifier) @local.definition.variable . "=") diff --git a/queries/ssh_config/locals.scm b/queries/ssh_config/locals.scm index d4ccbfdde..a3309a9a6 100644 --- a/queries/ssh_config/locals.scm +++ b/queries/ssh_config/locals.scm @@ -1,7 +1,7 @@ (parameter keyword: "Tag" - argument: (string) @reference) + argument: (string) @local.reference) (condition criteria: "tagged" - argument: (pattern) @definition) + argument: (pattern) @local.definition) diff --git a/queries/starlark/locals.scm b/queries/starlark/locals.scm index ad7d89d2d..ff9af3803 100644 --- a/queries/starlark/locals.scm +++ b/queries/starlark/locals.scm @@ -1,85 +1,85 @@ ;;; Program structure -(module) @scope +(module) @local.scope ; Function with parameters, defines parameters (parameters - (identifier) @definition.parameter) + (identifier) @local.definition.parameter) (default_parameter - (identifier) @definition.parameter) + (identifier) @local.definition.parameter) (typed_parameter - (identifier) @definition.parameter) + (identifier) @local.definition.parameter) (typed_default_parameter - (identifier) @definition.parameter) + (identifier) @local.definition.parameter) ; *args parameter (parameters (list_splat_pattern - (identifier) @definition.parameter)) + (identifier) @local.definition.parameter)) ; **kwargs parameter (parameters (dictionary_splat_pattern - (identifier) @definition.parameter)) + (identifier) @local.definition.parameter)) ; Function defines function and scope ((function_definition - name: (identifier) @definition.function) @scope + name: (identifier) @local.definition.function) @local.scope (#set! definition.function.scope "parent")) ;;; Loops ; not a scope! (for_statement left: (pattern_list - (identifier) @definition.var)) + (identifier) @local.definition.var)) (for_statement left: (tuple_pattern - (identifier) @definition.var)) + (identifier) @local.definition.var)) (for_statement - left: (identifier) @definition.var) + left: (identifier) @local.definition.var) ; for in list comprehension (for_in_clause - left: (identifier) @definition.var) + left: (identifier) @local.definition.var) (for_in_clause left: (tuple_pattern - (identifier) @definition.var)) + (identifier) @local.definition.var)) (for_in_clause left: (pattern_list - (identifier) @definition.var)) + (identifier) @local.definition.var)) -(dictionary_comprehension) @scope -(list_comprehension) @scope -(set_comprehension) @scope +(dictionary_comprehension) @local.scope +(list_comprehension) @local.scope +(set_comprehension) @local.scope ;;; Assignments (assignment - left: (identifier) @definition.var) + left: (identifier) @local.definition.var) (assignment left: (pattern_list - (identifier) @definition.var)) + (identifier) @local.definition.var)) (assignment left: (tuple_pattern - (identifier) @definition.var)) + (identifier) @local.definition.var)) (assignment left: (attribute (identifier) - (identifier) @definition.field)) + (identifier) @local.definition.field)) ; Walrus operator x := 1 (named_expression - (identifier) @definition.var) + (identifier) @local.definition.var) (as_pattern - alias: (as_pattern_target) @definition.var) + alias: (as_pattern_target) @local.definition.var) ;;; REFERENCES -(identifier) @reference +(identifier) @local.reference ;; Starlark-specific @@ -87,5 +87,5 @@ ((call function: (identifier) @_fn arguments: (argument_list - (string) @definition.import)) + (string) @local.definition.import)) (#eq? @_fn "load")) diff --git a/queries/supercollider/locals.scm b/queries/supercollider/locals.scm index f2238b478..d04677cae 100644 --- a/queries/supercollider/locals.scm +++ b/queries/supercollider/locals.scm @@ -4,24 +4,24 @@ (code_block) (function_block) (control_structure) -] @scope +] @local.scope ; Definitions (argument - name: (identifier) @definition.parameter + name: (identifier) @local.definition.parameter (#set! "definition.var.scope" "local") ) (variable_definition - name: (variable (local_var (identifier) @definition.var + name: (variable (local_var (identifier) @local.definition.var ))) (variable_definition - name: (variable (environment_var (identifier) @definition.var)) + name: (variable (environment_var (identifier) @local.definition.var)) (#set! "definition.var.scope" "global")) -(function_definition name: (variable) @definition.var +(function_definition name: (variable) @local.definition.var (#set! "definition.var.scope" "parent") ) -(identifier) @reference +(identifier) @local.reference diff --git a/queries/swift/locals.scm b/queries/swift/locals.scm index dfe1c83b1..45d4f2f0a 100644 --- a/queries/swift/locals.scm +++ b/queries/swift/locals.scm @@ -1,5 +1,5 @@ -(import_declaration (identifier) @definition.import) -(function_declaration name: (simple_identifier) @definition.function) +(import_declaration (identifier) @local.definition.import) +(function_declaration name: (simple_identifier) @local.definition.function) ; Scopes [ @@ -15,4 +15,4 @@ (function_declaration) (class_declaration) (protocol_declaration) -] @scope +] @local.scope diff --git a/queries/systemtap/locals.scm b/queries/systemtap/locals.scm index 5d4447e52..15056808c 100644 --- a/queries/systemtap/locals.scm +++ b/queries/systemtap/locals.scm @@ -6,30 +6,30 @@ (for_statement) (foreach_statement) (catch_clause) -] @scope +] @local.scope (init_declarator - name: (identifier) @definition.var) + name: (identifier) @local.definition.var) (array_declarator - name: (identifier) @definition.var) + name: (identifier) @local.definition.var) (function_definition - name: (identifier) @definition.function) + name: (identifier) @local.definition.function) (parameter - name: (identifier) @definition.parameter) + name: (identifier) @local.definition.parameter) (tuple_capture - (identifier) @definition.var) + (identifier) @local.definition.var) (catch_clause - parameter: (identifier) @definition.var) + parameter: (identifier) @local.definition.var) (assignment_expression - left: (identifier) @definition.var) + left: (identifier) @local.definition.var) (call_expression - function: (identifier) @reference) + function: (identifier) @local.reference) -(identifier) @reference +(identifier) @local.reference diff --git a/queries/t32/locals.scm b/queries/t32/locals.scm index dc1f97fc2..bad645fdf 100644 --- a/queries/t32/locals.scm +++ b/queries/t32/locals.scm @@ -1,38 +1,38 @@ -(block) @scope +(block) @local.scope ; Parameter definitions (parameter_declaration command: (identifier) - macro: (macro) @definition.parameter) + macro: (macro) @local.definition.parameter) ; Variable definitions (macro_definition command: (identifier) - macro: (macro) @definition.var) + macro: (macro) @local.definition.var) (command_expression command: (identifier) arguments: (argument_list - declarator: (trace32_hll_variable) @definition.var)) + declarator: (trace32_hll_variable) @local.definition.var)) ; Function definitions (subroutine_block command: (identifier) - subroutine: (identifier) @definition.function) + subroutine: (identifier) @local.definition.function) (labeled_expression - label: (identifier) @definition.function + label: (identifier) @local.definition.function (block)) ; References ( (subroutine_call_expression command: (identifier) - subroutine: (identifier) @reference) + subroutine: (identifier) @local.reference) (#set! reference.kind "function") ) [ (macro) (trace32_hll_variable) -] @reference +] @local.reference diff --git a/queries/tablegen/locals.scm b/queries/tablegen/locals.scm index 04602991c..f1404adb6 100644 --- a/queries/tablegen/locals.scm +++ b/queries/tablegen/locals.scm @@ -10,42 +10,42 @@ (foreach) (if) (let) -] @scope +] @local.scope ; References [ (var) (identifier) -] @reference +] @local.reference ; Definitions (instruction - (identifier) @definition.field) + (identifier) @local.definition.field) (let_instruction - (identifier) @definition.field) + (identifier) @local.definition.field) (include_directive - (string) @definition.import) + (string) @local.definition.import) -(template_arg (identifier) @definition.parameter) +(template_arg (identifier) @local.definition.parameter) (class - name: (identifier) @definition.type) + name: (identifier) @local.definition.type) (multiclass - name: (identifier) @definition.type) + name: (identifier) @local.definition.type) (def - name: (value (_) @definition.type)) + name: (value (_) @local.definition.type)) (defm - name: (value (_) @definition.type)) + name: (value (_) @local.definition.type)) (defset - name: (identifier) @definition.type) + name: (identifier) @local.definition.type) (def_var - name: (identifier) @definition.var) + name: (identifier) @local.definition.var) diff --git a/queries/teal/locals.scm b/queries/teal/locals.scm index 431e659a1..e26efc43e 100644 --- a/queries/teal/locals.scm +++ b/queries/teal/locals.scm @@ -1,23 +1,23 @@ (var_declaration declarators: (var_declarators - (var (identifier)) @definition.var)) + (var (identifier)) @local.definition.var)) (var_assignment variables: (assignment_variables - (var (identifier) @definition.var) @definition.associated)) + (var (identifier) @local.definition.var) @local.definition.associated)) -(arg name: (identifier) @definition.parameter) +(arg name: (identifier) @local.definition.parameter) -(anon_function) @scope +(anon_function) @local.scope ((function_statement - (function_name) @definition.function) @scope) + (function_name) @local.definition.function) @local.scope) -(program) @scope -(if_statement) @scope -(generic_for_statement (for_body) @scope) -(numeric_for_statement (for_body) @scope) -(repeat_statement) @scope -(while_statement (while_body) @scope) -(do_statement) @scope +(program) @local.scope +(if_statement) @local.scope +(generic_for_statement (for_body) @local.scope) +(numeric_for_statement (for_body) @local.scope) +(repeat_statement) @local.scope +(while_statement (while_body) @local.scope) +(do_statement) @local.scope -(identifier) @reference +(identifier) @local.reference diff --git a/queries/thrift/locals.scm b/queries/thrift/locals.scm index d95cc5da1..d1c4af9a1 100644 --- a/queries/thrift/locals.scm +++ b/queries/thrift/locals.scm @@ -3,49 +3,49 @@ [ (document) (definition) -] @scope +] @local.scope ; References -(identifier) @reference +(identifier) @local.reference ; Definitions -(annotation_identifier) @definition +(annotation_identifier) @local.definition -(const_definition (identifier) @definition.constant) +(const_definition (identifier) @local.definition.constant) (enum_definition "enum" - . (identifier) @definition.enum - "{" (identifier) @definition.constant "}") + . (identifier) @local.definition.enum + "{" (identifier) @local.definition.constant "}") (senum_definition "senum" - . (identifier) @definition.enum) + . (identifier) @local.definition.enum) -(field (identifier) @definition.field) +(field (identifier) @local.definition.field) -(function_definition (identifier) @definition.function) +(function_definition (identifier) @local.definition.function) (namespace_declaration "namespace" (namespace_scope) - . (_) @definition.namespace + . (_) @local.definition.namespace (namespace_uri)?) -(parameter (identifier) @definition.parameter) +(parameter (identifier) @local.definition.parameter) (struct_definition - "struct" . (identifier) @definition.type) + "struct" . (identifier) @local.definition.type) (union_definition - "union" . (identifier) @definition.type) + "union" . (identifier) @local.definition.type) (exception_definition - "exception" . (identifier) @definition.type) + "exception" . (identifier) @local.definition.type) (service_definition - "service" . (identifier) @definition.type) + "service" . (identifier) @local.definition.type) (interaction_definition - "interaction" . (identifier) @definition.type) + "interaction" . (identifier) @local.definition.type) -(typedef_identifier) @definition.type +(typedef_identifier) @local.definition.type diff --git a/queries/tiger/locals.scm b/queries/tiger/locals.scm index 33ccd3c71..df26bb2a0 100644 --- a/queries/tiger/locals.scm +++ b/queries/tiger/locals.scm @@ -9,31 +9,31 @@ (for_expression) (let_expression) (function_declaration) -] @scope +] @local.scope ; }}} ; Definitions {{{ (type_declaration - name: (identifier) @definition.type + name: (identifier) @local.definition.type (#set! "definition.var.scope" "parent")) (parameters - name: (identifier) @definition.parameter) + name: (identifier) @local.definition.parameter) (function_declaration - name: (identifier) @definition.function + name: (identifier) @local.definition.function (#set! "definition.var.scope" "parent")) (primitive_declaration - name: (identifier) @definition.function + name: (identifier) @local.definition.function (#set! "definition.var.scope" "parent")) (variable_declaration - name: (identifier) @definition.var + name: (identifier) @local.definition.var (#set! "definition.var.scope" "parent")) ; }}} ; References {{{ -(identifier) @reference +(identifier) @local.reference ; }}} ; vim: sw=2 foldmethod=marker diff --git a/queries/tlaplus/locals.scm b/queries/tlaplus/locals.scm index 81f774b27..fbb4abf97 100644 --- a/queries/tlaplus/locals.scm +++ b/queries/tlaplus/locals.scm @@ -12,45 +12,45 @@ (set_filter) (set_map) (unbounded_quantification) -] @scope +] @local.scope -(choose (identifier) @definition.parameter) -(choose (tuple_of_identifiers (identifier) @definition.parameter)) -(constant_declaration (identifier) @definition.constant) -(constant_declaration (operator_declaration name: (_) @definition.constant)) +(choose (identifier) @local.definition.parameter) +(choose (tuple_of_identifiers (identifier) @local.definition.parameter)) +(constant_declaration (identifier) @local.definition.constant) +(constant_declaration (operator_declaration name: (_) @local.definition.constant)) (function_definition - name: (identifier) @definition.function + name: (identifier) @local.definition.function (#set! "definition.function.scope" "parent")) -(lambda (identifier) @definition.parameter) +(lambda (identifier) @local.definition.parameter) (module_definition - name: (_) @definition.import + name: (_) @local.definition.import (#set! "definition.import.scope" "parent")) -(module_definition parameter: (identifier) @definition.parameter) -(module_definition parameter: (operator_declaration name: (_) @definition.parameter)) +(module_definition parameter: (identifier) @local.definition.parameter) +(module_definition parameter: (operator_declaration name: (_) @local.definition.parameter)) (operator_definition - name: (_) @definition.macro + name: (_) @local.definition.macro (#set! "definition.macro.scope" "parent")) -(operator_definition parameter: (identifier) @definition.parameter) -(operator_definition parameter: (operator_declaration name: (_) @definition.parameter)) -(quantifier_bound (identifier) @definition.parameter) -(quantifier_bound (tuple_of_identifiers (identifier) @definition.parameter)) -(unbounded_quantification (identifier) @definition.parameter) -(variable_declaration (identifier) @definition.var) +(operator_definition parameter: (identifier) @local.definition.parameter) +(operator_definition parameter: (operator_declaration name: (_) @local.definition.parameter)) +(quantifier_bound (identifier) @local.definition.parameter) +(quantifier_bound (tuple_of_identifiers (identifier) @local.definition.parameter)) +(unbounded_quantification (identifier) @local.definition.parameter) +(variable_declaration (identifier) @local.definition.var) ; Proof scopes and definitions [ (non_terminal_proof) (suffices_proof_step) (theorem) -] @scope +] @local.scope -(assume_prove (new (identifier) @definition.parameter)) -(assume_prove (new (operator_declaration name: (_) @definition.parameter))) -(assumption name: (identifier) @definition.constant) -(pick_proof_step (identifier) @definition.parameter) -(take_proof_step (identifier) @definition.parameter) +(assume_prove (new (identifier) @local.definition.parameter)) +(assume_prove (new (operator_declaration name: (_) @local.definition.parameter))) +(assumption name: (identifier) @local.definition.constant) +(pick_proof_step (identifier) @local.definition.parameter) +(take_proof_step (identifier) @local.definition.parameter) (theorem - name: (identifier) @definition.constant + name: (identifier) @local.definition.constant (#set! "definition.constant.scope" "parent")) ; PlusCal scopes and definitions @@ -59,30 +59,30 @@ (pcal_macro) (pcal_procedure) (pcal_with) -] @scope +] @local.scope -(pcal_macro_decl parameter: (identifier) @definition.parameter) -(pcal_proc_var_decl (identifier) @definition.parameter) -(pcal_var_decl (identifier) @definition.var) -(pcal_with (identifier) @definition.parameter) +(pcal_macro_decl parameter: (identifier) @local.definition.parameter) +(pcal_proc_var_decl (identifier) @local.definition.parameter) +(pcal_var_decl (identifier) @local.definition.var) +(pcal_with (identifier) @local.definition.parameter) ; Built-in PlusCal variables (pcal_algorithm_body [ - (_ (identifier_ref) @definition.var) - (_ (_ (identifier_ref) @definition.var)) - (_ (_ (_ (identifier_ref) @definition.var))) - (_ (_ (_ (_ (identifier_ref) @definition.var)))) - (_ (_ (_ (_ (_ (identifier_ref) @definition.var))))) + (_ (identifier_ref) @local.definition.var) + (_ (_ (identifier_ref) @local.definition.var)) + (_ (_ (_ (identifier_ref) @local.definition.var))) + (_ (_ (_ (_ (identifier_ref) @local.definition.var)))) + (_ (_ (_ (_ (_ (identifier_ref) @local.definition.var))))) ] - (#any-of? @definition.var "self" "pc" "stack")) + (#any-of? @local.definition.var "self" "pc" "stack")) ; References -(identifier_ref) @reference -((prefix_op_symbol) @reference) -(bound_prefix_op symbol: (_) @reference) -((infix_op_symbol) @reference) -(bound_infix_op symbol: (_) @reference) -((postfix_op_symbol) @reference) -(bound_postfix_op symbol: (_) @reference) -(bound_nonfix_op symbol: (_) @reference) +(identifier_ref) @local.reference +((prefix_op_symbol) @local.reference) +(bound_prefix_op symbol: (_) @local.reference) +((infix_op_symbol) @local.reference) +(bound_infix_op symbol: (_) @local.reference) +((postfix_op_symbol) @local.reference) +(bound_postfix_op symbol: (_) @local.reference) +(bound_nonfix_op symbol: (_) @local.reference) diff --git a/queries/toml/locals.scm b/queries/toml/locals.scm index d3dda77b4..2ca4e5404 100644 --- a/queries/toml/locals.scm +++ b/queries/toml/locals.scm @@ -1,4 +1,4 @@ [ (table) (table_array_element) -] @scope +] @local.scope diff --git a/queries/turtle/locals.scm b/queries/turtle/locals.scm index e791f0bbd..db3455df8 100644 --- a/queries/turtle/locals.scm +++ b/queries/turtle/locals.scm @@ -1,12 +1,12 @@ -(turtle_doc) @scope +(turtle_doc) @local.scope (subject [ (prefixed_name) (iri_reference) - ] @definition.var) + ] @local.definition.var) [ (prefixed_name) (iri_reference) -] @reference +] @local.reference diff --git a/queries/typescript/locals.scm b/queries/typescript/locals.scm index efbcaecaa..8addb1b27 100644 --- a/queries/typescript/locals.scm +++ b/queries/typescript/locals.scm @@ -1,27 +1,27 @@ ; inherits: ecma -(required_parameter (identifier) @definition) -(optional_parameter (identifier) @definition) +(required_parameter (identifier) @local.definition) +(optional_parameter (identifier) @local.definition) ; x => x (arrow_function - parameter: (identifier) @definition.parameter) + parameter: (identifier) @local.definition.parameter) ;; ({ a }) => null (required_parameter (object_pattern - (shorthand_property_identifier_pattern) @definition.parameter)) + (shorthand_property_identifier_pattern) @local.definition.parameter)) ;; ({ a: b }) => null (required_parameter (object_pattern (pair_pattern - value: (identifier) @definition.parameter))) + value: (identifier) @local.definition.parameter))) ;; ([ a ]) => null (required_parameter (array_pattern - (identifier) @definition.parameter)) + (identifier) @local.definition.parameter)) (required_parameter (rest_pattern - (identifier) @definition.parameter)) + (identifier) @local.definition.parameter)) diff --git a/queries/udev/locals.scm b/queries/udev/locals.scm index 33714d157..f4923467c 100644 --- a/queries/udev/locals.scm +++ b/queries/udev/locals.scm @@ -2,23 +2,23 @@ (assignment key: "LABEL" - (value (content) @definition)) + (value (content) @local.definition)) (assignment key: "GOTO" - (value (content) @reference)) + (value (content) @local.reference)) ;; env vars (assignment key: "ENV" - (env_var) @definition.var) + (env_var) @local.definition.var) (match key: "ENV" - (env_var) @reference) + (env_var) @local.reference) -(var_sub (env_var) @reference) +(var_sub (env_var) @local.reference) ;; misc @@ -26,4 +26,4 @@ (attribute) (kernel_param) (seclabel) -] @reference +] @local.reference diff --git a/queries/ungrammar/locals.scm b/queries/ungrammar/locals.scm index 9fd87e637..389d5c262 100644 --- a/queries/ungrammar/locals.scm +++ b/queries/ungrammar/locals.scm @@ -1,7 +1,7 @@ -(grammar) @scope +(grammar) @local.scope -(definition) @definition +(definition) @local.definition -(label_name) @definition.label +(label_name) @local.definition.label -(identifier) @reference +(identifier) @local.reference diff --git a/queries/usd/locals.scm b/queries/usd/locals.scm index 4e7e97b5f..89eb171d1 100644 --- a/queries/usd/locals.scm +++ b/queries/usd/locals.scm @@ -1,4 +1,4 @@ [ (block) (metadata) -] @scope +] @local.scope diff --git a/queries/uxntal/locals.scm b/queries/uxntal/locals.scm index 0a8ddee96..e31616223 100644 --- a/queries/uxntal/locals.scm +++ b/queries/uxntal/locals.scm @@ -5,18 +5,18 @@ (macro) (memory_execution) (subroutine) -] @scope +] @local.scope ; References -(identifier) @reference +(identifier) @local.reference ; Definitions (label "@" - . (identifier) @definition.function) + . (identifier) @local.definition.function) (macro "%" - . (identifier) @definition.macro) + . (identifier) @local.definition.macro) diff --git a/queries/v/locals.scm b/queries/v/locals.scm index f0e08403a..03623a717 100644 --- a/queries/v/locals.scm +++ b/queries/v/locals.scm @@ -1,28 +1,28 @@ ((function_declaration - name: (identifier) @definition.function)) ;@function + name: (identifier) @local.definition.function)) ;@function (var_declaration var_list: (expression_list (reference_expression - (identifier) @definition.var))) + (identifier) @local.definition.var))) ((function_declaration - name: (identifier) @definition.function)) + name: (identifier) @local.definition.function)) -(const_declaration (const_definition name: (identifier) @definition.var)) +(const_declaration (const_definition name: (identifier) @local.definition.var)) -(identifier) @reference +(identifier) @local.reference -((call_expression name: (reference_expression (identifier)) @reference) +((call_expression name: (reference_expression (identifier)) @local.reference) (#set! reference.kind "call")) ((call_expression name: (selector_expression - field: (reference_expression (identifier) @definition.function))) + field: (reference_expression (identifier) @local.definition.function))) (#set! reference.kind "call")) -(source_file) @scope -(function_declaration) @scope -(if_expression) @scope -(block) @scope -(for_statement) @scope +(source_file) @local.scope +(function_declaration) @local.scope +(if_expression) @local.scope +(block) @local.scope +(for_statement) @local.scope diff --git a/queries/verilog/locals.scm b/queries/verilog/locals.scm index 507ddea44..35b874ab4 100644 --- a/queries/verilog/locals.scm +++ b/queries/verilog/locals.scm @@ -6,56 +6,56 @@ (function_declaration) (always_construct) (module_declaration) -] @scope +] @local.scope (data_declaration (list_of_variable_decl_assignments (variable_decl_assignment - (simple_identifier) @definition.var))) + (simple_identifier) @local.definition.var))) (genvar_initialization (genvar_identifier - (simple_identifier) @definition.var)) + (simple_identifier) @local.definition.var)) (for_initialization (for_variable_declaration - (simple_identifier) @definition.var)) + (simple_identifier) @local.definition.var)) (net_declaration (list_of_net_decl_assignments (net_decl_assignment - (simple_identifier) @definition.var))) + (simple_identifier) @local.definition.var))) (ansi_port_declaration (port_identifier - (simple_identifier) @definition.var)) + (simple_identifier) @local.definition.var)) (parameter_declaration (list_of_param_assignments (param_assignment (parameter_identifier - (simple_identifier) @definition.parameter)))) + (simple_identifier) @local.definition.parameter)))) (local_parameter_declaration (list_of_param_assignments (param_assignment (parameter_identifier - (simple_identifier) @definition.parameter)))) + (simple_identifier) @local.definition.parameter)))) ;; TODO: fixme ;(function_declaration ;(function_identifier - ;(simple_identifier) @definition.function)) + ;(simple_identifier) @local.definition.function)) (function_declaration (function_body_declaration (function_identifier (function_identifier - (simple_identifier) @definition.function)))) + (simple_identifier) @local.definition.function)))) (tf_port_item1 (port_identifier - (simple_identifier) @definition.parameter)) + (simple_identifier) @local.definition.parameter)) ; too broad, now includes types etc -(simple_identifier) @reference +(simple_identifier) @local.reference diff --git a/queries/vim/locals.scm b/queries/vim/locals.scm index 11252b9f4..4ba551e40 100644 --- a/queries/vim/locals.scm +++ b/queries/vim/locals.scm @@ -1,10 +1,10 @@ [ (script_file) (function_definition) -] @scope +] @local.scope -(function_declaration name: (identifier) @definition.function) -(function_declaration parameters: (parameters (identifier) @definition.parameter)) -(let_statement [(scoped_identifier) (identifier)] @definition.var) +(function_declaration name: (identifier) @local.definition.function) +(function_declaration parameters: (parameters (identifier) @local.definition.parameter)) +(let_statement [(scoped_identifier) (identifier)] @local.definition.var) -(identifier) @reference +(identifier) @local.reference diff --git a/queries/wing/locals.scm b/queries/wing/locals.scm index a467939bd..c5515d15e 100644 --- a/queries/wing/locals.scm +++ b/queries/wing/locals.scm @@ -1,5 +1,5 @@ -(block) @scope +(block) @local.scope (variable_definition_statement - name: (identifier) @definition) + name: (identifier) @local.definition) ; TODO: Missing "@local.reference" usage tuned for each relevant identifier location diff --git a/queries/xcompose/locals.scm b/queries/xcompose/locals.scm index bd42d5fea..365472da2 100644 --- a/queries/xcompose/locals.scm +++ b/queries/xcompose/locals.scm @@ -1,3 +1,3 @@ -(result (keysym) @definition) +(result (keysym) @local.definition) -(event (keysym) @reference) +(event (keysym) @local.reference) diff --git a/queries/xml/locals.scm b/queries/xml/locals.scm index 05e162fbf..214b43818 100644 --- a/queries/xml/locals.scm +++ b/queries/xml/locals.scm @@ -1,25 +1,25 @@ ;; tags -(elementdecl (Name) @definition.type) +(elementdecl (Name) @local.definition.type) (elementdecl (contentspec - (children (Name) @reference))) + (children (Name) @local.reference))) -(AttlistDecl . (Name) @reference) +(AttlistDecl . (Name) @local.reference) -(STag (Name) @reference) -(ETag (Name) @reference) -(EmptyElemTag (Name) @reference) +(STag (Name) @local.reference) +(ETag (Name) @local.reference) +(EmptyElemTag (Name) @local.reference) ;; attributes -(AttDef (Name) @definition.field) +(AttDef (Name) @local.definition.field) -(Attribute (Name) @reference) +(Attribute (Name) @local.reference) ;; entities -(GEDecl (Name) @definition.macro) +(GEDecl (Name) @local.definition.macro) -(EntityRef (Name) @reference) +(EntityRef (Name) @local.reference) diff --git a/queries/yaml/locals.scm b/queries/yaml/locals.scm index 89167cf58..8a438434b 100644 --- a/queries/yaml/locals.scm +++ b/queries/yaml/locals.scm @@ -2,7 +2,7 @@ (stream) (document) (block_node) -] @scope +] @local.scope -(anchor_name) @definition -(alias_name) @reference +(anchor_name) @local.definition +(alias_name) @local.reference diff --git a/queries/yuck/locals.scm b/queries/yuck/locals.scm index 677281b0b..063d59b1a 100644 --- a/queries/yuck/locals.scm +++ b/queries/yuck/locals.scm @@ -6,16 +6,16 @@ (json_array) (json_object) (parenthesized_expression) -] @scope +] @local.scope -(symbol) @reference +(symbol) @local.reference -(keyword) @definition.field +(keyword) @local.definition.field (json_object (simplexpr - (ident) @definition.field)) + (ident) @local.definition.field)) (ast_block (symbol) - (ident) @definition.type) + (ident) @local.definition.type) From 17fae3f4a3c81d17c3b40dfa815cca77116b81d0 Mon Sep 17 00:00:00 2001 From: ObserverOfTime Date: Sat, 19 Aug 2023 19:28:45 +0300 Subject: [PATCH 0781/2494] feat(injections): add printf format strings --- README.md | 1 + lockfile.json | 3 ++ lua/nvim-treesitter/parsers.lua | 8 ++++ queries/awk/injections.scm | 8 ++++ queries/bash/injections.scm | 25 ++++++++++++ queries/c/injections.scm | 67 +++++++++++++++++++++++++++++++++ queries/go/injections.scm | 14 +++++++ queries/java/injections.scm | 7 ++++ queries/kotlin/injections.scm | 8 ++++ queries/lua/injections.scm | 17 +++++++++ queries/printf/highlights.scm | 1 + queries/python/injections.scm | 5 +++ queries/teal/injections.scm | 17 +++++++++ 13 files changed, 181 insertions(+) create mode 100644 queries/printf/highlights.scm diff --git a/README.md b/README.md index 6db64faee..a765566f3 100644 --- a/README.md +++ b/README.md @@ -328,6 +328,7 @@ We are looking for maintainers to add more parsers and to write query files for - [x] [pod](https://github.com/tree-sitter-perl/tree-sitter-pod) (maintained by @RabbiVeesh, @LeoNerd) - [x] [Path of Exile item filter](https://github.com/ObserverOfTime/tree-sitter-poe-filter) (experimental, maintained by @ObserverOfTime) - [x] [pony](https://github.com/amaanq/tree-sitter-pony) (maintained by @amaanq, @mfelsche) +- [x] [printf](https://github.com/ObserverOfTime/tree-sitter-printf) (maintained by @ObserverOfTime) - [x] [prisma](https://github.com/victorhqc/tree-sitter-prisma) (maintained by @elianiva) - [x] [promql](https://github.com/MichaHoffmann/tree-sitter-promql) (maintained by @MichaHoffmann) - [x] [properties](https://github.com/ObserverOfTime/tree-sitter-properties) (maintained by @ObserverOfTime) diff --git a/lockfile.json b/lockfile.json index 7c92b385e..42d210d0f 100644 --- a/lockfile.json +++ b/lockfile.json @@ -464,6 +464,9 @@ "pony": { "revision": "16f930b250433cfcd4fb4144df92bb98ad344c20" }, + "printf": { + "revision": "8a3f07c1f620ae46d14873e5b7ee0d3e114c15e8" + }, "prisma": { "revision": "eca2596a355b1a9952b4f80f8f9caed300a272b5" }, diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index bfadf5239..d60553206 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -1387,6 +1387,14 @@ list.pony = { maintainers = { "@amaanq", "@mfelsche" }, } +list.printf = { + install_info = { + url = "https://github.com/ObserverOfTime/tree-sitter-printf", + files = { "src/parser.c" }, + }, + maintainers = { "@ObserverOfTime" }, +} + list.prisma = { install_info = { url = "https://github.com/victorhqc/tree-sitter-prisma", diff --git a/queries/awk/injections.scm b/queries/awk/injections.scm index bc35c8312..24db57d67 100644 --- a/queries/awk/injections.scm +++ b/queries/awk/injections.scm @@ -3,3 +3,11 @@ ((regex) @injection.content (#set! injection.language "regex")) + +((print_statement + (exp_list . (string) @injection.content)) + (#set! injection.language "printf")) + +((printf_statement + (exp_list . (string) @injection.content)) + (#set! injection.language "printf")) diff --git a/queries/bash/injections.scm b/queries/bash/injections.scm index fdb03cda5..516df3b3d 100644 --- a/queries/bash/injections.scm +++ b/queries/bash/injections.scm @@ -8,3 +8,28 @@ (heredoc_body) @injection.content (heredoc_end) @injection.language) (#downcase! @injection.language)) + +; printf 'format' +((command + name: (command_name) @_command + . argument: [(string) (raw_string)] @injection.content) + (#eq? @_command "printf") + (#set! injection.language "printf")) + +; printf -v var 'format' +((command + name: (command_name) @_command + argument: (word) @_arg + . (_) . argument: [(string) (raw_string)] @injection.content) + (#eq? @_command "printf") + (#eq? @_arg "-v") + (#set! injection.language "printf")) + +; printf -- 'format' +((command + name: (command_name) @_command + argument: (word) @_arg + . argument: [(string) (raw_string)] @injection.content) + (#eq? @_command "printf") + (#eq? @_arg "--") + (#set! injection.language "printf")) diff --git a/queries/c/injections.scm b/queries/c/injections.scm index 6b1fc3522..086dede9e 100644 --- a/queries/c/injections.scm +++ b/queries/c/injections.scm @@ -12,6 +12,73 @@ (#lua-match? @injection.content "/[*][!<*][^a-zA-Z]") (#set! injection.language "doxygen")) +((call_expression + function: (identifier) @_function + arguments: (argument_list + . (string_literal (string_content) @injection.content))) + (#any-of? @_function "printf" "printf_s" + "vprintf" "vprintf_s" + "scanf" "scanf_s" + "vscanf" "vscanf_s" + "wprintf" "wprintf_s" + "vwprintf" "vwprintf_s" + "wscanf" "wscanf_s" + "vwscanf" "vwscanf_s" + "cscanf" "_cscanf" + "printw" + "scanw") + (#set! injection.language "printf")) + +((call_expression + function: (identifier) @_function + arguments: (argument_list + (_) . (string_literal (string_content) @injection.content))) + (#any-of? @_function "fprintf" "fprintf_s" + "sprintf" + "dprintf" + "fscanf" "fscanf_s" + "sscanf" "sscanf_s" + "vsscanf" "vsscanf_s" + "vfprintf" "vfprintf_s" + "vsprintf" + "vdprintf" + "fwprintf" "fwprintf_s" + "vfwprintf" "vfwprintf_s" + "fwscanf" "fwscanf_s" + "swscanf" "swscanf_s" + "vswscanf" "vswscanf_s" + "vfscanf" "vfscanf_s" + "vfwscanf" "vfwscanf_s" + "wprintw" + "vw_printw" "vwprintw" + "wscanw" + "vw_scanw" "vwscanw") + (#set! injection.language "printf")) + +((call_expression + function: (identifier) @_function + arguments: (argument_list + (_) . (_) . (string_literal (string_content) @injection.content))) + (#any-of? @_function "sprintf_s" + "snprintf" "snprintf_s" + "vsprintf_s" + "vsnprintf" "vsnprintf_s" + "swprintf" "swprintf_s" + "snwprintf_s" + "vswprintf" "vswprintf_s" + "vsnwprintf_s" + "mvprintw" + "mvscanw") + (#set! injection.language "printf")) + +((call_expression + function: (identifier) @_function + arguments: (argument_list + (_) . (_) . (_) . (string_literal (string_content) @injection.content))) + (#any-of? @_function "mvwprintw" + "mvwscanw") + (#set! injection.language "printf")) + ; TODO: add when asm is added ; (gnu_asm_expression assembly_code: (string_literal) @injection.content ; (#set! injection.language "asm")) diff --git a/queries/go/injections.scm b/queries/go/injections.scm index affc7a115..cf19ebac5 100644 --- a/queries/go/injections.scm +++ b/queries/go/injections.scm @@ -19,6 +19,20 @@ (#offset! @injection.content 0 1 0 -1) (#set! injection.language "regex"))) + ((comment) @injection.content (#match? @injection.content "/\\*!([a-zA-Z]+:)?re2c") (#set! injection.language "re2c")) + +((call_expression + function: (selector_expression field: (field_identifier) @_method) + arguments: (argument_list . (interpreted_string_literal) @injection.content)) + (#any-of? @_method "Printf" "Sprintf" "Fatalf" "Scanf") + (#set! injection.language "printf")) + +((call_expression + function: (selector_expression field: (field_identifier) @_method) + arguments: (argument_list (_) . (interpreted_string_literal) @injection.content)) + (#eq? @_method "Fprintf") + (#set! injection.language "printf")) + diff --git a/queries/java/injections.scm b/queries/java/injections.scm index d79ffa6f1..8696c16ff 100644 --- a/queries/java/injections.scm +++ b/queries/java/injections.scm @@ -7,3 +7,10 @@ ((block_comment) @injection.content (#lua-match? @injection.content "/[*][!<*][^a-zA-Z]") (#set! injection.language "doxygen")) + +((method_invocation + name: (identifier) @_method + arguments: (argument_list + . (string_literal . (_) @injection.content))) + (#any-of? @_method "format" "printf") + (#set! injection.language "printf")) diff --git a/queries/kotlin/injections.scm b/queries/kotlin/injections.scm index 757259d10..8ac2eba60 100644 --- a/queries/kotlin/injections.scm +++ b/queries/kotlin/injections.scm @@ -34,3 +34,11 @@ (value_arguments (value_argument (string_literal) @injection.content (#set! injection.language "regex"))))) + +; "pi = %.2f".format(3.14159) +((call_expression + (navigation_expression + (string_literal) @injection.content + (navigation_suffix (simple_identifier) @_method))) + (#eq? @_method "format") + (#set! injection.language "printf")) diff --git a/queries/lua/injections.scm b/queries/lua/injections.scm index 57ea527d4..03e057dfe 100644 --- a/queries/lua/injections.scm +++ b/queries/lua/injections.scm @@ -135,6 +135,23 @@ (#set! injection.language "luap") (#set! injection.include-children)))) +; string.format("pi = %.2f", 3.14159) +((function_call + (dot_index_expression + field: (identifier) @_method) + arguments: (arguments + . (string (string_content) @injection.content))) + (#eq? @_method "format") + (#set! injection.language "printf")) + +; ("pi = %.2f"):format(3.14159) +((function_call + (method_index_expression + table: (_ (string (string_content) @injection.content)) + method: (identifier) @_method)) + (#eq? @_method "format") + (#set! injection.language "printf")) + (comment content: (_) @injection.content (#set! injection.language "comment")) diff --git a/queries/printf/highlights.scm b/queries/printf/highlights.scm new file mode 100644 index 000000000..db5ef9a3f --- /dev/null +++ b/queries/printf/highlights.scm @@ -0,0 +1 @@ +(format) @character diff --git a/queries/python/injections.scm b/queries/python/injections.scm index aa36a5af9..87d1c3478 100644 --- a/queries/python/injections.scm +++ b/queries/python/injections.scm @@ -6,5 +6,10 @@ (#eq? @_re "re") (#set! injection.language "regex")) +((binary_operator + left: (string (string_content) @injection.content) + operator: "%") + (#set! injection.language "printf")) + ((comment) @injection.content (#set! injection.language "comment")) diff --git a/queries/teal/injections.scm b/queries/teal/injections.scm index 5eef08702..789826452 100644 --- a/queries/teal/injections.scm +++ b/queries/teal/injections.scm @@ -26,5 +26,22 @@ (#set! injection.language "c") ) +; string.format('...') +((function_call + (index + (identifier) @_base + key: (identifier) @_entry) + (arguments . (string) @injection.content)) + (#eq? @_base "string") + (#eq? @_entry "format") + (#set! injection.language "printf")) + +; ('...'):format() +((function_call + (method_index (string) @printf + key: (identifier) @_func)) + (#eq? @_func "format") + (#set! injection.language "printf")) + ((comment) @injection.content (#set! injection.language "comment")) From 10dd49958c96f86c8247c715bd20a6681afc1d8b Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 24 Dec 2023 12:52:21 +0100 Subject: [PATCH 0782/2494] chore(tests): consistent captures --- tests/query/highlights/bash/double-parens.sh | 6 +- tests/query/highlights/clojure/test.clj | 42 ++-- tests/query/highlights/cpp/concepts.cpp | 12 +- tests/query/highlights/cpp/test.cpp | 20 +- tests/query/highlights/ecma/test.ts | 18 +- tests/query/highlights/fusion/basic.fusion | 62 ++--- .../gitattributes/test.gitattributes | 56 ++--- tests/query/highlights/gleam/assert.gleam | 20 +- tests/query/highlights/gleam/function.gleam | 214 +++++++++--------- tests/query/highlights/gleam/import.gleam | 34 +-- tests/query/highlights/gleam/pipe.gleam | 26 +-- tests/query/highlights/gleam/todo.gleam | 8 +- tests/query/highlights/gleam/type.gleam | 128 +++++------ tests/query/highlights/hack/as-foreach.hack | 4 +- .../highlights/hack/async-functions.hack | 6 +- .../query/highlights/hack/attribute-type.hack | 6 +- tests/query/highlights/hack/generics.hack | 26 +-- .../query/highlights/hack/heredoc-dollar.hack | 2 +- tests/query/highlights/hack/shapes.hack | 10 +- tests/query/highlights/hack/use.hack | 28 +-- tests/query/highlights/hack/using.hack | 4 +- tests/query/highlights/hack/xhp.hack | 6 +- tests/query/highlights/hocon/test.conf | 66 +++--- tests/query/highlights/julia/test.jl | 40 ++-- tests/query/highlights/lua/test.lua | 14 +- tests/query/highlights/markdown/test.md | 30 +-- tests/query/highlights/pascal/test.pas | 52 ++--- .../highlights/python/pattern_matching.py | 34 +-- .../highlights/rust/super-crate-imports.rs | 8 +- tests/query/highlights/solidity/test.sol | 38 ++-- tests/query/highlights/t32/comments.cmm | 6 +- tests/query/highlights/t32/keywords.cmm | 98 ++++---- tests/query/highlights/t32/literals.cmm | 32 +-- tests/query/highlights/t32/var.cmm | 90 ++++---- tests/query/highlights/tiger/built-ins.tig | 24 +- tests/query/highlights/tiger/comment.tig | 6 +- tests/query/highlights/tiger/functions.tig | 10 +- tests/query/highlights/tiger/identifiers.tig | 36 +-- tests/query/highlights/tiger/imports.tig | 4 +- tests/query/highlights/tiger/keywords.tig | 38 ++-- tests/query/highlights/tiger/literals.tig | 8 +- .../query/highlights/tiger/meta-variables.tig | 10 +- .../highlights/tiger/object-oriented.tig | 24 +- tests/query/highlights/tiger/operators.tig | 48 ++-- tests/query/highlights/typescript/as.ts | 6 +- tests/query/highlights/usd/prims.usda | 80 +++---- tests/query/highlights/usd/properties.usda | 28 +-- tests/query/highlights/usd/subLayers.usda | 6 +- tests/query/highlights/wing/class.w | 22 +- tests/query/highlights/wing/nested_method.w | 6 +- tests/query/highlights/xhp-intro.hack | 16 +- .../injections/cuda/macro-self-injection.cu | 2 +- .../bash-on-run-instructions.dockerfile | 4 +- .../injections/ecma/ecma-test-injections.js | 8 +- .../injections/html/test-html-injections.html | 40 ++-- .../svelte/test-svelte-injections.svelte | 18 +- .../injections/vue/negative-assertions.vue | 4 +- .../injections/vue/test-vue-injections.vue | 41 ++-- .../yaml/bash-on-github-actions.yml | 6 +- .../yaml/promql-on-prometheus-rules.yaml | 4 +- 60 files changed, 872 insertions(+), 873 deletions(-) diff --git a/tests/query/highlights/bash/double-parens.sh b/tests/query/highlights/bash/double-parens.sh index 1f7aee4e4..8d841d170 100644 --- a/tests/query/highlights/bash/double-parens.sh +++ b/tests/query/highlights/bash/double-parens.sh @@ -1,6 +1,6 @@ if (( $(tree-sitter parse test/Petalisp/**/*.lisp -q | wc -l) > 2 )); then -# ^ punctuation.special -# ^ punctuation.special -# ^ punctuation.bracket +# ^ @punctuation.special +# ^ @punctuation.special +# ^ @punctuation.bracket exit 1 fi diff --git a/tests/query/highlights/clojure/test.clj b/tests/query/highlights/clojure/test.clj index ab9e46d9a..f40e9b0c4 100644 --- a/tests/query/highlights/clojure/test.clj +++ b/tests/query/highlights/clojure/test.clj @@ -1,52 +1,52 @@ (ns test {:clj-kondo/ignore true}) -; <- punctuation.bracket -; ^ include -; ^ namespace +; <- @punctuation.bracket +; ^ @include +; ^ @namespace ; asdf -;^^^^^^ comment +;^^^^^^ @comment #_ abc -;^^^^^^ comment +;^^^^^^ @comment (func obj) -;^^^^ function.call -; ^^^ variable +;^^^^ @function.call +; ^^^ @variable #(+ % %1 %&) -;^ punctuation.special -; ^ function.call -; ^ ^^ ^^ variable.builtin +;^ @punctuation.special +; ^ @function.call +; ^ ^^ ^^ @variable.builtin & -;^ parameter +;^ @parameter ->abc -;^^^^^ constructor +;^^^^^ @constructor ->>abc -;^^^^^^ variable +;^^^^^^ @variable *1 *2 *3 *e -;^^ ^^ ^^ ^^ variable.builtin +;^^ ^^ ^^ ^^ @variable.builtin (.method) -;^^^^^^^ method +;^^^^^^^ @method (.-field) -;^^^^^^^ field +;^^^^^^^ @field Abc/method -;^^^^^^^^^^ field +;^^^^^^^^^^ @field (Abc/method) -;^^^^^^^^^^ method +;^^^^^^^^^^ @method Abc -;^^^ type +;^^^ @type abc. -;^^^^ type +;^^^^ @type ^abc -;^ punctuation.special +;^ @punctuation.special diff --git a/tests/query/highlights/cpp/concepts.cpp b/tests/query/highlights/cpp/concepts.cpp index 27aed7a70..6fe6af436 100644 --- a/tests/query/highlights/cpp/concepts.cpp +++ b/tests/query/highlights/cpp/concepts.cpp @@ -1,14 +1,14 @@ template concept Derived = std::is_base_of::value; -// ^ keyword -// ^ type.definition +// ^ @keyword +// ^ @type.definition template concept Hashable = requires(T a) { -// ^ keyword -// ^ parameter -// ^ type +// ^ @keyword +// ^ @parameter +// ^ @type { std::hash{}(a) } -> std::convertible_to; typename CommonType; // CommonType is valid and names a type { CommonType{std::forward(t)} }; @@ -18,5 +18,5 @@ concept Hashable = requires(T a) { template requires requires (T x) { x + x; } // ad-hoc constraint, note keyword used twice -// ^ keyword +// ^ @keyword T add(T a, T b) { return a + b; } diff --git a/tests/query/highlights/cpp/test.cpp b/tests/query/highlights/cpp/test.cpp index 77e3be698..3f903a55f 100644 --- a/tests/query/highlights/cpp/test.cpp +++ b/tests/query/highlights/cpp/test.cpp @@ -1,19 +1,19 @@ #include #include -// ^ include -// ^ string +// ^ @include +// ^ @string auto main( int argc, char** argv ) -> int -// ^ type.builtin - // ^ parameter - // ^ type.builtin - // ^ type.builtin - // ^ operator +// ^ @type.builtin + // ^ @parameter + // ^ @type.builtin + // ^ @type.builtin + // ^ @operator { std::cout << "Hello world!" << std::endl; - // ^ punctuation.delimiter + // ^ @punctuation.delimiter return EXIT_SUCCESS; - // ^ keyword.return - // ^ constant + // ^ @keyword.return + // ^ @constant } diff --git a/tests/query/highlights/ecma/test.ts b/tests/query/highlights/ecma/test.ts index d35cf8272..9ecd50c76 100644 --- a/tests/query/highlights/ecma/test.ts +++ b/tests/query/highlights/ecma/test.ts @@ -1,32 +1,32 @@ class H { pub_field = "Hello"; - // ^ property + // ^ @property #priv_field = "World!"; - // ^ property + // ^ @property #private_method() { - // ^ method + // ^ @method return `${this.pub_field} -- ${this.#priv_field}`; - // ^ property - // ^ property + // ^ @property + // ^ @property } public_method() { - // ^ method + // ^ @method return this.#private_method(); - // ^ method.call + // ^ @method.call } ok() { return this.public_method(); - // ^ method.call + // ^ @method.call } } function doSomething(options) { const { enable: on, - // ^ punctuation.delimiter + // ^ @punctuation.delimiter } = options } diff --git a/tests/query/highlights/fusion/basic.fusion b/tests/query/highlights/fusion/basic.fusion index e4c4d6afc..e63c86eea 100644 --- a/tests/query/highlights/fusion/basic.fusion +++ b/tests/query/highlights/fusion/basic.fusion @@ -1,60 +1,60 @@ include: SomeFile.fusion -//<- include -// ^text.uri +//<- @include +// ^ @text.uri namespace: ns = Neos.Fusion.Space -//<- keyword -// ^namespace -// ^operator -// ^namespace +//<- @keyword +// ^ @namespace +// ^ @operator +// ^ @namespace prototype(MyType) < prototype(ns:SuperType) { //<-keyword -// ^punctuation.bracket -// ^type -// ^punctuation.bracket -// ^operator -// ^namespace -// ^type +// ^ @punctuation.bracket +// ^ @type +// ^ @punctuation.bracket +// ^ @operator +// ^ @namespace +// ^ @type deleteProp > - // ^operator + // ^ @operator string = 'value' - //<- property - // ^operator - // ^string + //<- @property + // ^ @operator + // ^ @string number = 10.2 - // ^number + // ^ @number null = null - // ^constant.builtin + // ^ @constant.builtin boolean = true - // ^boolean + // ^ @boolean property.inner = "value" - //<- property - // ^property + //<- @property + // ^ @property property.@meta = "value" - //<- property - // ^attribute + //<- @property + // ^ @attribute property.type = SomeType - //<- property - // ^type + //<- @property + // ^ @type property.aliasedType = ns:SomeType - //<- property - // ^namespace - // ^type + //<- @property + // ^ @namespace + // ^ @type property.fullQualifiedType = SomeNamespace:SomeType - //<- property - // ^namespace - // ^type + //<- @property + // ^ @namespace + // ^ @type } diff --git a/tests/query/highlights/gitattributes/test.gitattributes b/tests/query/highlights/gitattributes/test.gitattributes index 1d398db41..a16c233e6 100644 --- a/tests/query/highlights/gitattributes/test.gitattributes +++ b/tests/query/highlights/gitattributes/test.gitattributes @@ -1,37 +1,37 @@ [attr]nodiff -diff -merge -# <- preproc -# ^^^^^^ property -# ^ operator -# ^^^^ variable.builtin -# ^ operator -# ^^^^^ variable.builtin +# <- @preproc +# ^^^^^^ @property +# ^ @operator +# ^^^^ @variable.builtin +# ^ @operator +# ^^^^^ @variable.builtin vendor/** linguist-vendored=true -# ^ punctuation.delimiter -# ^^ character.special -# ^^^^^^^^^^^^^^^^^ parameter -# ^ operator -# ^^^^ boolean +# ^ @punctuation.delimiter +# ^^ @character.special +# ^^^^^^^^^^^^^^^^^ @parameter +# ^ @operator +# ^^^^ @boolean [^._]-[[:lower:]] !something -# ^ punctuation.bracket -# ^ operator -# ^^ string.special -# ^ punctuation.bracket -# ^ punctuation.bracket -# ^^^^^^^^^ constant -# ^ punctuation.bracket -# ^ operator -# ^^^^^^^^^^ parameter +# ^ @punctuation.bracket +# ^ @operator +# ^^ @string.special +# ^ @punctuation.bracket +# ^ @punctuation.bracket +# ^^^^^^^^^ @constant +# ^ @punctuation.bracket +# ^ @operator +# ^^^^^^^^^^ @parameter "_\u4E00\t\56txt" encoding=UTF-16 -# <- punctuation.special -# ^^^^^^ string.escape -# ^^ string.escape -# ^^^ string.escape -# ^ punctuation.special -# ^^^^^^^^ variable.builtin -# ^ operator -# ^^^^^^ string +# <- @punctuation.special +# ^^^^^^ @string.escape +# ^^ @string.escape +# ^^^ @string.escape +# ^ @punctuation.special +# ^^^^^^^^ @variable.builtin +# ^ @operator +# ^^^^^^ @string # vim:ft=gitattributes: diff --git a/tests/query/highlights/gleam/assert.gleam b/tests/query/highlights/gleam/assert.gleam index 3711339bb..d36716a3f 100644 --- a/tests/query/highlights/gleam/assert.gleam +++ b/tests/query/highlights/gleam/assert.gleam @@ -1,13 +1,13 @@ pub fn main() { assert Ok(i) = parse_int("123") - // <- exception - // ^^ constructor - // ^ punctuation.bracket - // ^ variable - // ^ punctuation.bracket - // ^ operator - // ^^^^^^^^^ function.call - // ^ punctuation.bracket - // ^^^^^ string - // ^ punctuation.bracket + // <- @exception + // ^^ @constructor + // ^ @punctuation.bracket + // ^ @variable + // ^ @punctuation.bracket + // ^ @operator + // ^^^^^^^^^ @function.call + // ^ @punctuation.bracket + // ^^^^^ @string + // ^ @punctuation.bracket } diff --git a/tests/query/highlights/gleam/function.gleam b/tests/query/highlights/gleam/function.gleam index cf2fbf969..aed4879dc 100644 --- a/tests/query/highlights/gleam/function.gleam +++ b/tests/query/highlights/gleam/function.gleam @@ -1,127 +1,127 @@ pub fn add(x: Int, y: Int) -> Int { -// <- type.qualifier -// ^^ keyword.function -// ^^^ function -// ^ punctuation.bracket -// ^ parameter -// ^ punctuation.delimiter -// ^^^ type.builtin -// ^ punctuation.delimiter -// ^ parameter -// ^ punctuation.delimiter -// ^^^ type.builtin -// ^ punctuation.bracket -// ^ punctuation.delimiter -// ^^^ type.builtin -// ^ punctuation.bracket +// <- @type.qualifier +// ^^ @keyword.function +// ^^^ @function +// ^ @punctuation.bracket +// ^ @parameter +// ^ @punctuation.delimiter +// ^^^ @type.builtin +// ^ @punctuation.delimiter +// ^ @parameter +// ^ @punctuation.delimiter +// ^^^ @type.builtin +// ^ @punctuation.bracket +// ^ @punctuation.delimiter +// ^^^ @type.builtin +// ^ @punctuation.bracket } -// <- punctuation.bracket +// <- @punctuation.bracket pub fn twice(f: fn(t) -> t, x: t) -> t { -// <- type.qualifier -// ^ keyword.function -// ^^^^^ function -// ^ punctuation.bracket -// ^ parameter -// ^ punctuation.delimiter -// ^^ keyword.function -// ^ punctuation.bracket -// ^ type -// ^ punctuation.bracket -// ^^ punctuation.delimiter -// ^ type -// ^ punctuation.delimiter -// ^ parameter -// ^ punctuation.delimiter -// ^ type -// ^ punctuation.bracket -// ^^ punctuation.delimiter -// ^ type -// ^ punctuation.bracket +// <- @type.qualifier +// ^ @keyword.function +// ^^^^^ @function +// ^ @punctuation.bracket +// ^ @parameter +// ^ @punctuation.delimiter +// ^^ @keyword.function +// ^ @punctuation.bracket +// ^ @type +// ^ @punctuation.bracket +// ^^ @punctuation.delimiter +// ^ @type +// ^ @punctuation.delimiter +// ^ @parameter +// ^ @punctuation.delimiter +// ^ @type +// ^ @punctuation.bracket +// ^^ @punctuation.delimiter +// ^ @type +// ^ @punctuation.bracket } -// <- punctuation.bracket +// <- @punctuation.bracket fn list_of_two(my_value: a) -> List(a) { -// <- keyword.function -// ^ function -// ^ punctuation.bracket -// ^ parameter -// ^ punctuation.delimiter -// ^ type -// ^ punctuation.bracket -// ^ punctuation.delimiter -// ^^^^ type.builtin -// ^ punctuation.bracket -// ^ type -// ^ punctuation.bracket -// ^ punctuation.bracket +// <- @keyword.function +// ^ @function +// ^ @punctuation.bracket +// ^ @parameter +// ^ @punctuation.delimiter +// ^ @type +// ^ @punctuation.bracket +// ^ @punctuation.delimiter +// ^^^^ @type.builtin +// ^ @punctuation.bracket +// ^ @type +// ^ @punctuation.bracket +// ^ @punctuation.bracket } -// <- punctuation.bracket +// <- @punctuation.bracket fn replace( -// <- keyword.function -// ^^^^^^^ function -// ^ punctuation.bracket +// <- @keyword.function +// ^^^^^^^ @function +// ^ @punctuation.bracket in string: String, - // <- label - // ^^^^^^ parameter - // ^ punctuation.delimiter - // ^^^^^^ type.builtin - // ^ punctuation.delimiter + // <- @label + // ^^^^^^ @parameter + // ^ @punctuation.delimiter + // ^^^^^^ @type.builtin + // ^ @punctuation.delimiter each pattern: String, - // <- label - // ^^^^^^^ parameter - // ^ punctuation.delimiter - // ^^^^^^ type.builtin - // ^ punctuation.delimiter + // <- @label + // ^^^^^^^ @parameter + // ^ @punctuation.delimiter + // ^^^^^^ @type.builtin + // ^ @punctuation.delimiter with replacement: String, - // <- label - // ^^^^^^^^^^^ parameter - // ^ punctuation.delimiter - // ^^^^^^ type.builtin - // ^ punctuation.delimiter + // <- @label + // ^^^^^^^^^^^ @parameter + // ^ @punctuation.delimiter + // ^^^^^^ @type.builtin + // ^ @punctuation.delimiter ) { replace(in: "A,B,C", each: ",", with: " ") - // <- function.call - // ^ punctuation.bracket - // ^^ label - // ^ punctuation.delimiter - // ^^^^^^^ string - // ^ punctuation.delimiter - // ^^^^ label - // ^ punctuation.delimiter - // ^^^ string - // ^ punctuation.delimiter - // ^^^^ label - // ^ punctuation.delimiter - // ^^^ string - // ^ punctuation.bracket + // <- @function.call + // ^ @punctuation.bracket + // ^^ @label + // ^ @punctuation.delimiter + // ^^^^^^^ @string + // ^ @punctuation.delimiter + // ^^^^ @label + // ^ @punctuation.delimiter + // ^^^ @string + // ^ @punctuation.delimiter + // ^^^^ @label + // ^ @punctuation.delimiter + // ^^^ @string + // ^ @punctuation.bracket } -// <- punctuation.bracket +// <- @punctuation.bracket pub external fn random_float() -> Float = "rand" "uniform" -// <- type.qualifier -// ^^^^^^^^ type.qualifier -// ^^ keyword.function -// ^^^^^^^^^^^^ function -// ^ punctuation.bracket -// ^ punctuation.bracket -// ^^ punctuation.delimiter -// ^^^^^ type.builtin -// ^ operator -// ^^^^^^ namespace -// ^^^^^^^^^ function +// <- @type.qualifier +// ^^^^^^^^ @type.qualifier +// ^^ @keyword.function +// ^^^^^^^^^^^^ @function +// ^ @punctuation.bracket +// ^ @punctuation.bracket +// ^^ @punctuation.delimiter +// ^^^^^ @type.builtin +// ^ @operator +// ^^^^^^ @namespace +// ^^^^^^^^^ @function pub external fn inspect(a) -> a = "Elixir.IO" "inspect" -// <- type.qualifier -// ^^^^^^^^ type.qualifier -// ^^ keyword.function -// ^^^^^^^ function -// ^ punctuation.bracket -// ^ type -// ^ punctuation.bracket -// ^^ punctuation.delimiter -// ^ type -// ^ operator -// ^^^^^^^^^^^ namespace -// ^^^^^^^^^ function +// <- @type.qualifier +// ^^^^^^^^ @type.qualifier +// ^^ @keyword.function +// ^^^^^^^ @function +// ^ @punctuation.bracket +// ^ @type +// ^ @punctuation.bracket +// ^^ @punctuation.delimiter +// ^ @type +// ^ @operator +// ^^^^^^^^^^^ @namespace +// ^^^^^^^^^ @function diff --git a/tests/query/highlights/gleam/import.gleam b/tests/query/highlights/gleam/import.gleam index c48b38199..3ee141513 100644 --- a/tests/query/highlights/gleam/import.gleam +++ b/tests/query/highlights/gleam/import.gleam @@ -1,22 +1,22 @@ import gleam/io -// <- include -// ^ namespace -// ^ operator -// ^ namespace +// <- @include +// ^ @namespace +// ^ @operator +// ^ @namespace import cat as kitten -// <- include -// ^ namespace -// ^ keyword -// ^ namespace +// <- @include +// ^ @namespace +// ^ @keyword +// ^ @namespace import animal/cat.{Cat, stroke} -// <- include -// ^ namespace -// ^ operator -// ^ punctuation.delimiter -// ^ punctuation.bracket -// ^^^ type -// ^ punctuation.delimiter -// ^^^^^^ function -// ^ punctuation.bracket +// <- @include +// ^ @namespace +// ^ @operator +// ^ @punctuation.delimiter +// ^ @punctuation.bracket +// ^^^ @type +// ^ @punctuation.delimiter +// ^^^^^^ @function +// ^ @punctuation.bracket diff --git a/tests/query/highlights/gleam/pipe.gleam b/tests/query/highlights/gleam/pipe.gleam index d0341217b..c696b0227 100644 --- a/tests/query/highlights/gleam/pipe.gleam +++ b/tests/query/highlights/gleam/pipe.gleam @@ -1,18 +1,18 @@ pub fn run() { 1 - // <- number + // <- @number |> add(_, 2) - // <- operator - // ^^^ function.call - // ^ punctuation.bracket - // ^ comment - // ^ punctuation.delimiter - // ^ number - // ^ punctuation.bracket + // <- @operator + // ^^^ @function.call + // ^ @punctuation.bracket + // ^ @comment + // ^ @punctuation.delimiter + // ^ @number + // ^ @punctuation.bracket |> add(3) - // <- operator - // ^^^ function.call - // ^ punctuation.bracket - // ^ number - // ^ punctuation.bracket + // <- @operator + // ^^^ @function.call + // ^ @punctuation.bracket + // ^ @number + // ^ @punctuation.bracket } diff --git a/tests/query/highlights/gleam/todo.gleam b/tests/query/highlights/gleam/todo.gleam index 27038bb73..b7384ecbd 100644 --- a/tests/query/highlights/gleam/todo.gleam +++ b/tests/query/highlights/gleam/todo.gleam @@ -1,7 +1,7 @@ fn favourite_number() -> Int { todo("We're going to decide which number is best tomorrow") - // <- keyword - // ^ punctuation.bracket - // ^ string - // ^ punctuation.bracket + // <- @keyword + // ^ @punctuation.bracket + // ^ @string + // ^ @punctuation.bracket } diff --git a/tests/query/highlights/gleam/type.gleam b/tests/query/highlights/gleam/type.gleam index b44aceadc..0905e1ea4 100644 --- a/tests/query/highlights/gleam/type.gleam +++ b/tests/query/highlights/gleam/type.gleam @@ -1,84 +1,84 @@ pub type Cat { -// <- type.qualifier -// ^^^^ keyword -// ^^^ type -// ^ punctuation.bracket +// <- @type.qualifier +// ^^^^ @keyword +// ^^^ @type +// ^ @punctuation.bracket Cat(name: String, cuteness: Int) - // <- constructor - // ^ punctuation.bracket - // ^^^^ property - // ^ punctuation.delimiter - // ^^^^^^ type.builtin - // ^ punctuation.delimiter - // ^^^^^^^^ property - // ^ punctuation.delimiter - // ^^^ type.builtin - // ^ punctuation.bracket + // <- @constructor + // ^ @punctuation.bracket + // ^^^^ @property + // ^ @punctuation.delimiter + // ^^^^^^ @type.builtin + // ^ @punctuation.delimiter + // ^^^^^^^^ @property + // ^ @punctuation.delimiter + // ^^^ @type.builtin + // ^ @punctuation.bracket } fn cats() { Cat(name: "Nubi", cuteness: 2001) - // <- type - // ^ punctuation.bracket - // ^^^^ property - // ^ punctuation.delimiter - // ^^^^^^ string - // ^ punctuation.delimiter - // ^^^^^^^^ property - // ^ punctuation.delimiter - // ^^^^ number - // ^ punctuation.bracket + // <- @type + // ^ @punctuation.bracket + // ^^^^ @property + // ^ @punctuation.delimiter + // ^^^^^^ @string + // ^ @punctuation.delimiter + // ^^^^^^^^ @property + // ^ @punctuation.delimiter + // ^^^^ @number + // ^ @punctuation.bracket Cat("Ginny", 1950) - // <- constructor - // ^ punctuation.bracket - // ^^^^^^^ string - // ^ punctuation.delimiter - // ^^^^ number - // ^ punctuation.bracket + // <- @constructor + // ^ @punctuation.bracket + // ^^^^^^^ @string + // ^ @punctuation.delimiter + // ^^^^ @number + // ^ @punctuation.bracket } type Box(inner_type) { -// <- keyword -// ^^^ type -// ^ punctuation.bracket -// ^^^^^^^^^^ type -// ^ punctuation.bracket -// ^ punctuation.bracket +// <- @keyword +// ^^^ @type +// ^ @punctuation.bracket +// ^^^^^^^^^^ @type +// ^ @punctuation.bracket +// ^ @punctuation.bracket Box(inner: inner_type) - // <- constructor - // ^ punctuation.bracket - // ^^^^^ property - // ^ punctuation.delimiter - // ^^^^^^^^^^ type - // ^ punctuation.bracket + // <- @constructor + // ^ @punctuation.bracket + // ^^^^^ @property + // ^ @punctuation.delimiter + // ^^^^^^^^^^ @type + // ^ @punctuation.bracket } pub opaque type Counter { -// <- type.qualifier -// ^^^^^^ type.qualifier -// ^^^^ keyword -// ^^^^^^^ type -// ^ punctuation.bracket +// <- @type.qualifier +// ^^^^^^ @type.qualifier +// ^^^^ @keyword +// ^^^^^^^ @type +// ^ @punctuation.bracket Counter(value: Int) } pub fn have_birthday(person) { Person(..person, age: person.age + 1, is_happy: True) - // <- constructor - // ^ punctuation.bracket - // ^^ operator - // ^^^^^^ variable - // ^ punctuation.delimiter - // ^^^ property - // ^ punctuation.delimiter - // ^^^^^^ variable - // ^ punctuation.delimiter - // ^^^ property - // ^ operator - // ^ number - // ^ punctuation.delimiter - // ^^^^^^^^ property - // ^ punctuation.delimiter - // ^^^^ boolean - // ^ punctuation.bracket + // <- @constructor + // ^ @punctuation.bracket + // ^^ @operator + // ^^^^^^ @variable + // ^ @punctuation.delimiter + // ^^^ @property + // ^ @punctuation.delimiter + // ^^^^^^ @variable + // ^ @punctuation.delimiter + // ^^^ @property + // ^ @operator + // ^ @number + // ^ @punctuation.delimiter + // ^^^^^^^^ @property + // ^ @punctuation.delimiter + // ^^^^ @boolean + // ^ @punctuation.bracket } diff --git a/tests/query/highlights/hack/as-foreach.hack b/tests/query/highlights/hack/as-foreach.hack index 8969be8fc..d7a66875b 100644 --- a/tests/query/highlights/hack/as-foreach.hack +++ b/tests/query/highlights/hack/as-foreach.hack @@ -1,6 +1,6 @@ foreach (($array as vec[]) as $item) {} -// ^ repeat -// ^ type +// ^ @repeat +// ^ @type # Our expectation test for the code below intentionally includes an ERROR. foreach ($array as vec[] as $item) {} diff --git a/tests/query/highlights/hack/async-functions.hack b/tests/query/highlights/hack/async-functions.hack index 4488c992d..41779d76d 100644 --- a/tests/query/highlights/hack/async-functions.hack +++ b/tests/query/highlights/hack/async-functions.hack @@ -1,8 +1,8 @@ async function func0(): void {} -// ^ type.builtin +// ^ @type.builtin async function func1() {} -// ^ type.builtin -// ^ keyword.operator +// ^ @type.builtin +// ^ @keyword.operator async ($x) ==> $x + 1; diff --git a/tests/query/highlights/hack/attribute-type.hack b/tests/query/highlights/hack/attribute-type.hack index 5ab9eaa4b..0bd12df8c 100644 --- a/tests/query/highlights/hack/attribute-type.hack +++ b/tests/query/highlights/hack/attribute-type.hack @@ -2,13 +2,13 @@ newtype T1 = ?shape( // TODO: ?operator (? not captureable at the moment) ?'int' => int -// ^ operator +// ^ @operator ); <> -// ^ attribute +// ^ @attribute type T2 = (function(T1): string); -// ^ type +// ^ @type // TODO: keyword.function (currently not in AST) <> diff --git a/tests/query/highlights/hack/generics.hack b/tests/query/highlights/hack/generics.hack index 9582240b9..66b008aa4 100644 --- a/tests/query/highlights/hack/generics.hack +++ b/tests/query/highlights/hack/generics.hack @@ -1,24 +1,24 @@ class Box { - // ^ type - // ^ type + // ^ @type + // ^ @type protected T $data; - // ^ type.qualifier - // ^ type + // ^ @type.qualifier + // ^ @type public function __construct(T $data) { - // ^ type - // ^ parameter - // ^ keyword.function - // ^ type.qualifier - // ^ method + // ^ @type + // ^ @parameter + // ^ @keyword.function + // ^ @type.qualifier + // ^ @method $this->data = $data; } public function getData(): T { - // ^ method - // ^ type.qualifier + // ^ @method + // ^ @type.qualifier return $this->data; - // ^ operator - // ^ variable.builtin + // ^ @operator + // ^ @variable.builtin } } diff --git a/tests/query/highlights/hack/heredoc-dollar.hack b/tests/query/highlights/hack/heredoc-dollar.hack index 8034cc863..8ea247389 100644 --- a/tests/query/highlights/hack/heredoc-dollar.hack +++ b/tests/query/highlights/hack/heredoc-dollar.hack @@ -1,4 +1,4 @@ << int, - // ^ string + // ^ @string "b" => string, - // ^ type.builtin + // ^ @type.builtin ); } diff --git a/tests/query/highlights/hack/use.hack b/tests/query/highlights/hack/use.hack index d7b7ce784..353838a18 100644 --- a/tests/query/highlights/hack/use.hack +++ b/tests/query/highlights/hack/use.hack @@ -1,28 +1,28 @@ use const Space\Const\C; -// ^ keyword -// ^ constant +// ^ @keyword +// ^ @constant use function Space\Func\F as E; -// ^ function -// ^ function +// ^ @function +// ^ @function use type Space\Type\T; -// ^ keyword +// ^ @keyword use namespace Space\Name\N as M; -// ^ keyword -// ^ namespace +// ^ @keyword +// ^ @namespace use namespace Space\Name2\N2, Space\Nothing\N3 as N8, type Space\Type2\N4,; -// ^ namespace -// ^ type +// ^ @namespace +// ^ @type use namespace Space\Name\N10\{A as A2, B\}; -// ^ namespace -// ^ namespace -// ^ namespace +// ^ @namespace +// ^ @namespace +// ^ @namespace use namespace Space\Name\{\C, Slash as Forward}; use \What\Is\This\{function A as A2, B, const H\S\L as stdlib, function F}; use type \{kind,}; use Q\B\{kind2,}; -// ^ namespace +// ^ @namespace use type Q\B\{kind3,}; -// <- include +// <- @include diff --git a/tests/query/highlights/hack/using.hack b/tests/query/highlights/hack/using.hack index 4452ea962..c3a7be153 100644 --- a/tests/query/highlights/hack/using.hack +++ b/tests/query/highlights/hack/using.hack @@ -1,3 +1,3 @@ using ($new = new Object(), $file = new File('using', '+using')) {} -// <- keyword -// ^ type +// <- @keyword +// ^ @type diff --git a/tests/query/highlights/hack/xhp.hack b/tests/query/highlights/hack/xhp.hack index 992296b97..57563a131 100644 --- a/tests/query/highlights/hack/xhp.hack +++ b/tests/query/highlights/hack/xhp.hack @@ -4,7 +4,7 @@ echo "Hello $user_name"; // XHP: Typechecked, well-formed, and secure $user_name = 'Andrew'; $xhp = Hello {$user_name}; -// ^ tag -// ^ tag -// ^ string +// ^ @tag +// ^ @tag +// ^ @string echo await $xhp->toStringAsync(); diff --git a/tests/query/highlights/hocon/test.conf b/tests/query/highlights/hocon/test.conf index 881417b67..acfe4f975 100644 --- a/tests/query/highlights/hocon/test.conf +++ b/tests/query/highlights/hocon/test.conf @@ -1,59 +1,59 @@ HOCON = Human-Optimized Config Object Notation -// ^field -// ^string -// ^string -// ^string -// ^string +// ^ @field +// ^ @string +// ^ @string +// ^ @string +// ^ @string "it's": "a JSON\nsuperset", -// ^string -// ^string.escape -// ^punctuation.delimiter +// ^ @string +// ^ @string.escape +// ^ @punctuation.delimiter features: [ -// ^operator -// ^punctuation.bracket +// ^ @operator +// ^ @punctuation.bracket less noisy / less pedantic syntax -// ^string +// ^ @string ability to refer to another part of the configuration import/include another configuration file into the current file a mapping to a flat properties list such as Java's system properties ability to get values from environment variables # ability to write comments -// ^comment -// ^comment +// ^@ comment +// ^ @comment // this is also a comment -// ^comment -// ^comment +// ^ @comment +// ^ @comment ] specs url: "https://github.com/lightbend/config/blob/master/HOCON.md" includes: { include required(file("~/prog/tree-sitter-hocon/grammar.js")) -// ^keyword -//^include -// ^punctuation.bracket -// ^punctuation.bracket +// ^ @keyword +//^ @include +// ^ @punctuation.bracket +// ^ @punctuation.bracket override = true -// ^boolean +// ^ @boolean } it's: ${it's}. A ${HOCON} -// ^punctuation.special -// ^punctuation.special -// ^punctuation.special -// ^string -// ^string -// ^punctuation.special -// ^punctuation.special +// ^ @punctuation.special +// ^ @punctuation.special +// ^ @punctuation.special +// ^ @string +// ^ @string +// ^ @punctuation.special +// ^ @punctuation.special this.is.a."long.key" = null, -// ^punctuation.delimiter -// ^punctuation.delimiter -// ^punctuation.delimiter -// ^constant.builtin +// ^ @punctuation.delimiter +// ^ @punctuation.delimiter +// ^ @punctuation.delimiter +// ^ @constant.builtin week = 7 days -// ^number -// ^keyword +// ^ @number +// ^ @keyword diff --git a/tests/query/highlights/julia/test.jl b/tests/query/highlights/julia/test.jl index 46fc313c0..065df5c9e 100644 --- a/tests/query/highlights/julia/test.jl +++ b/tests/query/highlights/julia/test.jl @@ -1,26 +1,26 @@ function load_data(::Symbol; ::Int) :: Tuple -# <- keyword.function -# ^ function -# ^ punctuation.bracket -# ^^ punctuation.delimiter -# ^ type.builtin -# ^ punctuation.delimiter -# ^^ punctuation.delimiter -# ^^^ type.builtin -# ^ punctuation.bracket -# ^^ punctuation.delimiter -# ^ type.builtin +# <- @keyword.function +# ^ @function +# ^ @punctuation.bracket +# ^^ @punctuation.delimiter +# ^ @type.builtin +# ^ @punctuation.delimiter +# ^^ @punctuation.delimiter +# ^^^ @type.builtin +# ^ @punctuation.bracket +# ^^ @punctuation.delimiter +# ^ @type.builtin dataset = CIFAR10(; Tx = Float32, split = split) -# ^^^^^^^ variable -# ^ operator -# ^ function.call -# ^ operator -# ^ type.builtin +# ^^^^^^^ @variable +# ^ @operator +# ^ @function.call +# ^ @operator +# ^ @type.builtin X = reshape(dataset.features[:, :, :, begin:n_obs], :, n_obs) # flattening the image pixels -# ^^^^^ variable.builtin +# ^^^^^ @variable.builtin y = categorical2onehot(dataset.targets[begin:n_obs], N_LABELS) -# ^^^^^ variable.builtin +# ^^^^^ @variable.builtin return X, y -# ^^^^^^ keyword.return +# ^^^^^^ @keyword.return end -# <- keyword.function +# <- @keyword.function diff --git a/tests/query/highlights/lua/test.lua b/tests/query/highlights/lua/test.lua index e8725b9fe..55818bb74 100644 --- a/tests/query/highlights/lua/test.lua +++ b/tests/query/highlights/lua/test.lua @@ -1,18 +1,18 @@ -- luacheck: ignore local a = { 1, 2, 3, 4, 5 } --- ^ number ^ punctuation.bracket --- ^ variable +-- ^ @number ^ @punctuation.bracket +-- ^ @variable local _ = next(a) --- ^ function.builtin --- ^ keyword +-- ^ @function.builtin +-- ^ @keyword _ = next(a) --- ^ function.builtin +-- ^ @function.builtin next(a) --- ^ function.builtin +-- ^ @function.builtin -- Checking for incorrect hlgroup of injected luap string.match(s, "\0%d[^\n]+") --- ^ !constant +-- ^ @!constant diff --git a/tests/query/highlights/markdown/test.md b/tests/query/highlights/markdown/test.md index 2d3734515..20953a863 100644 --- a/tests/query/highlights/markdown/test.md +++ b/tests/query/highlights/markdown/test.md @@ -1,28 +1,28 @@ # H1 - + ## H2 - + - Item 1 - Item 2 - + 1. Item 1 2. Item 2 - + ----![image_description](https://example.com/image.jpg "awesome image title") - - - - - - + + + + + + [link_text](#local_reference "link go brr...") - - - - - + + + + + diff --git a/tests/query/highlights/pascal/test.pas b/tests/query/highlights/pascal/test.pas index f60e8b40b..3a6cc786a 100644 --- a/tests/query/highlights/pascal/test.pas +++ b/tests/query/highlights/pascal/test.pas @@ -1,39 +1,39 @@ program foobar; -// ^ keyword +// ^ @keyword var -// <- keyword +// <- @keyword foo: bar; -// ^ variable -// ^ type +// ^ @variable +// ^ @type foo: foo.bar; -// ^ variable -// ^ type -// ^ type -// ^ type +// ^ @variable +// ^ @type +// ^ @type +// ^ @type begin -// ^ keyword +// ^ @keyword foo := bar; -// ^ variable -// ^ variable +// ^ @variable +// ^ @variable foo; -// ^ function +// ^ @function foo(); -// ^ function +// ^ @function foo(bar(xyz)); -// ^ function -// ^ function -// ^ variable +// ^ @function +// ^ @function +// ^ @variable xx + yy; -// ^ variable -// ^ variable +// ^ @variable +// ^ @variable xx := y + z + func(a, b, c); -// ^ variable -// ^ variable -// ^ variable -// ^ function -// ^ variable -// ^ variable -// ^ variable +// ^ @variable +// ^ @variable +// ^ @variable +// ^ @function +// ^ @variable +// ^ @variable +// ^ @variable end. -// <- keyword +// <- @keyword diff --git a/tests/query/highlights/python/pattern_matching.py b/tests/query/highlights/python/pattern_matching.py index 2d7d7d0c0..cd359a48f 100644 --- a/tests/query/highlights/python/pattern_matching.py +++ b/tests/query/highlights/python/pattern_matching.py @@ -1,51 +1,51 @@ match command.split(): -# ^ conditional +# ^ @conditional case ["quit"]: - # ^ conditional + # ^ @conditional print("Goodbye!") quit_game() case ["look"]: - # ^ conditional + # ^ @conditional current_room.describe() case ["get", obj]: - # ^ conditional + # ^ @conditional character.get(obj, current_room) case ["go", direction]: - # ^ conditional + # ^ @conditional current_room = current_room.neighbor(direction) # The rest of your commands go here match command.split(): -# ^ conditional +# ^ @conditional case ["drop", *objects]: - # ^ conditional + # ^ @conditional for obj in objects: character.drop(obj, current_room) match command.split(): -# ^ conditional +# ^ @conditional case ["quit"]: ... # Code omitted for brevity case ["go", direction]: pass case ["drop", *objects]: pass case _: print(f"Sorry, I couldn't understand {command!r}") - # ^^ @function.macro + # ^^ @@function.macro match command.split(): -# ^ conditional +# ^ @conditional case ["north"] | ["go", "north"]: - # ^ conditional + # ^ @conditional current_room = current_room.neighbor("north") case ["get", obj] | ["pick", "up", obj] | ["pick", obj, "up"]: - # ^ conditional + # ^ @conditional pass match = 2 -# ^ variable +# ^ @variable match, a = 2, 3 -# ^ variable +# ^ @variable match: int = secret -# ^ variable +# ^ @variable x, match: str = 2, "hey, what's up?" -# <- variable -# ^ variable +# <- @variable +# ^ @variable diff --git a/tests/query/highlights/rust/super-crate-imports.rs b/tests/query/highlights/rust/super-crate-imports.rs index 49a0c2918..59354a32c 100644 --- a/tests/query/highlights/rust/super-crate-imports.rs +++ b/tests/query/highlights/rust/super-crate-imports.rs @@ -1,12 +1,12 @@ use crate::a; -// ^ namespace +// ^ @namespace // ^ !keyword use crate::{b, c}; -// ^ namespace +// ^ @namespace // ^ !keyword use super::a; -// ^ namespace +// ^ @namespace // ^ !keyword use super::{b, c}; -// ^ namespace +// ^ @namespace // ^ !keyword diff --git a/tests/query/highlights/solidity/test.sol b/tests/query/highlights/solidity/test.sol index 062970fdd..99117bb55 100644 --- a/tests/query/highlights/solidity/test.sol +++ b/tests/query/highlights/solidity/test.sol @@ -1,27 +1,27 @@ // Example contract from official documentation at https://github.com/ethereum/solidity/blob/v0.8.12/docs/examples/voting.rst // SPDX-License-Identifier: GPL-3.0 -// ^ comment +// ^ @comment pragma solidity >=0.7.0 <0.9.0; -// ^ preproc -// ^ preproc +// ^ @preproc +// ^ @preproc import * as something from "anotherFile"; -// ^ ^ ^ include +// ^ ^ ^ @include /// @title Voting with delegation. -// <- comment +// <- @comment contract Ballot { // ^keyword -// ^ type +// ^ @type // This declares a new complex type which will // be used for variables later. // It will represent a single voter. struct Voter { -// ^ type +// ^ @type uint weight; // weight is accumulated by delegation -// ^ type.builtin -// ^ field +// ^ @type.builtin +// ^ @field bool voted; // if true, that person already voted address delegate; // person delegated to uint vote; // index of the voted proposal @@ -34,23 +34,23 @@ contract Ballot { } address public chairperson; -// ^ type.builtin +// ^ @type.builtin // This declares a state variable that // stores a `Voter` struct for each possible address. mapping(address => Voter) public voters; -// ^ ^ punctuation.bracket -// ^ punctuation.delimiter +// ^ ^ @punctuation.bracket +// ^ @punctuation.delimiter // A dynamically-sized array of `Proposal` structs. Proposal[] public proposals; enum ActionChoices { GoLeft, GoRight, GoStraight, SitStill } -// ^ constant +// ^ @constant /// Create a new ballot to choose one of `proposalNames`. constructor(bytes32[] memory proposalNames) { -// ^ constructor +// ^ @constructor chairperson = msg.sender; voters[chairperson].weight = 1; @@ -63,7 +63,7 @@ contract Ballot { // appends it to the end of `proposals`. proposals.push(Proposal({ name: proposalNames[i], -// ^ field +// ^ @field voteCount: 0 })); } @@ -72,9 +72,9 @@ contract Ballot { // Give `voter` the right to vote on this ballot. // May only be called by `chairperson`. function giveRightToVote(address voter) external { -// ^ keyword.function -// ^ function -// ^ parameter +// ^ @keyword.function +// ^ @function +// ^ @parameter // If the first argument of `require` evaluates // to `false`, execution terminates and all // changes to the state and to Ether balances @@ -180,7 +180,7 @@ contract Ballot { contract Another { Ballot b = new Ballot(new bytes32[](1)); -// ^ keyword.operator +// ^ @keyword.operator } // vim:ft=solidity diff --git a/tests/query/highlights/t32/comments.cmm b/tests/query/highlights/t32/comments.cmm index 0bab130f6..e36f7e63a 100644 --- a/tests/query/highlights/t32/comments.cmm +++ b/tests/query/highlights/t32/comments.cmm @@ -1,10 +1,10 @@ // This is a comment -; <- comment +; <- @comment ; Another comment -; <- comment +; <- @comment ECHO &a // This is a trailing comment -; ^ comment +; ^ @comment // vim: set ft=t32: diff --git a/tests/query/highlights/t32/keywords.cmm b/tests/query/highlights/t32/keywords.cmm index 21422438b..a4013d72f 100644 --- a/tests/query/highlights/t32/keywords.cmm +++ b/tests/query/highlights/t32/keywords.cmm @@ -1,123 +1,123 @@ PRIVATE &password -; <- keyword -; ^ variable.builtin +; <- @keyword +; ^ @variable.builtin ENTRY &password -; <- keyword -; ^ parameter +; <- @keyword +; ^ @parameter ENTRY %LINE &salt -; <- keyword -; ^ constant.builtin -; ^ parameter +; <- @keyword +; ^ @constant.builtin +; ^ @parameter IF "&password"=="" -; <- conditional -; ^ string -; ^ variable.builtin -; ^ operator +; <- @conditional +; ^ @string +; ^ @variable.builtin +; ^ @operator ( ECHO "Failed to provide password." ENDDO -; ^ keyword.return +; ^ @keyword.return ) ELSE -; <- conditional +; <- @conditional ( PRIVATE &pass &pass=FALSE() -; ^ function.builtin +; ^ @function.builtin WHILE !&pass -; ^ operator +; ^ @operator ( GOSUB verify_password "&password" -; ^ function.call +; ^ @function.call RETURNVALUES &pass -; ^ parameter +; ^ @parameter WAIT 10.ms -; ^ float +; ^ @float ) IF !&pass GOTO fail -; ^ label +; ^ @label ELSE ( GOSUB start_debug -; ^ function.call +; ^ @function.call ) ) LOCAL &num -; ^ variable.builtin +; ^ @variable.builtin &num = 2. -; ^ number +; ^ @number RePeaT &num PRINT "Password: &password" -; ^ variable.builtin -; ^ variable.builtin +; ^ @variable.builtin +; ^ @variable.builtin WinCLEAR FramePOS ,,,,Maximized -; ^ punctuation.delimiter -; ^ constant.builtin +; ^ @punctuation.delimiter +; ^ @constant.builtin WinPOS 0% 50% 100% 35% -; ^ float +; ^ @float COVerage.ListFunc ENDDO fail: -; <- label +; <- @label PRINT %ERROR "Password verification failed." END -; ^ keyword.return +; ^ @keyword.return verify_password: -; <- function +; <- @function ( PARAMETERS &password -; ^ parameter +; ^ @parameter SYStem.Option.KEYCODE "&password" SYStem.JtagClock 1kHz -; ^ float +; ^ @float SYStem.Mode.Attach Data.Set N: EAXI:0x34000000 %Long 0x34000100 0x34000021 /verify -; ^ constant.builtin -; ^ constant.builtin -; ^ number -; ^ constant.builtin -; ^ number -; ^ constant.builtin +; ^ @constant.builtin +; ^ @constant.builtin +; ^ @number +; ^ @constant.builtin +; ^ @number +; ^ @constant.builtin RETURN TRUE() -; ^ keyword.return +; ^ @keyword.return ) SUBROUTINE start_debug -; <- keyword.function -; ^ function +; <- @keyword.function +; ^ @function ( COVerage.ListModule %MULTI.OBC \sieve -; ^ keyword -; ^ constant.builtin -; ^ symbol +; ^ @keyword +; ^ @constant.builtin +; ^ @symbol Var.DRAW flags[0..16] /Alternate 3 -; ^ keyword -; ^ variable -; ^ constant.builtin -; ^ number +; ^ @keyword +; ^ @variable +; ^ @constant.builtin +; ^ @number Go main RETURN -; ^ keyword.return +; ^ @keyword.return ) // vim: set ft=t32: diff --git a/tests/query/highlights/t32/literals.cmm b/tests/query/highlights/t32/literals.cmm index 6c6849aea..8c63ce96d 100644 --- a/tests/query/highlights/t32/literals.cmm +++ b/tests/query/highlights/t32/literals.cmm @@ -1,39 +1,39 @@ WinPOS ,,1000.,,,,myWatchWindow -; ^ number +; ^ @number PRinTer.OPEN "~~~/varwatch.txt" ASCIIE -; ^ string +; ^ @string sYmbol.NEW _InitialSP 0x34000100 -; ^ number +; ^ @number DO ~~~~/test.cmm -; ^ string.special +; ^ @string.special WAIT 1.ns -; ^ float +; ^ @float SYStem.JtagClock 100.GHZ -; ^ float +; ^ @float DATA.SET P:&HEAD+0x4 %LONG DATA.LONG(EA:&HEAD+0x4)&0xFFFFFF -; ^ constant.builtin +; ^ @constant.builtin List `main` -; ^ symbol +; ^ @symbol &range = 'a'--'z'||'0'--'9' -; ^ character -; ^ operator -; ^ character +; ^ @character +; ^ @operator +; ^ @character Data.Set N: 0xffff800000 0y0011xx01xx&&a -; ^ constant.builtin -; ^ number -; ^ number -; ^ operator +; ^ @constant.builtin +; ^ @number +; ^ @number +; ^ @operator WinPOS 0% 85% 100% 15% -; ^ float +; ^ @float // vim: set ft=t32: diff --git a/tests/query/highlights/t32/var.cmm b/tests/query/highlights/t32/var.cmm index d77de90c8..de67278a0 100644 --- a/tests/query/highlights/t32/var.cmm +++ b/tests/query/highlights/t32/var.cmm @@ -1,7 +1,7 @@ Var.NEWGLOBAL char[4][32] \myarr -; <- keyword -; ^ type.builtin -; ^ variable.builtin +; <- @keyword +; ^ @type.builtin +; ^ @variable.builtin LOCAL &i &data &data="zero|one|two|three" @@ -12,64 +12,64 @@ WHILE &i<4 PRIVATE &val &val=STRing.SPLIT("&data","|",&i) Var.Assign \myarr[&i]="&val" -; ^ variable.builtin -; ^ operator +; ^ @variable.builtin +; ^ @operator &i=&i+1. ) Var.NEWLOCAL \x -; <- keyword -; ^ variable.builtin +; <- @keyword +; ^ @variable.builtin Var.set \x=func3(5,3) -; ^ variable.builtin -; ^ function.call -; ^ number +; ^ @variable.builtin +; ^ @function.call +; ^ @number PRINT Var.VALUE(\x) -; ^ variable.builtin +; ^ @variable.builtin PRINT Var.VALUE('a') -; ^ character +; ^ @character Var.Assign (*ap)[2..4] = &a -; ^ variable -; ^ variable +; ^ @variable +; ^ @variable Var.Assign sp = &s.n+offset -; ^ variable -; ^ variable -; ^ field -; ^ variable +; ^ @variable +; ^ @variable +; ^ @field +; ^ @variable Var.Assign padd = (CAddition const * volatile)&d -; ^ variable -; ^ type -; ^ type.qualifier -; ^ type.qualifier -; ^ variable +; ^ @variable +; ^ @type +; ^ @type.qualifier +; ^ @type.qualifier +; ^ @variable Var.Assign e1 = (enum e2)&e -; ^ variable -; ^ keyword -; ^ type -; ^ variable +; ^ @variable +; ^ @keyword +; ^ @type +; ^ @variable Var.Assign *vector = (struct Vector3d*)&acceleration -; ^ variable -; ^ keyword -; ^ type -; ^ variable +; ^ @variable +; ^ @keyword +; ^ @type +; ^ @variable Var.Assign z = (union foo)x -; ^ variable -; ^ keyword -; ^ type -; ^ variable +; ^ @variable +; ^ @keyword +; ^ @type +; ^ @variable Var.Assign b = -a -; ^ variable -; ^ variable +; ^ @variable +; ^ @variable Var.Assign c = i++ -; ^ variable -; ^ variable +; ^ @variable +; ^ @variable Var.Assign d = sizeof(int) -; ^ variable -; ^ keyword.operator -; ^ type.builtin +; ^ @variable +; ^ @keyword.operator +; ^ @type.builtin Var.call strcmp(key,buffer) -; ^ function.call -; ^ variable -; ^ variable +; ^ @function.call +; ^ @variable +; ^ @variable // vim: set ft=t32: diff --git a/tests/query/highlights/tiger/built-ins.tig b/tests/query/highlights/tiger/built-ins.tig index 7cc1ca501..9aa649421 100644 --- a/tests/query/highlights/tiger/built-ins.tig +++ b/tests/query/highlights/tiger/built-ins.tig @@ -1,21 +1,21 @@ let var a := exit(0) - /* ^ function.builtin */ + /* ^ @function.builtin */ primitive exit(ret: int) /* Shadowing the prelude-included built-in */ - /* ^ type.builtin */ + /* ^ @type.builtin */ var b := exit(0) - /* ^ function.builtin */ + /* ^ @function.builtin */ type int = string /* Shadowing the built-in type */ - /* ^ type.builtin */ + /* ^ @type.builtin */ var c : int := "This is an \"int\"" - /* ^ type.builtin (not sure why it isn't 'type')*/ + /* ^ @type.builtin (not sure why it isn't 'type')*/ var d : Object := nil - /* ^ type.builtin */ + /* ^ @type.builtin */ type Object = int @@ -23,22 +23,22 @@ let in let var c : int := "This is an int" - /* ^ type.builtin (not sure why it isn't 'type')*/ + /* ^ @type.builtin (not sure why it isn't 'type')*/ var d : Object := "This is an object" - /* ^ type.builtin (not sure why it isn't 'type')*/ + /* ^ @type.builtin (not sure why it isn't 'type')*/ in end; exit(1); - /* <- function.builtin */ + /* <- @function.builtin */ print("shadowing is fun"); - /* <- function.builtin */ + /* <- @function.builtin */ self; - /* <- variable.builtin */ + /* <- @variable.builtin */ b := print - /* ^ variable */ + /* ^ @variable */ end /* vim: set ft=tiger: */ diff --git a/tests/query/highlights/tiger/comment.tig b/tests/query/highlights/tiger/comment.tig index a9c91535f..9323dba05 100644 --- a/tests/query/highlights/tiger/comment.tig +++ b/tests/query/highlights/tiger/comment.tig @@ -1,6 +1,6 @@ /* This is /* a nested */ comment */ -/* <- comment - ^ comment - ^ comment +/* <- @comment + ^ @comment + ^ @comment */ /* vim: set ft=tiger: */ diff --git a/tests/query/highlights/tiger/functions.tig b/tests/query/highlights/tiger/functions.tig index 219c05916..6505d20fe 100644 --- a/tests/query/highlights/tiger/functions.tig +++ b/tests/query/highlights/tiger/functions.tig @@ -1,9 +1,9 @@ primitive print(s: string) -/* ^ function */ -/* ^ parameter */ +/* ^ @function */ +/* ^ @parameter */ function func(a: int) : int = (print("Hello World!"); a) -/* ^ function */ -/* ^ parameter */ -/* ^ function.builtin */ +/* ^ @function */ +/* ^ @parameter */ +/* ^ @function.builtin */ /* vim: set ft=tiger: */ diff --git a/tests/query/highlights/tiger/identifiers.tig b/tests/query/highlights/tiger/identifiers.tig index 4216c930d..e712e57de 100644 --- a/tests/query/highlights/tiger/identifiers.tig +++ b/tests/query/highlights/tiger/identifiers.tig @@ -1,30 +1,30 @@ type int = int -/* ^ variable */ -/* ^ type.builtin */ +/* ^ @variable */ +/* ^ @type.builtin */ type int_array = array of int -/* ^ type.builtin */ +/* ^ @type.builtin */ type record = {a: int, b: string} -/* ^ property */ -/* ^ type.builtin */ -/* ^ property */ -/* ^ type.builtin */ +/* ^ @property */ +/* ^ @type.builtin */ +/* ^ @property */ +/* ^ @type.builtin */ var record := record {a = 12, b = "27"} -/* ^ variable */ -/* ^ type */ -/* ^ property */ -/* ^ property */ +/* ^ @variable */ +/* ^ @type */ +/* ^ @property */ +/* ^ @property */ var array := int_array[12] of 27; -/* ^ variable */ -/* ^ type */ +/* ^ @variable */ +/* ^ @type */ primitive func(a: int, b: string) : array -/* ^ parameter */ -/* ^ type.builtin */ -/* ^ parameter */ -/* ^ type.builtin */ -/* ^ type */ +/* ^ @parameter */ +/* ^ @type.builtin */ +/* ^ @parameter */ +/* ^ @type.builtin */ +/* ^ @type */ /* vim: set ft=tiger: */ diff --git a/tests/query/highlights/tiger/imports.tig b/tests/query/highlights/tiger/imports.tig index 068dc4810..f20a0bc1a 100644 --- a/tests/query/highlights/tiger/imports.tig +++ b/tests/query/highlights/tiger/imports.tig @@ -1,4 +1,4 @@ import "lib.tih" -/* <- include */ -/* ^ string.special */ +/* <- @include */ +/* ^ @string.special */ /* vim: set ft=tiger: */ diff --git a/tests/query/highlights/tiger/keywords.tig b/tests/query/highlights/tiger/keywords.tig index 862a531cd..7deb0288d 100644 --- a/tests/query/highlights/tiger/keywords.tig +++ b/tests/query/highlights/tiger/keywords.tig @@ -1,42 +1,42 @@ let -/* <- keyword */ +/* <- @keyword */ var a := 12 - /* <- keyword */ + /* <- @keyword */ function f() : int = a - /* <- keyword.function */ + /* <- @keyword.function */ primitive g() - /* <- keyword.function */ + /* <- @keyword.function */ import "lib.tih" - /* <- include */ + /* <- @include */ type array_of_int = array of int - /* <- keyword */ - /* ^ keyword */ - /* ^ keyword */ + /* <- @keyword */ + /* ^ @keyword */ + /* ^ @keyword */ in -/* <- keyword */ +/* <- @keyword */ 12; if 12 then 27 else 42; - /* <- keyword */ - /* ^ keyword */ - /* ^ keyword */ + /* <- @keyword */ + /* ^ @keyword */ + /* ^ @keyword */ for i := 12 to 27 do 42; - /* <- repeat */ - /* ^ repeat */ - /* ^ repeat */ + /* <- @repeat */ + /* ^ @repeat */ + /* ^ @repeat */ while 12 do break - /* <- repeat */ - /* ^ repeat */ - /* ^ keyword */ + /* <- @repeat */ + /* ^ @repeat */ + /* ^ @keyword */ end -/* <- keyword */ +/* <- @keyword */ /* vim: set ft=tiger: */ diff --git a/tests/query/highlights/tiger/literals.tig b/tests/query/highlights/tiger/literals.tig index c7d7b5d8e..46f3c8616 100644 --- a/tests/query/highlights/tiger/literals.tig +++ b/tests/query/highlights/tiger/literals.tig @@ -1,9 +1,9 @@ nil -/* <- constant.builtin */ +/* <- @constant.builtin */ 42 -/* <- number */ +/* <- @number */ "Hello World!\n" -/* <- string - ^ string.escape +/* <- @string + ^ @string.escape */ /* vim: set ft=tiger: */ diff --git a/tests/query/highlights/tiger/meta-variables.tig b/tests/query/highlights/tiger/meta-variables.tig index 24c01ac69..1b2c6c976 100644 --- a/tests/query/highlights/tiger/meta-variables.tig +++ b/tests/query/highlights/tiger/meta-variables.tig @@ -1,14 +1,14 @@ let _chunks(42) - /* <- keyword */ + /* <- @keyword */ in _lvalue(12) : _namety(42) := _cast("I'm So Meta Even This Acronym", string); - /* <- keyword */ - /* ^ keyword */ - /* ^ keyword */ + /* <- @keyword */ + /* ^ @keyword */ + /* ^ @keyword */ _exp(42) - /* <- keyword */ + /* <- @keyword */ end /* vim: set ft=tiger: */ diff --git a/tests/query/highlights/tiger/object-oriented.tig b/tests/query/highlights/tiger/object-oriented.tig index b09b82b19..607efec8c 100644 --- a/tests/query/highlights/tiger/object-oriented.tig +++ b/tests/query/highlights/tiger/object-oriented.tig @@ -1,29 +1,29 @@ let class A extends Object {} - /* <- keyword */ - /* ^ keyword */ - /* ^ type.builtin */ + /* <- @keyword */ + /* ^ @keyword */ + /* ^ @type.builtin */ type B = class extends A { - /* ^ keyword */ - /* ^ keyword */ - /* ^ type */ + /* ^ @keyword */ + /* ^ @keyword */ + /* ^ @type */ var a := 12 method meth() : int = self.a - /* <- keyword.function */ - /* ^ method */ - /* ^ variable.builtin */ + /* <- @keyword.function */ + /* ^ @method */ + /* ^ @variable.builtin */ } var object := new B - /* ^ keyword.operator */ + /* ^ @keyword.operator */ in object.a := 27; - /* ^ property */ + /* ^ @property */ object.meth() - /* ^ method */ + /* ^ @method */ end /* vim: set ft=tiger: */ diff --git a/tests/query/highlights/tiger/operators.tig b/tests/query/highlights/tiger/operators.tig index 569b8a8bc..d803af75b 100644 --- a/tests/query/highlights/tiger/operators.tig +++ b/tests/query/highlights/tiger/operators.tig @@ -1,49 +1,49 @@ let var a : int := 42 - /* ^ punctuation.delimiter */ - /* ^ operator */ + /* ^ @punctuation.delimiter */ + /* ^ @operator */ in ( - /* <- punctuation.bracket */ + /* <- @punctuation.bracket */ -1 | 2 & 3 + 4 * 5; - /* <- operator */ - /* ^ operator */ - /* ^ operator */ - /* ^ operator */ - /* ^ operator */ - /* ^ punctuation.delimiter */ + /* <- @operator */ + /* ^ @operator */ + /* ^ @operator */ + /* ^ @operator */ + /* ^ @operator */ + /* ^ @punctuation.delimiter */ 12 >= 27; - /* ^ operator */ + /* ^ @operator */ 12 <= 27; - /* ^ operator */ + /* ^ @operator */ 12 = 27; - /* ^ operator */ + /* ^ @operator */ 12 <> 27; - /* ^ operator */ + /* ^ @operator */ 12 < 27; - /* ^ operator */ + /* ^ @operator */ 12 > 27; - /* ^ operator */ + /* ^ @operator */ record.field; - /* ^ punctuation.delimiter */ + /* ^ @punctuation.delimiter */ func(a, b); - /* ^ punctuation.bracket */ - /* ^ punctuation.bracket */ - /* ^ punctuation.delimiter */ + /* ^ @punctuation.bracket */ + /* ^ @punctuation.bracket */ + /* ^ @punctuation.delimiter */ record_type { }; - /* ^ punctuation.bracket */ - /* ^ punctuation.bracket */ + /* ^ @punctuation.bracket */ + /* ^ @punctuation.bracket */ array[42] - /* ^ punctuation.bracket */ - /* ^ punctuation.bracket */ + /* ^ @punctuation.bracket */ + /* ^ @punctuation.bracket */ ) - /* <- punctuation.bracket */ + /* <- @punctuation.bracket */ end /* vim: set ft=tiger: */ diff --git a/tests/query/highlights/typescript/as.ts b/tests/query/highlights/typescript/as.ts index ef0ce98e5..71221f410 100644 --- a/tests/query/highlights/typescript/as.ts +++ b/tests/query/highlights/typescript/as.ts @@ -1,8 +1,8 @@ import * as foo from 'foo'; -// ^ include +// ^ @include export { foo as bar }; -// ^ include +// ^ @include const n = 5 as number; -// ^ keyword.operator +// ^ @keyword.operator diff --git a/tests/query/highlights/usd/prims.usda b/tests/query/highlights/usd/prims.usda index eeac67d74..eeeeae920 100644 --- a/tests/query/highlights/usd/prims.usda +++ b/tests/query/highlights/usd/prims.usda @@ -1,11 +1,11 @@ def Xform "cube" ( assetInfo = { - # <- keyword + # <- @keyword asset[] payloadAssetDependencies = [@fizz.usd@, @buzz.usd@] - # <- type - # ^ keyword - # ^ text.uri - # ^ text.uri + # <- @type + # ^ @keyword + # ^ @text.uri + # ^ @text.uri } ) { @@ -13,13 +13,13 @@ def Xform "cube" ( def "root" ( add references = @foo.usda@ (offset = 1; scale = 2.0) - # <- text.uri - # ^ string.special - # ^ keyword - # ^ number - # ^ punctuation.delimiter - # ^ keyword - # ^ float + # <- @text.uri + # ^ @string.special + # ^ @keyword + # ^ @number + # ^ @punctuation.delimiter + # ^ @keyword + # ^ @float ) { } @@ -28,14 +28,14 @@ def "World" { over "points" ( clips = { - # <- keyword + # <- @keyword dictionary default = { - # <- type - # ^ variable + # <- @type + # ^ @variable double2[] times = [(101, 101), (102, 102)] - # <- type - # ^ keyword - # ^ number + # <- @type + # ^ @keyword + # ^ @number } } ) @@ -49,9 +49,9 @@ def Xform "torch_2" ( ) { // Pre-published light list - # <- comment + # <- @comment rel lightList = [ ] # inline comment - # ^ comment + # ^ @comment token lightList:cacheBehavior = "consumeAndContinue" double3 xformOp:translate = (1, 0, 0.5) @@ -60,7 +60,7 @@ def Xform "torch_2" ( def "foo" ( "some comment" - # <- comment.documentation + # <- @comment.documentation ) { } @@ -68,20 +68,20 @@ def "foo" ( def "foo" ( # inline comment "actual in-description comment" - # <- comment.documentation + # <- @comment.documentation ) { } def "foo" ( add references = @foo.usda@ - # <- function.call + # <- @function.call append references = @foo.usda@ - # <- function.call + # <- @function.call delete references = @foo.usda@ - # <- function.call + # <- @function.call reorder references = [@foo.usda@] - # <- function.call + # <- @function.call references = [@foo.usda@] # explicit ) @@ -90,11 +90,11 @@ def "foo" ( over "Parent" ( prepend references = [, @./ref.usda@] - # <- function.call - # ^ keyword - # ^ string.special - # ^ text.uri - # ^ string.special + # <- @function.call + # ^ @keyword + # ^ @string.special + # ^ @text.uri + # ^ @string.special ) { } @@ -102,17 +102,17 @@ over "Parent" ( def "foo" { float value.timeSamples = { - # <- type - # ^ variable - # ^ property + # <- @type + # ^ @variable + # ^ @property -414: 14.4 - # <- number - # ^ float + # <- @number + # ^ @float 10: 201.0, - # <- number - # ^ float + # <- @number + # ^ @float 10.123: 201.0123, - # <- float - # ^ float + # <- @float + # ^ @float } } diff --git a/tests/query/highlights/usd/properties.usda b/tests/query/highlights/usd/properties.usda index 67df8a623..e518c73f7 100644 --- a/tests/query/highlights/usd/properties.usda +++ b/tests/query/highlights/usd/properties.usda @@ -1,21 +1,21 @@ dictionary foo = {} -# <- type +# <- @type half[] foo = [2, 1, 2] -# <- type +# <- @type string foo = "something" -# <- type +# <- @type timecode time = 1.0 -# <- type +# <- @type token[] purpose = ["default", "render"] -# <- type +# <- @type rel material:binding:collection:Erasers = None -# <- type -# ^ namespace -# ^ punctuation.delimiter -# ^ namespace -# ^ punctuation.delimiter -# ^ namespace -# ^ punctuation.delimiter -# ^ variable -# ^ constant.builtin +# <- @type +# ^ @namespace +# ^ @punctuation.delimiter +# ^ @namespace +# ^ @punctuation.delimiter +# ^ @namespace +# ^ @punctuation.delimiter +# ^ @variable +# ^ @constant.builtin diff --git a/tests/query/highlights/usd/subLayers.usda b/tests/query/highlights/usd/subLayers.usda index b4dfa6298..24581b90a 100644 --- a/tests/query/highlights/usd/subLayers.usda +++ b/tests/query/highlights/usd/subLayers.usda @@ -1,9 +1,9 @@ #usda 1.0 ( subLayers = [ - # <- keyword + # <- @keyword @./model_sub.usda@ (offset = 1) - # <- text.uri - # ^ keyword + # <- @text.uri + # ^ @keyword ] ) diff --git a/tests/query/highlights/wing/class.w b/tests/query/highlights/wing/class.w index 06160d741..b102db891 100644 --- a/tests/query/highlights/wing/class.w +++ b/tests/query/highlights/wing/class.w @@ -1,19 +1,19 @@ bring cloud; -// <- keyword +// <- @keyword class Foo { -// <- keyword -// ^ variable -// ^ punctuation.bracket +// <- @keyword +// ^ @variable +// ^ @punctuation.bracket name: str; -//^ field -// ^ type.builtin -// ^ punctuation.delimiter +//^ @field +// ^ @type.builtin +// ^ @punctuation.delimiter new(name: str) { -//^ keyword -// ^ variable +//^ @keyword +// ^ @variable this.name = name; -// ^ punctuation.delimiter -// ^ operator +// ^ @punctuation.delimiter +// ^ @operator } } diff --git a/tests/query/highlights/wing/nested_method.w b/tests/query/highlights/wing/nested_method.w index 04fd1a37d..8a454b34c 100644 --- a/tests/query/highlights/wing/nested_method.w +++ b/tests/query/highlights/wing/nested_method.w @@ -1,4 +1,4 @@ test1.test2.test3(); -// <- variable -// ^ property -// ^ method.call +// <- @variable +// ^ @property +// ^ @method.call diff --git a/tests/query/highlights/xhp-intro.hack b/tests/query/highlights/xhp-intro.hack index 942d2ff00..ccbe60c57 100644 --- a/tests/query/highlights/xhp-intro.hack +++ b/tests/query/highlights/xhp-intro.hack @@ -5,23 +5,23 @@ use type Facebook\XHP\HTML\{XHPHTMLHelpers, a, form}; final xhp class a_post extends x\element { -// ^ type.qualifier -// ^ type.qualifier -// ^ keyword +// ^ @type.qualifier +// ^ @type.qualifier +// ^ @keyword use XHPHTMLHelpers; attribute string href @required; - // ^ attribute + // ^ @attribute attribute string target; - // ^ keyword + // ^ @keyword <<__Override>> protected async function renderAsync(): Awaitable { $id = $this->getID(); $anchor = {$this->getChildren()}; - // ^ tag.delimiter - // ^ tag + // ^ @tag.delimiter + // ^ @tag $form = (
setAttribute('href', '#'); - // ^ method.call + // ^ @method.call return $form; } diff --git a/tests/query/injections/cuda/macro-self-injection.cu b/tests/query/injections/cuda/macro-self-injection.cu index 1acef197b..a91184287 100644 --- a/tests/query/injections/cuda/macro-self-injection.cu +++ b/tests/query/injections/cuda/macro-self-injection.cu @@ -1,2 +1,2 @@ #define FOO(X,Y) X + Y -// ^ cuda +// ^ @cuda diff --git a/tests/query/injections/dockerfile/bash-on-run-instructions.dockerfile b/tests/query/injections/dockerfile/bash-on-run-instructions.dockerfile index d25020494..00621f1a3 100644 --- a/tests/query/injections/dockerfile/bash-on-run-instructions.dockerfile +++ b/tests/query/injections/dockerfile/bash-on-run-instructions.dockerfile @@ -1,6 +1,6 @@ FROM foo RUN bar -# ^ bash +# ^ @bash RUN \ baz -# ^ bash +# ^ @bash diff --git a/tests/query/injections/ecma/ecma-test-injections.js b/tests/query/injections/ecma/ecma-test-injections.js index 68d53721a..16ddd3c6b 100644 --- a/tests/query/injections/ecma/ecma-test-injections.js +++ b/tests/query/injections/ecma/ecma-test-injections.js @@ -1,9 +1,9 @@ html`

`; - // ^ html + // ^ @html html(`

`); - // ^ html + // ^ @html svg`

`; - // ^ html + // ^ @html svg(`

`); - // ^ html + // ^ @html diff --git a/tests/query/injections/html/test-html-injections.html b/tests/query/injections/html/test-html-injections.html index 954ce5623..0df3bd420 100644 --- a/tests/query/injections/html/test-html-injections.html +++ b/tests/query/injections/html/test-html-injections.html @@ -6,50 +6,50 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
- + Test div to test css injections for style attributes
- + - + diff --git a/tests/query/injections/svelte/test-svelte-injections.svelte b/tests/query/injections/svelte/test-svelte-injections.svelte index 5a9a03300..ea88aa6a9 100644 --- a/tests/query/injections/svelte/test-svelte-injections.svelte +++ b/tests/query/injections/svelte/test-svelte-injections.svelte @@ -1,23 +1,21 @@ - + - - + + - + - - + +

Test file

{#each someItems as someItem} - +
{someItem}
- + {/each} diff --git a/tests/query/injections/vue/negative-assertions.vue b/tests/query/injections/vue/negative-assertions.vue index fdc871919..000702a17 100644 --- a/tests/query/injections/vue/negative-assertions.vue +++ b/tests/query/injections/vue/negative-assertions.vue @@ -1,4 +1,4 @@ - + - + diff --git a/tests/query/injections/vue/test-vue-injections.vue b/tests/query/injections/vue/test-vue-injections.vue index 773e53a5f..4966e6ac0 100644 --- a/tests/query/injections/vue/test-vue-injections.vue +++ b/tests/query/injections/vue/test-vue-injections.vue @@ -1,38 +1,39 @@ - + - + - + - - + + - - + + - - - + + + - + - + - + - - + + - - + + + // const file = files[0]; diff --git a/tests/query/injections/yaml/bash-on-github-actions.yml b/tests/query/injections/yaml/bash-on-github-actions.yml index ba56de193..5c732b09b 100644 --- a/tests/query/injections/yaml/bash-on-github-actions.yml +++ b/tests/query/injections/yaml/bash-on-github-actions.yml @@ -14,10 +14,10 @@ jobs: node-version: '16' - name: Install dependencies run: npm ci - # ^ bash + # ^ @bash - name: Run tests run: npm test - # ^ bash + # ^ @bash - name: Parse Petalisp run: | git submodule init @@ -27,6 +27,6 @@ jobs: else echo "Successfully parsed Petalisp" fi - # ^ bash + # ^ @bash - name: Run tests run: npm test diff --git a/tests/query/injections/yaml/promql-on-prometheus-rules.yaml b/tests/query/injections/yaml/promql-on-prometheus-rules.yaml index 8b1895c16..f064da375 100644 --- a/tests/query/injections/yaml/promql-on-prometheus-rules.yaml +++ b/tests/query/injections/yaml/promql-on-prometheus-rules.yaml @@ -3,7 +3,7 @@ groups: rules: - alert: Node down expr: up{job="node_exporter"} == 0 - # ^ promql + # ^ @promql for: 3m labels: severity: warning @@ -13,7 +13,7 @@ groups: - alert: Node down expr: | up{job="node_exporter"} == 0 - # ^ promql + # ^ @promql for: 3m labels: severity: warning From 1ae9b0e4558fe7868f8cda2db65239cfb14836d0 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 24 Dec 2023 10:00:20 +0100 Subject: [PATCH 0783/2494] feat!: align standard captures with upstream Problem: Sharing highlight queries with upstream tree-sitter and Helix is difficult. Solution: Where reasonable, use capture names in tree-sitter's standard list or Helix's Atom-style hierarchy. Specifically: * tree-sitter "standard capture names" (https://github.com/tree-sitter/tree-sitter/blob/3f44b896852eb7daaa6df4fb778c9bb52c70c815/highlight/src/lib.rs#L20-L72): - `@parameter` -> `@variable.parameter` - `@field` -> `@variable.member` - `@namespace` -> `@module` - `@float` -> `@number.float` - `@symbol` -> `@string.special.symbol` - `@string.regex` -> `@string.regexp` - `@text.*` -> `@markup.*` (`strong`, `italic`, `link`, `strikethrough`; with exceptions; see below) - `@text.title` -> `@markup.heading` - `@text.literal` -> `@markup.raw` - `@text.reference` -> `@markup.link` - `@text.uri` -> `@markup.link.url` (in markup links) - `@string.special` -> `@markup.link.label` (non-url links) - `@punctuation.special` -> `@markup.list` (markdown lists only; move subitems from `@text.todo`) * Helix captures (https://docs.helix-editor.com/master/themes.html#syntax-highlighting): - `@method` -> `@function.method` - `@method.call` -> `@function.method.call` - `@text.{todo,warning,note,danger}` -> `@comment.{error,warning,hint,info,todo}` - `@text.diff.{add,delete,}` -> `@diff.{plus,minus,delta}` - `@text.uri` -> `@string.special.url` (outside markup) - `@preproc` -> `@keyword.directive` - `@define` -> `@keyword.directive`(`.define`?) - `@storageclass` -> `@keyword.storage` - `@conditional` -> `@keyword.conditional` - `@debug` -> `@keyword.debug` - `@exception` -> `@keyword.exception` - `@include` -> `@keyword.import` - `@repeat` -> `@keyword.repeat` * cleanup - remove some redundant `@conceal` (but still allow it for conceal-only patterns) - remove obsolete `@error` (syntax linting is out of scope for this repo) - sort, cleanup capture list in `CONTRIBUTING.md` --- CONTRIBUTING.md | 258 ++++++++++-------- queries/ada/highlights.scm | 30 +- queries/agda/highlights.scm | 6 +- queries/angular/highlights.scm | 2 +- queries/apex/highlights.scm | 16 +- queries/awk/highlights.scm | 20 +- queries/bash/highlights.scm | 20 +- queries/bass/highlights.scm | 20 +- queries/beancount/highlights.scm | 2 +- queries/bibtex/highlights.scm | 6 +- queries/bicep/highlights.scm | 26 +- queries/bitbake/highlights.scm | 54 ++-- queries/blueprint/highlights.scm | 8 +- queries/c/highlights.scm | 34 +-- queries/c_sharp/highlights.scm | 44 +-- queries/cairo/highlights.scm | 56 ++-- queries/capnp/highlights.scm | 20 +- queries/chatito/highlights.scm | 10 +- queries/clojure/highlights.scm | 62 ++--- queries/cmake/highlights.scm | 24 +- queries/comment/highlights.scm | 38 +-- queries/commonlisp/highlights.scm | 26 +- queries/cooklang/highlights.scm | 6 +- queries/corn/highlights.scm | 2 +- queries/cpon/highlights.scm | 4 +- queries/cpp/highlights.scm | 30 +- queries/css/highlights.scm | 4 +- queries/cuda/highlights.scm | 2 +- queries/cue/highlights.scm | 16 +- queries/d/highlights.scm | 22 +- queries/dart/highlights.scm | 20 +- queries/devicetree/highlights.scm | 4 +- queries/dhall/highlights.scm | 16 +- queries/diff/highlights.scm | 4 +- queries/dot/highlights.scm | 6 +- queries/doxygen/highlights.scm | 6 +- queries/dtd/highlights.scm | 20 +- queries/ebnf/highlights.scm | 4 +- queries/ecma/highlights.scm | 46 ++-- queries/elixir/highlights.scm | 4 +- queries/elm/highlights.scm | 20 +- queries/elsa/highlights.scm | 4 +- queries/elvish/highlights.scm | 22 +- queries/erlang/highlights.scm | 28 +- queries/facility/highlights.scm | 2 +- queries/fennel/highlights.scm | 22 +- queries/firrtl/highlights.scm | 36 +-- queries/fish/highlights.scm | 24 +- queries/foam/highlights.scm | 24 +- queries/fortran/highlights.scm | 28 +- queries/fsh/highlights.scm | 2 +- queries/func/highlights.scm | 16 +- queries/fusion/highlights.scm | 12 +- queries/gdscript/highlights.scm | 24 +- queries/git_config/highlights.scm | 16 +- queries/git_rebase/highlights.scm | 2 +- queries/gitattributes/highlights.scm | 15 +- queries/gitcommit/highlights.scm | 22 +- queries/gleam/highlights.scm | 18 +- queries/glimmer/highlights.scm | 12 +- queries/glsl/highlights.scm | 2 +- queries/gn/highlights.scm | 8 +- queries/go/highlights.scm | 24 +- queries/go/locals.scm | 2 +- queries/godot_resource/highlights.scm | 2 +- queries/gomod/highlights.scm | 2 +- queries/gosum/highlights.scm | 4 +- queries/gpg/highlights.scm | 10 +- queries/graphql/highlights.scm | 10 +- queries/groovy/highlights.scm | 6 +- queries/gstlaunch/highlights.scm | 2 +- queries/hack/highlights.scm | 30 +- queries/hare/highlights.scm | 26 +- queries/haskell/highlights.scm | 50 ++-- queries/haskell_persistent/highlights.scm | 4 +- queries/hcl/highlights.scm | 10 +- queries/heex/highlights.scm | 2 +- queries/hocon/highlights.scm | 6 +- queries/hoon/highlights.scm | 4 +- queries/html_tags/highlights.scm | 32 +-- queries/htmldjango/highlights.scm | 4 +- queries/http/highlights.scm | 8 +- queries/hurl/highlights.scm | 11 +- queries/ini/highlights.scm | 3 +- queries/ispc/highlights.scm | 4 +- queries/janet_simple/highlights.scm | 6 +- queries/java/highlights.scm | 32 +-- queries/javascript/highlights.scm | 20 +- queries/jq/highlights.scm | 8 +- queries/jsonnet/highlights.scm | 16 +- queries/julia/highlights.scm | 54 ++-- queries/kconfig/highlights.scm | 12 +- queries/kdl/highlights.scm | 4 +- queries/kotlin/highlights.scm | 26 +- queries/kusto/highlights.scm | 4 +- queries/lalrpop/highlights.scm | 6 +- queries/latex/highlights.scm | 146 +++++----- queries/ledger/highlights.scm | 6 +- queries/leo/highlights.scm | 20 +- queries/linkerscript/highlights.scm | 12 +- queries/liquidsoap/highlights.scm | 22 +- queries/llvm/highlights.scm | 6 +- queries/lua/highlights.scm | 34 +-- queries/luadoc/highlights.scm | 18 +- queries/luap/highlights.scm | 2 +- queries/luau/highlights.scm | 36 +-- queries/m68k/highlights.scm | 18 +- queries/make/highlights.scm | 14 +- queries/markdown/highlights.scm | 78 +++--- queries/markdown_inline/highlights.scm | 57 ++-- queries/matlab/highlights.scm | 34 +-- queries/menhir/highlights.scm | 4 +- queries/mermaid/highlights.scm | 18 +- queries/meson/highlights.scm | 6 +- queries/mlir/highlights.scm | 6 +- queries/nasm/highlights.scm | 14 +- queries/nickel/highlights.scm | 10 +- queries/nim/highlights.scm | 132 ++++----- queries/nim_format_string/highlights.scm | 4 +- queries/ninja/highlights.scm | 4 +- queries/nix/highlights.scm | 25 +- queries/nqc/highlights.scm | 2 +- queries/objc/highlights.scm | 34 +-- queries/objdump/highlights.scm | 24 +- queries/ocaml/highlights.scm | 14 +- queries/ocamllex/highlights.scm | 2 +- queries/odin/highlights.scm | 40 +-- queries/pascal/highlights.scm | 24 +- queries/passwd/highlights.scm | 8 +- queries/perl/highlights.scm | 24 +- queries/php/highlights.scm | 28 +- queries/phpdoc/highlights.scm | 14 +- queries/pioasm/highlights.scm | 6 +- queries/po/highlights.scm | 2 +- queries/pod/highlights.scm | 18 +- queries/poe_filter/highlights.scm | 8 +- queries/pony/highlights.scm | 46 ++-- queries/promql/highlights.scm | 10 +- queries/proto/highlights.scm | 4 +- queries/prql/highlights.scm | 14 +- queries/pug/highlights.scm | 24 +- queries/puppet/highlights.scm | 28 +- queries/purescript/highlights.scm | 24 +- queries/python/highlights.scm | 64 ++--- queries/ql/highlights.scm | 12 +- queries/qmldir/highlights.scm | 4 +- queries/qmljs/highlights.scm | 6 +- queries/query/highlights.scm | 12 +- queries/r/highlights.scm | 24 +- queries/racket/highlights.scm | 12 +- queries/rasi/highlights.scm | 6 +- queries/rbs/highlights.scm | 10 +- queries/re2c/highlights.scm | 10 +- queries/regex/highlights.scm | 2 +- queries/rego/highlights.scm | 12 +- queries/requirements/highlights.scm | 6 +- queries/robot/highlights.scm | 20 +- queries/ron/highlights.scm | 2 +- queries/rst/highlights.scm | 44 +-- queries/ruby/highlights.scm | 40 +-- queries/rust/highlights.scm | 68 ++--- queries/scala/highlights.scm | 43 +-- queries/scfg/highlights.scm | 2 +- queries/scheme/highlights.scm | 10 +- queries/scss/highlights.scm | 22 +- queries/slang/highlights.scm | 2 +- queries/slint/highlights.scm | 20 +- queries/smali/highlights.scm | 48 ++-- queries/smithy/highlights.scm | 18 +- queries/snakemake/highlights.scm | 10 +- queries/solidity/highlights.scm | 50 ++-- queries/soql/highlights.scm | 4 +- queries/sparql/highlights.scm | 14 +- queries/sql/highlights.scm | 12 +- queries/squirrel/highlights.scm | 20 +- queries/ssh_config/highlights.scm | 8 +- queries/starlark/highlights.scm | 42 +-- queries/strace/highlights.scm | 2 +- queries/supercollider/highlights.scm | 12 +- queries/surface/highlights.scm | 4 +- queries/svelte/highlights.scm | 8 +- queries/swift/highlights.scm | 32 +-- queries/systemtap/highlights.scm | 18 +- queries/t32/highlights.scm | 20 +- queries/tablegen/highlights.scm | 18 +- queries/teal/highlights.scm | 12 +- queries/templ/highlights.scm | 2 +- queries/terraform/highlights.scm | 2 +- queries/textproto/highlights.scm | 2 +- queries/thrift/highlights.scm | 20 +- queries/tiger/highlights.scm | 12 +- queries/tlaplus/highlights.scm | 48 ++-- queries/toml/highlights.scm | 2 +- queries/tsv/highlights.scm | 2 +- queries/turtle/highlights.scm | 4 +- queries/twig/highlights.scm | 8 +- queries/typescript/highlights.scm | 28 +- queries/typoscript/highlights.scm | 6 +- queries/ungrammar/highlights.scm | 2 +- queries/unison/highlights.scm | 16 +- queries/usd/highlights.scm | 10 +- queries/uxntal/highlights.scm | 14 +- queries/v/highlights.scm | 30 +- queries/vala/highlights.scm | 44 +-- queries/verilog/highlights.scm | 24 +- queries/vhs/highlights.scm | 7 +- queries/vim/highlights.scm | 22 +- queries/vimdoc/highlights.scm | 44 +-- queries/vue/highlights.scm | 2 +- queries/wgsl/highlights.scm | 12 +- queries/wgsl_bevy/highlights.scm | 10 +- queries/wing/highlights.scm | 10 +- queries/xcompose/highlights.scm | 2 +- queries/xml/highlights.scm | 14 +- queries/yaml/highlights.scm | 10 +- queries/yang/highlights.scm | 6 +- queries/yuck/highlights.scm | 14 +- queries/zig/highlights.scm | 22 +- tests/query/highlights/capnp/test.capnp | 28 +- tests/query/highlights/clojure/test.clj | 14 +- tests/query/highlights/cpp/concepts.cpp | 2 +- .../highlights/cpp/enums-as-constants.cpp | 2 +- tests/query/highlights/cpp/test.cpp | 4 +- tests/query/highlights/ecma/test.ts | 8 +- tests/query/highlights/fusion/basic.fusion | 14 +- .../highlights/fusion/expressions.fusion | 4 +- .../gitattributes/test.gitattributes | 6 +- tests/query/highlights/gleam/assert.gleam | 2 +- tests/query/highlights/gleam/function.gleam | 20 +- tests/query/highlights/gleam/import.gleam | 16 +- tests/query/highlights/hack/as-foreach.hack | 2 +- tests/query/highlights/hack/generics.hack | 6 +- tests/query/highlights/hack/shapes.hack | 2 +- tests/query/highlights/hack/use.hack | 14 +- tests/query/highlights/haskell/test.hs | 124 ++++----- tests/query/highlights/hocon/test.conf | 4 +- tests/query/highlights/markdown/test.md | 30 +- tests/query/highlights/nix/test.nix | 8 +- tests/query/highlights/python/fields.py | 6 +- .../query/highlights/python/future_import.py | 4 +- .../highlights/python/pattern_matching.py | 22 +- tests/query/highlights/python/raise_from.py | 4 +- tests/query/highlights/python/yield_from.py | 4 +- tests/query/highlights/r/test.r | 18 +- tests/query/highlights/rust/for.rs | 2 +- .../highlights/rust/super-crate-imports.rs | 8 +- .../smali/baksmali_test_class.smali | 26 +- tests/query/highlights/solidity/test.sol | 12 +- tests/query/highlights/t32/keywords.cmm | 20 +- tests/query/highlights/t32/literals.cmm | 10 +- tests/query/highlights/t32/var.cmm | 2 +- tests/query/highlights/tiger/functions.tig | 4 +- tests/query/highlights/tiger/identifiers.tig | 4 +- tests/query/highlights/tiger/imports.tig | 4 +- tests/query/highlights/tiger/keywords.tig | 12 +- .../highlights/tiger/object-oriented.tig | 4 +- tests/query/highlights/typescript/as.ts | 4 +- tests/query/highlights/usd/prims.usda | 18 +- tests/query/highlights/usd/properties.usda | 6 +- tests/query/highlights/usd/subLayers.usda | 2 +- tests/query/highlights/wing/class.w | 2 +- tests/query/highlights/wing/nested_method.w | 2 +- tests/query/highlights/xhp-intro.hack | 2 +- 263 files changed, 2356 insertions(+), 2337 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 209886d54..8c98c46b3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -84,16 +84,88 @@ you can mark the language as optional (by putting it between parenthesis). As languages differ quite a lot, here is a set of captures available to you when building a `highlights.scm` query. Note that your colorscheme needs to define (or link) these captures as highlight groups. -#### Misc +#### Identifiers -```scheme -@comment ; line and block comments -@comment.documentation ; comments documenting code -@error ; syntax/parser errors -@none ; completely disable the highlight -@preproc ; various preprocessor directives & shebangs -@define ; preprocessor definition directives -@operator ; symbolic operators (e.g. `+` / `*`) +```query +@variable ; various variable names +@variable.builtin ; built-in variable names (e.g. `this`) +@variable.parameter ; parameters of a function +@variable.member ; object and struct fields + +@constant ; constant identifiers +@constant.builtin ; built-in constant values +@constant.macro ; constants defined by the preprocessor + +@module ; modules or namespaces +@module.builtin ; built-in modules or namespaces +@label ; GOTO and other labels (e.g. `label:` in C), including heredoc labels +``` +#### Literals + +```query +@string ; string literals +@string.documentation ; string documenting code (e.g. Python docstrings) +@string.regexp ; regular expressions +@string.escape ; escape sequences +@string.special ; other special strings (e.g. dates) +@string.special.symbol ; symbols or atoms +@string.special.url ; URIs (e.g. hyperlinks) +@string.special.path ; filenames + +@character ; character literals +@character.special ; special characters (e.g. wildcards) + +@boolean ; boolean literals +@number ; numeric literals +@number.float ; floating-point number literals +``` + +#### Types + +```query +@type ; type or class definitions and annotations +@type.builtin ; built-in types +@type.definition ; identifiers in type definitions (e.g. `typedef ` in C) +@type.qualifier ; type qualifiers (e.g. `const`) + +@attribute ; attribute annotations (e.g. Python decorators) +@property ; the key in key/value pairs +``` + +#### Functions + +```query +@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. `+` / `*`) +``` + +#### Keywords + +```query +@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 & shebangs +@keyword.directive.define ; preprocessor definition directives ``` #### Punctuation @@ -104,119 +176,53 @@ As languages differ quite a lot, here is a set of captures available to you when @punctuation.special ; special symbols (e.g. `{}` in string interpolation) ``` -#### Literals +#### Comments -```scheme -@string ; string literals -@string.documentation ; string documenting code (e.g. Python docstrings) -@string.regex ; regular expressions -@string.escape ; escape sequences -@string.special ; other special strings (e.g. dates) +```query +@comment ; line and block comments +@comment.documentation ; comments documenting code -@character ; character literals -@character.special ; special characters (e.g. wildcards) - -@boolean ; boolean literals -@number ; numeric literals -@float ; floating-point number literals +@comment.error ; error-type comments (e.g., `DEPRECATED:`) +@comment.warning ; warning-type comments (e.g., `WARNING:`, `FIX:`) +@comment.hint ; note-type comments (e.g., `NOTE:`) +@comment.info ; info-type comments +@comment.todo ; todo-type comments (e.g-, `TODO:`, `WIP:`) ``` -#### Functions - -```scheme -@function ; function definitions -@function.builtin ; built-in functions -@function.call ; function calls -@function.macro ; preprocessor macros - -@method ; method definitions -@method.call ; method calls - -@constructor ; constructor calls and definitions -@parameter ; parameters of a function -``` - -#### Keywords - -```scheme -@keyword ; various keywords -@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.return ; keywords like `return` and `yield` - -@conditional ; keywords related to conditionals (e.g. `if` / `else`) -@conditional.ternary ; ternary operator (e.g. `?` / `:`) - -@repeat ; keywords related to loops (e.g. `for` / `while`) -@debug ; keywords related to debugging -@label ; GOTO and other labels (e.g. `label:` in C) -@include ; keywords for including modules (e.g. `import` / `from` in Python) -@exception ; keywords related to exceptions (e.g. `throw` / `catch`) -``` - -#### Types - -```scheme -@type ; type or class definitions and annotations -@type.builtin ; built-in types -@type.definition ; identifiers in type definitions (e.g. `typedef ` in C) -@type.qualifier ; type qualifiers (e.g. `const`) - -@storageclass ; modifiers that affect storage in memory or life-time -@attribute ; attribute annotations (e.g. Python decorators) -@field ; object and struct fields -@property ; similar to `@field` -``` - -#### Identifiers - -```scheme -@variable ; various variable names -@variable.builtin ; built-in variable names (e.g. `this`) - -@constant ; constant identifiers -@constant.builtin ; built-in constant values -@constant.macro ; constants defined by the preprocessor - -@namespace ; modules or namespaces -@symbol ; symbols or atoms -``` - -#### Text +#### Markup Mainly for markup languages. -```scheme -@text ; non-structured text -@text.strong ; bold text -@text.emphasis ; text with emphasis -@text.underline ; underlined text -@text.strike ; strikethrough text -@text.title ; text that is part of a title -@text.quote ; text quotations -@text.uri ; URIs (e.g. hyperlinks) -@text.math ; math environments (e.g. `$ ... $` in LaTeX) -@text.environment ; text environments of markup languages -@text.environment.name ; text indicating the type of an environment -@text.reference ; text references, footnotes, citations, etc. +```query +@markup.strong ; bold text +@markup.italic ; text with emphasis +@markup.strikethrough ; strikethrough text +@markup.underline ; underlined text (only for literal underline markup!) -@text.literal ; literal or verbatim text (e.g., inline code) -@text.literal.block ; literal or verbatim text as a stand-alone block +@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 ; (use priority 90 for blocks with injections) -@text.todo ; todo notes -@text.note ; info notes -@text.warning ; warning notes -@text.danger ; danger/error notes - -@text.diff.add ; added text (for diff files) -@text.diff.delete ; deleted text (for diff files) +@markup.list ; list markers +@markup.list.checked ; checked todo-style list markers +@markup.list.unchecked ; unchecked todo-style list markers ``` -#### Tags - -Used for XML-like tags. +```query +@diff.plus ; added text (for diff files) +@diff.minus ; deleted text (for diff files) +@diff.delta ; changed text (for diff files) +``` ```scheme @tag ; XML tag names @@ -224,17 +230,14 @@ Used for XML-like tags. @tag.delimiter ; XML tag delimiters ``` -#### Conceal +#### Non-highlighting captures -```scheme -@conceal ; for captures that are only used for concealing +```query +@none ; completely disable the highlight +@conceal ; captures that are only meant to be concealed ``` -`@conceal` must be followed by `(#set! conceal "")`. - -#### Spell - -```scheme +```query @spell ; for defining regions to be spellchecked @nospell ; for defining regions that should NOT be spellchecked ``` @@ -243,6 +246,25 @@ The main types of nodes which are spell checked are: - Comments - Strings; where it makes sense. Strings that have interpolation or are typically used for non text purposes are not spell checked (e.g. bash). +#### Predicates + +Captures can be restricted according to node contents using [predicates](https://neovim.io/doc/user/treesitter.html#treesitter-predicates). For performance reasons, prefer earlier predicates in this list: + +1. `#eq?` (literal match) +2. `#any-of?` (one of several literal matches) +3. `#lua-match?` (match against a [Lua pattern](https://neovim.io/doc/user/luaref.html#lua-pattern)) +4. `#match?`/`#vim-match?` (match against a [Vim regular expression](https://neovim.io/doc/user/pattern.html#regexp) + +#### Conceal + +Captures can be concealed by setting the [`conceal` metadata](https://neovim.io/doc/user/treesitter.html#treesitter-highlight-conceal), e.g.., +```query + (fenced_code_block_delimiter @markup.raw.block (#set! conceal "")) +``` +The capture should be meaningful to allow proper highlighting when `set conceallevel=0`. If the unconcealed capture should not be highlighted (e.g., because an earlier pattern handles this), you can use `@conceal`. + +A conceal can be restricted to part of the capture via the [`#offset!` directive](https://neovim.io/doc/user/treesitter.html#treesitter-directive-offset%21). + #### Priority Captures can be assigned a priority to control precedence of highlights via the diff --git a/queries/ada/highlights.scm b/queries/ada/highlights.scm index 694763073..a88935b2a 100644 --- a/queries/ada/highlights.scm +++ b/queries/ada/highlights.scm @@ -44,7 +44,7 @@ "aliased" "constant" "renames" -] @storageclass +] @keyword.storage [ "mod" "new" @@ -56,7 +56,7 @@ [ "with" "use" -] @include +] @keyword.import [ "body" "function" @@ -79,7 +79,7 @@ "parallel" "reverse" "some" -] @repeat +] @keyword.repeat [ "return" ] @keyword.return @@ -90,11 +90,11 @@ "then" "elsif" "select" -] @conditional +] @keyword.conditional [ "exception" "raise" -] @exception +] @keyword.exception (comment) @comment @spell (string_literal) @string (character_literal) @string @@ -109,24 +109,24 @@ (entry_declaration . (identifier) @function) ;; Some keywords should take different categories depending on the context -(use_clause "use" @include "type" @include) -(with_clause "private" @include) -(with_clause "limited" @include) -(use_clause (_) @namespace) -(with_clause (_) @namespace) +(use_clause "use" @keyword.import "type" @keyword.import) +(with_clause "private" @keyword.import) +(with_clause "limited" @keyword.import) +(use_clause (_) @module) +(with_clause (_) @module) (loop_statement "end" @keyword.repeat) -(if_statement "end" @conditional) +(if_statement "end" @keyword.conditional) (loop_parameter_specification "in" @keyword.repeat) (loop_parameter_specification "in" @keyword.repeat) (iterator_specification ["in" "of"] @keyword.repeat) (range_attribute_designator "range" @keyword.repeat) -(raise_statement "with" @exception) +(raise_statement "with" @keyword.exception) -(gnatprep_declarative_if_statement) @preproc -(gnatprep_if_statement) @preproc -(gnatprep_identifier) @preproc +(gnatprep_declarative_if_statement) @keyword.directive +(gnatprep_if_statement) @keyword.directive +(gnatprep_identifier) @keyword.directive (subprogram_declaration "is" @keyword.function "abstract" @keyword.function) (aspect_specification "with" @keyword.function) diff --git a/queries/agda/highlights.scm b/queries/agda/highlights.scm index a5c42c0a8..6ff55d2fc 100644 --- a/queries/agda/highlights.scm +++ b/queries/agda/highlights.scm @@ -27,13 +27,13 @@ ;; Imports and Module Declarations -"import" @include +"import" @keyword.import -(module_name) @namespace +(module_name) @module ;; Pragmas and comments -(pragma) @preproc +(pragma) @keyword.directive (comment) @comment @spell diff --git a/queries/angular/highlights.scm b/queries/angular/highlights.scm index dc926bb9a..42d69c28a 100644 --- a/queries/angular/highlights.scm +++ b/queries/angular/highlights.scm @@ -6,7 +6,7 @@ name: (identifier) @function) (pipe_call arguments: (pipe_arguments - (identifier) @parameter)) + (identifier) @variable.parameter)) (structural_assignment operator: (identifier) @keyword) diff --git a/queries/apex/highlights.scm b/queries/apex/highlights.scm index f5ce0b9fb..729a84d15 100644 --- a/queries/apex/highlights.scm +++ b/queries/apex/highlights.scm @@ -28,10 +28,10 @@ ;; Methods (method_declaration - name: (identifier) @method) + name: (identifier) @function.method) (method_invocation - name: (identifier) @method.call) + name: (identifier) @function.method.call) (super) @function.builtin @@ -77,7 +77,7 @@ (method_declaration (formal_parameters (formal_parameter - name: (identifier) @parameter))) + name: (identifier) @variable.parameter))) (constructor_declaration name: (identifier) @constructor) @@ -142,10 +142,10 @@ (field_declaration declarator: (variable_declarator - name: (identifier) @field)) + name: (identifier) @variable.member)) (field_access - field: (identifier) @field) + field: (identifier) @variable.member) ; Variables @@ -194,14 +194,14 @@ "if" "else" "switch" -] @conditional +] @keyword.conditional [ "for" "while" "do" "break" -] @repeat +] @keyword.repeat [ "return" @@ -212,7 +212,7 @@ "finally" "try" "catch" - ] @exception + ] @keyword.exception "new" @keyword.operator diff --git a/queries/awk/highlights.scm b/queries/awk/highlights.scm index 4faf496e6..6d3b7ff0b 100644 --- a/queries/awk/highlights.scm +++ b/queries/awk/highlights.scm @@ -47,21 +47,21 @@ (number) @number (string) @string -(regex) @string.regex +(regex) @string.regexp (escape_sequence) @string.escape (comment) @comment @spell -((program . (comment) @preproc) - (#lua-match? @preproc "^#!/")) +((program . (comment) @keyword.directive) + (#lua-match? @keyword.directive "^#!/")) -(ns_qualified_name (namespace) @namespace) +(ns_qualified_name (namespace) @module) (ns_qualified_name "::" @punctuation.delimiter) (func_def name: (_ (identifier) @function) @function) (func_call name: (_ (identifier) @function) @function) -(func_def (param_list (identifier) @parameter)) +(func_def (param_list (identifier) @variable.parameter)) [ "print" @@ -92,7 +92,7 @@ "while" "for" "in" -] @repeat +] @keyword.repeat [ "if" @@ -100,14 +100,14 @@ "switch" "case" "default" -] @conditional +] @keyword.conditional [ "@include" "@load" -] @include +] @keyword.import -"@namespace" @preproc +"@namespace" @keyword.directive [ "BEGIN" @@ -156,7 +156,7 @@ (ternary_exp [ "?" ":" -] @conditional.ternary) +] @keyword.conditional.ternary) (update_exp [ "++" diff --git a/queries/bash/highlights.scm b/queries/bash/highlights.scm index 4ffae437e..033f9fbee 100644 --- a/queries/bash/highlights.scm +++ b/queries/bash/highlights.scm @@ -70,7 +70,7 @@ "case" "in" "esac" -] @conditional +] @keyword.conditional [ "for" @@ -79,7 +79,7 @@ "select" "until" "while" -] @repeat +] @keyword.repeat [ "declare" @@ -115,7 +115,7 @@ (arithmetic_expansion "," @punctuation.delimiter) -(ternary_expression [ "?" ":" ] @conditional.ternary) +(ternary_expression [ "?" ":" ] @keyword.conditional.ternary) (binary_expression operator: _ @operator) (unary_expression operator: _ @operator) @@ -140,8 +140,8 @@ (command argument: [ - (word) @parameter - (concatenation (word) @parameter) + (word) @variable.parameter + (concatenation (word) @variable.parameter) ]) (number) @number @@ -149,7 +149,7 @@ (#lua-match? @number "^[0-9]+$")) (file_redirect - destination: (word) @parameter) + destination: (word) @variable.parameter) (file_descriptor) @operator @@ -175,12 +175,12 @@ (#lua-match? @constant "^[A-Z][A-Z_0-9]*$")) (case_item - value: (word) @parameter) + value: (word) @variable.parameter) [ (regex) (extglob_pattern) -] @string.regex +] @string.regexp -((program . (comment) @preproc) - (#lua-match? @preproc "^#!/")) +((program . (comment) @keyword.directive) + (#lua-match? @keyword.directive "^#!/")) diff --git a/queries/bass/highlights.scm b/queries/bass/highlights.scm index 296443d52..3a16cbb34 100644 --- a/queries/bass/highlights.scm +++ b/queries/bass/highlights.scm @@ -21,13 +21,13 @@ ;; Namespaces (symbind - (symbol) @namespace + (symbol) @module . (keyword)) ;; Includes -((symbol) @include - (#any-of? @include "use" "import" "load")) +((symbol) @keyword.import + (#any-of? @keyword.import "use" "import" "load")) ;; Keywords @@ -43,13 +43,13 @@ ((list . (symbol) @keyword.function . (symbol) @function - (symbol)? @parameter) + (symbol)? @variable.parameter) (#any-of? @keyword.function "def" "defop" "defn" "fn")) ((cons . (symbol) @keyword.function . (symbol) @function - (symbol)? @parameter) + (symbol)? @variable.parameter) (#any-of? @keyword.function "def" "defop" "defn" "fn")) ((symbol) @function.builtin @@ -60,13 +60,13 @@ ;; Conditionals -((symbol) @conditional - (#any-of? @conditional "if" "case" "cond" "when")) +((symbol) @keyword.conditional + (#any-of? @keyword.conditional "if" "case" "cond" "when")) ;; Repeats -((symbol) @repeat - (#any-of? @repeat "each")) +((symbol) @keyword.repeat + (#any-of? @keyword.repeat "each")) ;; Operators @@ -89,7 +89,7 @@ (escape_sequence) @string.escape -(path) @text.uri @string.special +(path) @string.special.url (number) @number diff --git a/queries/beancount/highlights.scm b/queries/beancount/highlights.scm index 5817fb2e2..191dc519e 100644 --- a/queries/beancount/highlights.scm +++ b/queries/beancount/highlights.scm @@ -1,4 +1,4 @@ -(date) @field +(date) @variable.member (txn) @attribute (account) @type (amount) @number diff --git a/queries/bibtex/highlights.scm b/queries/bibtex/highlights.scm index bd240f581..602ed5d27 100644 --- a/queries/bibtex/highlights.scm +++ b/queries/bibtex/highlights.scm @@ -23,10 +23,10 @@ (number) @number (field - name: (identifier) @field) + name: (identifier) @variable.member) (token - (identifier) @parameter) + (identifier) @variable.parameter) [ (brace_word) @@ -36,7 +36,7 @@ [ (key_brace) (key_paren) -] @symbol +] @string.special.symbol (string name: (identifier) @constant) diff --git a/queries/bicep/highlights.scm b/queries/bicep/highlights.scm index b555edb37..ae691c76b 100644 --- a/queries/bicep/highlights.scm +++ b/queries/bicep/highlights.scm @@ -1,16 +1,16 @@ ; Includes (import_statement - "import" @include) + "import" @keyword.import) (import_with_statement - "import" @include - "with" @include) + "import" @keyword.import + "with" @keyword.import) ; Namespaces (module_declaration - (identifier) @namespace) + (identifier) @module) ; Builtins @@ -80,16 +80,16 @@ ; Parameters (parameter_declaration - (identifier) @parameter + (identifier) @variable.parameter (_)) (call_expression function: (_) - (arguments (identifier) @parameter)) + (arguments (identifier) @variable.parameter)) (call_expression function: (_) - (arguments (member_expression object: (identifier) @parameter))) + (arguments (member_expression object: (identifier) @variable.parameter))) ; Variables @@ -118,16 +118,16 @@ ; Conditionals -"if" @conditional +"if" @keyword.conditional (ternary_expression - "?" @conditional.ternary - ":" @conditional.ternary) + "?" @keyword.conditional.ternary + ":" @keyword.conditional.ternary) ; Loops (for_statement - "for" @repeat + "for" @keyword.repeat "in" ":" @punctuation.delimiter) @@ -179,8 +179,8 @@ (string) @string (import_string "'" @string - (import_name) @namespace - "@" @symbol + (import_name) @module + "@" @string.special.symbol (import_version) @string.special) (escape_sequence) @string.escape diff --git a/queries/bitbake/highlights.scm b/queries/bitbake/highlights.scm index 46eaf11e3..c4f51d624 100644 --- a/queries/bitbake/highlights.scm +++ b/queries/bitbake/highlights.scm @@ -6,7 +6,7 @@ "require" "export" "import" -] @include +] @keyword.import ; Keywords @@ -37,16 +37,16 @@ (yield "from" @keyword.return) (future_import_statement - "from" @include + "from" @keyword.import "__future__" @constant.builtin) -(import_from_statement "from" @include) -"import" @include +(import_from_statement "from" @keyword.import) +"import" @keyword.import -(aliased_import "as" @include) +(aliased_import "as" @keyword.import) -["if" "elif" "else"] @conditional +["if" "elif" "else"] @keyword.conditional -["for" "while" "break" "continue"] @repeat +["for" "while" "break" "continue"] @keyword.repeat [ "try" @@ -54,13 +54,13 @@ "except*" "raise" "finally" -] @exception +] @keyword.exception -(raise_statement "from" @exception) +(raise_statement "from" @keyword.exception) (try_statement (else_clause - "else" @exception)) + "else" @keyword.exception)) [ "addtask" @@ -73,7 +73,7 @@ [ "before" "after" -] @storageclass +] @keyword.storage [ "append" @@ -132,11 +132,11 @@ ; Fields -(flag) @field +(flag) @variable.member ((attribute - attribute: (python_identifier) @field) - (#lua-match? @field "^[%l_].*$")) + attribute: (python_identifier) @variable.member) + (#lua-match? @variable.member "^[%l_].*$")) ; Functions @@ -145,7 +145,7 @@ (call function: (attribute - attribute: (python_identifier) @method.call)) + attribute: (python_identifier) @function.method.call)) ((call function: (python_identifier) @constructor) @@ -200,34 +200,34 @@ ; Namespace -(inherit_path) @namespace +(inherit_path) @module ;; Normal parameters (parameters - (python_identifier) @parameter) + (python_identifier) @variable.parameter) ;; Lambda parameters (lambda_parameters - (python_identifier) @parameter) + (python_identifier) @variable.parameter) (lambda_parameters (tuple_pattern - (python_identifier) @parameter)) + (python_identifier) @variable.parameter)) ; Default parameters (keyword_argument - name: (python_identifier) @parameter) + name: (python_identifier) @variable.parameter) ; Naming parameters on call-site (default_parameter - name: (python_identifier) @parameter) + name: (python_identifier) @variable.parameter) (typed_parameter - (python_identifier) @parameter) + (python_identifier) @variable.parameter) (typed_default_parameter - (python_identifier) @parameter) + (python_identifier) @variable.parameter) ; Variadic parameters *args, **kwargs (parameters (list_splat_pattern ; *args - (python_identifier) @parameter)) + (python_identifier) @variable.parameter)) (parameters (dictionary_splat_pattern ; **kwargs - (python_identifier) @parameter)) + (python_identifier) @variable.parameter)) ;; Literals @@ -239,7 +239,7 @@ (#eq? @variable.builtin "cls")) (integer) @number -(float) @float +(float) @number.float ; Operators @@ -309,7 +309,7 @@ "\"" ] @string -(include_path) @string.special +(include_path) @string.special.path [ (escape_sequence) diff --git a/queries/blueprint/highlights.scm b/queries/blueprint/highlights.scm index d85986ffd..3e3a8e4a8 100644 --- a/queries/blueprint/highlights.scm +++ b/queries/blueprint/highlights.scm @@ -9,7 +9,7 @@ (boolean) @boolean -(using) @include +(using) @keyword.import (template) @keyword @@ -34,11 +34,11 @@ (template_definition (template_name_qualifier) @type.qualifier) -(import_statement (gobject_library) @namespace) +(import_statement (gobject_library) @module) -(import_statement (version_number) @float) +(import_statement (version_number) @number.float) -(float) @float +(float) @number.float (number) @number [ diff --git a/queries/c/highlights.scm b/queries/c/highlights.scm index 74656e336..33c30f095 100644 --- a/queries/c/highlights.scm +++ b/queries/c/highlights.scm @@ -1,4 +1,4 @@ -; 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)) (preproc_def (preproc_arg) @variable) @@ -27,14 +27,14 @@ "do" "continue" "break" -] @repeat +] @keyword.repeat [ "if" "else" "case" "switch" -] @conditional +] @keyword.conditional [ "#if" @@ -46,11 +46,11 @@ "#elifdef" "#elifndef" (preproc_directive) -] @preproc +] @keyword.directive -"#define" @define +"#define" @keyword.directive.define -"#include" @include +"#include" @keyword.import [ ";" ":" "," "::" ] @punctuation.delimiter @@ -111,7 +111,7 @@ (false) ] @boolean -(conditional_expression [ "?" ":" ] @conditional.ternary) +(conditional_expression [ "?" ":" ] @keyword.conditional.ternary) (string_literal) @string (system_lib_string) @string @@ -140,7 +140,7 @@ (type_descriptor) ] @type -(storage_class_specifier) @storageclass +(storage_class_specifier) @keyword.storage [ (type_qualifier) @@ -149,7 +149,7 @@ ] @type.qualifier (linkage_specification - "extern" @storageclass) + "extern" @keyword.storage) (type_definition declarator: (type_identifier) @type.definition) @@ -236,13 +236,13 @@ ;; Parameters (parameter_declaration - declarator: (identifier) @parameter) + declarator: (identifier) @variable.parameter) (parameter_declaration - declarator: (array_declarator) @parameter) + declarator: (array_declarator) @variable.parameter) (parameter_declaration - declarator: (pointer_declarator) @parameter) + declarator: (pointer_declarator) @variable.parameter) ; K&R functions ; To enable support for K&R functions, @@ -250,24 +250,24 @@ ; 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) @parameter) +; (parameter_list (identifier) @variable.parameter) ; ; (function_definition ; declarator: _ ; (declaration -; declarator: (identifier) @parameter)) +; declarator: (identifier) @variable.parameter)) ; ; (function_definition ; declarator: _ ; (declaration -; declarator: (array_declarator) @parameter)) +; declarator: (array_declarator) @variable.parameter)) ; ; (function_definition ; declarator: _ ; (declaration -; declarator: (pointer_declarator) @parameter)) +; declarator: (pointer_declarator) @variable.parameter)) -(preproc_params (identifier) @parameter) +(preproc_params (identifier) @variable.parameter) [ "__attribute__" diff --git a/queries/c_sharp/highlights.scm b/queries/c_sharp/highlights.scm index bc74a16ff..1cd566728 100644 --- a/queries/c_sharp/highlights.scm +++ b/queries/c_sharp/highlights.scm @@ -5,10 +5,10 @@ (#has-ancestor? @keyword accessor_declaration)) (method_declaration - name: (identifier) @method) + name: (identifier) @function.method) (local_function_statement - name: (identifier) @method) + name: (identifier) @function.method) (method_declaration type: (identifier) @type) @@ -23,41 +23,41 @@ (invocation_expression (member_access_expression - name: (identifier) @method.call)) + name: (identifier) @function.method.call)) (invocation_expression function: (conditional_access_expression (member_binding_expression - name: (identifier) @method.call))) + name: (identifier) @function.method.call))) (namespace_declaration - name: [(qualified_name) (identifier)] @namespace) + name: [(qualified_name) (identifier)] @module) (qualified_name (identifier) @type) (invocation_expression - (identifier) @method.call) + (identifier) @function.method.call) (field_declaration (variable_declaration (variable_declarator - (identifier) @field))) + (identifier) @variable.member))) (initializer_expression (assignment_expression - left: (identifier) @field)) + left: (identifier) @variable.member)) (parameter_list (parameter - name: (identifier) @parameter)) + name: (identifier) @variable.parameter)) (parameter_list (parameter type: (identifier) @type)) (integer_literal) @number -(real_literal) @float +(real_literal) @number.float (null_literal) @constant.builtin (character_literal) @character @@ -154,12 +154,12 @@ ; Generic Method invocation with generic type (invocation_expression function: (generic_name - . (identifier) @method.call)) + . (identifier) @function.method.call)) (invocation_expression (member_access_expression (generic_name - (identifier) @method))) + (identifier) @function.method))) (base_list (identifier) @type) @@ -194,10 +194,10 @@ (identifier) @type) (name_colon - (identifier) @parameter) + (identifier) @variable.parameter) -(warning_directive) @text.warning -(error_directive) @exception +(warning_directive) @comment.warning +(error_directive) @keyword.exception (define_directive (identifier) @constant) @constant.macro @@ -231,7 +231,7 @@ (elif_directive) (else_directive) (endif_directive) -] @conditional +] @keyword.conditional (if_directive (identifier) @constant) @@ -245,14 +245,14 @@ "continue" "goto" "foreach" -] @repeat +] @keyword.repeat [ "try" "catch" "throw" "finally" -] @exception +] @keyword.exception [ "+" @@ -304,7 +304,7 @@ ":" ] @punctuation.delimiter -(conditional_expression ["?" ":"] @conditional.ternary) +(conditional_expression ["?" ":"] @keyword.conditional.ternary) [ "[" @@ -325,10 +325,10 @@ [ "using" "as" -] @include +] @keyword.import (alias_qualified_name - (identifier "global") @include) + (identifier "global") @keyword.import) [ "with" @@ -385,7 +385,7 @@ "static" "volatile" "required" -] @storageclass +] @keyword.storage [ "abstract" diff --git a/queries/cairo/highlights.scm b/queries/cairo/highlights.scm index 715644fcc..f8bacede9 100644 --- a/queries/cairo/highlights.scm +++ b/queries/cairo/highlights.scm @@ -3,17 +3,17 @@ [ "%builtins" "%lang" -] @preproc +] @keyword.directive ; Includes -(import_statement [ "from" "import" ] @include module_name: (dotted_name (identifier) @namespace . )) +(import_statement [ "from" "import" ] @keyword.import module_name: (dotted_name (identifier) @module . )) [ "as" "use" "mod" -] @include +] @keyword.import ; Variables @@ -21,24 +21,24 @@ ; Namespaces -(namespace_definition (identifier) @namespace) +(namespace_definition (identifier) @module) (mod_item - name: (identifier) @namespace) + name: (identifier) @module) -(use_list (self) @namespace) +(use_list (self) @module) -(scoped_use_list (self) @namespace) +(scoped_use_list (self) @module) (scoped_identifier - path: (identifier) @namespace) + path: (identifier) @module) (scoped_identifier (scoped_identifier - name: (identifier) @namespace)) + name: (identifier) @module)) (scoped_type_identifier - path: (identifier) @namespace) + path: (identifier) @module) ((scoped_identifier path: (identifier) @type) @@ -65,13 +65,13 @@ (#lua-match? @constant "^[A-Z]")) (scoped_use_list - path: (identifier) @namespace) + path: (identifier) @module) (scoped_use_list path: (scoped_identifier - (identifier) @namespace)) + (identifier) @module)) -(use_list (scoped_identifier (identifier) @namespace . (_))) +(use_list (scoped_identifier (identifier) @module . (_))) (use_list (identifier) @type (#lua-match? @type "^[A-Z]")) @@ -125,47 +125,47 @@ [ "tempvar" "extern" -] @storageclass +] @keyword.storage [ "if" "else" "match" -] @conditional +] @keyword.conditional [ "loop" -] @repeat +] @keyword.repeat [ "assert" "static_assert" "nopanic" -] @exception +] @keyword.exception ; Fields -(implicit_arguments (typed_identifier (identifier) @field)) +(implicit_arguments (typed_identifier (identifier) @variable.member)) -(member_expression "." (identifier) @field) +(member_expression "." (identifier) @variable.member) -(call_expression (assignment_expression left: (identifier) @field)) +(call_expression (assignment_expression left: (identifier) @variable.member)) -(tuple_expression (assignment_expression left: (identifier) @field)) +(tuple_expression (assignment_expression left: (identifier) @variable.member)) -(field_identifier) @field +(field_identifier) @variable.member -(shorthand_field_initializer (identifier) @field) +(shorthand_field_initializer (identifier) @variable.member) ; Parameters -(arguments (typed_identifier (identifier) @parameter)) +(arguments (typed_identifier (identifier) @variable.parameter)) -(call_expression (tuple_expression (assignment_expression left: (identifier) @parameter))) +(call_expression (tuple_expression (assignment_expression left: (identifier) @variable.parameter))) -(return_type (tuple_type (named_type . (identifier) @parameter))) +(return_type (tuple_type (named_type . (identifier) @variable.parameter))) -(parameter (identifier) @parameter) +(parameter (identifier) @variable.parameter) ; Builtins @@ -202,7 +202,7 @@ ; Types -(struct_definition . (identifier) @type (typed_identifier (identifier) @field)?) +(struct_definition . (identifier) @type (typed_identifier (identifier) @variable.member)?) (named_type (identifier) @type .) diff --git a/queries/capnp/highlights.scm b/queries/capnp/highlights.scm index f3954ae8c..80c8262e7 100644 --- a/queries/capnp/highlights.scm +++ b/queries/capnp/highlights.scm @@ -3,7 +3,7 @@ [ (unique_id) (top_level_annotation_body) -] @preproc +] @keyword.directive ; Includes @@ -12,9 +12,9 @@ "$import" "embed" "using" -] @include +] @keyword.import -(import_path) @string @text.uri +(import_path) @string.special.path ; Keywords @@ -53,11 +53,11 @@ [ (annotation_definition_identifier) (method_identifier) -] @method +] @function.method ; Fields -(field_identifier) @field +(field_identifier) @variable.member ; Properties @@ -68,9 +68,9 @@ [ (param_identifier) (return_identifier) -] @parameter +] @variable.parameter -(annotation_target) @parameter.builtin +(annotation_target) @variable.parameter.builtin ; Constants @@ -110,7 +110,7 @@ (namespace) ] @string -(namespace) @text.underline +(namespace) @string.special (escape_sequence) @string.escape @@ -118,11 +118,11 @@ (number) @number -(float) @float +(float) @number.float (boolean) @boolean -(data_hex) @symbol +(data_hex) @string.special.symbol ; Punctuation diff --git a/queries/chatito/highlights.scm b/queries/chatito/highlights.scm index 12a344523..913787012 100644 --- a/queries/chatito/highlights.scm +++ b/queries/chatito/highlights.scm @@ -12,14 +12,14 @@ [":" ","] @punctuation.delimiter -(["\"" "'"] @punctuation.special @conceal +(["\"" "'"] @punctuation.special (#set! conceal "")) ["%" "?" "#"] @character.special ;; Entities -(intent) @namespace +(intent) @module (slot) @type @@ -37,13 +37,13 @@ ;; Import -"import" @include +"import" @keyword.import -(file) @string.special +(file) @string.special.path ;; Text -(word) @text @spell +(word) @spell ;; Comment diff --git a/queries/clojure/highlights.scm b/queries/clojure/highlights.scm index 2d3922adf..d0b0bf0cb 100644 --- a/queries/clojure/highlights.scm +++ b/queries/clojure/highlights.scm @@ -17,14 +17,14 @@ (dis_expr) @comment (#set! "priority" 105) ; Higher priority to mark the whole sexpr as a comment ) -(kwd_lit) @symbol +(kwd_lit) @string.special.symbol (str_lit) @string (num_lit) @number (char_lit) @character (bool_lit) @boolean (nil_lit) @constant.builtin (comment) @comment @spell -(regex_lit) @string.regex +(regex_lit) @string.regexp ["'" "`"] @string.escape @@ -49,13 +49,13 @@ ; Quoted symbols (quoting_lit - (sym_lit) @symbol) + (sym_lit) @string.special.symbol) (syn_quoting_lit - (sym_lit) @symbol) + (sym_lit) @string.special.symbol) ; Used in destructure pattern -((sym_lit) @parameter - (#lua-match? @parameter "^[&]")) +((sym_lit) @variable.parameter + (#lua-match? @variable.parameter "^[&]")) ; Inline function variables ((sym_lit) @variable.builtin @@ -102,19 +102,19 @@ ; Interop ; (.instanceMember instance args*) ; (.instanceMember Classname args*) -((sym_lit) @method - (#lua-match? @method "^%.[^-]")) +((sym_lit) @function.method + (#lua-match? @function.method "^%.[^-]")) ; (.-instanceField instance) -((sym_lit) @field - (#lua-match? @field "^%.%-.*")) +((sym_lit) @variable.member + (#lua-match? @variable.member "^%.%-.*")) ; Classname/staticField -((sym_lit) @field - (#lua-match? @field "^[%u].*/.+")) +((sym_lit) @variable.member + (#lua-match? @variable.member "^[%u].*/.+")) ; (Classname/staticMethod args*) (list_lit . - (sym_lit) @method - (#lua-match? @method "^[%u].*/.+")) + (sym_lit) @function.method + (#lua-match? @function.method "^[%u].*/.+")) ;; TODO: Special casing for the `.` macro ; Operators @@ -145,29 +145,29 @@ (#any-of? @comment "comment")) ; Conditionals -((sym_lit) @conditional - (#any-of? @conditional +((sym_lit) @keyword.conditional + (#any-of? @keyword.conditional "case" "cond" "cond->" "cond->>" "condp")) -((sym_lit) @conditional - (#any-of? @conditional +((sym_lit) @keyword.conditional + (#any-of? @keyword.conditional "if" "if-let" "if-not" "if-some")) -((sym_lit) @conditional - (#any-of? @conditional +((sym_lit) @keyword.conditional + (#any-of? @keyword.conditional "when" "when-first" "when-let" "when-not" "when-some")) ; Repeats -((sym_lit) @repeat - (#any-of? @repeat +((sym_lit) @keyword.repeat + (#any-of? @keyword.repeat "doseq" "dotimes" "for" "loop" "recur" "while")) ; Exception -((sym_lit) @exception - (#any-of? @exception +((sym_lit) @keyword.exception + (#any-of? @keyword.exception "throw" "try" "catch" "finally")) ; Includes -((sym_lit) @include - (#any-of? @include "ns" "import" "require" "use")) +((sym_lit) @keyword.import + (#any-of? @keyword.import "ns" "import" "require" "use")) ; Builtin macros ;; TODO: Do all these items belong here? @@ -350,18 +350,18 @@ ;; TODO: Reproduce bug and file ticket ;. ;[(vec_lit - ; (sym_lit)* @parameter) + ; (sym_lit)* @variable.parameter) ; (list_lit ; (vec_lit - ; (sym_lit)* @parameter))]) + ; (sym_lit)* @variable.parameter))]) ;[((list_lit ; (vec_lit -; (sym_lit) @parameter) +; (sym_lit) @variable.parameter) ; (_) ; + ; ((vec_lit -; (sym_lit) @parameter) +; (sym_lit) @variable.parameter) ; (_))) @@ -378,4 +378,4 @@ (sym_lit) @_include (#eq? @_include "ns") . - (sym_lit) @namespace) + (sym_lit) @module) diff --git a/queries/cmake/highlights.scm b/queries/cmake/highlights.scm index af6b70cc8..bdad657e3 100644 --- a/queries/cmake/highlights.scm +++ b/queries/cmake/highlights.scm @@ -21,7 +21,7 @@ (normal_command (identifier) @function) -["ENV" "CACHE"] @storageclass +["ENV" "CACHE"] @keyword.storage ["$" "{" "}" "<" ">"] @punctuation.special ["(" ")"] @punctuation.bracket @@ -37,18 +37,18 @@ (elseif) (else) (endif) -] @conditional +] @keyword.conditional [ (foreach) (endforeach) (while) (endwhile) -] @repeat +] @keyword.repeat (normal_command - (identifier) @repeat - (#match? @repeat "\\c^(continue|break)$") + (identifier) @keyword.repeat + (#match? @keyword.repeat "\\c^(continue|break)$") ) (normal_command (identifier) @keyword.return @@ -59,7 +59,7 @@ (function) (argument_list . (argument) @function - (argument)* @parameter + (argument)* @variable.parameter ) ) @@ -67,7 +67,7 @@ (macro) (argument_list . (argument) @function.macro - (argument)* @parameter + (argument)* @variable.parameter ) ) @@ -134,7 +134,7 @@ (argument_list . (argument) ( - (argument) @_cache @storageclass + (argument) @_cache @keyword.storage . (argument) @_type @type (#any-of? @_cache "CACHE") @@ -148,8 +148,8 @@ (#match? @_function "\\c^unset$") (argument_list . (argument) - (argument) @storageclass - (#any-of? @storageclass "CACHE" "PARENT_SCOPE") + (argument) @keyword.storage + (#any-of? @keyword.storage "CACHE" "PARENT_SCOPE") ) ) @@ -213,5 +213,5 @@ (escape_sequence) @string.escape -((source_file . (line_comment) @preproc) - (#lua-match? @preproc "^#!/")) +((source_file . (line_comment) @keyword.directive) + (#lua-match? @keyword.directive "^#!/")) diff --git a/queries/comment/highlights.scm b/queries/comment/highlights.scm index 87491c7a5..41b653e93 100644 --- a/queries/comment/highlights.scm +++ b/queries/comment/highlights.scm @@ -1,41 +1,43 @@ ((tag - (name) @text.todo @nospell - ("(" @punctuation.bracket (user) @constant ")" @punctuation.bracket)? + (name) @comment.todo @nospell + ("(" @punctuation.bracket + (user) @constant + ")" @punctuation.bracket)? ":" @punctuation.delimiter) - (#any-of? @text.todo "TODO" "WIP")) + (#any-of? @comment.todo "TODO" "WIP")) -("text" @text.todo @nospell - (#any-of? @text.todo "TODO" "WIP")) +("text" @comment.todo @nospell + (#any-of? @comment.todo "TODO" "WIP")) ((tag - (name) @text.note @nospell + (name) @comment.note @nospell ("(" @punctuation.bracket (user) @constant ")" @punctuation.bracket)? ":" @punctuation.delimiter) - (#any-of? @text.note "NOTE" "XXX" "INFO" "DOCS" "PERF" "TEST")) + (#any-of? @comment.note "NOTE" "XXX" "INFO" "DOCS" "PERF" "TEST")) -("text" @text.note @nospell - (#any-of? @text.note "NOTE" "XXX" "INFO" "DOCS" "PERF" "TEST")) +("text" @comment.note @nospell + (#any-of? @comment.note "NOTE" "XXX" "INFO" "DOCS" "PERF" "TEST")) ((tag - (name) @text.warning @nospell + (name) @comment.warning @nospell ("(" @punctuation.bracket (user) @constant ")" @punctuation.bracket)? ":" @punctuation.delimiter) - (#any-of? @text.warning "HACK" "WARNING" "WARN" "FIX")) + (#any-of? @comment.warning "HACK" "WARNING" "WARN" "FIX")) -("text" @text.warning @nospell - (#any-of? @text.warning "HACK" "WARNING" "WARN" "FIX")) +("text" @comment.warning @nospell + (#any-of? @comment.warning "HACK" "WARNING" "WARN" "FIX")) ((tag - (name) @text.danger @nospell + (name) @comment.error @nospell ("(" @punctuation.bracket (user) @constant ")" @punctuation.bracket)? ":" @punctuation.delimiter) - (#any-of? @text.danger "FIXME" "BUG" "ERROR")) + (#any-of? @comment.error "FIXME" "BUG" "ERROR")) -("text" @text.danger @nospell - (#any-of? @text.danger "FIXME" "BUG" "ERROR")) +("text" @comment.error @nospell + (#any-of? @comment.error "FIXME" "BUG" "ERROR")) ; Issue number (#123) ("text" @number (#lua-match? @number "^#[0-9]+$")) -((uri) @text.uri @nospell) +((uri) @string.special.url @nospell) diff --git a/queries/commonlisp/highlights.scm b/queries/commonlisp/highlights.scm index 55c0c8fc2..4c6501de6 100644 --- a/queries/commonlisp/highlights.scm +++ b/queries/commonlisp/highlights.scm @@ -10,14 +10,14 @@ (defun_header function_name: (_) @function) (defun_header - lambda_list: (list_lit (sym_lit) @parameter)) + lambda_list: (list_lit (sym_lit) @variable.parameter)) (defun_header keyword: (defun_keyword "defmethod") - lambda_list: (list_lit (list_lit . (sym_lit) . (sym_lit) @symbol))) + lambda_list: (list_lit (list_lit . (sym_lit) . (sym_lit) @string.special.symbol))) (defun_header - lambda_list: (list_lit (list_lit . (sym_lit) @parameter . (_)))) + lambda_list: (list_lit (list_lit . (sym_lit) @variable.parameter . (_)))) (defun_header - specifier: (sym_lit) @symbol) + specifier: (sym_lit) @string.special.symbol) [":" "::" "."] @punctuation.special @@ -51,14 +51,14 @@ ] @function.macro "=" @operator -(include_reader_macro) @symbol +(include_reader_macro) @string.special.symbol ["#C" "#c"] @number -[(kwd_lit) (self_referential_reader_macro)] @symbol +[(kwd_lit) (self_referential_reader_macro)] @string.special.symbol (package_lit - package: (_) @namespace) -"cl" @namespace + package: (_) @module) +"cl" @module (str_lit) @string @@ -119,10 +119,10 @@ (#lua-match? @constant "^[+].+[+]$")) (var_quoting_lit - marker: "#'" @symbol - value: (_) @symbol) + marker: "#'" @string.special.symbol + value: (_) @string.special.symbol) -["#" "#p" "#P"] @symbol +["#" "#p" "#P"] @string.special.symbol (list_lit . @@ -137,8 +137,8 @@ (#match? @operator "^([+*-+=<>]|<=|>=|/=)$")) -((sym_lit) @symbol -(#lua-match? @symbol "^[&]")) +((sym_lit) @string.special.symbol +(#lua-match? @string.special.symbol "^[&]")) [(array_dimension) "#0A" "#0a"] @number diff --git a/queries/cooklang/highlights.scm b/queries/cooklang/highlights.scm index 4ced465bd..2ed9f2049 100644 --- a/queries/cooklang/highlights.scm +++ b/queries/cooklang/highlights.scm @@ -2,21 +2,21 @@ (ingredient "@" @tag - (name)? @text.title + (name)? @markup.heading (amount (quantity)? @number (units)? @tag.attribute)?) (timer "~" @tag - (name)? @text.title + (name)? @markup.heading (amount (quantity)? @number (units)? @tag.attribute)?) (cookware "#" @tag - (name)? @text.title + (name)? @markup.heading (amount (quantity)? @number (units)? @tag.attribute)?) diff --git a/queries/corn/highlights.scm b/queries/corn/highlights.scm index 200c33e1b..18672fd04 100644 --- a/queries/corn/highlights.scm +++ b/queries/corn/highlights.scm @@ -15,6 +15,6 @@ (string) @string (integer) @number -(float) @float +(float) @number.float (boolean) @boolean (null) @keyword diff --git a/queries/cpon/highlights.scm b/queries/cpon/highlights.scm index 36df3555c..370c48b1b 100644 --- a/queries/cpon/highlights.scm +++ b/queries/cpon/highlights.scm @@ -19,7 +19,7 @@ (number) @number -(float) @float +(float) @number.float (boolean) @boolean @@ -38,7 +38,7 @@ [ "<" ">" ] @punctuation.bracket -(("\"" @conceal) +(("\"" @string) (#set! conceal "")) ; Comments diff --git a/queries/cpp/highlights.scm b/queries/cpp/highlights.scm index b9a8cfec0..4919a1b3f 100644 --- a/queries/cpp/highlights.scm +++ b/queries/cpp/highlights.scm @@ -1,33 +1,33 @@ ; inherits: c -((identifier) @field - (#lua-match? @field "^m_.*$")) +((identifier) @variable.member + (#lua-match? @variable.member "^m_.*$")) (parameter_declaration - declarator: (reference_declarator) @parameter) + declarator: (reference_declarator) @variable.parameter) ; function(Foo ...foo) (variadic_parameter_declaration declarator: (variadic_declarator - (_) @parameter)) + (_) @variable.parameter)) ; int foo = 0 (optional_parameter_declaration - declarator: (_) @parameter) + declarator: (_) @variable.parameter) -;(field_expression) @parameter ;; How to highlight this? +;(field_expression) @variable.parameter ;; How to highlight this? (((field_expression - (field_identifier) @method)) @_parent + (field_identifier) @function.method)) @_parent (#has-parent? @_parent template_method function_declarator)) (field_declaration - (field_identifier) @field) + (field_identifier) @variable.member) (field_initializer (field_identifier) @property) (function_declarator - declarator: (field_identifier) @method) + declarator: (field_identifier) @function.method) (concept_definition name: (identifier) @type.definition) @@ -37,17 +37,17 @@ (auto) @type.builtin -(namespace_identifier) @namespace +(namespace_identifier) @module ((namespace_identifier) @type (#lua-match? @type "^[%u]")) (case_statement value: (qualified_identifier (identifier) @constant)) -(using_declaration . "using" . "namespace" . [(qualified_identifier) (identifier)] @namespace) +(using_declaration . "using" . "namespace" . [(qualified_identifier) (identifier)] @module) (destructor_name - (identifier) @method) + (identifier) @function.method) ; functions (function_declarator @@ -125,10 +125,10 @@ ; methods (function_declarator (template_method - (field_identifier) @method)) + (field_identifier) @function.method)) (call_expression (field_expression - (field_identifier) @method.call)) + (field_identifier) @function.method.call)) ; constructors @@ -176,7 +176,7 @@ "catch" "noexcept" "throw" -] @exception +] @keyword.exception [ diff --git a/queries/css/highlights.scm b/queries/css/highlights.scm index 383d6b7dc..8beba125f 100644 --- a/queries/css/highlights.scm +++ b/queries/css/highlights.scm @@ -9,7 +9,7 @@ (from) ] @keyword -"@import" @include +"@import" @keyword.import (comment) @comment @spell @@ -57,7 +57,7 @@ (attribute_name) ] @property -(namespace_name) @namespace +(namespace_name) @module ((property_name) @type.definition (#lua-match? @type.definition "^[-][-]")) diff --git a/queries/cuda/highlights.scm b/queries/cuda/highlights.scm index 275871deb..0a90dbf67 100644 --- a/queries/cuda/highlights.scm +++ b/queries/cuda/highlights.scm @@ -8,6 +8,6 @@ "__global__" "__forceinline__" "__noinline__" -] @storageclass +] @keyword.storage "__launch_bounds__" @type.qualifier diff --git a/queries/cue/highlights.scm b/queries/cue/highlights.scm index 00088dec9..47fd36311 100644 --- a/queries/cue/highlights.scm +++ b/queries/cue/highlights.scm @@ -3,18 +3,18 @@ [ "package" "import" -] @include +] @keyword.import ; Namespaces -(package_identifier) @namespace +(package_identifier) @module (import_spec ["." "_"] @punctuation.special) [ (attr_path) (package_path) -] @text.uri ;; In attributes +] @string.special.url ;; In attributes ; Attributes @@ -22,13 +22,13 @@ ; Conditionals -"if" @conditional +"if" @keyword.conditional ; Repeats [ "for" -] @repeat +] @keyword.repeat (for_clause "_" @punctuation.special) @@ -69,7 +69,7 @@ (field (label - (identifier) @field)) + (identifier) @variable.member)) (selector_expression (_) @@ -135,11 +135,11 @@ (number) @number -(float) @float +(float) @number.float (si_unit (float) - (_) @symbol) + (_) @string.special.symbol) (boolean) @boolean diff --git a/queries/d/highlights.scm b/queries/d/highlights.scm index 229a9bf55..18ced7246 100644 --- a/queries/d/highlights.scm +++ b/queries/d/highlights.scm @@ -59,7 +59,7 @@ (integer_literal) @number -(float_literal) @float +(float_literal) @number.float [ "true" @@ -88,12 +88,12 @@ (parameter (var_declarator - (identifier) @parameter + (identifier) @variable.parameter ) ) (function_literal - (identifier) @parameter + (identifier) @variable.parameter ) (constructor @@ -112,7 +112,7 @@ "else" "if" "switch" -] @conditional +] @keyword.conditional [ "break" @@ -122,7 +122,7 @@ "foreach" "foreach_reverse" "while" -] @repeat +] @keyword.repeat [ "__parameters" @@ -209,7 +209,7 @@ "finally" "throw" "try" -] @exception +] @keyword.exception "null" @constant.builtin @@ -218,7 +218,7 @@ "const" "immutable" "shared" -] @storageclass +] @keyword.storage [ "abstract" @@ -241,11 +241,11 @@ . (identifier) @type.definition) (module_declaration - "module" @include + "module" @keyword.import ) (import_declaration - "import" @include + "import" @keyword.import ) (type) @type @@ -272,8 +272,8 @@ (fundamental_type) @type.builtin -(module_fully_qualified_name (packages (package_name) @namespace)) -(module_name) @namespace +(module_fully_qualified_name (packages (package_name) @module)) +(module_name) @module (at_attribute) @attribute diff --git a/queries/dart/highlights.scm b/queries/dart/highlights.scm index 3ebdae0ea..be2824da5 100644 --- a/queries/dart/highlights.scm +++ b/queries/dart/highlights.scm @@ -84,11 +84,11 @@ (scoped_identifier scope: (identifier) @type) (function_signature - name: (identifier) @method) + name: (identifier) @function.method) (getter_signature - (identifier) @method) + (identifier) @function.method) (setter_signature - name: (identifier) @method) + name: (identifier) @function.method) (enum_declaration name: (identifier) @type) (enum_constant @@ -131,10 +131,10 @@ ; Parameters ; -------------------- (formal_parameter - name: (identifier) @parameter) + name: (identifier) @variable.parameter) (named_argument - (label (identifier) @parameter)) + (label (identifier) @variable.parameter)) ; Literals ; -------------------- @@ -147,7 +147,7 @@ ; (hex_floating_point_literal) ] @number -(symbol_literal) @symbol +(symbol_literal) @string.special.symbol (string_literal) @string (true) @boolean (false) @boolean @@ -165,7 +165,7 @@ "as" "show" "hide" -] @include +] @keyword.import ; Reserved words (cannot be used as identifiers) [ @@ -257,7 +257,7 @@ "static" "typedef")) -["if" "else" "switch" "default"] @conditional +["if" "else" "switch" "default"] @keyword.conditional [ "try" @@ -265,6 +265,6 @@ "catch" "finally" (break_statement) -] @exception +] @keyword.exception -["do" "while" "continue" "for"] @repeat +["do" "while" "continue" "for"] @keyword.repeat diff --git a/queries/devicetree/highlights.scm b/queries/devicetree/highlights.scm index a7504260a..6236189bf 100644 --- a/queries/devicetree/highlights.scm +++ b/queries/devicetree/highlights.scm @@ -3,7 +3,7 @@ [ (preproc_include) (dtsi_include) -] @include +] @keyword.import (preproc_def) @constant.macro (preproc_function_def) @function.macro @@ -22,7 +22,7 @@ (integer_literal) @number (identifier) @variable -(node (identifier) @namespace) +(node (identifier) @module) (property (identifier) @property) (labeled_item (identifier) @label) (call_expression (identifier) @function.macro) diff --git a/queries/dhall/highlights.scm b/queries/dhall/highlights.scm index cd068efd0..5e2a77848 100644 --- a/queries/dhall/highlights.scm +++ b/queries/dhall/highlights.scm @@ -2,11 +2,11 @@ ;; Imports -(missing_import) @include +(missing_import) @keyword.import (local_import) @string.special.path -(http_import) @string @text.uri +(http_import) @string.special.url [ (env_variable) @@ -29,7 +29,7 @@ ;; Parameters -(lambda_expression label: (label) @parameter) +(lambda_expression label: (label) @variable.parameter) ;; Variables @@ -44,13 +44,13 @@ ; Fields -(record_literal_entry (label) @field) +(record_literal_entry (label) @variable.member) -(record_type_entry (label) @field) +(record_type_entry (label) @variable.member) (selector (selector_dot) - (_) @field) + (_) @variable.member) ;; Keywords @@ -141,7 +141,7 @@ "if" "then" "else" -] @conditional +] @keyword.conditional ;; Literals @@ -157,7 +157,7 @@ (natural_literal) ] @number -(double_literal) @float +(double_literal) @number.float (boolean_literal) @boolean diff --git a/queries/diff/highlights.scm b/queries/diff/highlights.scm index 4b9cbad60..4288913d9 100644 --- a/queries/diff/highlights.scm +++ b/queries/diff/highlights.scm @@ -1,5 +1,5 @@ -[(addition) (new_file)] @text.diff.add -[(deletion) (old_file)] @text.diff.delete +[(addition) (new_file)] @diff.plus +[(deletion) (old_file)] @diff.minus (commit) @constant (location) @attribute diff --git a/queries/dot/highlights.scm b/queries/dot/highlights.scm index 6916d3721..f204ce44c 100644 --- a/queries/dot/highlights.scm +++ b/queries/dot/highlights.scm @@ -33,12 +33,12 @@ (subgraph id: (id - (identifier) @namespace) + (identifier) @module) ) (attribute name: (id - (identifier) @field) + (identifier) @variable.member) ) (attribute @@ -48,6 +48,6 @@ (comment) @comment -(preproc) @preproc +(preproc) @keyword.directive (comment) @spell diff --git a/queries/doxygen/highlights.scm b/queries/doxygen/highlights.scm index 42d76a448..fadcdfa80 100644 --- a/queries/doxygen/highlights.scm +++ b/queries/doxygen/highlights.scm @@ -10,14 +10,14 @@ ((tag (tag_name) @_param - (identifier) @parameter) + (identifier) @variable.parameter) (#any-of? @_param "@param" "\\param")) (function (identifier) @function) (function_link) @function -(emphasis) @text.emphasis +(emphasis) @markup.italic [ "\\a" @@ -30,7 +30,7 @@ "in" "out" "inout" -] @storageclass +] @keyword.storage "~" @operator diff --git a/queries/dtd/highlights.scm b/queries/dtd/highlights.scm index 678e61f92..fac7d923c 100644 --- a/queries/dtd/highlights.scm +++ b/queries/dtd/highlights.scm @@ -1,6 +1,6 @@ ;; XML declaration -(XMLDecl "xml" @preproc) +(XMLDecl "xml" @keyword.directive) (XMLDecl [ "version" "encoding" ] @tag.attribute) @@ -10,12 +10,12 @@ ;; Processing instructions -(PI) @preproc +(PI) @keyword.directive ;; Element declaration (elementdecl - "ELEMENT" @define + "ELEMENT" @keyword.directive.define (Name) @tag) (contentspec @@ -30,7 +30,7 @@ ;; Entity declaration (GEDecl - "ENTITY" @define + "ENTITY" @keyword.directive.define (Name) @constant) (GEDecl (EntityValue) @string) @@ -42,7 +42,7 @@ ;; Parsed entity declaration (PEDecl - "ENTITY" @define + "ENTITY" @keyword.directive.define "%" @operator (Name) @function.macro) @@ -51,18 +51,18 @@ ;; Notation declaration (NotationDecl - "NOTATION" @preproc + "NOTATION" @keyword.directive (Name) @label) ((NotationDecl (ExternalID - (SystemLiteral (URI) @string.special)) + (SystemLiteral (URI) @string.special.url)) (#set! "priority" 105))) ;; Attlist declaration (AttlistDecl - "ATTLIST" @define + "ATTLIST" @keyword.directive.define (Name) @tag) (AttDef (Name) @tag.attribute) @@ -100,7 +100,7 @@ (PubidLiteral) @string.special -(SystemLiteral (URI) @text.uri) +(SystemLiteral (URI) @string.special.url) ;; Delimiters & punctuation @@ -114,6 +114,6 @@ ;; Misc -[ "INCLUDE" "IGNORE" ] @include +[ "INCLUDE" "IGNORE" ] @keyword.import (Comment) @comment @spell diff --git a/queries/ebnf/highlights.scm b/queries/ebnf/highlights.scm index 00acf59e0..b0dfa2737 100644 --- a/queries/ebnf/highlights.scm +++ b/queries/ebnf/highlights.scm @@ -13,8 +13,8 @@ ((identifier) @type (#lua-match? @type "^%u")) -((identifier) @symbol - (#lua-match? @symbol "^%l")) +((identifier) @string.special.symbol + (#lua-match? @string.special.symbol "^%l")) ((identifier) @constant (#lua-match? @constant "^%u[%u%d_]+$")) diff --git a/queries/ecma/highlights.scm b/queries/ecma/highlights.scm index 664421701..b6fd64668 100644 --- a/queries/ecma/highlights.scm +++ b/queries/ecma/highlights.scm @@ -86,25 +86,25 @@ (generator_function_declaration name: (identifier) @function) (method_definition - name: [(property_identifier) (private_property_identifier)] @method) + name: [(property_identifier) (private_property_identifier)] @function.method) (method_definition name: (property_identifier) @constructor (#eq? @constructor "constructor")) (pair - key: (property_identifier) @method + key: (property_identifier) @function.method value: (function)) (pair - key: (property_identifier) @method + key: (property_identifier) @function.method value: (arrow_function)) (assignment_expression left: (member_expression - property: (property_identifier) @method) + property: (property_identifier) @function.method) right: (arrow_function)) (assignment_expression left: (member_expression - property: (property_identifier) @method) + property: (property_identifier) @function.method) right: (function)) (variable_declarator @@ -129,13 +129,13 @@ (call_expression function: (member_expression - property: [(property_identifier) (private_property_identifier)] @method.call)) + property: [(property_identifier) (private_property_identifier)] @function.method.call)) ; Builtins ;--------- -((identifier) @namespace.builtin - (#eq? @namespace.builtin "Intl")) +((identifier) @module.builtin + (#eq? @module.builtin "Intl")) ((identifier) @function.builtin (#any-of? @function.builtin @@ -159,7 +159,7 @@ ; Variables ;---------- (namespace_import - (identifier) @namespace) + (identifier) @module) ; Decorators ;---------- @@ -192,15 +192,15 @@ ((comment) @comment.documentation (#lua-match? @comment.documentation "^/[*][*][^*].*[*]/$")) -(hash_bang_line) @preproc +(hash_bang_line) @keyword.directive -((string_fragment) @preproc - (#eq? @preproc "use strict")) +((string_fragment) @keyword.directive + (#eq? @keyword.directive "use strict")) (string) @string (template_string) @string (escape_sequence) @string.escape -(regex_pattern) @string.regex +(regex_pattern) @string.regexp (regex_flags) @character.special (regex "/" @punctuation.bracket) ; Regex delimiters @@ -266,7 +266,7 @@ ] @operator (binary_expression "/" @operator) -(ternary_expression ["?" ":"] @conditional.ternary) +(ternary_expression ["?" ":"] @keyword.conditional.ternary) (unary_expression ["!" "~" "-" "+"] @operator) (unary_expression ["delete" "void"] @keyword.operator) @@ -289,17 +289,17 @@ "else" "switch" "case" -] @conditional +] @keyword.conditional [ "import" "from" -] @include +] @keyword.import -(export_specifier "as" @include) -(import_specifier "as" @include) -(namespace_export "as" @include) -(namespace_import "as" @include) +(export_specifier "as" @keyword.import) +(import_specifier "as" @keyword.import) +(namespace_export "as" @keyword.import) +(namespace_import "as" @keyword.import) [ "for" @@ -307,7 +307,7 @@ "do" "while" "continue" -] @repeat +] @keyword.repeat [ "break" @@ -352,9 +352,9 @@ "try" "catch" "finally" -] @exception +] @keyword.exception (export_statement "default" @keyword) (switch_default - "default" @conditional) + "default" @keyword.conditional) diff --git a/queries/elixir/highlights.scm b/queries/elixir/highlights.scm index 0fbde2959..5a9297fc7 100644 --- a/queries/elixir/highlights.scm +++ b/queries/elixir/highlights.scm @@ -40,7 +40,7 @@ (quoted_atom) (keyword) (quoted_keyword) -] @symbol +] @string.special.symbol ; Interpolation (interpolation ["#{" "}"] @string.special) @@ -52,7 +52,7 @@ (integer) @number ; Floats -(float) @float +(float) @number.float ; Characters [ diff --git a/queries/elm/highlights.scm b/queries/elm/highlights.scm index fbd3a4c3f..11bc0a00d 100644 --- a/queries/elm/highlights.scm +++ b/queries/elm/highlights.scm @@ -16,7 +16,7 @@ "else" (case) (of) -] @conditional +] @keyword.conditional [ "let" @@ -32,7 +32,7 @@ [ (import) (exposing) -] @include +] @keyword.import ; Punctuation @@ -79,14 +79,14 @@ (lower_case_identifier) @variable) (value_qid - ((dot) (lower_case_identifier) @field)) + ((dot) (lower_case_identifier) @variable.member)) (field_access_expr - ((dot) (lower_case_identifier) @field)) + ((dot) (lower_case_identifier) @variable.member)) (function_declaration_left - (anything_pattern (underscore) @parameter)) + (anything_pattern (underscore) @variable.parameter)) (function_declaration_left - (lower_pattern (lower_case_identifier) @parameter)) + (lower_pattern (lower_case_identifier) @variable.parameter)) ; Functions @@ -136,13 +136,13 @@ ;-------- (module_declaration - (upper_case_qid (upper_case_identifier) @namespace)) + (upper_case_qid (upper_case_identifier) @module)) (import_clause - (upper_case_qid (upper_case_identifier) @namespace)) + (upper_case_qid (upper_case_identifier) @module)) (as_clause - (upper_case_identifier) @namespace) + (upper_case_identifier) @module) (value_expr - (value_qid (upper_case_identifier) @namespace)) + (value_qid (upper_case_identifier) @module)) ; Types diff --git a/queries/elsa/highlights.scm b/queries/elsa/highlights.scm index c787dadd8..8e52b6f5b 100644 --- a/queries/elsa/highlights.scm +++ b/queries/elsa/highlights.scm @@ -11,11 +11,11 @@ ; Method -(method) @method +(method) @function.method ; Parameter -(parameter) @parameter +(parameter) @variable.parameter ; Variables diff --git a/queries/elvish/highlights.scm b/queries/elvish/highlights.scm index 886f5bcda..d6243549f 100644 --- a/queries/elvish/highlights.scm +++ b/queries/elvish/highlights.scm @@ -1,21 +1,21 @@ (comment) @comment @spell -["if" "elif"] @conditional -(if (else "else" @conditional)) +["if" "elif"] @keyword.conditional +(if (else "else" @keyword.conditional)) -["while" "for"] @repeat -(while (else "else" @repeat)) -(for (else "else" @repeat)) +["while" "for"] @keyword.repeat +(while (else "else" @keyword.repeat)) +(for (else "else" @keyword.repeat)) -["try" "catch" "finally"] @exception -(try (else "else" @exception)) +["try" "catch" "finally"] @keyword.exception +(try (else "else" @keyword.exception)) -"use" @include -(import (bareword) @string.special) +"use" @keyword.import +(import (bareword) @string.special.path) (wildcard ["*" "**" "?"] @character.special) -(command argument: (bareword) @parameter) +(command argument: (bareword) @variable.parameter) (command head: (identifier) @function.call) ((command head: (identifier) @keyword.return) (#eq? @keyword.return "return")) @@ -34,7 +34,7 @@ "fn" @keyword.function (identifier) @function) -(parameter_list) @parameter +(parameter_list) @variable.parameter (parameter_list "|" @punctuation.bracket) ["var" "set" "tmp" "del"] @keyword diff --git a/queries/erlang/highlights.scm b/queries/erlang/highlights.scm index 0c129e23f..da0d1e600 100644 --- a/queries/erlang/highlights.scm +++ b/queries/erlang/highlights.scm @@ -3,7 +3,7 @@ (char) @character (integer) @number -(float) @float +(float) @number.float (comment) @comment @spell @@ -70,12 +70,12 @@ "end" "maybe" "else" -] @conditional +] @keyword.conditional [ "catch" "try" -] @exception +] @keyword.exception ((atom) @boolean (#any-of? @boolean "true" "false")) @@ -86,26 +86,26 @@ (pp_define lhs: _ @constant.macro (#set! "priority" 101) ) -(_preprocessor_directive) @preproc (#set! "priority" 99) +(_preprocessor_directive) @keyword.directive (#set! "priority" 99) ;; Attributes -(pp_include) @include -(pp_include_lib) @include -(export_attribute) @include +(pp_include) @keyword.import +(pp_include_lib) @keyword.import +(export_attribute) @keyword.import (export_type_attribute) @type.definition (export_type_attribute types: (fa fun: _ @type (#set! "priority" 101))) -(behaviour_attribute) @include -(module_attribute (atom) @namespace) @include +(behaviour_attribute) @keyword.import +(module_attribute (atom) @module) @keyword.import (wild_attribute name: (attr_name name: _ @attribute)) @attribute ;; Records (record_expr) @type -(record_field_expr _ @field) @type -(record_field_name _ @field) @type +(record_field_expr _ @variable.member) @type +(record_field_name _ @variable.member) @type (record_name "#" @type name: _ @type) @type (record_decl name: _ @type) @type.definition -(record_field name: _ @field) -(record_field name: _ @field ty: _ @type) +(record_field name: _ @variable.member) +(record_field name: _ @variable.member ty: _ @type) ;; Type alias (type_alias name: _ @type) @type.definition @@ -115,7 +115,7 @@ ;;; expr_function_call (call expr: [(atom) (remote) (var)] @function) -(call (atom) @exception (#any-of? @exception "error" "throw" "exit")) +(call (atom) @keyword.exception (#any-of? @keyword.exception "error" "throw" "exit")) ;;; Parenthesized expression: (SomeFunc)(), only highlight the parens (call diff --git a/queries/facility/highlights.scm b/queries/facility/highlights.scm index c10ff49be..060ccd05c 100644 --- a/queries/facility/highlights.scm +++ b/queries/facility/highlights.scm @@ -75,7 +75,7 @@ name: (identifier) @variable) (method - name: (identifier) @method) + name: (identifier) @function.method) (number_literal) @number (string_literal) @string diff --git a/queries/fennel/highlights.scm b/queries/fennel/highlights.scm index 14c91d976..620c42ef3 100644 --- a/queries/fennel/highlights.scm +++ b/queries/fennel/highlights.scm @@ -30,11 +30,11 @@ (multi_symbol "." @punctuation.delimiter - (symbol) @field) + (symbol) @variable.member) (multi_symbol_method ":" @punctuation.delimiter - (symbol) @method.call .) + (symbol) @function.method.call .) (list . (symbol) @function.call) (list . (multi_symbol (symbol) @function.call .)) @@ -42,7 +42,7 @@ ((symbol) @variable.builtin (#lua-match? @variable.builtin "^[$]")) -(binding) @symbol +(binding) @string.special.symbol [ "fn" @@ -64,16 +64,16 @@ [ "for" "each" -] @repeat -((symbol) @repeat - (#any-of? @repeat +] @keyword.repeat +((symbol) @keyword.repeat + (#any-of? @keyword.repeat "while")) [ "match" -] @conditional -((symbol) @conditional - (#any-of? @conditional +] @keyword.conditional +((symbol) @keyword.conditional + (#any-of? @keyword.conditional "if" "when")) [ @@ -89,8 +89,8 @@ (#any-of? @keyword "comment" "do" "doc" "eval-compiler" "lua" "macros" "quote" "tset" "values")) -((symbol) @include - (#any-of? @include +((symbol) @keyword.import + (#any-of? @keyword.import "require" "require-macros" "import-macros" "include")) [ diff --git a/queries/firrtl/highlights.scm b/queries/firrtl/highlights.scm index ace8f712e..5f165eb32 100644 --- a/queries/firrtl/highlights.scm +++ b/queries/firrtl/highlights.scm @@ -1,8 +1,8 @@ ; Namespaces -(circuit (identifier) @namespace) +(circuit (identifier) @module) -(module (identifier) @namespace) +(module (identifier) @module) ; Types @@ -52,14 +52,14 @@ [ "input" "output" -] @storageclass +] @keyword.storage ; Conditionals [ "when" "else" -] @conditional +] @keyword.conditional ; Annotations @@ -99,31 +99,31 @@ "reader" "writer" "readwriter" -] @field.builtin +] @variable.member.builtin -((field_id) @field +((field_id) @variable.member (#set! "priority" 105)) -(port (identifier) @field) +(port (identifier) @variable.member) -(wire (identifier) @field) +(wire (identifier) @variable.member) -(cmem (identifier) @field) +(cmem (identifier) @variable.member) -(smem (identifier) @field) +(smem (identifier) @variable.member) -(memory (identifier) @field) +(memory (identifier) @variable.member) -(register (identifier) @field) +(register (identifier) @variable.member) ; Parameters -(primitive_operation (identifier) @parameter) +(primitive_operation (identifier) @variable.parameter) -(mux (identifier) @parameter) -(printf (identifier) @parameter) -(reset (identifier) @parameter) -(stop (identifier) @parameter) +(mux (identifier) @variable.parameter) +(printf (identifier) @variable.parameter) +(reset (identifier) @variable.parameter) +(stop (identifier) @variable.parameter) ; Variables @@ -151,7 +151,7 @@ (number_str) @string.special -(double) @float +(double) @number.float (string) @string diff --git a/queries/fish/highlights.scm b/queries/fish/highlights.scm index 8d0fba29a..28ddf0b98 100644 --- a/queries/fish/highlights.scm +++ b/queries/fish/highlights.scm @@ -35,29 +35,29 @@ [ "if" "end" -] @conditional) +] @keyword.conditional) (switch_statement [ "switch" "end" -] @conditional) +] @keyword.conditional) (case_clause [ "case" -] @conditional) +] @keyword.conditional) (else_clause [ "else" -] @conditional) +] @keyword.conditional) (else_if_clause [ "else" "if" -] @conditional) +] @keyword.conditional) ;; Loops/Blocks @@ -65,19 +65,19 @@ [ "while" "end" -] @repeat) +] @keyword.repeat) (for_statement [ "for" "end" -] @repeat) +] @keyword.repeat) (begin_statement [ "begin" "end" -] @repeat) +] @keyword.repeat) ;; Keywords @@ -106,7 +106,7 @@ (command argument: [ - (word) @parameter (#lua-match? @parameter "^[-]") + (word) @variable.parameter (#lua-match? @variable.parameter "^[-]") ] ) @@ -137,7 +137,7 @@ option: [ (word) (concatenation (word)) - ] @parameter (#lua-match? @parameter "^[-]") + ] @variable.parameter (#lua-match? @variable.parameter "^[-]") ) ;; Strings @@ -159,5 +159,5 @@ ((word) @boolean (#any-of? @boolean "true" "false")) -((program . (comment) @preproc) - (#lua-match? @preproc "^#!/")) +((program . (comment) @keyword.directive) + (#lua-match? @keyword.directive "^#!/")) diff --git a/queries/foam/highlights.scm b/queries/foam/highlights.scm index aba33b4e8..33370df66 100644 --- a/queries/foam/highlights.scm +++ b/queries/foam/highlights.scm @@ -11,32 +11,32 @@ ;; Macros (macro - "$" @conditional - (prev_scope)* @conditional - (identifier)* @namespace + "$" @keyword.conditional + (prev_scope)* @keyword.conditional + (identifier)* @module ) ;; Directives -"#" @conditional +"#" @keyword.conditional (preproc_call - directive: (identifier)* @conditional - argument: (identifier)* @namespace + directive: (identifier)* @keyword.conditional + argument: (identifier)* @module ) ((preproc_call - argument: (identifier)* @namespace) @conditional - (#eq? @conditional "ifeq")) -((preproc_call) @conditional - (#any-of? @conditional "else" "endif")) + argument: (identifier)* @module) @keyword.conditional + (#eq? @keyword.conditional "ifeq")) +((preproc_call) @keyword.conditional + (#any-of? @keyword.conditional "else" "endif")) ;; Literals -(number_literal) @float +(number_literal) @number.float (string_literal) @string (escape_sequence) @string.escape (boolean) @boolean ;; Treat [m^2 s^-2] the same as if it was put in numbers format -(dimensions dimension: (identifier) @float) +(dimensions dimension: (identifier) @number.float) ;; Punctuation [ diff --git a/queries/fortran/highlights.scm b/queries/fortran/highlights.scm index 3e85212bd..c2eaa6a7e 100644 --- a/queries/fortran/highlights.scm +++ b/queries/fortran/highlights.scm @@ -1,26 +1,26 @@ ; Preprocs -(preproc_file_line) @preproc +(preproc_file_line) @keyword.directive ; Namespaces (program_statement - (name) @namespace) + (name) @module) (end_program_statement - (name) @namespace) + (name) @module) (module_statement - (name) @namespace) + (name) @module) (end_module_statement - (name) @namespace) + (name) @module) (submodule_statement - (name) @namespace) + (name) @module) (end_submodule_statement - (name) @namespace) + (name) @module) ; Includes @@ -28,7 +28,7 @@ "import" "include" "use" -] @include +] @keyword.import (import_statement "," @@ -147,7 +147,7 @@ "in" "inout" "out" -] @storageclass +] @keyword.storage ; Labels @@ -211,7 +211,7 @@ [ "error" -] @exception +] @keyword.exception ; Conditionals @@ -224,7 +224,7 @@ "if" "then" "where" -] @conditional +] @keyword.conditional ; Repeats @@ -238,7 +238,7 @@ "continue" "cycle" "exit" -] @repeat +] @keyword.repeat ; Variables @@ -247,10 +247,10 @@ ; Parameters (keyword_argument - name: (identifier) @parameter) + name: (identifier) @variable.parameter) (parameters - (identifier) @parameter) + (identifier) @variable.parameter) ; Properties diff --git a/queries/fsh/highlights.scm b/queries/fsh/highlights.scm index e4c0edd8e..9a11e279f 100644 --- a/queries/fsh/highlights.scm +++ b/queries/fsh/highlights.scm @@ -85,7 +85,7 @@ (flag) @constant ; Special Params -(code_value) @parameter +(code_value) @variable.parameter ; Extras (fsh_comment) @comment @spell diff --git a/queries/func/highlights.scm b/queries/func/highlights.scm index c1662a180..b5b6dde35 100644 --- a/queries/func/highlights.scm +++ b/queries/func/highlights.scm @@ -1,20 +1,20 @@ ; Include -"#include" @include +"#include" @keyword.import (include_path) @string ; Preproc [ "#pragma" -] @preproc +] @keyword.directive (pragma_directive [ "version" "not-version" "test-version-set" - ] @preproc) + ] @keyword.directive) ; Keywords @@ -40,14 +40,14 @@ "elseif" "elseifnot" "until" -] @conditional +] @keyword.conditional ; Exceptions [ "try" "catch" -] @exception +] @keyword.exception ; Repeats @@ -56,7 +56,7 @@ "forall" "repeat" "while" -] @repeat +] @keyword.repeat ; Qualifiers [ @@ -83,11 +83,11 @@ function: (identifier) @function) (method_call - method_name: (identifier) @method.call) + method_name: (identifier) @function.method.call) ; Parameters -(parameter) @parameter +(parameter) @variable.parameter ; Types diff --git a/queries/fusion/highlights.scm b/queries/fusion/highlights.scm index 81f471f68..e8c217e67 100644 --- a/queries/fusion/highlights.scm +++ b/queries/fusion/highlights.scm @@ -12,7 +12,7 @@ (afx_attribute (afx_property_identifier) @tag.attribute) -(afx_text) @text +(afx_text) @spell ; identifiers eel @@ -43,13 +43,13 @@ (include_statement [ "include" - ] @include - (source_file) @text.uri + ] @keyword.import + (source_file) @string.special.url ) (namespace_declaration "namespace" @keyword - (alias_namespace) @namespace) + (alias_namespace) @module) (type name: (type_name) @type) @@ -78,7 +78,7 @@ [ (package_name) (alias_namespace) -] @namespace +] @module (namespace_declaration "=" @operator) (assignment "=" @operator) @@ -117,4 +117,4 @@ ] @punctuation.delimiter (eel_ternary_expression - ["?" ":"] @conditional.ternary) + ["?" ":"] @keyword.conditional.ternary) diff --git a/queries/gdscript/highlights.scm b/queries/gdscript/highlights.scm index 535dcd009..1b4edbc7e 100644 --- a/queries/gdscript/highlights.scm +++ b/queries/gdscript/highlights.scm @@ -6,7 +6,7 @@ (comment) @comment @spell (string_name) @string (string) @string -(float) @float +(float) @number.float (integer) @number (null) @constant (setter) @function @@ -15,14 +15,14 @@ (get_body "get" @keyword.function) (static_keyword) @type.qualifier (tool_statement) @keyword -(breakpoint_statement) @debug +(breakpoint_statement) @keyword.debug (inferred_type) @operator [(true) (false)] @boolean [ (get_node) (node_path) -] @text.uri +] @string.special.url (class_name_statement (name) @type) @keyword @@ -44,14 +44,14 @@ (function_definition (name) @function (parameters - (identifier) @parameter)*) + (identifier) @variable.parameter)*) -(typed_parameter (identifier) @parameter) -(default_parameter (identifier) @parameter) +(typed_parameter (identifier) @variable.parameter) +(default_parameter (identifier) @variable.parameter) (call (identifier) @function.call) -(call (identifier) @include - (#any-of? @include "preload" "load")) +(call (identifier) @keyword.import + (#any-of? @keyword.import "preload" "load")) ;; Properties and Methods @@ -63,9 +63,9 @@ ; Same question but for methods? (class_definition - (body (function_definition (name) @method))) + (body (function_definition (name) @function.method))) -(attribute_call (identifier) @method.call) +(attribute_call (identifier) @function.method.call) (attribute (_) (identifier) @property) ;; Enums @@ -90,9 +90,9 @@ ["," "." ":"] @punctuation.delimiter -["if" "elif" "else" "match"] @conditional +["if" "elif" "else" "match"] @keyword.conditional -["for" "while" "break" "continue"] @repeat +["for" "while" "break" "continue"] @keyword.repeat [ "~" diff --git a/queries/git_config/highlights.scm b/queries/git_config/highlights.scm index 18b75bc64..df1dde803 100644 --- a/queries/git_config/highlights.scm +++ b/queries/git_config/highlights.scm @@ -2,13 +2,13 @@ (section_name) @type -((section_name) @include - (#eq? @include "include")) +((section_name) @keyword.import + (#eq? @keyword.import "include")) ((section_header - (section_name) @include + (section_name) @keyword.import (subsection_name)) - (#eq? @include "includeIf")) + (#eq? @keyword.import "includeIf")) (variable (name) @property) @@ -28,11 +28,11 @@ (string) @string -((string) @text.uri - (#lua-match? @text.uri "^[.]?[/]")) +((string) @string.special.path + (#lua-match? @string.special.path "^[.]?[/]")) -((string) @text.uri - (#lua-match? @text.uri "^[~]")) +((string) @string.special.path + (#lua-match? @string.special.path "^[~]")) (section_header [ diff --git a/queries/git_rebase/highlights.scm b/queries/git_rebase/highlights.scm index 466bd2f16..9ace6be26 100644 --- a/queries/git_rebase/highlights.scm +++ b/queries/git_rebase/highlights.scm @@ -1,6 +1,6 @@ ((command) @keyword (label)? @constant - (message)? @text @spell) + (message)? @none @spell) (option) @operator diff --git a/queries/gitattributes/highlights.scm b/queries/gitattributes/highlights.scm index 5d044b356..9f3c03dfb 100644 --- a/queries/gitattributes/highlights.scm +++ b/queries/gitattributes/highlights.scm @@ -22,7 +22,7 @@ ] @string.escape (attribute - (attr_name) @parameter) + (attr_name) @variable.parameter) (attribute (builtin_attr) @variable.builtin) @@ -37,15 +37,16 @@ (string_value) @string -(macro_tag) @preproc +(macro_tag) @keyword.directive (macro_def macro_name: (_) @property) -[ - (pattern_negation) - (redundant_escape) - (trailing_slash) -] @error +; we do not lint syntax errors +; [ +; (pattern_negation) +; (redundant_escape) +; (trailing_slash) +; ] @error (comment) @comment @spell diff --git a/queries/gitcommit/highlights.scm b/queries/gitcommit/highlights.scm index 9c70e19b5..d475021c2 100644 --- a/queries/gitcommit/highlights.scm +++ b/queries/gitcommit/highlights.scm @@ -1,17 +1,17 @@ (comment) @comment (generated_comment) @comment -(title) @text.title -(text) @text -(branch) @text.reference +(title) @markup.heading +; (text) @none +(branch) @markup.link (change) @keyword -(filepath) @text.uri +(filepath) @string.special.url (arrow) @punctuation.delimiter -(subject) @text.title @spell -(subject (overflow) @text @spell) +(subject) @markup.heading @spell +(subject (overflow) @none @spell) (subject (subject_prefix) @function @nospell) (prefix (type) @keyword @nospell) -(prefix (scope) @parameter @nospell) +(prefix (scope) @variable.parameter @nospell) (prefix [ "(" ")" @@ -21,12 +21,12 @@ "!" ] @punctuation.special) -(message) @text @spell +(message) @spell (trailer (token) @label) -(trailer (value) @text) +; (trailer (value) @none) -(breaking_change (token) @text.warning) -(breaking_change (value) @text @spell) +(breaking_change (token) @comment.warning) +(breaking_change (value) @none @spell) (scissor) @comment diff --git a/queries/gleam/highlights.scm b/queries/gleam/highlights.scm index bc392dec4..f74f17ab7 100644 --- a/queries/gleam/highlights.scm +++ b/queries/gleam/highlights.scm @@ -16,18 +16,18 @@ ; Imports [ "import" -] @include +] @keyword.import ; Conditionals [ "case" "if" -] @conditional +] @keyword.conditional ; Exceptions [ "assert" -] @exception +] @keyword.exception ; Punctuation [ @@ -99,9 +99,9 @@ ] @comment ; Modules & Imports -(module) @namespace -(import alias: ((identifier) @namespace)?) -(remote_type_identifier module: (identifier) @namespace) +(module) @module +(import alias: ((identifier) @module)?) +(remote_type_identifier module: (identifier) @module) (unqualified_import name: (identifier) @function) ; Strings @@ -113,11 +113,11 @@ ; Numbers (integer) @number -(float) @float +(float) @number.float ; Function Parameter Labels (function_call arguments: (arguments (argument label: (label) @label))) -(function_parameter label: (label)? @label name: (identifier) @parameter) +(function_parameter label: (label)? @label name: (identifier) @variable.parameter) ; Records (record arguments: (arguments (argument label: (label) @property)?)) @@ -154,7 +154,7 @@ ; External Functions (external_function name: (identifier) @function) -(external_function_body (string) @namespace . (string) @function) +(external_function_body (string) @module . (string) @function) ; Constructors (constructor_name) @type @constructor diff --git a/queries/glimmer/highlights.scm b/queries/glimmer/highlights.scm index a577ba425..059a1069c 100644 --- a/queries/glimmer/highlights.scm +++ b/queries/glimmer/highlights.scm @@ -23,10 +23,10 @@ (block_statement_end) @tag.delimiter ; Highlight `if`/`each`/`let` -(block_statement_start path: (identifier) @conditional) -(block_statement_end path: (identifier) @conditional) -((mustache_statement (identifier) @conditional) - (#lua-match? @conditional "else")) +(block_statement_start path: (identifier) @keyword.conditional) +(block_statement_end path: (identifier) @keyword.conditional) +((mustache_statement (identifier) @keyword.conditional) + (#lua-match? @keyword.conditional "else")) ; == Mustache Statements === @@ -66,8 +66,8 @@ (identifier) @function ]) (#not-any-of? @function "if" "yield")) -((helper_invocation helper: (identifier) @conditional) - (#eq? @conditional "if")) +((helper_invocation helper: (identifier) @keyword.conditional) + (#eq? @keyword.conditional "if")) ((helper_invocation helper: (identifier) @keyword) (#eq? @keyword "yield")) diff --git a/queries/glsl/highlights.scm b/queries/glsl/highlights.scm index b23ad797b..5825673c1 100644 --- a/queries/glsl/highlights.scm +++ b/queries/glsl/highlights.scm @@ -29,7 +29,7 @@ "subroutine" @keyword.function -(extension_storage_class) @storageclass +(extension_storage_class) @keyword.storage ((identifier) @variable.builtin (#lua-match? @variable.builtin "^gl_")) diff --git a/queries/gn/highlights.scm b/queries/gn/highlights.scm index 87082a30a..3b09a7753 100644 --- a/queries/gn/highlights.scm +++ b/queries/gn/highlights.scm @@ -1,17 +1,17 @@ ; Includes -"import" @include +"import" @keyword.import ; Conditionals [ "if" "else" -] @conditional +] @keyword.conditional ; Repeats -"foreach" @repeat +"foreach" @keyword.repeat ; Operators @@ -42,7 +42,7 @@ ; Fields -(scope_access field: (identifier) @field) +(scope_access field: (identifier) @variable.member) ; Literals diff --git a/queries/go/highlights.scm b/queries/go/highlights.scm index 65c00ea27..9c6fe1be8 100644 --- a/queries/go/highlights.scm +++ b/queries/go/highlights.scm @@ -8,10 +8,10 @@ (type_spec name: (type_identifier) @type.definition) (field_identifier) @property (identifier) @variable -(package_identifier) @namespace +(package_identifier) @module -(parameter_declaration (identifier) @parameter) -(variadic_parameter_declaration (identifier) @parameter) +(parameter_declaration (identifier) @variable.parameter) +(variadic_parameter_declaration (identifier) @variable.parameter) (label_name) @label @@ -25,7 +25,7 @@ (call_expression function: (selector_expression - field: (field_identifier) @method.call)) + field: (field_identifier) @function.method.call)) ; Function definitions @@ -33,10 +33,10 @@ name: (identifier) @function) (method_declaration - name: (field_identifier) @method) + name: (field_identifier) @function.method) (method_spec - name: (field_identifier) @method) + name: (field_identifier) @function.method) ; Constructors @@ -112,19 +112,19 @@ "return" @keyword.return "go" @keyword.coroutine -"for" @repeat +"for" @keyword.repeat [ "import" "package" -] @include +] @keyword.import [ "else" "case" "switch" "if" - ] @conditional + ] @keyword.conditional ;; Builtin types @@ -204,7 +204,7 @@ (escape_sequence) @string.escape (int_literal) @number -(float_literal) @float +(float_literal) @number.float (imaginary_literal) @number [ @@ -218,8 +218,8 @@ ] @constant.builtin (keyed_element - . (literal_element (identifier) @field)) -(field_declaration name: (field_identifier) @field) + . (literal_element (identifier) @variable.member)) +(field_declaration name: (field_identifier) @variable.member) ; Comments diff --git a/queries/go/locals.scm b/queries/go/locals.scm index 37d72b2be..5702a2b93 100644 --- a/queries/go/locals.scm +++ b/queries/go/locals.scm @@ -5,7 +5,7 @@ ( (method_declaration - name: (field_identifier) @local.definition.method); @method + name: (field_identifier) @local.definition.method); @function.method ) (short_var_declaration diff --git a/queries/godot_resource/highlights.scm b/queries/godot_resource/highlights.scm index 848fbbe1f..f87f228d9 100644 --- a/queries/godot_resource/highlights.scm +++ b/queries/godot_resource/highlights.scm @@ -6,7 +6,7 @@ (string) @string (integer) @number -(float) @float +(float) @number.float (true) @constant.builtin (false) @constant.builtin diff --git a/queries/gomod/highlights.scm b/queries/gomod/highlights.scm index 76a2a4523..8e3906fc1 100644 --- a/queries/gomod/highlights.scm +++ b/queries/gomod/highlights.scm @@ -11,7 +11,7 @@ "=>" @operator (comment) @comment @spell -(module_path) @text.uri +(module_path) @string.special.url [ (version) diff --git a/queries/gosum/highlights.scm b/queries/gosum/highlights.scm index bb65bd71f..bd9595b2b 100644 --- a/queries/gosum/highlights.scm +++ b/queries/gosum/highlights.scm @@ -8,11 +8,11 @@ ] @keyword -(module_path) @string @text.uri +(module_path) @string.special.url (module_version) @string.special (hash_version) @attribute -(hash) @symbol +(hash) @string.special.symbol [ (number) diff --git a/queries/gpg/highlights.scm b/queries/gpg/highlights.scm index fb70ba135..1dac05562 100644 --- a/queries/gpg/highlights.scm +++ b/queries/gpg/highlights.scm @@ -1,8 +1,8 @@ (option . _ @keyword) (option - ("no-" @parameter)? - (name) @parameter) + ("no-" @variable.parameter)? + (name) @variable.parameter) (string (content) @string) @@ -11,7 +11,7 @@ "clear" ] @string.special -(url) @text.uri +(url) @string.special.url (key) @constant @@ -25,9 +25,9 @@ "sensitive:" @type.qualifier -(filter_name) @parameter +(filter_name) @variable.parameter -(filter_scope) @namespace +(filter_scope) @module (filter_property) @property diff --git a/queries/graphql/highlights.scm b/queries/graphql/highlights.scm index 48f27f983..136f287ee 100644 --- a/queries/graphql/highlights.scm +++ b/queries/graphql/highlights.scm @@ -80,17 +80,17 @@ (input_fields_definition (input_value_definition - (name) @parameter)) + (name) @variable.parameter)) (argument - (name) @parameter) + (name) @variable.parameter) (arguments_definition (input_value_definition - (name) @parameter)) + (name) @variable.parameter)) (variable_definition - (variable) @parameter) + (variable) @variable.parameter) (argument (value @@ -103,7 +103,7 @@ (int_value) @number -(float_value) @float +(float_value) @number.float (boolean_value) @boolean diff --git a/queries/groovy/highlights.scm b/queries/groovy/highlights.scm index a9b38ef5b..25dcdb8ca 100644 --- a/queries/groovy/highlights.scm +++ b/queries/groovy/highlights.scm @@ -7,7 +7,7 @@ (block (unit - (identifier) @namespace)) + (identifier) @module)) (func (identifier) @function) @@ -64,8 +64,8 @@ "private" "public")) -((identifier) @exception - (#any-of? @exception +((identifier) @keyword.exception + (#any-of? @keyword.exception "throw" "finally" "try" diff --git a/queries/gstlaunch/highlights.scm b/queries/gstlaunch/highlights.scm index 8fc8d2198..36118712e 100644 --- a/queries/gstlaunch/highlights.scm +++ b/queries/gstlaunch/highlights.scm @@ -16,7 +16,7 @@ ] @punctuation.bracket (property - key: (identifier) @field) + key: (identifier) @variable.member) (value) @string (string_literal) @string (cap diff --git a/queries/hack/highlights.scm b/queries/hack/highlights.scm index efe5631a6..91efe90b4 100644 --- a/queries/hack/highlights.scm +++ b/queries/hack/highlights.scm @@ -43,7 +43,7 @@ "include_once" "require" "require_once" -] @include +] @keyword.import [ "new" @@ -184,10 +184,10 @@ ] @operator (integer) @number -(float) @float +(float) @number.float (parameter - (variable) @parameter) + (variable) @variable.parameter) (call_expression function: (qualified_identifier (identifier) @function.call .)) @@ -197,23 +197,23 @@ (call_expression function: (selection_expression - (qualified_identifier (identifier) @method.call .))) + (qualified_identifier (identifier) @function.method.call .))) (qualified_identifier - (_) @namespace . + (_) @module . (_)) (use_statement (qualified_identifier - (_) @namespace .) + (_) @module .) (use_clause)) (use_statement (use_type "namespace") (use_clause (qualified_identifier - (identifier) @namespace .) - alias: (identifier)? @namespace)) + (identifier) @module .) + alias: (identifier)? @module)) (use_statement (use_type "const") @@ -239,8 +239,8 @@ (use_clause (use_type "namespace") (qualified_identifier - (_) @namespace .) - alias: (identifier)? @namespace) + (_) @module .) + alias: (identifier)? @module) (use_clause (use_type "function") @@ -263,7 +263,7 @@ (function_declaration name: (identifier) @function) (method_declaration - name: (identifier) @method) + name: (identifier) @function.method) (type_arguments [ "<" ">" ] @punctuation.bracket) @@ -279,7 +279,7 @@ "\\" @punctuation.delimiter) (ternary_expression - ["?" ":"] @conditional.ternary) + ["?" ":"] @keyword.conditional.ternary) [ "if" @@ -287,13 +287,13 @@ "elseif" "switch" "case" -] @conditional +] @keyword.conditional [ "try" "catch" "finally" -] @exception +] @keyword.exception [ "for" @@ -302,7 +302,7 @@ "do" "continue" "break" -] @repeat +] @keyword.repeat [ (string) diff --git a/queries/hare/highlights.scm b/queries/hare/highlights.scm index f331da910..fb9f3f158 100644 --- a/queries/hare/highlights.scm +++ b/queries/hare/highlights.scm @@ -23,18 +23,18 @@ [ "use" -] @include +] @keyword.import (use_statement (scoped_type_identifier - (identifier) @namespace)) + (identifier) @module)) (use_statement - (identifier) @namespace "{") + (identifier) @module "{") (use_statement - . (identifier) @namespace .) + . (identifier) @module .) ((scoped_type_identifier - path: (_) @namespace) + path: (_) @module) (#set! "priority" 105)) ; Keywords @@ -103,7 +103,7 @@ (call_expression . (scoped_type_identifier - . (identifier) . "::" . (identifier) @method.call)) + . (identifier) . "::" . (identifier) @function.method.call)) ((call_expression . (identifier) @function.builtin) @@ -123,25 +123,25 @@ ; Parameters (parameter - (_) @parameter . ":") + (_) @variable.parameter . ":") ; Fields ((member_expression - "." (_) @field) + "." (_) @variable.member) (#set! "priority" 105)) (field - . (identifier) @field) + . (identifier) @variable.member) (field_assignment - . (identifier) @field) + . (identifier) @variable.member) ; Repeats [ "for" -] @repeat +] @keyword.repeat ; Conditionals @@ -152,7 +152,7 @@ "switch" "match" "case" -] @conditional +] @keyword.conditional ; Operators @@ -237,7 +237,7 @@ (number) @number -(float) @float +(float) @number.float (boolean) @boolean diff --git a/queries/haskell/highlights.scm b/queries/haskell/highlights.scm index 2c2189c38..92b36434d 100644 --- a/queries/haskell/highlights.scm +++ b/queries/haskell/highlights.scm @@ -8,27 +8,27 @@ (pat_wildcard) @variable (function - patterns: (patterns (_) @parameter)) + patterns: (patterns (_) @variable.parameter)) -(exp_lambda (_)+ @parameter "->") +(exp_lambda (_)+ @variable.parameter "->") (function infix: (infix - lhs: (_) @parameter)) + lhs: (_) @variable.parameter)) (function infix: (infix - rhs: (_) @parameter)) + rhs: (_) @variable.parameter)) ;; ---------------------------------------------------------------------------- ;; Literals and comments (integer) @number (exp_negation) @number -(exp_literal (float)) @float +(exp_literal (float)) @number.float (char) @character (string) @string -(con_unit) @symbol ; unit, as in () +(con_unit) @string.special.symbol ; unit, as in () (comment) @comment @@ -82,9 +82,9 @@ [ "forall" "∀" -] @repeat +] @keyword.repeat -(pragma) @preproc +(pragma) @keyword.directive [ "if" @@ -92,13 +92,13 @@ "else" "case" "of" -] @conditional +] @keyword.conditional [ "import" "qualified" "module" -] @include +] @keyword.import [ (operator) @@ -124,12 +124,12 @@ ] @operator -(module) @namespace +(module) @module ((qualified_module (module) @constructor) . (module)) -(qualified_type (module) @namespace) -(qualified_variable (module) @namespace) -(import (module) @namespace) +(qualified_type (module) @module) +(qualified_variable (module) @module) +(import (module) @module) (import (module) @constructor . (module)) [ @@ -250,7 +250,7 @@ [ ((variable) @function.call) (qualified_variable ( - (module) @namespace + (module) @module (variable) @function.call)) ]) . (operator)) @@ -391,7 +391,7 @@ ;; namespaced quasi-quoter (quasiquote (_ - (module) @namespace + (module) @module . (variable) @function.call )) @@ -400,8 +400,8 @@ ;; ---------------------------------------------------------------------------- ;; Exceptions/error handling -((variable) @exception - (#any-of? @exception +((variable) @keyword.exception + (#any-of? @keyword.exception "error" "undefined" "try" @@ -431,8 +431,8 @@ ;; ---------------------------------------------------------------------------- ;; Debugging -((variable) @debug - (#any-of? @debug +((variable) @keyword.debug + (#any-of? @keyword.debug "trace" "traceId" "traceShow" @@ -453,11 +453,11 @@ ;; ---------------------------------------------------------------------------- ;; Fields -(field (variable) @field) -(pat_field (variable) @field) -(exp_projection field: (variable) @field) -(import_item (type) . (import_con_names (variable) @field)) -(exp_field field: [((variable) @field) (qualified_variable (variable) @field)]) +(field (variable) @variable.member) +(pat_field (variable) @variable.member) +(exp_projection field: (variable) @variable.member) +(import_item (type) . (import_con_names (variable) @variable.member)) +(exp_field field: [((variable) @variable.member) (qualified_variable (variable) @variable.member)]) ;; ---------------------------------------------------------------------------- diff --git a/queries/haskell_persistent/highlights.scm b/queries/haskell_persistent/highlights.scm index afb32f11d..e806befcf 100644 --- a/queries/haskell_persistent/highlights.scm +++ b/queries/haskell_persistent/highlights.scm @@ -2,13 +2,13 @@ ;; Literals and comments (integer) @number -(float) @float +(float) @number.float (char) @character (string) @string (attribute_name) @attribute (attribute_exclamation_mark) @attribute -(con_unit) @symbol ; unit, as in () +(con_unit) @string.special.symbol ; unit, as in () (comment) @comment @spell diff --git a/queries/hcl/highlights.scm b/queries/hcl/highlights.scm index 4cc822abd..bb0de9816 100644 --- a/queries/hcl/highlights.scm +++ b/queries/hcl/highlights.scm @@ -48,13 +48,13 @@ "for" "endfor" "in" -] @repeat +] @keyword.repeat [ "if" "else" "endif" -] @conditional +] @keyword.conditional [ (quoted_template_start) ; " @@ -84,14 +84,14 @@ (body (block (identifier) @keyword)) (body (block (body (block (identifier) @type)))) (function_call (identifier) @function) -(attribute (identifier) @field) +(attribute (identifier) @variable.member) ; { key: val } ; ; highlight identifier keys as though they were block attributes -(object_elem key: (expression (variable_expr (identifier) @field))) +(object_elem key: (expression (variable_expr (identifier) @variable.member))) ; var.foo, data.bar ; ; first element in get_attr is a variable.builtin or a reference to a variable.builtin -(expression (variable_expr (identifier) @variable.builtin) (get_attr (identifier) @field)) +(expression (variable_expr (identifier) @variable.builtin) (get_attr (identifier) @variable.member)) diff --git a/queries/heex/highlights.scm b/queries/heex/highlights.scm index ed8efb906..f13e5d04f 100644 --- a/queries/heex/highlights.scm +++ b/queries/heex/highlights.scm @@ -30,7 +30,7 @@ (comment) @comment @spell ; HEEx text content is treated as markup -(text) @text +; (text) @none ; HEEx tags and slots are highlighted as HTML [ diff --git a/queries/hocon/highlights.scm b/queries/hocon/highlights.scm index 1fdd6ca4b..f0cc498b4 100644 --- a/queries/hocon/highlights.scm +++ b/queries/hocon/highlights.scm @@ -15,12 +15,12 @@ "required" ] @keyword -(include "include" @include) +(include "include" @keyword.import) (substitution ["${" "${?" "}"] @punctuation.special) -(substitution (_) @field) +(substitution (_) @variable.member) -(path (_) @field) +(path (_) @variable.member) (value [":" "=" "+=" ] @operator) [ diff --git a/queries/hoon/highlights.scm b/queries/hoon/highlights.scm index f7136f63e..029d20c1e 100644 --- a/queries/hoon/highlights.scm +++ b/queries/hoon/highlights.scm @@ -27,7 +27,7 @@ (date) @string.special -(mold) @symbol +(mold) @string.special.symbol (specialIndex) @number.builtin (lark) @operator -(fullContext) @symbol +(fullContext) @string.special.symbol diff --git a/queries/html_tags/highlights.scm b/queries/html_tags/highlights.scm index 8d39afd49..44626caac 100644 --- a/queries/html_tags/highlights.scm +++ b/queries/html_tags/highlights.scm @@ -1,54 +1,54 @@ (tag_name) @tag -(erroneous_end_tag_name) @error +; (erroneous_end_tag_name) @error ; we do not lint syntax errors (comment) @comment @spell (attribute_name) @tag.attribute ((attribute (quoted_attribute_value) @string) (#set! "priority" 99)) -(text) @text @spell +(text) @none @spell -((element (start_tag (tag_name) @_tag) (text) @text.title) +((element (start_tag (tag_name) @_tag) (text) @markup.heading) (#eq? @_tag "title")) -((element (start_tag (tag_name) @_tag) (text) @text.title.1) +((element (start_tag (tag_name) @_tag) (text) @markup.heading.1) (#eq? @_tag "h1")) -((element (start_tag (tag_name) @_tag) (text) @text.title.2) +((element (start_tag (tag_name) @_tag) (text) @markup.heading.2) (#eq? @_tag "h2")) -((element (start_tag (tag_name) @_tag) (text) @text.title.3) +((element (start_tag (tag_name) @_tag) (text) @markup.heading.3) (#eq? @_tag "h3")) -((element (start_tag (tag_name) @_tag) (text) @text.title.4) +((element (start_tag (tag_name) @_tag) (text) @markup.heading.4) (#eq? @_tag "h4")) -((element (start_tag (tag_name) @_tag) (text) @text.title.5) +((element (start_tag (tag_name) @_tag) (text) @markup.heading.5) (#eq? @_tag "h5")) -((element (start_tag (tag_name) @_tag) (text) @text.title.6) +((element (start_tag (tag_name) @_tag) (text) @markup.heading.6) (#eq? @_tag "h6")) -((element (start_tag (tag_name) @_tag) (text) @text.strong) +((element (start_tag (tag_name) @_tag) (text) @markup.strong) (#any-of? @_tag "strong" "b")) -((element (start_tag (tag_name) @_tag) (text) @text.emphasis) +((element (start_tag (tag_name) @_tag) (text) @markup.italic) (#any-of? @_tag "em" "i")) -((element (start_tag (tag_name) @_tag) (text) @text.strike) +((element (start_tag (tag_name) @_tag) (text) @markup.strikethrough) (#any-of? @_tag "s" "del")) -((element (start_tag (tag_name) @_tag) (text) @text.underline) +((element (start_tag (tag_name) @_tag) (text) @markup.underline) (#eq? @_tag "u")) -((element (start_tag (tag_name) @_tag) (text) @text.literal) +((element (start_tag (tag_name) @_tag) (text) @markup.raw) (#any-of? @_tag "code" "kbd")) -((element (start_tag (tag_name) @_tag) (text) @text.uri) +((element (start_tag (tag_name) @_tag) (text) @string.special.url) (#eq? @_tag "a")) ((attribute (attribute_name) @_attr - (quoted_attribute_value (attribute_value) @text.uri)) + (quoted_attribute_value (attribute_value) @string.special.url)) (#any-of? @_attr "href" "src")) [ diff --git a/queries/htmldjango/highlights.scm b/queries/htmldjango/highlights.scm index 814c7c420..214dbb36f 100644 --- a/queries/htmldjango/highlights.scm +++ b/queries/htmldjango/highlights.scm @@ -18,8 +18,8 @@ (variable_name) @variable -(filter_name) @method -(filter_argument) @parameter +(filter_name) @function.method +(filter_argument) @variable.parameter (keyword) @keyword diff --git a/queries/http/highlights.scm b/queries/http/highlights.scm index e03f61253..c5af93714 100644 --- a/queries/http/highlights.scm +++ b/queries/http/highlights.scm @@ -4,7 +4,7 @@ ; Methods -(method) @method +(method) @function.method ; Constants @@ -16,11 +16,11 @@ ; Fields -(pair name: (identifier) @field) +(pair name: (identifier) @variable.member) ; Parameters -(query_param (key) @parameter) +(query_param (key) @variable.parameter) ; Operators @@ -35,7 +35,7 @@ (string) @string -(target_url) @string @text.uri +(target_url) @string.special.url (number) @number diff --git a/queries/hurl/highlights.scm b/queries/hurl/highlights.scm index a32f1965b..d43c172b8 100644 --- a/queries/hurl/highlights.scm +++ b/queries/hurl/highlights.scm @@ -100,7 +100,7 @@ [ (float) (json_number) -] @float +] @number.float [ ":" "," ] @punctuation.delimiter @@ -115,13 +115,16 @@ [ "base64," - "file," "hex," - (file_value) (version) ] @string.special -(regex) @string.regex +[ + "file," + (file_value) +] @string.special.path + +(regex) @string.regexp (multiline_string_type) @type diff --git a/queries/ini/highlights.scm b/queries/ini/highlights.scm index dfe46cc72..d431a78b5 100644 --- a/queries/ini/highlights.scm +++ b/queries/ini/highlights.scm @@ -12,5 +12,4 @@ ] @operator (setting (setting_name) @property) -(setting_value) @text ; grammar does not support subtypes -(ERROR (setting_name) @text) +; (setting_value) @none ; grammar does not support subtypes diff --git a/queries/ispc/highlights.scm b/queries/ispc/highlights.scm index 6770d6bb9..804b6ee63 100644 --- a/queries/ispc/highlights.scm +++ b/queries/ispc/highlights.scm @@ -24,11 +24,11 @@ "foreach_tiled" "foreach_active" "foreach_unique" -] @repeat +] @keyword.repeat [ "cif" -] @conditional +] @keyword.conditional [ "varying" diff --git a/queries/janet_simple/highlights.scm b/queries/janet_simple/highlights.scm index 2b4ddf95b..25ce38635 100644 --- a/queries/janet_simple/highlights.scm +++ b/queries/janet_simple/highlights.scm @@ -1,6 +1,6 @@ ;; >> Literals -(kwd_lit) @symbol +(kwd_lit) @string.special.symbol (str_lit) @string (long_str_lit) @string (buf_lit) @string @@ -31,10 +31,10 @@ ;; Quoted symbols (quote_lit - (sym_lit) @symbol) + (sym_lit) @string.special.symbol) (qq_lit - (sym_lit) @symbol) + (sym_lit) @string.special.symbol) ;; Dynamic variables diff --git a/queries/java/highlights.scm b/queries/java/highlights.scm index 27f139ec2..4ff56641d 100644 --- a/queries/java/highlights.scm +++ b/queries/java/highlights.scm @@ -7,30 +7,30 @@ ; Methods (method_declaration - name: (identifier) @method) + name: (identifier) @function.method) (method_invocation - name: (identifier) @method.call) + name: (identifier) @function.method.call) (super) @function.builtin ; Parameters (formal_parameter - name: (identifier) @parameter) + name: (identifier) @variable.parameter) (catch_formal_parameter - name: (identifier) @parameter) + name: (identifier) @variable.parameter) (spread_parameter (variable_declarator - name: (identifier) @parameter)) ; int... foo + name: (identifier) @variable.parameter)) ; int... foo ;; Lambda parameter -(inferred_parameters (identifier) @parameter) ; (x,y) -> ... +(inferred_parameters (identifier) @variable.parameter) ; (x,y) -> ... (lambda_expression - parameters: (identifier) @parameter) ; x -> ... + parameters: (identifier) @variable.parameter) ; x -> ... ; Operators @@ -107,10 +107,10 @@ (field_declaration declarator: (variable_declarator - name: (identifier) @field)) + name: (identifier) @variable.member)) (field_access - field: (identifier) @field) + field: (identifier) @variable.member) [ (boolean_type) @@ -153,7 +153,7 @@ [ (decimal_floating_point_literal) (hex_floating_point_literal) -] @float +] @number.float [ (true) @@ -204,7 +204,7 @@ [ "transient" "volatile" -] @storageclass +] @keyword.storage [ "return" @@ -222,9 +222,9 @@ "else" "switch" "case" -] @conditional +] @keyword.conditional -(ternary_expression ["?" ":"] @conditional.ternary) +(ternary_expression ["?" ":"] @keyword.conditional.ternary) ; Loops @@ -234,7 +234,7 @@ "do" "continue" "break" -] @repeat +] @keyword.repeat ; Includes @@ -247,7 +247,7 @@ "provides" "requires" "uses" -] @include +] @keyword.import ; Punctuation @@ -277,7 +277,7 @@ "finally" "try" "catch" -] @exception +] @keyword.exception ; Labels diff --git a/queries/javascript/highlights.scm b/queries/javascript/highlights.scm index 8fc69e6c7..e757dd2bd 100644 --- a/queries/javascript/highlights.scm +++ b/queries/javascript/highlights.scm @@ -1,55 +1,55 @@ ; inherits: ecma,jsx ;;; Parameters -(formal_parameters (identifier) @parameter) +(formal_parameters (identifier) @variable.parameter) (formal_parameters (rest_pattern - (identifier) @parameter)) + (identifier) @variable.parameter)) ;; ({ a }) => null (formal_parameters (object_pattern - (shorthand_property_identifier_pattern) @parameter)) + (shorthand_property_identifier_pattern) @variable.parameter)) ;; ({ a = b }) => null (formal_parameters (object_pattern (object_assignment_pattern - (shorthand_property_identifier_pattern) @parameter))) + (shorthand_property_identifier_pattern) @variable.parameter))) ;; ({ a: b }) => null (formal_parameters (object_pattern (pair_pattern - value: (identifier) @parameter))) + value: (identifier) @variable.parameter))) ;; ([ a ]) => null (formal_parameters (array_pattern - (identifier) @parameter)) + (identifier) @variable.parameter)) ;; ({ a } = { a }) => null (formal_parameters (assignment_pattern (object_pattern - (shorthand_property_identifier_pattern) @parameter))) + (shorthand_property_identifier_pattern) @variable.parameter))) ;; ({ a = b } = { a }) => null (formal_parameters (assignment_pattern (object_pattern (object_assignment_pattern - (shorthand_property_identifier_pattern) @parameter)))) + (shorthand_property_identifier_pattern) @variable.parameter)))) ;; a => null (arrow_function - parameter: (identifier) @parameter) + parameter: (identifier) @variable.parameter) ;; optional parameters (formal_parameters (assignment_pattern - left: (identifier) @parameter)) + left: (identifier) @variable.parameter)) ;; punctuation (optional_chain) @punctuation.delimiter diff --git a/queries/jq/highlights.scm b/queries/jq/highlights.scm index 66acd26f4..e9967e95e 100644 --- a/queries/jq/highlights.scm +++ b/queries/jq/highlights.scm @@ -48,7 +48,7 @@ (identifier) @function) (funcdefargs - (identifier) @parameter) + (identifier) @variable.parameter) [ "reduce" @@ -264,7 +264,7 @@ [ "import" "include" -] @include +] @keyword.import [ "if" @@ -272,12 +272,12 @@ "elif" "else" "end" -] @conditional +] @keyword.conditional [ "try" "catch" -] @exception +] @keyword.exception [ "or" diff --git a/queries/jsonnet/highlights.scm b/queries/jsonnet/highlights.scm index e7ea6d8bb..c8eb38fcc 100644 --- a/queries/jsonnet/highlights.scm +++ b/queries/jsonnet/highlights.scm @@ -11,7 +11,7 @@ ] @boolean ; Keywords -"for" @repeat +"for" @keyword.repeat "in" @keyword.operator "function" @keyword.function @@ -19,7 +19,7 @@ "if" "then" "else" -] @conditional +] @keyword.conditional [ (local) @@ -30,7 +30,7 @@ [ "assert" "error" -] @exception +] @keyword.exception [ (dollar) @@ -84,12 +84,12 @@ [ (import) (importstr) -] @include +] @keyword.import ; Fields -(fieldname (id) @field) -(fieldname (string (string_content) @field)) +(fieldname (id) @variable.member) +(fieldname (string (string_content) @variable.member)) ; Functions (field @@ -98,7 +98,7 @@ function: (fieldname (string (string_content) @function))) (param - identifier: (id) @parameter) + identifier: (id) @variable.parameter) (bind (id) @variable.local) (bind function: (id) @function) @@ -113,6 +113,6 @@ "(" (args (named_argument - (id) @parameter + (id) @variable.parameter ))? ")") diff --git a/queries/julia/highlights.scm b/queries/julia/highlights.scm index c1245f4d8..20a154618 100644 --- a/queries/julia/highlights.scm +++ b/queries/julia/highlights.scm @@ -14,11 +14,11 @@ name: (identifier) @function.macro) (quote_expression - ":" @symbol - [(identifier) (operator)] @symbol) + ":" @string.special.symbol + [(identifier) (operator)] @string.special.symbol) (field_expression - (identifier) @field .) + (identifier) @variable.member .) ;;; Function names @@ -68,18 +68,18 @@ ;;; Parameters (parameter_list - (identifier) @parameter) + (identifier) @variable.parameter) (optional_parameter . - (identifier) @parameter) + (identifier) @variable.parameter) (slurp_parameter - (identifier) @parameter) + (identifier) @variable.parameter) (typed_parameter - parameter: (identifier)? @parameter + parameter: (identifier)? @variable.parameter type: (_) @type) (function_expression - . (identifier) @parameter) ; Single parameter arrow functions + . (identifier) @variable.parameter) ; Single parameter arrow functions ;;; Types @@ -362,42 +362,42 @@ ["let" "end"] @keyword) (if_statement - ["if" "end"] @conditional) + ["if" "end"] @keyword.conditional) (elseif_clause - "elseif" @conditional) + "elseif" @keyword.conditional) (else_clause - "else" @conditional) + "else" @keyword.conditional) (if_clause - "if" @conditional) ; `if` clause in comprehensions + "if" @keyword.conditional) ; `if` clause in comprehensions (ternary_expression - ["?" ":"] @conditional.ternary) + ["?" ":"] @keyword.conditional.ternary) (try_statement - ["try" "end"] @exception) + ["try" "end"] @keyword.exception) (finally_clause - "finally" @exception) + "finally" @keyword.exception) (catch_clause - "catch" @exception) + "catch" @keyword.exception) (for_statement - ["for" "end"] @repeat) + ["for" "end"] @keyword.repeat) (while_statement - ["while" "end"] @repeat) + ["while" "end"] @keyword.repeat) (for_clause - "for" @repeat) + "for" @keyword.repeat) [ (break_statement) (continue_statement) -] @repeat +] @keyword.repeat (module_definition - ["module" "baremodule" "end"] @include) + ["module" "baremodule" "end"] @keyword.import) (import_statement - ["import" "using"] @include) + ["import" "using"] @keyword.import) (import_alias - "as" @include) + "as" @keyword.import) (export_statement - "export" @include) + "export" @keyword.import) (selected_import ":" @punctuation.delimiter) @@ -458,10 +458,10 @@ (boolean_literal) @boolean (integer_literal) @number -(float_literal) @float +(float_literal) @number.float -((identifier) @float - (#any-of? @float "NaN" "NaN16" "NaN32" +((identifier) @number.float + (#any-of? @number.float "NaN" "NaN16" "NaN32" "Inf" "Inf16" "Inf32")) ((identifier) @constant.builtin diff --git a/queries/kconfig/highlights.scm b/queries/kconfig/highlights.scm index 2e7c401a1..d2db087ce 100644 --- a/queries/kconfig/highlights.scm +++ b/queries/kconfig/highlights.scm @@ -1,4 +1,4 @@ -"source" @include +"source" @keyword.import [ "mainmenu" @@ -24,7 +24,7 @@ "select" "imply" "visible if" -] @conditional +] @keyword.conditional [ "def_bool" @@ -70,10 +70,10 @@ ((symbol) @constant (#lua-match? @constant "[A-Z0-9]+")) -(mainmenu name: (prompt) @text.title) -(comment_entry name: (prompt) @text.title) -(menu name: (prompt) @text.title) +(mainmenu name: (prompt) @markup.heading) +(comment_entry name: (prompt) @markup.heading) +(menu name: (prompt) @markup.heading) -(source (prompt) @text.uri @string.special) +(source (prompt) @string.special.url) (comment) @comment @spell diff --git a/queries/kdl/highlights.scm b/queries/kdl/highlights.scm index d903128a8..5aafdeca3 100644 --- a/queries/kdl/highlights.scm +++ b/queries/kdl/highlights.scm @@ -29,8 +29,8 @@ (number) @number -(number (decimal) @float) -(number (exponent) @float) +(number (decimal) @number.float) +(number (exponent) @number.float) (boolean) @boolean diff --git a/queries/kotlin/highlights.scm b/queries/kotlin/highlights.scm index 36bf148f9..1ce0c5430 100644 --- a/queries/kotlin/highlights.scm +++ b/queries/kotlin/highlights.scm @@ -97,10 +97,10 @@ )) (package_header "package" @keyword - . (identifier (simple_identifier) @namespace)) + . (identifier (simple_identifier) @module)) (import_header - "import" @include) + "import" @keyword.import) ; The last `simple_identifier` in a `import_header` will always either be a function ; or a type. Classes can appear anywhere in the import path, unlike functions @@ -142,16 +142,16 @@ ("init") @constructor) (parameter - (simple_identifier) @parameter) + (simple_identifier) @variable.parameter) (parameter_with_optional_type - (simple_identifier) @parameter) + (simple_identifier) @variable.parameter) ; lambda parameters (lambda_literal (lambda_parameters (variable_declaration - (simple_identifier) @parameter))) + (simple_identifier) @variable.parameter))) ;;; Function calls @@ -227,9 +227,9 @@ ((multiline_comment) @comment.documentation (#lua-match? @comment.documentation "^/[*][*][^*].*[*]/$")) -(shebang_line) @preproc +(shebang_line) @keyword.directive -(real_literal) @float +(real_literal) @number.float [ (integer_literal) (long_literal) @@ -254,7 +254,7 @@ ; - "[abc]?".toRegex() (call_expression (navigation_expression - ((string_literal) @string.regex) + ((string_literal) @string.regexp) (navigation_suffix ((simple_identifier) @_function (#eq? @_function "toRegex"))))) @@ -266,7 +266,7 @@ (call_suffix (value_arguments (value_argument - (string_literal) @string.regex)))) + (string_literal) @string.regexp)))) ; - Regex.fromLiteral("[abc]?") (call_expression @@ -279,7 +279,7 @@ (call_suffix (value_arguments (value_argument - (string_literal) @string.regex)))) + (string_literal) @string.regexp)))) ;;; Keywords @@ -323,7 +323,7 @@ "if" "else" "when" -] @conditional +] @keyword.conditional [ "for" @@ -333,14 +333,14 @@ "continue@" "break" "break@" -] @repeat +] @keyword.repeat [ "try" "catch" "throw" "finally" -] @exception +] @keyword.exception (annotation diff --git a/queries/kusto/highlights.scm b/queries/kusto/highlights.scm index 825f49b35..a0ad0a895 100644 --- a/queries/kusto/highlights.scm +++ b/queries/kusto/highlights.scm @@ -12,8 +12,8 @@ ] @function.call (typed_parameter - (identifier) @parameter) -(function_arguments (identifier) @parameter) + (identifier) @variable.parameter) +(function_arguments (identifier) @variable.parameter) [ (binary_operator) diff --git a/queries/lalrpop/highlights.scm b/queries/lalrpop/highlights.scm index b6fda252e..c0c1a3a81 100644 --- a/queries/lalrpop/highlights.scm +++ b/queries/lalrpop/highlights.scm @@ -10,7 +10,7 @@ [ "match" "else" -] @conditional +] @keyword.conditional [ "+" @@ -32,7 +32,7 @@ ["<" ">"] @punctuation.bracket) (binding_symbol - name: (identifier) @parameter) + name: (identifier) @variable.parameter) (bare_symbol (macro @@ -54,7 +54,7 @@ [";" ":"] @punctuation.delimiter -(lifetime (identifier) @storageclass) +(lifetime (identifier) @keyword.storage) (string_literal) @string (regex_literal) @string diff --git a/queries/latex/highlights.scm b/queries/latex/highlights.scm index ea66645e5..5ccc2b8fe 100644 --- a/queries/latex/highlights.scm +++ b/queries/latex/highlights.scm @@ -6,7 +6,7 @@ command: _ @function) (key_value_pair - key: (_) @parameter + key: (_) @variable.parameter value: (_)) [ @@ -15,13 +15,13 @@ (comment_environment) ] @comment @spell -((line_comment) @preproc - (#lua-match? @preproc "^%% !TeX")) +((line_comment) @keyword.directive + (#lua-match? @keyword.directive "^%% !TeX")) [ (brack_group) (brack_group_argc) -] @parameter +] @variable.parameter [(operator) "="] @operator @@ -34,12 +34,12 @@ ;; General environments (begin - command: _ @text.environment - name: (curly_group_text (text) @text.environment.name)) + command: _ @markup.environment + name: (curly_group_text (text) @markup.environment.name)) (end - command: _ @text.environment - name: (curly_group_text (text) @text.environment.name)) + command: _ @markup.environment + name: (curly_group_text (text) @markup.environment.name)) ;; Definitions and references (new_command_definition @@ -54,11 +54,11 @@ (environment_definition command: _ @function.macro - name: (curly_group_text (_) @text.reference)) + name: (curly_group_text (_) @markup.link)) (theorem_definition command: _ @function.macro - name: (curly_group_text (_) @text.environment.name)) + name: (curly_group_text (_) @markup.environment.name)) (paired_delimiter_definition command: _ @function.macro @@ -66,178 +66,178 @@ (label_definition command: _ @function.macro - name: (curly_group_text (_) @text.reference)) + name: (curly_group_text (_) @markup.link)) (label_reference_range command: _ @function.macro - from: (curly_group_text (_) @text.reference) - to: (curly_group_text (_) @text.reference)) + from: (curly_group_text (_) @markup.link) + to: (curly_group_text (_) @markup.link)) (label_reference command: _ @function.macro - names: (curly_group_text_list (_) @text.reference)) + names: (curly_group_text_list (_) @markup.link)) (label_number command: _ @function.macro - name: (curly_group_text (_) @text.reference) - number: (_) @text.reference) + name: (curly_group_text (_) @markup.link) + number: (_) @markup.link) (citation command: _ @function.macro - keys: (curly_group_text_list) @text.reference) + keys: (curly_group_text_list) @markup.link) (glossary_entry_definition command: _ @function.macro - name: (curly_group_text (_) @text.reference)) + name: (curly_group_text (_) @markup.link)) (glossary_entry_reference command: _ @function.macro - name: (curly_group_text (_) @text.reference)) + name: (curly_group_text (_) @markup.link)) (acronym_definition command: _ @function.macro - name: (curly_group_text (_) @text.reference)) + name: (curly_group_text (_) @markup.link)) (acronym_reference command: _ @function.macro - name: (curly_group_text (_) @text.reference)) + name: (curly_group_text (_) @markup.link)) (color_definition command: _ @function.macro - name: (curly_group_text (_) @text.reference)) + name: (curly_group_text (_) @markup.link)) (color_reference command: _ @function.macro - name: (curly_group_text (_) @text.reference)) + name: (curly_group_text (_) @markup.link)) ;; Math [ (displayed_equation) (inline_formula) -] @text.math +] @markup.math (math_environment (begin - command: _ @text.math - name: (curly_group_text (text) @text.math))) + command: _ @markup.math + name: (curly_group_text (text) @markup.math))) (math_environment - (text) @text.math) + (text) @markup.math) (math_environment (end - command: _ @text.math - name: (curly_group_text (text) @text.math))) + command: _ @markup.math + name: (curly_group_text (text) @markup.math))) ;; Sectioning (title_declaration - command: _ @namespace - options: (brack_group (_) @text.title.1)? - text: (curly_group (_) @text.title.1)) + command: _ @module + options: (brack_group (_) @markup.heading.1)? + text: (curly_group (_) @markup.heading.1)) (author_declaration - command: _ @namespace + command: _ @module authors: (curly_group_author_list - ((author)+ @text.title.1))) + ((author)+ @markup.heading.1))) (chapter - command: _ @namespace - toc: (brack_group (_) @text.title.2)? - text: (curly_group (_) @text.title.2)) + command: _ @module + toc: (brack_group (_) @markup.heading.2)? + text: (curly_group (_) @markup.heading.2)) (part - command: _ @namespace - toc: (brack_group (_) @text.title.2)? - text: (curly_group (_) @text.title.2)) + command: _ @module + toc: (brack_group (_) @markup.heading.2)? + text: (curly_group (_) @markup.heading.2)) (section - command: _ @namespace - toc: (brack_group (_) @text.title.3)? - text: (curly_group (_) @text.title.3)) + command: _ @module + toc: (brack_group (_) @markup.heading.3)? + text: (curly_group (_) @markup.heading.3)) (subsection - command: _ @namespace - toc: (brack_group (_) @text.title.4)? - text: (curly_group (_) @text.title.4)) + command: _ @module + toc: (brack_group (_) @markup.heading.4)? + text: (curly_group (_) @markup.heading.4)) (subsubsection - command: _ @namespace - toc: (brack_group (_) @text.title.5)? - text: (curly_group (_) @text.title.5)) + command: _ @module + toc: (brack_group (_) @markup.heading.5)? + text: (curly_group (_) @markup.heading.5)) (paragraph - command: _ @namespace - toc: (brack_group (_) @text.title.6)? - text: (curly_group (_) @text.title.6)) + command: _ @module + toc: (brack_group (_) @markup.heading.6)? + text: (curly_group (_) @markup.heading.6)) (subparagraph - command: _ @namespace - toc: (brack_group (_) @text.title.6)? - text: (curly_group (_) @text.title.6)) + command: _ @module + toc: (brack_group (_) @markup.heading.6)? + text: (curly_group (_) @markup.heading.6)) ;; Beamer frames (generic_environment (begin name: (curly_group_text - (text) @text.environment.name) - (#any-of? @text.environment.name "frame")) + (text) @markup.environment.name) + (#any-of? @markup.environment.name "frame")) . - (curly_group (_) @text.title)) + (curly_group (_) @markup.heading)) ((generic_command command: (command_name) @_name arg: (curly_group - (text) @text.title)) + (text) @markup.heading)) (#eq? @_name "\\frametitle")) ;; Formatting (text_mode - content: (curly_group (_) @text)) + content: (curly_group (_) @none @spell)) ((generic_command command: (command_name) @_name - arg: (curly_group (_) @text.emphasis)) + arg: (curly_group (_) @markup.italic)) (#eq? @_name "\\emph")) ((generic_command command: (command_name) @_name - arg: (curly_group (_) @text.emphasis)) + arg: (curly_group (_) @markup.italic)) (#any-of? @_name "\\textit" "\\mathit")) ((generic_command command: (command_name) @_name - arg: (curly_group (_) @text.strong)) + arg: (curly_group (_) @markup.strong)) (#any-of? @_name "\\textbf" "\\mathbf")) ((generic_command command: (command_name) @_name . - arg: (curly_group (_) @text.uri)) + arg: (curly_group (_) @markup.link.url)) (#any-of? @_name "\\url" "\\href")) ;; File inclusion commands (class_include - command: _ @include + command: _ @keyword.import path: (curly_group_path) @string) (package_include - command: _ @include + command: _ @keyword.import paths: (curly_group_path_list) @string) (latex_include - command: _ @include + command: _ @keyword.import path: (curly_group_path) @string) (import_include - command: _ @include + command: _ @keyword.import directory: (curly_group_path) @string file: (curly_group_path) @string) (bibtex_include - command: _ @include + command: _ @keyword.import path: (curly_group_path) @string) (biblatex_include - "\\addbibresource" @include - glob: (curly_group_glob_pattern) @string.regex) + "\\addbibresource" @keyword.import + glob: (curly_group_glob_pattern) @string.regexp) (graphics_include - command: _ @include + command: _ @keyword.import path: (curly_group_path) @string) (tikz_library_import - command: _ @include + command: _ @keyword.import paths: (curly_group_path_list) @string) (text) @spell diff --git a/queries/ledger/highlights.scm b/queries/ledger/highlights.scm index 185269a00..8194b50ad 100644 --- a/queries/ledger/highlights.scm +++ b/queries/ledger/highlights.scm @@ -23,11 +23,11 @@ (option_value) (check_in) (check_out) -] @text.literal +] @markup.raw -((account) @field) +((account) @variable.member) -"include" @include +"include" @keyword.import [ "account" diff --git a/queries/leo/highlights.scm b/queries/leo/highlights.scm index 60f3fefeb..11c2d67e4 100644 --- a/queries/leo/highlights.scm +++ b/queries/leo/highlights.scm @@ -34,23 +34,23 @@ "transition" ] @keyword.function -"import" @include +"import" @keyword.import "return" @keyword.return (return_arrow) @punctuation.delimiter -"for" @repeat +"for" @keyword.repeat [ "else" "if" -] @conditional +] @keyword.conditional [ (ternary_if) (ternary_else) -] @conditional.ternary +] @keyword.conditional.ternary [ "(" ")" "{" "}" "[" "]" ] @punctuation.bracket @@ -118,11 +118,11 @@ ] @string.special ;record declaration -(record_declaration (identifier) @field) +(record_declaration (identifier) @variable.member) ;struct component (struct_component_declaration - (identifier) @field) + (identifier) @variable.member) (type) @type @@ -140,7 +140,7 @@ (record_type (locator - (identifier) @field)) + (identifier) @variable.member)) (transition_declaration name: (identifier) @function.builtin) @@ -159,13 +159,13 @@ (method_call . (_) - . (identifier) @method.call) + . (identifier) @function.method.call) (function_parameter - (identifier) @parameter) + (identifier) @variable.parameter) (struct_declaration - name: (identifier) @field) + name: (identifier) @variable.member) (variable_declaration (identifier_or_identifiers diff --git a/queries/linkerscript/highlights.scm b/queries/linkerscript/highlights.scm index f933f31ca..0453ded85 100644 --- a/queries/linkerscript/highlights.scm +++ b/queries/linkerscript/highlights.scm @@ -13,13 +13,13 @@ ; Conditionals -(conditional_expression [ "?" ":" ] @conditional.ternary) +(conditional_expression [ "?" ":" ] @keyword.conditional.ternary) ; Variables (symbol) @variable -(filename) @string.special @text.underline +(filename) @string.special.path ; Functions @@ -27,8 +27,8 @@ function: (symbol) @function.call) ((call_expression - function: (symbol) @preproc) - (#eq? @preproc "DEFINED")) + function: (symbol) @keyword.directive) + (#eq? @keyword.directive "DEFINED")) ((call_expression function: (symbol) @function.builtin) @@ -52,7 +52,7 @@ [ "ORIGIN" "org" "o" "LENGTH" "len" "l" -] @field.builtin +] @variable.member.builtin ; Constants @@ -80,7 +80,7 @@ ; Exceptions -"ASSERT" @exception +"ASSERT" @keyword.exception [ "/DISCARD/" diff --git a/queries/liquidsoap/highlights.scm b/queries/liquidsoap/highlights.scm index fcf553e3b..45b5abe05 100644 --- a/queries/liquidsoap/highlights.scm +++ b/queries/liquidsoap/highlights.scm @@ -25,7 +25,7 @@ "for" "for_end" "while_end" -] @repeat +] @keyword.repeat [ "if" @@ -33,15 +33,15 @@ "elsif" "else" "if_end" -] @conditional +] @keyword.conditional [ "try" "catch" "try_end" -] @exception +] @keyword.exception -(inline_if [ "?" ":" ] @conditional.ternary) +(inline_if [ "?" ":" ] @keyword.conditional.ternary) [ "%ifdef" @@ -53,12 +53,12 @@ "%endif" "%argsof" "%include" -] @preproc +] @keyword.directive (encoder_name) @constant.builtin -(anonymous_argument (var) @parameter) -(labeled_argument label: (var) @parameter) +(anonymous_argument (var) @variable.parameter) +(labeled_argument label: (var) @variable.parameter) "." @punctuation.delimiter @@ -72,14 +72,14 @@ ] @punctuation.bracket (app name: (var) @function.call) -(method) @method -(method_app) @method.call +(method) @function.method +(method_app) @function.method.call (string) @string (string_interpolation [ "#{" "}" ] @punctuation.special) (integer) @number -(float) @float +(float) @number.float (bool) @boolean (comment) @comment -(regexp) @string.regex +(regexp) @string.regexp (type) @type diff --git a/queries/llvm/highlights.scm b/queries/llvm/highlights.scm index 37a31a3bb..96b8bab93 100644 --- a/queries/llvm/highlights.scm +++ b/queries/llvm/highlights.scm @@ -14,7 +14,7 @@ (global_type (local_var) @type.definition) -(argument) @parameter +(argument) @variable.parameter (_ inst_name: _ @keyword.operator) @@ -101,7 +101,7 @@ "localexec" (unnamed_addr) (dll_storage_class) -] @storageclass +] @keyword.storage (attribute_name) @attribute @@ -117,7 +117,7 @@ (cstring) @string (label) @label (_ inst_name: "ret" @keyword.return) -(float) @float +(float) @number.float [ (struct_value) diff --git a/queries/lua/highlights.scm b/queries/lua/highlights.scm index 2f12d3ce2..0cb861596 100644 --- a/queries/lua/highlights.scm +++ b/queries/lua/highlights.scm @@ -21,13 +21,13 @@ "while" "do" "end" -] @repeat) +] @keyword.repeat) (repeat_statement [ "repeat" "until" -] @repeat) +] @keyword.repeat) (if_statement [ @@ -36,27 +36,27 @@ "else" "then" "end" -] @conditional) +] @keyword.conditional) (elseif_statement [ "elseif" "then" "end" -] @conditional) +] @keyword.conditional) (else_statement [ "else" "end" -] @conditional) +] @keyword.conditional) (for_statement [ "for" "do" "end" -] @repeat) +] @keyword.repeat) (function_declaration [ @@ -133,8 +133,8 @@ ((identifier) @variable.builtin (#eq? @variable.builtin "self")) -((identifier) @namespace.builtin - (#any-of? @namespace.builtin "_G" "debug" "io" "jit" "math" "os" "package" "string" "table" "utf8")) +((identifier) @module.builtin + (#any-of? @module.builtin "_G" "debug" "io" "jit" "math" "os" "package" "string" "table" "utf8")) ((identifier) @keyword.coroutine (#eq? @keyword.coroutine "coroutine")) @@ -167,9 +167,9 @@ ;; Tables -(field name: (identifier) @field) +(field name: (identifier) @variable.member) -(dot_index_expression field: (identifier) @field) +(dot_index_expression field: (identifier) @variable.member) (table_constructor [ @@ -179,9 +179,9 @@ ;; Functions -(parameters (identifier) @parameter) +(parameters (identifier) @variable.parameter) -(vararg_expression) @parameter.builtin +(vararg_expression) @variable.parameter.builtin (function_declaration name: [ @@ -192,7 +192,7 @@ (function_declaration name: (method_index_expression - method: (identifier) @method)) + method: (identifier) @function.method)) (assignment_statement (variable_list . @@ -215,7 +215,7 @@ (dot_index_expression field: (identifier) @function.call) (method_index_expression - method: (identifier) @method.call) + method: (identifier) @function.method.call) ]) (function_call @@ -240,7 +240,7 @@ ((comment) @comment.documentation (#lua-match? @comment.documentation "^[-][-](%s?)@")) -(hash_bang_line) @preproc +(hash_bang_line) @keyword.directive (number) @number @@ -257,7 +257,7 @@ . (_) . (string - content: (string_content) @string.regex))) + content: (string_content) @string.regexp))) ;("123"):match("%d+") (function_call @@ -266,4 +266,4 @@ (#any-of? @_method "find" "match" "gmatch" "gsub")) arguments: (arguments . (string - content: (string_content) @string.regex))) + content: (string_content) @string.regexp))) diff --git a/queries/luadoc/highlights.scm b/queries/luadoc/highlights.scm index ec8bcb765..3555039dc 100644 --- a/queries/luadoc/highlights.scm +++ b/queries/luadoc/highlights.scm @@ -3,7 +3,7 @@ [ "@module" "@package" -] @include +] @keyword.import [ "@class" @@ -38,8 +38,8 @@ (function_type ["fun" "function"] @keyword.function) (source_annotation - filename: (identifier) @text.uri @string.special - extension: (identifier) @text.uri @string.special) + filename: (identifier) @string.special.path + extension: (identifier) @string.special.path) (version_annotation version: _ @constant.builtin) @@ -75,17 +75,17 @@ ; Parameters -(param_annotation (identifier) @parameter) +(param_annotation (identifier) @variable.parameter) -(parameter (identifier) @parameter) +(parameter (identifier) @variable.parameter) ; Fields -(field_annotation (identifier) @field) +(field_annotation (identifier) @variable.member) -(table_literal_type field: (identifier) @field) +(table_literal_type field: (identifier) @variable.member) -(member_type ["#" "."] . (identifier) @field) +(member_type ["#" "."] . (identifier) @variable.member) ; Types @@ -110,7 +110,7 @@ ; Literals -(string) @namespace ; only used in @module +(string) @module ; only used in @module (literal_type) @string diff --git a/queries/luap/highlights.scm b/queries/luap/highlights.scm index 87e6c6908..0f95d4eff 100644 --- a/queries/luap/highlights.scm +++ b/queries/luap/highlights.scm @@ -33,4 +33,4 @@ (negated_set "^" @operator) (balanced_match - (character) @parameter) + (character) @variable.parameter) diff --git a/queries/luau/highlights.scm b/queries/luau/highlights.scm index 4cd0b443c..5fdfb5006 100644 --- a/queries/luau/highlights.scm +++ b/queries/luau/highlights.scm @@ -1,6 +1,6 @@ ; Preproc -(hash_bang_line) @preproc +(hash_bang_line) @keyword.directive ;; Keywords @@ -23,18 +23,18 @@ "while" "do" "end" -] @repeat) +] @keyword.repeat) (repeat_statement [ "repeat" "until" -] @repeat) +] @keyword.repeat) [ (break_statement) (continue_statement) -] @repeat +] @keyword.repeat (if_statement [ @@ -43,27 +43,27 @@ "else" "then" "end" -] @conditional) +] @keyword.conditional) (elseif_statement [ "elseif" "then" "end" -] @conditional) +] @keyword.conditional) (else_statement [ "else" "end" -] @conditional) +] @keyword.conditional) (for_statement [ "for" "do" "end" -] @repeat) +] @keyword.repeat) (function_declaration [ @@ -149,19 +149,19 @@ ((identifier) @variable.builtin (#eq? @variable.builtin "self")) -((identifier) @namespace.builtin - (#any-of? @namespace.builtin "_G" "debug" "io" "jit" "math" "os" "package" "string" "table" "utf8")) +((identifier) @module.builtin + (#any-of? @module.builtin "_G" "debug" "io" "jit" "math" "os" "package" "string" "table" "utf8")) ((identifier) @keyword.coroutine (#eq? @keyword.coroutine "coroutine")) ;; Tables -(field name: (identifier) @field) +(field name: (identifier) @variable.member) -(dot_index_expression field: (identifier) @field) +(dot_index_expression field: (identifier) @variable.member) -(object_type (identifier) @field) +(object_type (identifier) @variable.member) (table_constructor [ @@ -171,8 +171,8 @@ ; Functions -(parameter . (identifier) @parameter) -(function_type (identifier) @parameter) +(parameter . (identifier) @variable.parameter) +(function_type (identifier) @variable.parameter) (function_call name: (identifier) @function.call) (function_declaration name: (identifier) @function) @@ -180,7 +180,7 @@ (function_call name: (dot_index_expression field: (identifier) @function.call)) (function_declaration name: (dot_index_expression field: (identifier) @function)) -(method_index_expression method: (identifier) @method.call) +(method_index_expression method: (identifier) @function.method.call) (function_call (identifier) @function.builtin @@ -252,11 +252,11 @@ (dot_index_expression field: (identifier) @_method (#any-of? @_method "find" "format" "match" "gmatch" "gsub")) - arguments: (arguments . (_) . (string content: _ @string.regex))) + arguments: (arguments . (_) . (string content: _ @string.regexp))) ; ("123"):match("%d+") (function_call (method_index_expression method: (identifier) @_method (#any-of? @_method "find" "format" "match" "gmatch" "gsub")) - arguments: (arguments . (string content: _ @string.regex))) + arguments: (arguments . (string content: _ @string.regexp))) diff --git a/queries/m68k/highlights.scm b/queries/m68k/highlights.scm index edb36cd57..e37c55ae0 100644 --- a/queries/m68k/highlights.scm +++ b/queries/m68k/highlights.scm @@ -7,9 +7,9 @@ (directive_mnemonic) ] @function.builtin -(include (directive_mnemonic) @include) -(include_bin (directive_mnemonic) @include) -(include_dir (directive_mnemonic) @include) +(include (directive_mnemonic) @keyword.import) +(include_bin (directive_mnemonic) @keyword.import) +(include_dir (directive_mnemonic) @keyword.import) (size) @attribute @@ -17,10 +17,8 @@ (macro_definition name: (symbol) @function.macro) (macro_call name: (symbol) @function.macro) -[ - (path) - (string_literal) -] @string +(string_literal) @string +(path) @string.special.path [ (decimal_literal) @@ -44,8 +42,8 @@ (named_register) ] @keyword -(repeat (control_mnemonic) @repeat) -(conditional (control_mnemonic) @conditional) +(repeat (control_mnemonic) @keyword.repeat) +(conditional (control_mnemonic) @keyword.conditional) (comment) @comment @spell @@ -68,4 +66,4 @@ ")+" ] @punctuation.bracket -(section) @namespace +(section) @module diff --git a/queries/make/highlights.scm b/queries/make/highlights.scm index b224a6765..e1d7aa4f7 100644 --- a/queries/make/highlights.scm +++ b/queries/make/highlights.scm @@ -7,8 +7,8 @@ "ifneq" "ifdef" "ifndef" - ] @conditional) - "endif" @conditional) + ] @keyword.conditional) + "endif" @keyword.conditional) (rule (targets (word) @function)) @@ -41,10 +41,12 @@ (export_directive "export" @keyword) (override_directive "override" @keyword) -(include_directive ["include" "-include"] @include) +(include_directive + ["include" "-include"] @keyword.import + filenames: (list (word) @string.special.path)) (variable_assignment - name: (word) @symbol + name: (word) @string.special.symbol [ "?=" ":=" @@ -55,12 +57,12 @@ ] @operator) (shell_assignment - name: (word) @symbol + name: (word) @string.special.symbol "!=" @operator) (define_directive "define" @keyword - name: (word) @symbol + name: (word) @string.special.symbol [ "=" ":=" diff --git a/queries/markdown/highlights.scm b/queries/markdown/highlights.scm index 9ffc6ee86..aa7b6a66c 100644 --- a/queries/markdown/highlights.scm +++ b/queries/markdown/highlights.scm @@ -1,38 +1,54 @@ ;From MDeiml/tree-sitter-markdown & Helix -(setext_heading (paragraph) @text.title.1 (setext_h1_underline) @text.title.1.marker) -(setext_heading (paragraph) @text.title.2 (setext_h2_underline) @text.title.2.marker) +(setext_heading (paragraph) @markup.heading.1 (setext_h1_underline) @markup.heading.1.marker) +(setext_heading (paragraph) @markup.heading.2 (setext_h2_underline) @markup.heading.2.marker) -(atx_heading (atx_h1_marker) @text.title.1.marker (inline) @text.title.1) -(atx_heading (atx_h2_marker) @text.title.2.marker (inline) @text.title.2) -(atx_heading (atx_h3_marker) @text.title.3.marker (inline) @text.title.3) -(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 -(indented_code_block) @text.literal.block -((fenced_code_block) @text.literal.block (#set! "priority" 90)) +(atx_heading (atx_h1_marker) @markup.heading.1.marker (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 -(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_delimiter_cell) @punctuation.special -[ - (fenced_code_block_delimiter) -] @punctuation.delimiter +;; Code blocks (conceal backticks and language annotation) +(indented_code_block) @markup.raw.block + +((fenced_code_block) @markup.raw.block + (#set! "priority" 90)) -;; Conceal backticks (fenced_code_block (fenced_code_block_delimiter) @conceal (#set! conceal "")) + (fenced_code_block - (info_string (language) @conceal - (#set! conceal ""))) + (info_string + (language) @conceal + (#set! conceal ""))) + +[ + (link_destination) +] @markup.link.url + +[ + (link_title) + (link_label) +] @markup.link.label + +[ + (list_marker_plus) + (list_marker_minus) + (list_marker_star) + (list_marker_dot) + (list_marker_parenthesis) +] @markup.list ; 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 @@ -58,28 +74,12 @@ (code_fence_content) @none -[ - (link_destination) -] @text.uri +(thematic_break) @punctuation.special -[ - (link_label) -] @text.reference +(task_list_marker_unchecked) @markup.list.unchecked +(task_list_marker_checked) @markup.list.checked -[ - (list_marker_plus) - (list_marker_minus) - (list_marker_star) - (list_marker_dot) - (list_marker_parenthesis) - (thematic_break) -] @punctuation.special - - -(task_list_marker_unchecked) @text.todo.unchecked -(task_list_marker_checked) @text.todo.checked - -((block_quote) @text.quote (#set! "priority" 90)) +((block_quote) @markup.quote (#set! "priority" 90)) [ (block_continuation) diff --git a/queries/markdown_inline/highlights.scm b/queries/markdown_inline/highlights.scm index f9589bdd9..a1f63328b 100644 --- a/queries/markdown_inline/highlights.scm +++ b/queries/markdown_inline/highlights.scm @@ -1,49 +1,36 @@ ;; From MDeiml/tree-sitter-markdown -[ - (code_span) - (link_title) -] @text.literal @nospell +(code_span) @markup.raw @nospell -[ - (emphasis_delimiter) - (code_span_delimiter) -] @punctuation.delimiter +(emphasis) @markup.italic -(emphasis) @text.emphasis +(strong_emphasis) @markup.strong -(strong_emphasis) @text.strong - -(strikethrough) @text.strike +(strikethrough) @markup.strikethrough [ (link_destination) (uri_autolink) -] @text.uri @nospell +] @markup.link.url @nospell (shortcut_link (link_text) @nospell) [ (link_label) (link_text) + (link_title) (image_description) -] @text.reference +] @markup.link.label [ (backslash_escape) (hard_line_break) ] @string.escape -(image "!" @punctuation.special) -(image ["[" "]" "(" ")"] @punctuation.bracket) -(inline_link ["[" "]" "(" ")"] @punctuation.bracket) -(shortcut_link ["[" "]"] @punctuation.bracket) - ; Conceal codeblock and text style markers -([ - (code_span_delimiter) - (emphasis_delimiter) -] @conceal -(#set! conceal "")) +((code_span_delimiter) @markup.raw + (#set! conceal "")) +((emphasis_delimiter) @markup.strong + (#set! conceal "")) ; Conceal inline links (inline_link @@ -53,7 +40,7 @@ "(" (link_destination) ")" - ] @conceal + ] @markup.link (#set! conceal "")) ; Conceal image links @@ -65,7 +52,7 @@ "(" (link_destination) ")" - ] @conceal + ] @markup.link (#set! conceal "")) ; Conceal full reference links @@ -74,7 +61,7 @@ "[" "]" (link_label) - ] @conceal + ] @markup.link (#set! conceal "")) ; Conceal collapsed reference links @@ -82,7 +69,7 @@ [ "[" "]" - ] @conceal + ] @markup.link (#set! conceal "")) ; Conceal shortcut links @@ -90,13 +77,13 @@ [ "[" "]" - ] @conceal + ] @markup.link (#set! conceal "")) ;; Replace common HTML entities. -((entity_reference) @conceal (#eq? @conceal " ") (#set! conceal "")) -((entity_reference) @conceal (#eq? @conceal "<") (#set! conceal "<")) -((entity_reference) @conceal (#eq? @conceal ">") (#set! conceal ">")) -((entity_reference) @conceal (#eq? @conceal "&") (#set! conceal "&")) -((entity_reference) @conceal (#eq? @conceal """) (#set! conceal "\"")) -((entity_reference) @conceal (#any-of? @conceal " " " ") (#set! conceal " ")) \ No newline at end of file +((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 " ")) diff --git a/queries/matlab/highlights.scm b/queries/matlab/highlights.scm index 9f8303a3d..a2e73ee62 100644 --- a/queries/matlab/highlights.scm +++ b/queries/matlab/highlights.scm @@ -1,7 +1,7 @@ ; Includes -((command_name) @include - (#eq? @include "import")) +((command_name) @keyword.import + (#eq? @keyword.import "import")) ; Keywords @@ -19,24 +19,24 @@ ; Conditionals -(if_statement [ "if" "end" ] @conditional) -(elseif_clause "elseif" @conditional) -(else_clause "else" @conditional) -(switch_statement [ "switch" "end" ] @conditional) -(case_clause "case" @conditional) -(otherwise_clause "otherwise" @conditional) -(break_statement) @conditional +(if_statement [ "if" "end" ] @keyword.conditional) +(elseif_clause "elseif" @keyword.conditional) +(else_clause "else" @keyword.conditional) +(switch_statement [ "switch" "end" ] @keyword.conditional) +(case_clause "case" @keyword.conditional) +(otherwise_clause "otherwise" @keyword.conditional) +(break_statement) @keyword.conditional ; Repeats -(for_statement [ "for" "parfor" "end" ] @repeat) -(while_statement [ "while" "end" ] @repeat) -(continue_statement) @repeat +(for_statement [ "for" "parfor" "end" ] @keyword.repeat) +(while_statement [ "while" "end" ] @keyword.repeat) +(continue_statement) @keyword.repeat ; Exceptions -(try_statement [ "try" "end" ] @exception) -(catch_clause "catch" @exception) +(try_statement [ "try" "end" ] @keyword.exception) +(catch_clause "catch" @keyword.exception) ; Variables @@ -51,7 +51,7 @@ ; Fields/Properties -(field_expression field: (identifier) @field) +(field_expression field: (identifier) @variable.member) (superclass "." (identifier) @property) @@ -87,13 +87,13 @@ (validation_functions (identifier) @function) (command (command_name) @function.call) -(command_argument) @parameter +(command_argument) @variable.parameter (return_statement) @keyword.return ; Parameters -(function_arguments (identifier) @parameter) +(function_arguments (identifier) @variable.parameter) ; Punctuation diff --git a/queries/menhir/highlights.scm b/queries/menhir/highlights.scm index 8b4b41d59..8c4e402c0 100644 --- a/queries/menhir/highlights.scm +++ b/queries/menhir/highlights.scm @@ -1,5 +1,5 @@ ["%parameter" "%token" "%type" "%start" "%attribute" "%left" "%right" "%nonassoc" "%public" "%inline" "%prec"] @keyword -["%on_error_reduce"] @exception +["%on_error_reduce"] @keyword.exception ["let"] @keyword.function @@ -15,7 +15,7 @@ (old_rule [(symbol)] @function) (new_rule [(lid)] @function) -(precedence [(symbol)] @parameter) +(precedence [(symbol)] @variable.parameter) (funcall) @function.call diff --git a/queries/mermaid/highlights.scm b/queries/mermaid/highlights.scm index 2f3e31b90..b661f8ad8 100644 --- a/queries/mermaid/highlights.scm +++ b/queries/mermaid/highlights.scm @@ -99,12 +99,12 @@ "&" ] @operator -(sequence_actor) @field -(class_name) @field +(sequence_actor) @variable.member +(class_name) @variable.member -(state_name) @field +(state_name) @variable.member -(gantt_task_text) @field +(gantt_task_text) @variable.member [ (class_annotation_line) @@ -116,10 +116,10 @@ (state_annotation_choice) ] @attribute -(directive) @include +(directive) @keyword.import (pie_label) @string -(pie_value) @float +(pie_value) @number.float [ (flowchart_direction_lr) @@ -128,7 +128,7 @@ (flowchart_direction_bt) ] @constant -(flow_vertex_id) @field +(flow_vertex_id) @variable.member [ (flow_link_arrow) @@ -164,10 +164,10 @@ (er_reltype_identifying) ] @operator -(er_entity_name) @field +(er_entity_name) @variable.member (er_attribute_type) @type -(er_attribute_name) @field +(er_attribute_name) @variable.member [ (er_attribute_key_type_pk) diff --git a/queries/meson/highlights.scm b/queries/meson/highlights.scm index 14fc52136..a61e6b1e6 100644 --- a/queries/meson/highlights.scm +++ b/queries/meson/highlights.scm @@ -40,21 +40,21 @@ ] @operator (ternaryoperator - ["?" ":"] @conditional.ternary) + ["?" ":"] @keyword.conditional.ternary) [ "if" "elif" "else" "endif" -] @conditional +] @keyword.conditional [ "foreach" "endforeach" (keyword_break) (keyword_continue) -] @repeat +] @keyword.repeat (string) @string diff --git a/queries/mlir/highlights.scm b/queries/mlir/highlights.scm index 2037ff78e..ff768a19d 100644 --- a/queries/mlir/highlights.scm +++ b/queries/mlir/highlights.scm @@ -274,7 +274,7 @@ (complex_literal) ] @number -(float_literal) @float +(float_literal) @number.float (bool_literal) @boolean [ @@ -328,8 +328,8 @@ (func_dialect name: (symbol_ref_id) @function) (llvm_dialect name: (symbol_ref_id) @function) -(func_arg_list (value_use) @parameter) -(block_arg_list (value_use) @parameter) +(func_arg_list (value_use) @variable.parameter) +(block_arg_list (value_use) @variable.parameter) (caret_id) @tag (value_use) @variable diff --git a/queries/nasm/highlights.scm b/queries/nasm/highlights.scm index 1556f9ca5..d588635fc 100644 --- a/queries/nasm/highlights.scm +++ b/queries/nasm/highlights.scm @@ -23,7 +23,7 @@ "?" @constant.builtin (conditional_expression - [ "?" ":" ] @conditional.ternary) + [ "?" ":" ] @keyword.conditional.ternary) [ ":" @@ -58,7 +58,7 @@ (string_literal) @string -(float_literal) @float +(float_literal) @number.float [ (packed_bcd_literal) @@ -83,18 +83,18 @@ (preproc_pragma) (preproc_line) (preproc_clear) -] @preproc +] @keyword.directive -(preproc_include) @include +(preproc_include) @keyword.import -(preproc_rep_loop) @repeat +(preproc_rep_loop) @keyword.repeat -(preproc_if) @conditional +(preproc_if) @keyword.conditional [ (preproc_def) (preproc_undef) -] @define +] @keyword.directive.define (preproc_function_def) @keyword.function diff --git a/queries/nickel/highlights.scm b/queries/nickel/highlights.scm index f4df28030..e340c37f7 100644 --- a/queries/nickel/highlights.scm +++ b/queries/nickel/highlights.scm @@ -11,10 +11,10 @@ "fun" @keyword.function -"import" @include +"import" @keyword.import -[ "if" "then" "else" ] @conditional -"match" @conditional +[ "if" "then" "else" ] @keyword.conditional +"match" @keyword.conditional (types) @type "Array" @type.builtin @@ -46,13 +46,13 @@ (interpolation_start) @punctuation.bracket (interpolation_end) @punctuation.bracket -(record_field) @field +(record_field) @variable.member (builtin) @function.builtin (fun_expr pats: (pattern id: - (ident) @parameter + (ident) @variable.parameter ) ) diff --git a/queries/nim/highlights.scm b/queries/nim/highlights.scm index a6e28038e..1a7da2ba2 100644 --- a/queries/nim/highlights.scm +++ b/queries/nim/highlights.scm @@ -27,7 +27,7 @@ (pragma_list) @variable)) ; NOTE: has to be after ; (type_expression) @type -; and before @preproc and all literals +; and before @keyword.directive and all literals ; constants/enums in array construction (array_construction @@ -86,14 +86,14 @@ [ "(" ")" "[" "[:" "]" "{" "}" ] @punctuation.bracket ; ============================================================================= -; @preproc ; various preprocessor directives & shebangs +; @keyword.directive ; various preprocessor directives & shebangs [ "macro" "template" -] @preproc +] @keyword.directive -(pragma_list ["{." "}" ".}"] @preproc) +(pragma_list ["{." "}" ".}"] @keyword.directive) ; NOTE: has to come after @punctuation.bracket ; ============================================================================= @@ -156,9 +156,9 @@ (custom_numeric_literal) @number ; ============================================================================= -; @float ; floating-point number literals +; @number.float ; floating-point number literals -(float_literal) @float +(float_literal) @number.float ; ============================================================================= ; @function ; function definitions @@ -294,14 +294,14 @@ ]) ; ============================================================================= -; @method ; method definitions +; @function.method ; method definitions (method_declaration name: [ - (identifier) @method - (accent_quoted (identifier) @method) - (exported_symbol (identifier) @method) - (exported_symbol (accent_quoted (identifier) @method)) + (identifier) @function.method + (accent_quoted (identifier) @function.method) + (exported_symbol (identifier) @function.method) + (exported_symbol (accent_quoted (identifier) @function.method)) ]) ; ============================================================================= @@ -403,7 +403,7 @@ ] @keyword.return ; ============================================================================= -; @conditional ; keywords related to conditionals (e.g. `if` / `else`) +; @keyword.conditional ; keywords related to conditionals (e.g. `if` / `else`) [ "if" @@ -411,21 +411,21 @@ "case" "elif" "else" -] @conditional +] @keyword.conditional -(of_branch "of" @conditional) +(of_branch "of" @keyword.conditional) ; ============================================================================= -; @repeat ; keywords related to loops (e.g. `for` / `while`) +; @keyword.repeat ; keywords related to loops (e.g. `for` / `while`) [ "for" "while" "continue" "break" -] @repeat +] @keyword.repeat -(for "in" @repeat) +(for "in" @keyword.repeat) ; ============================================================================= ; @label ; GOTO and other labels (e.g. `label:` in C) @@ -437,27 +437,27 @@ ]) ; ============================================================================= -; @include ; keywords for including modules (e.g. `import` / `from` in Python) +; @keyword.import ; keywords for including modules (e.g. `import` / `from` in Python) [ "import" "include" "export" -] @include +] @keyword.import -(import_from_statement "from" @include) +(import_from_statement "from" @keyword.import) -(except_clause "except" @include) +(except_clause "except" @keyword.import) ; ============================================================================= -; @exception ; keywords related to exceptions (e.g. `throw` / `catch`) +; @keyword.exception ; keywords related to exceptions (e.g. `throw` / `catch`) [ "try" "except" "finally" "raise" -] @exception +] @keyword.exception ; ============================================================================= ; @type ; type or class definitions and annotations @@ -505,15 +505,15 @@ ; where `tuple` is captured as @keyword ; ============================================================================= -; @parameter ; parameters of a function +; @variable.parameter ; parameters of a function ; named parameters when calling ; call(parameter_name=arg) (argument_list (equal_expression left: [ - (identifier) @parameter - (accent_quoted (identifier) @parameter) + (identifier) @variable.parameter + (accent_quoted (identifier) @variable.parameter) ])) ; parameters in function declaration @@ -522,8 +522,8 @@ (symbol_declaration_list (symbol_declaration name: [ - (identifier) @parameter - (accent_quoted (identifier) @parameter) + (identifier) @variable.parameter + (accent_quoted (identifier) @variable.parameter) ])))) ; NOTE: needs to be after @type @@ -533,8 +533,8 @@ (symbol_declaration_list (symbol_declaration name: [ - (identifier) @parameter - (accent_quoted (identifier) @parameter) + (identifier) @variable.parameter + (accent_quoted (identifier) @variable.parameter) ]))))) ; for loop variables @@ -543,43 +543,43 @@ (symbol_declaration_list (symbol_declaration name: [ - (identifier) @parameter - (accent_quoted (identifier) @parameter) + (identifier) @variable.parameter + (accent_quoted (identifier) @variable.parameter) ]))) ((tuple_deconstruct_declaration (symbol_declaration name: [ - (identifier) @parameter - (accent_quoted (identifier) @parameter) + (identifier) @variable.parameter + (accent_quoted (identifier) @variable.parameter) ])) @_tuple_decons (#has-ancestor? @_tuple_decons for)) (concept_declaration parameters: (parameter_list [ - (identifier) @parameter - (accent_quoted (identifier) @parameter) + (identifier) @variable.parameter + (accent_quoted (identifier) @variable.parameter) ])) (var_parameter [ - (identifier) @parameter - (accent_quoted (identifier) @parameter) + (identifier) @variable.parameter + (accent_quoted (identifier) @variable.parameter) ]) (type_parameter [ - (identifier) @parameter - (accent_quoted (identifier) @parameter) + (identifier) @variable.parameter + (accent_quoted (identifier) @variable.parameter) ]) (static_parameter [ - (identifier) @parameter - (accent_quoted (identifier) @parameter) + (identifier) @variable.parameter + (accent_quoted (identifier) @variable.parameter) ]) (ref_parameter [ - (identifier) @parameter - (accent_quoted (identifier) @parameter) + (identifier) @variable.parameter + (accent_quoted (identifier) @variable.parameter) ]) (pointer_parameter [ - (identifier) @parameter - (accent_quoted (identifier) @parameter) + (identifier) @variable.parameter + (accent_quoted (identifier) @variable.parameter) ]) @@ -612,17 +612,17 @@ (pointer_parameter "ptr" @type.qualifier) ; ============================================================================= -; @field ; object and struct fields +; @variable.member ; object and struct fields ; fields in object/tuple declaration (field_declaration (symbol_declaration_list (symbol_declaration name: [ - (identifier) @field - (accent_quoted (identifier) @field) - (exported_symbol (identifier) @field) - (exported_symbol (accent_quoted (identifier) @field)) + (identifier) @variable.member + (accent_quoted (identifier) @variable.member) + (exported_symbol (identifier) @variable.member) + (exported_symbol (accent_quoted (identifier) @variable.member)) ]))) ; fields in object construction @@ -630,16 +630,16 @@ (argument_list (colon_expression left: [ - (identifier) @field - (accent_quoted (identifier) @field) + (identifier) @variable.member + (accent_quoted (identifier) @variable.member) ]))) ; fields in tuple construction (tuple_construction (colon_expression left: [ - (identifier) @field - (accent_quoted (identifier) @field) + (identifier) @variable.member + (accent_quoted (identifier) @variable.member) ])) (variant_declaration @@ -647,10 +647,10 @@ (symbol_declaration_list (symbol_declaration name: [ - (identifier) @field - (accent_quoted (identifier) @field) - (exported_symbol (identifier) @field) - (exported_symbol (accent_quoted (identifier) @field)) + (identifier) @variable.member + (accent_quoted (identifier) @variable.member) + (exported_symbol (identifier) @variable.member) + (exported_symbol (accent_quoted (identifier) @variable.member)) ])))) ; ============================================================================= @@ -732,37 +732,37 @@ (nil_literal) @constant.builtin ; ============================================================================= -; @namespace ; modules or namespaces +; @module ; modules or namespaces (import_statement (expression_list - (identifier) @namespace)) + (identifier) @module)) (import_statement (expression_list (infix_expression operator: "as" - right: (identifier) @namespace))) + right: (identifier) @module))) (import_statement (expression_list (infix_expression operator: (operator) @_operator right: [ - (identifier) @namespace - (array_construction (identifier) @namespace) + (identifier) @module + (array_construction (identifier) @module) ])) (#eq? @_operator "/")) (import_from_statement module: (infix_expression operator: (operator) @_operator - right: (identifier) @namespace) + right: (identifier) @module) (#eq? @_operator "/")) (export_statement (expression_list - (identifier) @namespace)) + (identifier) @module)) ; ============================================================================= ; overrule things diff --git a/queries/nim_format_string/highlights.scm b/queries/nim_format_string/highlights.scm index 94a239dfb..b30ecbbef 100644 --- a/queries/nim_format_string/highlights.scm +++ b/queries/nim_format_string/highlights.scm @@ -6,10 +6,10 @@ (format_specifiers colon: (colon) @punctuation.delimiter - fill_align: (fill_align)? @conditional.ternary + fill_align: (fill_align)? @keyword.conditional.ternary sign: (sign)? @operator hash: (hash)? @punctuation.special - zero: (zero)? @field + zero: (zero)? @variable.member min_width: (min_width)? @number precision: (precision)? @number type: (type)? @type) diff --git a/queries/ninja/highlights.scm b/queries/ninja/highlights.scm index e90169ff3..5f87ff6b5 100644 --- a/queries/ninja/highlights.scm +++ b/queries/ninja/highlights.scm @@ -8,7 +8,7 @@ [ "include" "subninja" -] @include +] @keyword.import [ ":" @@ -39,7 +39,7 @@ ;; ;; Paths and Text ;; ============== -(path) @string.special +(path) @string.special.path (text) @string ;; diff --git a/queries/nix/highlights.scm b/queries/nix/highlights.scm index 97e5303ba..0f6caf4e2 100644 --- a/queries/nix/highlights.scm +++ b/queries/nix/highlights.scm @@ -15,8 +15,8 @@ ; exceptions (variable_expression - name: (identifier) @exception - (#any-of? @exception "abort" "throw") + name: (identifier) @keyword.exception + (#any-of? @keyword.exception "abort" "throw") (#set! "priority" 101)) ; if/then/else @@ -24,7 +24,7 @@ "if" "then" "else" -] @conditional +] @keyword.conditional ; field access default (`a.b or c`) "or" @keyword.operator @@ -37,7 +37,8 @@ (#set! "priority" 99)) @string ; paths and URLs -[ (path_expression) (hpath_expression) (spath_expression) (uri_expression) ] @string.special +[ (path_expression) (hpath_expression) (spath_expression) ] @string.special.path +(uri_expression) @string.special.url ; escape sequences (escape_sequence) @string.escape @@ -61,7 +62,7 @@ ; `?` in `{ x ? y }:`, used to set defaults for named function arguments (formal - name: (identifier) @parameter + name: (identifier) @variable.parameter "?"? @operator) ; `...` in `{ ... }`, used to ignore unknown named function arguments (see above) @@ -70,7 +71,7 @@ ; universal is the parameter of the function expression ; `:` in `x: y`, used to separate function argument from body (see above) (function_expression - universal: (identifier) @parameter + universal: (identifier) @variable.parameter ":" @punctuation.special) ; function calls @@ -82,8 +83,8 @@ (variable_expression) @variable (variable_expression - name: (identifier) @include - (#eq? @include "import")) + name: (identifier) @keyword.import + (#eq? @keyword.import "import")) (variable_expression name: (identifier) @boolean @@ -115,11 +116,11 @@ (select_expression expression: (_) @_expr - attrpath: (attrpath attr: (identifier) @field) + attrpath: (attrpath attr: (identifier) @variable.member) (#not-eq? @_expr "builtins") ) -(attrset_expression (binding_set (binding . (attrpath (identifier) @field)))) -(rec_attrset_expression (binding_set (binding . (attrpath (identifier) @field)))) +(attrset_expression (binding_set (binding . (attrpath (identifier) @variable.member)))) +(rec_attrset_expression (binding_set (binding . (attrpath (identifier) @variable.member)))) ; function definition (binding @@ -142,5 +143,5 @@ [ (unary_expression "-" (float_expression)) (float_expression) -] @float +] @number.float diff --git a/queries/nqc/highlights.scm b/queries/nqc/highlights.scm index 28d101f66..2198426ca 100644 --- a/queries/nqc/highlights.scm +++ b/queries/nqc/highlights.scm @@ -7,7 +7,7 @@ [ "until" -] @repeat +] @keyword.repeat [ "acquire" diff --git a/queries/objc/highlights.scm b/queries/objc/highlights.scm index c636895f6..129a74e89 100644 --- a/queries/objc/highlights.scm +++ b/queries/objc/highlights.scm @@ -3,15 +3,15 @@ ; Preprocs (preproc_undef - name: (_) @constant) @preproc + name: (_) @constant) @keyword.directive ; Includes -(module_import "@import" @include path: (identifier) @namespace) +(module_import "@import" @keyword.import path: (identifier) @module) ((preproc_include - _ @include path: (_)) - (#any-of? @include "#include" "#import")) + _ @keyword.import path: (_)) + (#any-of? @keyword.import "#include" "#import")) ; Type Qualifiers @@ -31,7 +31,7 @@ "@dynamic" "volatile" (protocol_qualifier) -] @storageclass +] @keyword.storage ; Keywords @@ -74,7 +74,7 @@ "@finally" "__finally" "@throw" -] @exception +] @keyword.exception ; Variables @@ -91,13 +91,13 @@ "asm" ] @function.builtin -(method_definition (identifier) @method) +(method_definition (identifier) @function.method) -(method_declaration (identifier) @method) +(method_declaration (identifier) @function.method) -(method_identifier (identifier)? @method ":" @method (identifier)? @method) +(method_identifier (identifier)? @function.method ":" @function.method (identifier)? @function.method) -(message_expression method: (identifier) @method.call) +(message_expression method: (identifier) @function.method.call) ; Constructors @@ -154,9 +154,9 @@ (class_declaration (identifier) @type) -(class_interface "@interface" . (identifier) @type superclass: _? @type category: _? @namespace) +(class_interface "@interface" . (identifier) @type superclass: _? @type category: _? @module) -(class_implementation "@implementation" . (identifier) @type superclass: _? @type category: _? @namespace) +(class_implementation "@implementation" . (identifier) @type superclass: _? @type category: _? @module) (protocol_forward_declaration (identifier) @type) ; @interface :( @@ -185,17 +185,17 @@ ; Parameters -(method_parameter ":" @method (identifier) @parameter) +(method_parameter ":" @function.method (identifier) @variable.parameter) -(method_parameter declarator: (identifier) @parameter) +(method_parameter declarator: (identifier) @variable.parameter) (parameter_declaration declarator: (function_declarator declarator: (parenthesized_declarator (block_pointer_declarator - declarator: (identifier) @parameter)))) + declarator: (identifier) @variable.parameter)))) -"..." @parameter.builtin +"..." @variable.parameter.builtin ; Operators @@ -207,7 +207,7 @@ (platform) @string.special -(version_number) @text.uri @number +(version_number) @string.special ; Punctuation diff --git a/queries/objdump/highlights.scm b/queries/objdump/highlights.scm index d23f5a0d9..7532260a6 100644 --- a/queries/objdump/highlights.scm +++ b/queries/objdump/highlights.scm @@ -6,26 +6,26 @@ (address) ] @number -[ - "file" "format" - "File" "Offset:" - "discriminator" -] @text -"Disassembly of section " @text.title +; [ +; "file" "format" +; "File" "Offset:" +; "discriminator" +; ] @none +"Disassembly of section " @markup.heading -(section_address) @number @text.underline +(section_address) @string.special (identifier) @variable (code_location (identifier) @function.call) (header (identifier) @keyword) -(disassembly_section_label (identifier) @namespace) -(disassembly_section (identifier) @namespace) +(disassembly_section_label (identifier) @module) +(disassembly_section (identifier) @module) -[(file_offset) (discriminator)] @field +[(file_offset) (discriminator)] @variable.member -(file_path) @string +(file_path) @string.special.path (instruction) @function -(bad_instruction) @text.warning +(bad_instruction) @comment.warning (label) @label ["<" ">"] @punctuation.special diff --git a/queries/ocaml/highlights.scm b/queries/ocaml/highlights.scm index e263d833e..d08c8e358 100644 --- a/queries/ocaml/highlights.scm +++ b/queries/ocaml/highlights.scm @@ -1,7 +1,7 @@ ; Modules ;-------- -[(module_name) (module_type_name)] @namespace +[(module_name) (module_type_name)] @module ; Types ;------ @@ -23,7 +23,7 @@ [(value_name) (type_variable)] @variable -(value_pattern) @parameter +(value_pattern) @variable.parameter ; Functions ;---------- @@ -40,7 +40,7 @@ (external (value_name) @function) -(method_name) @method +(method_name) @function.method ; Application ;------------ @@ -107,13 +107,13 @@ ["fun" "function" "functor"] @keyword.function -["if" "then" "else"] @conditional +["if" "then" "else"] @keyword.conditional -["exception" "try"] @exception +["exception" "try"] @keyword.exception -["include" "open"] @include +["include" "open"] @keyword.import -["for" "to" "downto" "while" "do" "done"] @repeat +["for" "to" "downto" "while" "do" "done"] @keyword.repeat ; Punctuation ;------------ diff --git a/queries/ocamllex/highlights.scm b/queries/ocamllex/highlights.scm index 248470821..6a5088710 100644 --- a/queries/ocamllex/highlights.scm +++ b/queries/ocamllex/highlights.scm @@ -23,7 +23,7 @@ ; Rules (lexer_entry_name) @function -(lexer_argument) @parameter +(lexer_argument) @variable.parameter (lexer_entry ["=" "|"] @punctuation.delimiter) diff --git a/queries/odin/highlights.scm b/queries/odin/highlights.scm index 6b06153f3..38896cbfc 100644 --- a/queries/odin/highlights.scm +++ b/queries/odin/highlights.scm @@ -3,14 +3,14 @@ [ (calling_convention) (tag) -] @preproc +] @keyword.directive ; Includes [ "import" "package" -] @include +] @keyword.import ; Keywords @@ -41,7 +41,7 @@ [ "distinct" "dynamic" -] @storageclass +] @keyword.storage ; Conditionals @@ -54,7 +54,7 @@ "where" "break" (fallthrough_statement) -] @conditional +] @keyword.conditional ((ternary_expression [ @@ -63,7 +63,7 @@ "if" "else" "when" - ] @conditional.ternary) + ] @keyword.conditional.ternary) (#set! "priority" 105)) ; Repeats @@ -72,7 +72,7 @@ "for" "do" "continue" -] @repeat +] @keyword.repeat ; Variables @@ -80,23 +80,23 @@ ; Namespaces -(package_declaration (identifier) @namespace) +(package_declaration (identifier) @module) -(import_declaration alias: (identifier) @namespace) +(import_declaration alias: (identifier) @module) -(foreign_block (identifier) @namespace) +(foreign_block (identifier) @module) -(using_statement (identifier) @namespace) +(using_statement (identifier) @module) ; Parameters -(parameter (identifier) @parameter ":" "="? (identifier)? @constant) +(parameter (identifier) @variable.parameter ":" "="? (identifier)? @constant) -(default_parameter (identifier) @parameter ":=") +(default_parameter (identifier) @variable.parameter ":=") -(named_type (identifier) @parameter) +(named_type (identifier) @variable.parameter) -(call_expression argument: (identifier) @parameter "=") +(call_expression argument: (identifier) @variable.parameter "=") ; Functions @@ -138,7 +138,7 @@ (struct . (identifier) @type) -(field_type . (identifier) @namespace "." (identifier) @type) +(field_type . (identifier) @module "." (identifier) @type) (bit_set_type (identifier) @type ";") @@ -152,13 +152,13 @@ ; Fields -(member_expression "." (identifier) @field) +(member_expression "." (identifier) @variable.member) -(struct_type "{" (identifier) @field) +(struct_type "{" (identifier) @variable.member) -(struct_field (identifier) @field "="?) +(struct_field (identifier) @variable.member "="?) -(field (identifier) @field) +(field (identifier) @variable.member) ; Constants @@ -187,7 +187,7 @@ (number) @number -(float) @float +(float) @number.float (string) @string diff --git a/queries/pascal/highlights.scm b/queries/pascal/highlights.scm index e11e0eaa2..088465545 100644 --- a/queries/pascal/highlights.scm +++ b/queries/pascal/highlights.scm @@ -72,13 +72,13 @@ (kWhile) (kRepeat) (kUntil) -] @repeat +] @keyword.repeat [ (kIf) (kThen) (kElse) -] @conditional +] @keyword.conditional [ (kPublished) @@ -95,9 +95,9 @@ (kPacked) (kAbsolute) -] @storageclass +] @keyword.storage -(kUses) @include +(kUses) @keyword.import ; -- Attributes @@ -278,7 +278,7 @@ (comment) @comment.documentation . (declVar)) -(pp) @preproc +(pp) @keyword.directive ; -- Type declaration @@ -304,11 +304,11 @@ ; -- Function parameters -(declArg name: (identifier) @parameter) +(declArg name: (identifier) @variable.parameter) ; -- Template parameters -(genericArg name: (identifier) @parameter) +(genericArg name: (identifier) @variable.parameter) (genericArg type: (typeref) @type) (declProc name: (genericDot lhs: (identifier) @type)) @@ -322,7 +322,7 @@ ; -- Exception parameters -(exceptionHandler variable: (identifier) @parameter) +(exceptionHandler variable: (identifier) @variable.parameter) ; -- Type usage @@ -394,10 +394,10 @@ (#lua-match? @keyword.return "^[eE][xX][iI][tT]$"))) (statement (exprCall entity: ((identifier) @keyword.return (#lua-match? @keyword.return "^[eE][xX][iI][tT]$")))) -(statement ((identifier) @repeat - (#lua-match? @repeat "^[bB][rR][eE][aA][kK]$"))) -(statement ((identifier) @repeat - (#lua-match? @repeat "^[cC][oO][nN][tT][iI][nN][uU][eE]$"))) +(statement ((identifier) @keyword.repeat + (#lua-match? @keyword.repeat "^[bB][rR][eE][aA][kK]$"))) +(statement ((identifier) @keyword.repeat + (#lua-match? @keyword.repeat "^[cC][oO][nN][tT][iI][nN][uU][eE]$"))) ; -- Identifier type inference diff --git a/queries/passwd/highlights.scm b/queries/passwd/highlights.scm index 3e078a123..51bb8fc5f 100644 --- a/queries/passwd/highlights.scm +++ b/queries/passwd/highlights.scm @@ -1,12 +1,12 @@ -(user) @namespace +(user) @module -(auth) @symbol +(auth) @string.special.symbol (gecos) @string -(home) @text.uri @constant +(home) @string.special.path -(shell) @text.uri @string.special +(shell) @string.special.path [ (gid) diff --git a/queries/perl/highlights.scm b/queries/perl/highlights.scm index e3aa0b2bb..7a0c4e530 100644 --- a/queries/perl/highlights.scm +++ b/queries/perl/highlights.scm @@ -1,13 +1,13 @@ -((source_file . (comment) @preproc) - (#lua-match? @preproc "^#!/")) +((source_file . (comment) @keyword.directive) + (#lua-match? @keyword.directive "^#!/")) -[ "use" "no" "require" ] @include +[ "use" "no" "require" ] @keyword.import -[ "if" "elsif" "unless" "else" ] @conditional +[ "if" "elsif" "unless" "else" ] @keyword.conditional -(conditional_expression [ "?" ":" ] @conditional.ternary) +(conditional_expression [ "?" ":" ] @keyword.conditional.ternary) -[ "while" "until" "for" "foreach" ] @repeat +[ "while" "until" "for" "foreach" ] @keyword.repeat "return" @keyword.return @@ -15,7 +15,7 @@ [ "map" "grep" "sort" ] @function.builtin -"package" @include +"package" @keyword.import [ "do" @@ -27,7 +27,7 @@ (_ operator: _ @operator) "\\" @operator -(yadayada) @exception +(yadayada) @keyword.exception (phaser_statement phase: _ @keyword.phaser) @@ -37,10 +37,10 @@ "isa" ] @keyword.operator -(eof_marker) @preproc +(eof_marker) @keyword.directive (data_section) @comment -(pod) @text +(pod) @none [ (number) @@ -70,7 +70,7 @@ (quoted_regexp) (match_regexp) (regexp_content) -] @string.regex +] @string.regexp (autoquoted_bareword) @string.special @@ -89,7 +89,7 @@ (relational_expression operator: "isa" right: (bareword) @type) (function_call_expression (function) @function.call) -(method_call_expression (method) @method.call) +(method_call_expression (method) @function.method.call) (method_call_expression invocant: (bareword) @type) (func0op_call_expression function: _ @function.builtin) diff --git a/queries/php/highlights.scm b/queries/php/highlights.scm index 427ab4838..aa3be62b9 100644 --- a/queries/php/highlights.scm +++ b/queries/php/highlights.scm @@ -59,7 +59,7 @@ (list_literal "list" @function.builtin) (method_declaration - name: (name) @method) + name: (name) @function.method) (function_call_expression function: (qualified_name (name) @function.call)) @@ -71,13 +71,13 @@ name: (name) @function.call) (member_call_expression - name: (name) @method.call) + name: (name) @function.method.call) (function_definition name: (name) @function) (nullsafe_member_call_expression - name: (name) @method) + name: (name) @function.method) (method_declaration name: (name) @constructor @@ -90,10 +90,10 @@ [ (simple_parameter) (variadic_parameter) -] @parameter +] @variable.parameter (argument - (name) @parameter) + (name) @variable.parameter) ; Member @@ -115,18 +115,18 @@ ; Namespace (namespace_definition - name: (namespace_name (name) @namespace)) + name: (namespace_name (name) @module)) (namespace_name_as_prefix - (namespace_name (name) @namespace)) + (namespace_name (name) @module)) ; Attributes (attribute_list) @attribute ; Conditions ( ? : ) -(conditional_expression) @conditional +(conditional_expression) @keyword.conditional ; Directives -(declare_directive ["strict_types" "ticks" "encoding"] @parameter) +(declare_directive ["strict_types" "ticks" "encoding"] @variable.parameter) ; Basic tokens @@ -149,7 +149,7 @@ (boolean) @boolean (null) @constant.builtin (integer) @number -(float) @float +(float) @number.float (comment) @comment @spell (named_label_statement) @label @@ -215,7 +215,7 @@ "switch" "match" "??" - ] @conditional + ] @keyword.conditional [ "continue" @@ -226,14 +226,14 @@ "for" "foreach" "while" - ] @repeat + ] @keyword.repeat [ "catch" "finally" "throw" "try" - ] @exception + ] @keyword.exception [ "include_once" @@ -241,7 +241,7 @@ "require_once" "require" "use" - ] @include + ] @keyword.import [ "," diff --git a/queries/phpdoc/highlights.scm b/queries/phpdoc/highlights.scm index 08ff9e1cb..a30409314 100644 --- a/queries/phpdoc/highlights.scm +++ b/queries/phpdoc/highlights.scm @@ -1,7 +1,7 @@ (tag_name) @attribute @nospell (tag (tag_name) @_tag (#eq? @_tag "@param") - (variable_name) @parameter + (variable_name) @variable.parameter ) (tag (tag_name) @_tag (#eq? @_tag "@property") @@ -12,11 +12,11 @@ (variable_name) @variable ) (tag - (tag_name) @_tag (#eq? @_tag "@method") - (name) @method + (tag_name) @_tag (#eq? @_tag "@function.method") + (name) @function.method ) (parameter - (variable_name) @parameter) + (variable_name) @variable.parameter) (type_list [ (array_type) @@ -27,14 +27,14 @@ (type_list) @nospell (variable_name) @nospell (tag - (description (text) @text)) + (description (text) @none @spell)) (tag [ (author_name) (version) - ] @text) + ] @none) (tag - (email_address) @text.uri + (email_address) @string.special.url ) (type_list "|" @keyword) diff --git a/queries/pioasm/highlights.scm b/queries/pioasm/highlights.scm index 055f745b4..6d0479b37 100644 --- a/queries/pioasm/highlights.scm +++ b/queries/pioasm/highlights.scm @@ -21,9 +21,9 @@ [ "block" "noblock" "rel" ] @attribute -[ "iffull" "ifempty" ] @conditional +[ "iffull" "ifempty" ] @keyword.conditional -"public" @storageclass +"public" @keyword.storage (integer) @number @@ -31,4 +31,4 @@ (directive (symbol_def (identifier) @variable)) (value (identifier) @variable) -(directive directive: _ @preproc) +(directive directive: _ @keyword.directive) diff --git a/queries/po/highlights.scm b/queries/po/highlights.scm index 307e32059..d799d692b 100644 --- a/queries/po/highlights.scm +++ b/queries/po/highlights.scm @@ -26,4 +26,4 @@ (comment (reference (text) @string.special.path)) -(comment (flag (text) @preproc)) +(comment (flag (text) @keyword.directive)) diff --git a/queries/pod/highlights.scm b/queries/pod/highlights.scm index e1e88f5f8..e5a192620 100644 --- a/queries/pod/highlights.scm +++ b/queries/pod/highlights.scm @@ -12,7 +12,7 @@ (command_paragraph (command) @keyword (#lua-match? @keyword "^=head") - (content) @text.title) + (content) @markup.heading) (command_paragraph (command) @keyword @@ -22,7 +22,7 @@ (command_paragraph (command) @keyword (#lua-match? @keyword "^=item") - (content) @text) + (content) @none) (command_paragraph (command) @keyword @@ -30,7 +30,7 @@ (content) @string.special) -(verbatim_paragraph (content) @text.literal) +(verbatim_paragraph (content) @markup.raw) (interior_sequence (sequence_letter) @character @@ -40,32 +40,32 @@ (interior_sequence (sequence_letter) @character (#eq? @character "B") - (content) @text.strong) + (content) @markup.strong) (interior_sequence (sequence_letter) @character (#eq? @character "C") - (content) @text.literal) + (content) @markup.raw) (interior_sequence (sequence_letter) @character (#eq? @character "F") - (content) @text.underline @string.special) + (content) @string.special.path) (interior_sequence (sequence_letter) @character (#eq? @character "I") - (content) @text.emphasis) + (content) @markup.italic) (interior_sequence (sequence_letter) @character (#eq? @character "L") - (content) @text.uri) + (content) @string.special.url) (interior_sequence (sequence_letter) @character (#eq? @character "X") - (content) @text.reference) + (content) @markup.link) (interior_sequence (sequence_letter) @character diff --git a/queries/poe_filter/highlights.scm b/queries/poe_filter/highlights.scm index 3b233a7d8..7db71d279 100644 --- a/queries/poe_filter/highlights.scm +++ b/queries/poe_filter/highlights.scm @@ -1,8 +1,8 @@ -["Show" "Hide" "Minimal"] @namespace +["Show" "Hide" "Minimal"] @module -["Import" "Optional"] @include +["Import" "Optional"] @keyword.import -(condition (name) @conditional) +(condition (name) @keyword.conditional) (action (name) @keyword) (continue) @label @@ -10,7 +10,7 @@ (string) @string -(file) @string.special +(file) @string.special.path [ (quality) diff --git a/queries/pony/highlights.scm b/queries/pony/highlights.scm index 18c3975ea..1d0c86c35 100644 --- a/queries/pony/highlights.scm +++ b/queries/pony/highlights.scm @@ -2,7 +2,7 @@ [ "use" -] @include +] @keyword.import ; Keywords @@ -68,13 +68,13 @@ "else" "elseif" "match" -] @conditional +] @keyword.conditional -(if_statement "end" @conditional) +(if_statement "end" @keyword.conditional) -(iftype_statement "end" @conditional) +(iftype_statement "end" @keyword.conditional) -(match_statement "end" @conditional) +(match_statement "end" @keyword.conditional) ; Repeats @@ -86,11 +86,11 @@ "continue" "do" "break" -] @repeat +] @keyword.repeat -(do_block "end" @repeat) +(do_block "end" @keyword.repeat) -(repeat_statement "end" @repeat) +(repeat_statement "end" @keyword.repeat) ; Exceptions @@ -98,11 +98,11 @@ "try" (error) "compile_error" -] @exception +] @keyword.exception -(try_statement "end" @exception) +(try_statement "end" @keyword.exception) -(recover_statement "end" @exception) +(recover_statement "end" @keyword.exception) ; Attributes @@ -116,9 +116,9 @@ ; Fields -(field name: (identifier) @field) +(field name: (identifier) @variable.member) -(member_expression "." (identifier) @field) +(member_expression "." (identifier) @variable.member) ; Constructors @@ -126,11 +126,11 @@ ; Methods -(method (identifier) @method) +(method (identifier) @function.method) -(behavior (identifier) @method) +(behavior (identifier) @function.method) -(ffi_method (identifier) @method) +(ffi_method (identifier) @function.method) ((ffi_method (string) @string.special) (#set! "priority" 105)) @@ -138,15 +138,15 @@ (call_expression callee: [ - (identifier) @method.call - (ffi_identifier (identifier) @method.call) - (member_expression "." (identifier) @method.call) + (identifier) @function.method.call + (ffi_identifier (identifier) @function.method.call) + (member_expression "." (identifier) @function.method.call) ]) ; Parameters -(parameter name: (identifier) @parameter) -(lambda_parameter name: (identifier) @parameter) +(parameter name: (identifier) @variable.parameter) +(lambda_parameter name: (identifier) @variable.parameter) ; Types @@ -156,7 +156,7 @@ (generic_parameter (identifier) @type) -(lambda_type (identifier)? @method) +(lambda_type (identifier)? @function.method) ((identifier) @type (#lua-match? @type "^_*[A-Z][a-zA-Z0-9_]*$")) @@ -250,7 +250,7 @@ (number) @number -(float) @float +(float) @number.float (boolean) @boolean diff --git a/queries/promql/highlights.scm b/queries/promql/highlights.scm index 47038034a..d0af0356c 100644 --- a/queries/promql/highlights.scm +++ b/queries/promql/highlights.scm @@ -25,15 +25,15 @@ ")" ] @punctuation.bracket -(float_literal) @float +(float_literal) @number.float (string_literal) @string (metric_name) @type -(range_selection) @text.strong @type -(subquery_range_selection) @text.strong @type +(range_selection) @type +(subquery_range_selection) @type -(label_name) @field -(label_value) @text.underline @string.regex +(label_name) @variable.member +(label_value) @string.regexp (function_name) @function.call diff --git a/queries/proto/highlights.scm b/queries/proto/highlights.scm index e869b87e0..f3715d5db 100644 --- a/queries/proto/highlights.scm +++ b/queries/proto/highlights.scm @@ -28,7 +28,7 @@ [ "package" "import" -] @include +] @keyword.import [ (key_type) @@ -51,7 +51,7 @@ (int_lit) @number -(float_lit) @float +(float_lit) @number.float [ (true) diff --git a/queries/prql/highlights.scm b/queries/prql/highlights.scm index 92f74f089..587e8f070 100644 --- a/queries/prql/highlights.scm +++ b/queries/prql/highlights.scm @@ -20,9 +20,9 @@ (keyword_from_text) ] @keyword -(keyword_loop) @repeat +(keyword_loop) @keyword.repeat -(keyword_case) @conditional +(keyword_case) @keyword.conditional [ (literal_string) @@ -31,9 +31,9 @@ ] @string (assignment - alias: (field) @field) + alias: (field) @variable.member) -alias: (identifier) @field +alias: (identifier) @variable.member (comment) @comment @spell @@ -75,7 +75,7 @@ alias: (identifier) @field (integer) @number -(decimal_number) @float +(decimal_number) @number.float [ (keyword_min) @@ -123,7 +123,7 @@ alias: (identifier) @field (keyword_full) (keyword_csv) (keyword_json) -] @method.call +] @function.method.call [ (keyword_true) @@ -139,7 +139,7 @@ alias: (identifier) @field name: (identifier) @function) (parameter - (identifier) @parameter) + (identifier) @variable.parameter) (variable (keyword_let) diff --git a/queries/pug/highlights.scm b/queries/pug/highlights.scm index 57667885a..cdd9d1d83 100644 --- a/queries/pug/highlights.scm +++ b/queries/pug/highlights.scm @@ -18,7 +18,7 @@ (id) @constant (class) @property -(doctype) @preproc +(doctype) @keyword.directive (content) @none @@ -33,22 +33,22 @@ (#match? @keyword "^(:|v-bind|v-|\\@)")) (quoted_attribute_value) @string -(include (keyword) @include) -(extends (keyword) @include) -(filename) @string.special +(include (keyword) @keyword.import) +(extends (keyword) @keyword.import) +(filename) @string.special.path (block_definition (keyword) @keyword) (block_append (keyword)+ @keyword) (block_prepend (keyword)+ @keyword) (block_name) @type -(conditional (keyword) @conditional) +(conditional (keyword) @keyword.conditional) (case - (keyword) @conditional - (when (keyword) @conditional)+) + (keyword) @keyword.conditional + (when (keyword) @keyword.conditional)+) -(each (keyword) @repeat) -(while (keyword) @repeat) +(each (keyword) @keyword.repeat) +(while (keyword) @keyword.repeat) (mixin_use "+" @punctuation.delimiter @@ -57,14 +57,14 @@ (keyword) @keyword.function (mixin_name) @function) (mixin_attributes - (attribute_name) @parameter) + (attribute_name) @variable.parameter) (filter ":" @punctuation.delimiter - (filter_name) @method.call) + (filter_name) @function.method.call) (filter (attributes - (attribute (attribute_name) @parameter))) + (attribute (attribute_name) @variable.parameter))) [ "(" ")" diff --git a/queries/puppet/highlights.scm b/queries/puppet/highlights.scm index 196aa9dbd..aaf5dac39 100644 --- a/queries/puppet/highlights.scm +++ b/queries/puppet/highlights.scm @@ -4,7 +4,7 @@ ; Includes -"include" @include +"include" @keyword.import (include_statement (identifier) @type) @@ -31,9 +31,9 @@ "else" "unless" "case" -] @conditional +] @keyword.conditional -(default_case "default" @conditional) +(default_case "default" @keyword.conditional) ; Properties @@ -42,13 +42,13 @@ ; Parameters -(lambda (variable (identifier) @parameter)) +(lambda (variable (identifier) @variable.parameter)) -(parameter (variable (identifier) @parameter)) +(parameter (variable (identifier) @variable.parameter)) -(function_call (identifier) @parameter) +(function_call (identifier) @variable.parameter) -(method_call (identifier) @parameter) +(method_call (identifier) @variable.parameter) ; Functions @@ -64,16 +64,16 @@ ; Methods (function_declaration - "function" . (class_identifier (identifier) @method . )) + "function" . (class_identifier (identifier) @function.method . )) (function_call - (class_identifier (identifier) @method.call . )) + (class_identifier (identifier) @function.method.call . )) (defined_resource_type - "define" . (class_identifier (identifier) @method . )) + "define" . (class_identifier (identifier) @function.method . )) (method_call - "." . (identifier) @method.call) + "." . (identifier) @function.method.call) ; Types @@ -104,7 +104,7 @@ ; "Namespaces" -(class_identifier . (identifier) @namespace) +(class_identifier . (identifier) @module) ; Operators @@ -171,13 +171,13 @@ (number) @number -(float) @float +(float) @number.float (string) @string (escape_sequence) @string.escape -(regex) @string.regex +(regex) @string.regexp (boolean) @boolean diff --git a/queries/purescript/highlights.scm b/queries/purescript/highlights.scm index 3e3ec3cb8..247ea839e 100644 --- a/queries/purescript/highlights.scm +++ b/queries/purescript/highlights.scm @@ -5,7 +5,7 @@ (integer) (exp_negation) ] @number - (exp_literal (number)) @float + (exp_literal (number)) @number.float (char) @character [ (string) @@ -43,12 +43,12 @@ "else" "case" "of" - ] @conditional + ] @keyword.conditional [ "import" "module" - ] @include + ] @keyword.import [ (operator) @@ -74,10 +74,10 @@ ] @operator (qualified_module (module) @constructor) - (module) @namespace - (qualified_type (module) @namespace) - (qualified_variable (module) @namespace) - (import (module) @namespace) + (module) @module + (qualified_type (module) @module) + (qualified_variable (module) @module) + (import (module) @module) [ (where) @@ -111,7 +111,7 @@ ; `_` wildcards in if-then-else and case-of expressions, ; as well as record updates and operator sections - (wildcard) @parameter + (wildcard) @variable.parameter ; ---------------------------------------------------------------------------- ; Functions and variables @@ -120,10 +120,10 @@ (exp_apply . (exp_name (variable) @function)) (exp_apply . (exp_name (qualified_variable (variable) @function))) - (row_field (field_name) @field) - (record_field (field_name) @field) - (record_accessor (variable) @field) - (exp_record_access (variable) @field) + (row_field (field_name) @variable.member) + (record_field (field_name) @variable.member) + (record_accessor (variable) @variable.member) + (exp_record_access (variable) @variable.member) (signature name: (variable) @type) (kind_declaration (class_name) @type) diff --git a/queries/python/highlights.scm b/queries/python/highlights.scm index 5b0301d21..9ba1fcf14 100644 --- a/queries/python/highlights.scm +++ b/queries/python/highlights.scm @@ -30,8 +30,8 @@ "_" @constant.builtin ; match wildcard ((attribute - attribute: (identifier) @field) - (#lua-match? @field "^[%l_].*$")) + attribute: (identifier) @variable.member) + (#lua-match? @variable.member "^[%l_].*$")) ((assignment left: (identifier) @type.definition @@ -51,7 +51,7 @@ (call function: (attribute - attribute: (identifier) @method.call)) + attribute: (identifier) @function.method.call)) ((call function: (identifier) @constructor) @@ -113,36 +113,36 @@ ;; Normal parameters (parameters - (identifier) @parameter) + (identifier) @variable.parameter) ;; Lambda parameters (lambda_parameters - (identifier) @parameter) + (identifier) @variable.parameter) (lambda_parameters (tuple_pattern - (identifier) @parameter)) + (identifier) @variable.parameter)) ; Default parameters (keyword_argument - name: (identifier) @parameter) + name: (identifier) @variable.parameter) ; Naming parameters on call-site (default_parameter - name: (identifier) @parameter) + name: (identifier) @variable.parameter) (typed_parameter - (identifier) @parameter) + (identifier) @variable.parameter) (typed_default_parameter - name: (identifier) @parameter) + name: (identifier) @variable.parameter) ; Variadic parameters *args, **kwargs (parameters (list_splat_pattern ; *args - (identifier) @parameter)) + (identifier) @variable.parameter)) (parameters (dictionary_splat_pattern ; **kwargs - (identifier) @parameter)) + (identifier) @variable.parameter)) (lambda_parameters (list_splat_pattern - (identifier) @parameter)) + (identifier) @variable.parameter)) (lambda_parameters (dictionary_splat_pattern - (identifier) @parameter)) + (identifier) @variable.parameter)) ;; Literals @@ -155,12 +155,12 @@ (#eq? @variable.builtin "cls")) (integer) @number -(float) @float +(float) @number.float (comment) @comment @spell -((module . (comment) @preproc) - (#lua-match? @preproc "^#!/")) +((module . (comment) @keyword.directive) + (#lua-match? @keyword.directive "^#!/")) (string) @string [ @@ -267,16 +267,16 @@ (yield "from" @keyword.return) (future_import_statement - "from" @include + "from" @keyword.import "__future__" @constant.builtin) -(import_from_statement "from" @include) -"import" @include +(import_from_statement "from" @keyword.import) +"import" @keyword.import -(aliased_import "as" @include) +(aliased_import "as" @keyword.import) -["if" "elif" "else" "match" "case"] @conditional +["if" "elif" "else" "match" "case"] @keyword.conditional -["for" "while" "break" "continue"] @repeat +["for" "while" "break" "continue"] @keyword.repeat [ "try" @@ -284,13 +284,13 @@ "except*" "raise" "finally" -] @exception +] @keyword.exception -(raise_statement "from" @exception) +(raise_statement "from" @keyword.exception) (try_statement (else_clause - "else" @exception)) + "else" @keyword.exception)) ["(" ")" "[" "]" "{" "}"] @punctuation.bracket @@ -309,7 +309,7 @@ (class_definition body: (block (function_definition - name: (identifier) @method))) + name: (identifier) @function.method))) (class_definition superclasses: (argument_list @@ -319,15 +319,15 @@ body: (block (expression_statement (assignment - left: (identifier) @field)))) - (#lua-match? @field "^%l.*$")) + left: (identifier) @variable.member)))) + (#lua-match? @variable.member "^%l.*$")) ((class_definition body: (block (expression_statement (assignment left: (_ - (identifier) @field))))) - (#lua-match? @field "^%l.*$")) + (identifier) @variable.member))))) + (#lua-match? @variable.member "^%l.*$")) ((class_definition (block @@ -358,5 +358,5 @@ (call function: (attribute object: (identifier) @_re) - arguments: (argument_list . (string (string_content) @string.regex)) + arguments: (argument_list . (string (string_content) @string.regexp)) (#eq? @_re "re")) diff --git a/queries/ql/highlights.scm b/queries/ql/highlights.scm index dcc702263..d7d9500b0 100644 --- a/queries/ql/highlights.scm +++ b/queries/ql/highlights.scm @@ -39,18 +39,18 @@ "strictsum" ] @function.builtin -"import" @include +"import" @keyword.import [ "if" "then" "else" -] @conditional +] @keyword.conditional [ "forall" "forex" -] @repeat +] @keyword.repeat [ "asc" @@ -106,8 +106,8 @@ "|" ] @punctuation.delimiter -(moduleExpr (simpleId) @namespace) -(module name: (moduleName) @namespace) +(moduleExpr (simpleId) @module) +(module name: (moduleName) @module) (dataclass name: (className) @type) (typeExpr name: (className) @type) @@ -118,7 +118,7 @@ (varName) @variable (integer) @number -(float) @float +(float) @number.float (string) @string diff --git a/queries/qmldir/highlights.scm b/queries/qmldir/highlights.scm index 1fd174708..a716e8c9e 100644 --- a/queries/qmldir/highlights.scm +++ b/queries/qmldir/highlights.scm @@ -1,6 +1,6 @@ ; Preproc -(command (identifier) @preproc) +(command (identifier) @keyword.directive) ; Keywords @@ -10,7 +10,7 @@ (number) @number -(float) @float +(float) @number.float ; Variables diff --git a/queries/qmljs/highlights.scm b/queries/qmljs/highlights.scm index 40008aad9..0b15f46cf 100644 --- a/queries/qmljs/highlights.scm +++ b/queries/qmljs/highlights.scm @@ -1,6 +1,6 @@ ; inherits: ecma -"pragma" @include +"pragma" @keyword.import ;;; Annotations @@ -61,7 +61,7 @@ ;;; namespace (nested_identifier (nested_identifier - (identifier) @namespace) + (identifier) @module) ) ; Properties @@ -100,7 +100,7 @@ (template_string) ] @string -(regex) @string.regex +(regex) @string.regexp (number) @number ; Tokens diff --git a/queries/query/highlights.scm b/queries/query/highlights.scm index ccf13a6c8..030e3d44f 100644 --- a/queries/query/highlights.scm +++ b/queries/query/highlights.scm @@ -27,15 +27,15 @@ ((parameters (identifier) @number) (#match? @number "^[-+]?[0-9]+(.[0-9]+)?$")) -((program . (comment)* . (comment) @include) - (#lua-match? @include "^;+ *inherits *:")) +((program . (comment)* . (comment) @keyword.import) + (#lua-match? @keyword.import "^;+ *inherits *:")) -((program . (comment)* . (comment) @preproc) - (#lua-match? @preproc "^;+ *extends *$")) +((program . (comment)* . (comment) @keyword.directive) + (#lua-match? @keyword.directive "^;+ *extends *$")) ((predicate name: (identifier) @_name - parameters: (parameters (string "\"" @string "\"" @string) @string.regex)) + parameters: (parameters (string "\"" @string "\"" @string) @string.regexp)) (#any-of? @_name "match" "not-match" @@ -46,5 +46,5 @@ ((predicate name: (identifier) @_name - parameters: (parameters (string "\"" @string "\"" @string) @string.regex . (string) .)) + parameters: (parameters (string "\"" @string "\"" @string) @string.regexp . (string) .)) (#any-of? @_name "gsub" "not-gsub")) diff --git a/queries/r/highlights.scm b/queries/r/highlights.scm index 9d837ba83..03cf01bd7 100755 --- a/queries/r/highlights.scm +++ b/queries/r/highlights.scm @@ -3,7 +3,7 @@ ; Literals (integer) @number -(float) @float +(float) @number.float (complex) @number @@ -12,29 +12,29 @@ (comment) @comment @spell -((program . (comment) @preproc) - (#lua-match? @preproc "^#!/")) +((program . (comment) @keyword.directive) + (#lua-match? @keyword.directive "^#!/")) (identifier) @variable ((dollar (identifier) @variable.builtin) (#eq? @variable.builtin "self")) -((dollar _ (identifier) @field)) +((dollar _ (identifier) @variable.member)) ; Parameters -(formal_parameters (identifier) @parameter) +(formal_parameters (identifier) @variable.parameter) (formal_parameters - (default_parameter name: (identifier) @parameter)) + (default_parameter name: (identifier) @variable.parameter)) -(default_argument name: (identifier) @parameter) +(default_argument name: (identifier) @variable.parameter) ; Namespace -(namespace_get namespace: (identifier) @namespace) -(namespace_get_internal namespace: (identifier) @namespace) +(namespace_get namespace: (identifier) @module) +(namespace_get_internal namespace: (identifier) @module) ; Operators [ @@ -111,14 +111,14 @@ "if" "else" "switch" -] @conditional +] @keyword.conditional [ "while" "repeat" "for" "in" -] @repeat +] @keyword.repeat [ (true) @@ -138,4 +138,4 @@ (namespace_get_internal function: (identifier) @function.call)) (call - function: ((dollar _ (identifier) @method.call))) + function: ((dollar _ (identifier) @function.method.call))) diff --git a/queries/racket/highlights.scm b/queries/racket/highlights.scm index 4448397ae..fdd392077 100644 --- a/queries/racket/highlights.scm +++ b/queries/racket/highlights.scm @@ -11,7 +11,7 @@ (number) @number (character) @character (boolean) @boolean -(keyword) @symbol +(keyword) @string.special.symbol ;; string ;; @@ -21,7 +21,7 @@ (escape_sequence) @string.escape -(regex) @string.regex +(regex) @string.regexp ;; comment ;; @@ -46,7 +46,7 @@ ;; quote ;; -(quote) @symbol +(quote) @string.special.symbol ;; list ;; @@ -125,14 +125,14 @@ (list . - (symbol) @include - (#eq? @include "require") + (symbol) @keyword.import + (#eq? @keyword.import "require") (#set! "priority" 101)) (quote . (symbol) - (#set! "priority" 105)) @symbol + (#set! "priority" 105)) @string.special.symbol ((sexp_comment) @comment (#set! "priority" 110)) diff --git a/queries/rasi/highlights.scm b/queries/rasi/highlights.scm index 6485a5f9e..7385e3245 100644 --- a/queries/rasi/highlights.scm +++ b/queries/rasi/highlights.scm @@ -1,8 +1,8 @@ (comment) @comment @spell "@media" @keyword -"@import" @include -"@theme" @include +"@import" @keyword.import +"@theme" @keyword.import (string_value) @string [ @@ -62,7 +62,7 @@ [ (global_selector) (id_selector) - ] @namespace + ] @module (id_selector_view [ "normal" "selected" "alternate" ] @attribute) (id_selector_state [ "normal" "urgent" "active" ] @type.qualifier) diff --git a/queries/rbs/highlights.scm b/queries/rbs/highlights.scm index e985e8e0a..4e46680a3 100644 --- a/queries/rbs/highlights.scm +++ b/queries/rbs/highlights.scm @@ -51,7 +51,7 @@ (constant) (operator) (setter) - ] @method)) + ] @function.method)) [(ivar_name) (cvar_name)] @property @@ -62,7 +62,7 @@ (interface_name (interface) @type) (alias_name (identifier) @type) (type_variable) @constant -(namespace (constant) @namespace) +(namespace (constant) @module) (builtin_type) @type.builtin @@ -70,16 +70,16 @@ (global_name) @property ; Standard Arguments -(parameter (var_name) @parameter) +(parameter (var_name) @variable.parameter) ; Keyword Arguments -(keyword) @parameter +(keyword) @variable.parameter ; Self (self) @variable.builtin ; Literal -(type (symbol_literal) @symbol) +(type (symbol_literal) @string.special.symbol) (type (string_literal (escape_sequence) @string.escape)) (type (string_literal) @string) diff --git a/queries/re2c/highlights.scm b/queries/re2c/highlights.scm index fd59c7208..7e679fbcc 100644 --- a/queries/re2c/highlights.scm +++ b/queries/re2c/highlights.scm @@ -5,14 +5,14 @@ "re2c" "local" "rules" -] @namespace +] @module ; Includes [ "!use" "!include" -] @include +] @keyword.import ; Keywords @@ -49,7 +49,7 @@ "*" "+" "?" -] @repeat +] @keyword.repeat ; Constants @@ -116,7 +116,7 @@ ; Literals -(regex) @string.regex +(regex) @string.regexp [ (dstring) ; case sensitive @@ -150,7 +150,7 @@ (#offset! @type 0 1 0 -1)) (set_header - value: (dstring) @string.special @text.underline) + value: (dstring) @string.special) (host_lang) @none diff --git a/queries/regex/highlights.scm b/queries/regex/highlights.scm index 3aa4af909..ddcf1d92a 100644 --- a/queries/regex/highlights.scm +++ b/queries/regex/highlights.scm @@ -17,7 +17,7 @@ ;; These are escaped special characters that lost their special meaning ;; -> no special highlighting -(identity_escape) @string.regex +(identity_escape) @string.regexp (class_character) @constant diff --git a/queries/rego/highlights.scm b/queries/rego/highlights.scm index 8d15d4fb4..5abaf0fd5 100644 --- a/queries/rego/highlights.scm +++ b/queries/rego/highlights.scm @@ -2,7 +2,7 @@ [ (import) (package) -] @include +] @keyword.import [ (with) @@ -43,9 +43,9 @@ (expr_call func_name: (fn_name (var) @function .)) -(expr_call func_arguments: (fn_args (expr) @parameter)) +(expr_call func_arguments: (fn_args (expr) @variable.parameter)) -(rule_args (term) @parameter) +(rule_args (term) @variable.parameter) [ (open_paren) @@ -56,9 +56,9 @@ (close_curly) ] @punctuation.bracket -(rule (rule_head (var) @method)) +(rule (rule_head (var) @function.method)) (rule - (rule_head (term (ref (var) @namespace))) - (rule_body (query (literal (expr (expr_infix (expr (term (ref (var)) @_output)))))) (#eq? @_output @namespace)) + (rule_head (term (ref (var) @module))) + (rule_body (query (literal (expr (expr_infix (expr (term (ref (var)) @_output)))))) (#eq? @_output @module)) ) diff --git a/queries/requirements/highlights.scm b/queries/requirements/highlights.scm index 3d3d20d91..921c3204b 100644 --- a/queries/requirements/highlights.scm +++ b/queries/requirements/highlights.scm @@ -2,11 +2,11 @@ (package) @variable -(extras (package) @parameter) +(extras (package) @variable.parameter) -(path) @text.underline @string.special +(path) @string.special.path -(url) @text.uri +(url) @string.special.url ;; versions diff --git a/queries/robot/highlights.scm b/queries/robot/highlights.scm index 06c559986..b5f7bd105 100644 --- a/queries/robot/highlights.scm +++ b/queries/robot/highlights.scm @@ -35,23 +35,23 @@ "IN ZIP" (break_statement) (continue_statement) -] @repeat -(for_statement "END" @repeat) +] @keyword.repeat +(for_statement "END" @keyword.repeat) -"WHILE" @repeat -(while_statement "END" @repeat) +"WHILE" @keyword.repeat +(while_statement "END" @keyword.repeat) [ "IF" "ELSE IF" -] @conditional -(if_statement "END" @conditional) -(if_statement (else_statement "ELSE" @conditional)) +] @keyword.conditional +(if_statement "END" @keyword.conditional) +(if_statement (else_statement "ELSE" @keyword.conditional)) [ "TRY" "EXCEPT" "FINALLY" -] @exception -(try_statement "END" @exception) -(try_statement (else_statement "ELSE" @exception)) +] @keyword.exception +(try_statement "END" @keyword.exception) +(try_statement (else_statement "ELSE" @keyword.exception)) diff --git a/queries/ron/highlights.scm b/queries/ron/highlights.scm index 7f5b9030f..4b0a87a50 100644 --- a/queries/ron/highlights.scm +++ b/queries/ron/highlights.scm @@ -15,7 +15,7 @@ (string) @string (boolean) @boolean (integer) @number -(float) @float +(float) @number.float (char) @character diff --git a/queries/rst/highlights.scm b/queries/rst/highlights.scm index 3231262c2..b3b2b0a88 100644 --- a/queries/rst/highlights.scm +++ b/queries/rst/highlights.scm @@ -7,11 +7,13 @@ "__" ":" "::" - "bullet" - "adornment" (transition) ] @punctuation.special +[ + "bullet" + "adornment" +] @markup.list ;; Resets for injection (doctest_block) @none @@ -22,11 +24,11 @@ name: (type) @function) (directive - body: (body (arguments) @parameter)) + body: (body (arguments) @variable.parameter)) ((directive - name: (type) @include) - (#eq? @include "include")) + name: (type) @keyword.import) + (#eq? @keyword.import "include")) ((directive name: (type) @function.builtin) @@ -48,10 +50,10 @@ [ (literal_block) (line_block) -] @text.literal +] @markup.raw.block (block_quote - (attribution)? @text.emphasis) @text.literal + (attribution)? @markup.italic) @markup.quote (substitution_definition name: (substitution) @constant) @@ -63,26 +65,26 @@ name: (label) @constant) (target - name: (name)? @constant - link: (_)? @text.literal) + name: (name)? @markup.link.label + link: (_)? @markup.link) ;; Lists ; Definition lists (list_item - (term) @text.strong - (classifier)? @text.emphasis) + (term) @markup.strong + (classifier)? @markup.italic) ; Field lists (field (field_name) @constant) ;; Inline markup -(emphasis) @text.emphasis +(emphasis) @markup.italic -(strong) @text.strong +(strong) @markup.strong -(standalone_hyperlink) @text.uri @nospell +(standalone_hyperlink) @string.special.url @nospell (role) @function @@ -111,17 +113,17 @@ [ "interpreted_text" (literal) -] @text.literal +] @markup.raw ; Prefix role ((interpreted_text (role) @_role - "interpreted_text" @text.emphasis) + "interpreted_text" @markup.italic) (#eq? @_role ":emphasis:")) ((interpreted_text (role) @_role - "interpreted_text" @text.strong) + "interpreted_text" @markup.strong) (#eq? @_role ":strong:")) ((interpreted_text @@ -131,12 +133,12 @@ ; Suffix role ((interpreted_text - "interpreted_text" @text.emphasis + "interpreted_text" @markup.italic (role) @_role) (#eq? @_role ":emphasis:")) ((interpreted_text - "interpreted_text" @text.strong + "interpreted_text" @markup.strong (role) @_role) (#eq? @_role ":strong:")) @@ -151,11 +153,11 @@ (footnote_reference) (citation_reference) (reference) -] @text.reference @nospell +] @markup.link @nospell ;; Others -(title) @text.title +(title) @markup.heading (comment) @comment @spell (comment "..") @comment diff --git a/queries/ruby/highlights.scm b/queries/ruby/highlights.scm index 727c0fc50..d68c11847 100644 --- a/queries/ruby/highlights.scm +++ b/queries/ruby/highlights.scm @@ -45,10 +45,10 @@ "unless" "when" "then" - ] @conditional + ] @keyword.conditional (if - "end" @conditional) + "end" @keyword.conditional) [ "for" @@ -58,7 +58,7 @@ "redo" "retry" "next" - ] @repeat + ] @keyword.repeat (constant) @constant @@ -68,10 +68,10 @@ [ "rescue" "ensure" - ] @exception + ] @keyword.exception -((identifier) @exception - (#any-of? @exception "fail" "raise")) +((identifier) @keyword.exception + (#any-of? @keyword.exception "fail" "raise")) ; Function calls @@ -87,8 +87,8 @@ (program (call - (identifier) @include) - (#any-of? @include "require" "require_relative" "load")) + (identifier) @keyword.import) + (#any-of? @keyword.import "require" "require_relative" "load")) ; Function definitions @@ -126,15 +126,15 @@ (super) ] @variable.builtin -(method_parameters (identifier) @parameter) -(lambda_parameters (identifier) @parameter) -(block_parameters (identifier) @parameter) -(splat_parameter (identifier) @parameter) -(hash_splat_parameter (identifier) @parameter) -(optional_parameter (identifier) @parameter) -(destructured_parameter (identifier) @parameter) -(block_parameter (identifier) @parameter) -(keyword_parameter (identifier) @parameter) +(method_parameters (identifier) @variable.parameter) +(lambda_parameters (identifier) @variable.parameter) +(block_parameters (identifier) @variable.parameter) +(splat_parameter (identifier) @variable.parameter) +(hash_splat_parameter (identifier) @variable.parameter) +(optional_parameter (identifier) @variable.parameter) +(destructured_parameter (identifier) @variable.parameter) +(block_parameter (identifier) @variable.parameter) +(keyword_parameter (identifier) @variable.parameter) ; TODO: Re-enable this once it is supported ; ((identifier) @function @@ -159,13 +159,13 @@ (simple_symbol) (delimited_symbol) (hash_key_symbol) - ] @symbol + ] @string.special.symbol (pair key: (hash_key_symbol) ":" @constant) -(regex) @string.regex +(regex) @string.regexp (escape_sequence) @string.escape (integer) @number -(float) @float +(float) @number.float [ (true) diff --git a/queries/rust/highlights.scm b/queries/rust/highlights.scm index 60438bd72..a262b6f08 100644 --- a/queries/rust/highlights.scm +++ b/queries/rust/highlights.scm @@ -23,12 +23,12 @@ (primitive_type) @type.builtin -(field_identifier) @field +(field_identifier) @variable.member -(shorthand_field_initializer (identifier) @field) +(shorthand_field_initializer (identifier) @variable.member) (mod_item - name: (identifier) @namespace) + name: (identifier) @module) (self) @variable.builtin @@ -40,9 +40,9 @@ (function_signature_item (identifier) @function) -(parameter (identifier) @parameter) +(parameter (identifier) @variable.parameter) -(closure_parameters (_) @parameter) +(closure_parameters (_) @variable.parameter) ; Function calls @@ -79,14 +79,14 @@ ; Assume that uppercase names in paths are types (scoped_identifier - path: (identifier) @namespace) + path: (identifier) @module) (scoped_identifier (scoped_identifier - name: (identifier) @namespace)) + name: (identifier) @module)) (scoped_type_identifier - path: (identifier) @namespace) + path: (identifier) @module) (scoped_type_identifier path: (identifier) @type @@ -94,7 +94,7 @@ (scoped_type_identifier (scoped_identifier - name: (identifier) @namespace)) + name: (identifier) @module)) ((scoped_identifier path: (identifier) @type) @@ -123,16 +123,16 @@ [ (crate) (super) -] @namespace +] @module (scoped_use_list - path: (identifier) @namespace) + path: (identifier) @module) (scoped_use_list path: (scoped_identifier - (identifier) @namespace)) + (identifier) @module)) -(use_list (scoped_identifier (identifier) @namespace . (_))) +(use_list (scoped_identifier (identifier) @module . (_))) (use_list (identifier) @type (#lua-match? @type "^[A-Z]")) @@ -216,7 +216,7 @@ (integer_literal) @number -(float_literal) @float +(float_literal) @number.float [ (raw_string_literal) @@ -232,9 +232,9 @@ [ "use" "mod" -] @include +] @keyword.import -(use_as_clause "as" @include) +(use_as_clause "as" @keyword.import) [ "default" @@ -266,9 +266,9 @@ "static" "dyn" "extern" -] @storageclass +] @keyword.storage -(lifetime ["'" (identifier)] @storageclass.lifetime) +(lifetime ["'" (identifier)] @keyword.storage.lifetime) "fn" @keyword.function @@ -281,19 +281,19 @@ (qualified_type "as" @keyword.operator) -(use_list (self) @namespace) +(use_list (self) @module) -(scoped_use_list (self) @namespace) +(scoped_use_list (self) @module) -(scoped_identifier [(crate) (super) (self)] @namespace) +(scoped_identifier [(crate) (super) (self)] @module) -(visibility_modifier [(crate) (super) (self)] @namespace) +(visibility_modifier [(crate) (super) (self)] @module) [ "if" "else" "match" -] @conditional +] @keyword.conditional [ "break" @@ -301,10 +301,10 @@ "in" "loop" "while" -] @repeat +] @keyword.repeat "for" @keyword -(for_expression "for" @repeat) +(for_expression "for" @keyword.repeat) ; Operators @@ -370,16 +370,16 @@ (empty_type "!" @type.builtin) (macro_invocation - macro: (identifier) @exception - "!" @exception - (#eq? @exception "panic")) + macro: (identifier) @keyword.exception + "!" @keyword.exception + (#eq? @keyword.exception "panic")) (macro_invocation - macro: (identifier) @exception - "!" @exception - (#contains? @exception "assert")) + macro: (identifier) @keyword.exception + "!" @keyword.exception + (#contains? @keyword.exception "assert")) (macro_invocation - macro: (identifier) @debug - "!" @debug - (#eq? @debug "dbg")) + macro: (identifier) @keyword.debug + "!" @keyword.debug + (#eq? @keyword.debug "dbg")) diff --git a/queries/scala/highlights.scm b/queries/scala/highlights.scm index 743d16cc2..2c483c46b 100644 --- a/queries/scala/highlights.scm +++ b/queries/scala/highlights.scm @@ -21,9 +21,9 @@ ;; variables (class_parameter - name: (identifier) @parameter) + name: (identifier) @variable.parameter) -(self_type (identifier) @parameter) +(self_type (identifier) @variable.parameter) (interpolation (identifier) @none) (interpolation (block) @none) @@ -52,24 +52,24 @@ ; method definition (function_declaration - name: (identifier) @method) + name: (identifier) @function.method) (function_definition - name: (identifier) @method) + name: (identifier) @function.method) ; imports/exports (import_declaration - path: (identifier) @namespace) -((stable_identifier (identifier) @namespace)) + path: (identifier) @module) +((stable_identifier (identifier) @module)) ((import_declaration path: (identifier) @type) (#lua-match? @type "^[A-Z]")) ((stable_identifier (identifier) @type) (#lua-match? @type "^[A-Z]")) (export_declaration - path: (identifier) @namespace) -((stable_identifier (identifier) @namespace)) + path: (identifier) @module) +((stable_identifier (identifier) @module)) ((export_declaration path: (identifier) @type) (#lua-match? @type "^[A-Z]")) @@ -87,7 +87,7 @@ (call_expression function: (field_expression - field: (identifier) @method.call)) + field: (identifier) @function.method.call)) ((call_expression function: (identifier) @constructor) @@ -105,10 +105,10 @@ name: (identifier) @function) (parameter - name: (identifier) @parameter) + name: (identifier) @variable.parameter) (binding - name: (identifier) @parameter) + name: (identifier) @variable.parameter) ; expressions @@ -125,15 +125,16 @@ (boolean_literal) @boolean (integer_literal) @number -(floating_point_literal) @float +(floating_point_literal) @number.float [ - (symbol_literal) (string) (character_literal) (interpolated_string_expression) ] @string +(symbol_literal) @string.special.symbol + (interpolation "$" @punctuation.special) ;; keywords @@ -177,11 +178,11 @@ "protected" ] @type.qualifier -(inline_modifier) @storageclass +(inline_modifier) @keyword.storage (null_literal) @constant.builtin -(wildcard) @parameter +(wildcard) @variable.parameter (annotation) @attribute @@ -194,7 +195,7 @@ "if" "match" "then" -] @conditional +] @keyword.conditional [ "(" @@ -215,7 +216,7 @@ "for" "while" "yield" -] @repeat +] @keyword.repeat "def" @keyword.function @@ -225,13 +226,13 @@ "@" ] @operator -["import" "export"] @include +["import" "export"] @keyword.import [ "try" "catch" "throw" -] @exception +] @keyword.exception "return" @keyword.return @@ -246,7 +247,7 @@ ;; `case` is a conditional keyword in case_block (case_block - (case_clause ("case") @conditional)) + (case_clause ("case") @keyword.conditional)) (operator_identifier) @operator @@ -260,5 +261,5 @@ ) ;; Scala CLI using directives -(using_directive_key) @parameter +(using_directive_key) @variable.parameter (using_directive_value) @string diff --git a/queries/scfg/highlights.scm b/queries/scfg/highlights.scm index 240d48a90..0fcfa7c9b 100644 --- a/queries/scfg/highlights.scm +++ b/queries/scfg/highlights.scm @@ -5,4 +5,4 @@ (comment) @comment @spell (directive_name) @type -(directive_params) @parameter +(directive_params) @variable.parameter diff --git a/queries/scheme/highlights.scm b/queries/scheme/highlights.scm index 7a8acfe9e..f555920ba 100644 --- a/queries/scheme/highlights.scm +++ b/queries/scheme/highlights.scm @@ -76,19 +76,19 @@ "assert" "library" "export" "import" "rename" "only" "except" "prefix")) -((symbol) @conditional - (#any-of? @conditional "if" "cond" "case" "when" "unless")) +((symbol) @keyword.conditional + (#any-of? @keyword.conditional "if" "cond" "case" "when" "unless")) ;; quote (quote "'" - (symbol)) @symbol + (symbol)) @string.special.symbol (list . (symbol) @_f - (#eq? @_f "quote")) @symbol + (#eq? @_f "quote")) @string.special.symbol ;; library @@ -96,7 +96,7 @@ . (symbol) @_lib . - (symbol) @namespace + (symbol) @module (#eq? @_lib "library")) diff --git a/queries/scss/highlights.scm b/queries/scss/highlights.scm index f45b4301e..b0801bb6f 100644 --- a/queries/scss/highlights.scm +++ b/queries/scss/highlights.scm @@ -15,7 +15,7 @@ "@return" @keyword.return -"@include" @include +"@include" @keyword.import [ "@while" @@ -24,7 +24,7 @@ "from" "through" "in" -] @repeat +] @keyword.repeat (single_line_comment) @comment @spell (function_name) @function @@ -37,25 +37,25 @@ (mixin_statement (name) @function) -(mixin_statement (parameters (parameter) @parameter)) +(mixin_statement (parameters (parameter) @variable.parameter)) (function_statement (name) @function) -(function_statement (parameters (parameter) @parameter)) +(function_statement (parameters (parameter) @variable.parameter)) (plain_value) @string (keyword_query) @function (identifier) @variable (variable_name) @variable -(each_statement (key) @parameter) -(each_statement (value) @parameter) -(each_statement (variable_value) @parameter) +(each_statement (key) @variable.parameter) +(each_statement (value) @variable.parameter) +(each_statement (variable_value) @variable.parameter) -(for_statement (variable) @parameter) -(for_statement (_ (variable_value) @parameter)) +(for_statement (variable) @variable.parameter) +(for_statement (_ (variable_value) @variable.parameter)) -(argument) @parameter -(arguments (variable_value) @parameter) +(argument) @variable.parameter +(arguments (variable_value) @variable.parameter) [ "[" diff --git a/queries/slang/highlights.scm b/queries/slang/highlights.scm index 6fd5f45ea..e93682eee 100644 --- a/queries/slang/highlights.scm +++ b/queries/slang/highlights.scm @@ -36,7 +36,7 @@ [ "__exported" "import" -] @include +] @keyword.import (property_declaration (identifier) @property) diff --git a/queries/slint/highlights.scm b/queries/slint/highlights.scm index 2ec720c33..a4fc7f4f3 100644 --- a/queries/slint/highlights.scm +++ b/queries/slint/highlights.scm @@ -2,7 +2,7 @@ (type_identifier) @type (comment) @comment @spell (int_literal) @number -(float_literal) @float +(float_literal) @number.float (string_literal) @string (function_identifier) @function [ @@ -16,33 +16,33 @@ (call_expression function: (field_expression field: (identifier) @function.call)) -(vis) @include +(vis) @keyword.import (units) @type (array_literal (identifier) @type) -(transition_statement state: (identifier) @field) -(state_expression state: (identifier) @field) +(transition_statement state: (identifier) @variable.member) +(state_expression state: (identifier) @variable.member) (struct_block_definition - (identifier) @field) + (identifier) @variable.member) -; (state_identifier) @field +; (state_identifier) @variable.member [ "in" "for" -] @repeat +] @keyword.repeat "@" @keyword [ "import" "from" -] @include +] @keyword.import [ "if" "else" -] @conditional +] @keyword.conditional [ "root" @@ -151,4 +151,4 @@ "=>" ] @operator -(ternary_expression [":" "?"] @conditional.ternary) +(ternary_expression [":" "?"] @keyword.conditional.ternary) diff --git a/queries/smali/highlights.scm b/queries/smali/highlights.scm index 3b6035c09..9668c59ba 100644 --- a/queries/smali/highlights.scm +++ b/queries/smali/highlights.scm @@ -20,40 +20,40 @@ ; Methods (method_definition - (method_signature (method_identifier) @method)) + (method_signature (method_identifier) @function.method)) (expression (opcode) @_invoke (body (full_method_signature - (method_signature (method_identifier) @method.call))) + (method_signature (method_identifier) @function.method.call))) (#lua-match? @_invoke "^invoke")) (method_handle (full_method_signature - (method_signature (method_identifier) @method.call))) + (method_signature (method_identifier) @function.method.call))) (custom_invoke - . (identifier) @method.call - (method_signature (method_identifier) @method.call)) + . (identifier) @function.method.call + (method_signature (method_identifier) @function.method.call)) (annotation_value (body - (method_signature (method_identifier) @method.call))) + (method_signature (method_identifier) @function.method.call))) (annotation_value (body (full_method_signature - (method_signature (method_identifier) @method.call)))) + (method_signature (method_identifier) @function.method.call)))) (field_definition (body - (method_signature (method_identifier) @method.call))) + (method_signature (method_identifier) @function.method.call))) (field_definition (body (full_method_signature - (method_signature (method_identifier) @method.call)))) + (method_signature (method_identifier) @function.method.call)))) ((method_identifier) @constructor (#any-of? @constructor "" "")) @@ -65,7 +65,7 @@ [ (field_identifier) (annotation_key) -] @field +] @variable.member ((field_identifier) @constant (#lua-match? @constant "^[%u_]*$")) @@ -79,8 +79,8 @@ ; Parameters -(parameter) @parameter.builtin -(param_identifier) @parameter +(parameter) @variable.parameter.builtin +(param_identifier) @variable.parameter ; Labels @@ -96,14 +96,14 @@ ((opcode) @keyword.return (#lua-match? @keyword.return "^return")) -((opcode) @conditional - (#lua-match? @conditional "^if")) +((opcode) @keyword.conditional + (#lua-match? @keyword.conditional "^if")) -((opcode) @conditional - (#lua-match? @conditional "^cmp")) +((opcode) @keyword.conditional + (#lua-match? @keyword.conditional "^cmp")) -((opcode) @exception - (#lua-match? @exception "^throw")) +((opcode) @keyword.exception + (#lua-match? @keyword.exception "^throw")) ((opcode) @comment (#eq? @comment "nop")) ; haha, anyone get it? ;) @@ -148,7 +148,7 @@ [ ".source" -] @include +] @keyword.import [ ".method" @@ -158,12 +158,12 @@ [ ".catch" ".catchall" -] @exception +] @keyword.exception ; Literals (string) @string -(source_directive (string "\"" _ @text.uri "\"")) +(source_directive (string "\"" _ @string.special.url "\"")) (escape_sequence) @string.escape (character) @character @@ -176,7 +176,7 @@ (float) (NaN) (Infinity) -] @float +] @number.float (boolean) @boolean @@ -184,7 +184,7 @@ ; Misc -(annotation_visibility) @storageclass +(annotation_visibility) @keyword.storage (access_modifier) @type.qualifier @@ -204,7 +204,7 @@ "/" ] @punctuation.delimiter -(line_directive (number) @text.underline @text.literal) +(line_directive (number) @string.special) ; Comments diff --git a/queries/smithy/highlights.scm b/queries/smithy/highlights.scm index 2b709c2a2..bb54dad73 100644 --- a/queries/smithy/highlights.scm +++ b/queries/smithy/highlights.scm @@ -1,16 +1,16 @@ ; Preproc -(control_key) @preproc +(control_key) @keyword.directive ; Namespace -(namespace) @namespace +(namespace) @module ; Includes [ "use" -] @include +] @keyword.import ; Builtins @@ -25,13 +25,13 @@ ; Fields (Members) -; (field) @field +; (field) @variable.member -(key_identifier) @field +(key_identifier) @variable.member (shape_member - (field) @field) -(operation_field) @field -(operation_error_field) @field + (field) @variable.member) +(operation_field) @variable.member +(operation_error_field) @variable.member ; Constants @@ -82,7 +82,7 @@ (number) @number -(float) @float +(float) @number.float (boolean) @boolean diff --git a/queries/snakemake/highlights.scm b/queries/snakemake/highlights.scm index 8b173e0b5..07f86e40d 100644 --- a/queries/snakemake/highlights.scm +++ b/queries/snakemake/highlights.scm @@ -17,11 +17,11 @@ ;; Rule imports (rule_import - "use" @include - "rule" @include - "from" @include - "as"? @include - "with"? @include + "use" @keyword.import + "rule" @keyword.import + "from" @keyword.import + "as"? @keyword.import + "with"? @keyword.import ) diff --git a/queries/solidity/highlights.scm b/queries/solidity/highlights.scm index f537cfab2..70ad31a1b 100644 --- a/queries/solidity/highlights.scm +++ b/queries/solidity/highlights.scm @@ -3,16 +3,16 @@ [ "pragma" "solidity" -] @preproc +] @keyword.directive (solidity_pragma_token - "||" @symbol) + "||" @string.special.symbol) (solidity_pragma_token - "-" @symbol) + "-" @string.special.symbol) (solidity_version_comparison_operator) @operator -(solidity_version) @text.underline @string.special +(solidity_version) @string.special ; Literals @@ -22,11 +22,11 @@ ] @string (hex_string_literal - "hex" @symbol + "hex" @string.special.symbol (_) @string) (unicode_string_literal - "unicode" @symbol + "unicode" @string.special.symbol (_) @string) [ @@ -57,7 +57,7 @@ (contract_declaration name: (identifier) @type) (struct_declaration name: (identifier) @type) -(struct_member name: (identifier) @field) +(struct_member name: (identifier) @variable.member) (enum_declaration name: (identifier) @type) (emit_statement . (identifier) @type) ; Handles ContractA, ContractB in function foo() override(ContractA, contractB) {} @@ -77,26 +77,26 @@ (modifier_invocation (identifier) @function) ; Handles expressions like structVariable.g(); -(call_expression . (member_expression (identifier) @method.call)) +(call_expression . (member_expression (identifier) @function.method.call)) ; Handles expressions like g(); (call_expression . (identifier) @function.call) ; Function parameters -(event_paramater name: (identifier) @parameter) -(parameter name: (identifier) @parameter) +(event_paramater name: (identifier) @variable.parameter) +(parameter name: (identifier) @variable.parameter) ; Yul functions (yul_function_call function: (yul_identifier) @function.call) ; Yul function parameters -(yul_function_definition . (yul_identifier) @function (yul_identifier) @parameter) +(yul_function_definition . (yul_identifier) @function (yul_identifier) @variable.parameter) (meta_type_expression "type" @keyword) -(member_expression property: (identifier) @field) -(call_struct_argument name: (identifier) @field) -(struct_field_assignment name: (identifier) @field) +(member_expression property: (identifier) @variable.member) +(call_struct_argument name: (identifier) @variable.member) +(struct_field_assignment name: (identifier) @variable.member) (enum_value) @constant ; Keywords @@ -143,7 +143,7 @@ "storage" "calldata" "constant" -] @storageclass +] @keyword.storage [ "for" @@ -151,7 +151,7 @@ "do" "break" "continue" -] @repeat +] @keyword.repeat [ "if" @@ -159,17 +159,17 @@ "switch" "case" "default" -] @conditional +] @keyword.conditional (ternary_expression - "?" @conditional.ternary - ":" @conditional.ternary) + "?" @keyword.conditional.ternary + ":" @keyword.conditional.ternary) [ "try" "catch" "revert" -] @exception +] @keyword.exception [ "return" @@ -182,11 +182,11 @@ [ "import" "using" -] @include -(import_directive "as" @include) -(import_directive "from" @include) -((import_directive source: (string) @text.underline) - (#offset! @text.underline 0 1 0 -1)) +] @keyword.import +(import_directive "as" @keyword.import) +(import_directive "from" @keyword.import) +((import_directive source: (string) @string.special.path) + (#offset! @string.special.path 0 1 0 -1)) ; Punctuation diff --git a/queries/soql/highlights.scm b/queries/soql/highlights.scm index 83736d9a7..def688ab2 100644 --- a/queries/soql/highlights.scm +++ b/queries/soql/highlights.scm @@ -32,7 +32,7 @@ (alias_expression (identifier) @label) -(storage_identifier) @storageclass +(storage_identifier) @keyword.storage (_ function_name: (identifier) @function) (date_literal) @string.special @@ -122,7 +122,7 @@ "WHEN" "ELSE" "THEN" -] @conditional +] @keyword.conditional ; Using Scope [ diff --git a/queries/sparql/highlights.scm b/queries/sparql/highlights.scm index 2cc745b65..0a4b6a84c 100644 --- a/queries/sparql/highlights.scm +++ b/queries/sparql/highlights.scm @@ -19,7 +19,7 @@ [ "_:" (namespace) -] @namespace +] @module [ "UNDEF" @@ -84,7 +84,7 @@ [ (decimal) (double) -] @float +] @number.float (boolean_literal) @boolean [ @@ -184,12 +184,12 @@ [ bound_variable: (var) "*" - ] @parameter) -(bind bound_variable: (var) @parameter) -(data_block bound_variable: (var) @parameter) -(group_condition bound_variable: (var) @parameter) + ] @variable.parameter) +(bind bound_variable: (var) @variable.parameter) +(data_block bound_variable: (var) @variable.parameter) +(group_condition bound_variable: (var) @variable.parameter) -(iri_reference ["<" ">"] @namespace) +(iri_reference ["<" ">"] @module) (lang_tag) @type (rdf_literal diff --git a/queries/sql/highlights.scm b/queries/sql/highlights.scm index d9f071362..aaadd0e2c 100644 --- a/queries/sql/highlights.scm +++ b/queries/sql/highlights.scm @@ -19,7 +19,7 @@ alias: (identifier) @variable) (field - name: (identifier) @field) + name: (identifier) @variable.member) (term alias: (identifier) @variable) @@ -36,10 +36,10 @@ ((literal) @number (#lua-match? @number "^%d+$")) -((literal) @float -(#lua-match? @float "^[-]?%d*\.%d*$")) +((literal) @number.float +(#lua-match? @number.float "^[-]?%d*\.%d*$")) -(parameter) @parameter +(parameter) @variable.parameter [ (keyword_true) @@ -92,14 +92,14 @@ (keyword_jsonfile) (keyword_sequencefile) (keyword_volatile) -] @storageclass +] @keyword.storage [ (keyword_case) (keyword_when) (keyword_then) (keyword_else) -] @conditional +] @keyword.conditional [ (keyword_select) diff --git a/queries/squirrel/highlights.scm b/queries/squirrel/highlights.scm index b0b9caf56..5fa20881c 100644 --- a/queries/squirrel/highlights.scm +++ b/queries/squirrel/highlights.scm @@ -40,7 +40,7 @@ "case" "default" "break" -] @conditional +] @keyword.conditional ; Repeats @@ -50,7 +50,7 @@ "do" "while" "continue" -] @repeat +] @keyword.repeat ; Exceptions @@ -58,13 +58,13 @@ "try" "catch" "throw" -] @exception +] @keyword.exception ; Storageclasses [ "local" -] @storageclass +] @keyword.storage ; Qualifiers @@ -90,7 +90,7 @@ ; Parameters (parameter - . (identifier) @parameter) + . (identifier) @variable.parameter) ; Properties (Slots) @@ -128,7 +128,7 @@ (member_declaration (function_declaration - "::"? (_) @method . "(" (_)? ")")) + "::"? (_) @function.method . "(" (_)? ")")) ((function_declaration "::"? (_) @function . "(" (_)? ")") @@ -150,7 +150,7 @@ (identifier) @function "=" (lambda_expression - "@" @symbol)) + "@" @string.special.symbol)) (call_expression [ @@ -278,8 +278,8 @@ ; Ternaries (ternary_expression - "?" @conditional.ternary - ":" @conditional.ternary) + "?" @keyword.conditional.ternary + ":" @keyword.conditional.ternary) ; Literals @@ -293,7 +293,7 @@ (integer) @number -(float) @float +(float) @number.float (bool) @boolean diff --git a/queries/ssh_config/highlights.scm b/queries/ssh_config/highlights.scm index 8de836b17..c0a0ae3e2 100644 --- a/queries/ssh_config/highlights.scm +++ b/queries/ssh_config/highlights.scm @@ -2,7 +2,7 @@ (string) @string -(pattern) @string.regex +(pattern) @string.regexp (token) @character @@ -17,7 +17,7 @@ (mac) (cipher) (key_sig) -] @parameter +] @variable.parameter [ ; generic @@ -44,7 +44,7 @@ (authentication) ] @constant.builtin -(uri) @text.uri +(uri) @string.special.url ; Keywords @@ -52,7 +52,7 @@ (parameter keyword: _ @keyword) -(host_declaration argument: _ @namespace) +(host_declaration argument: _ @module) (match_declaration (condition criteria: _ @attribute)) diff --git a/queries/starlark/highlights.scm b/queries/starlark/highlights.scm index 055fad16f..8d99963d5 100644 --- a/queries/starlark/highlights.scm +++ b/queries/starlark/highlights.scm @@ -28,8 +28,8 @@ "license")) ((attribute - attribute: (identifier) @field) - (#lua-match? @field "^[%l_].*$")) + attribute: (identifier) @variable.member) + (#lua-match? @variable.member "^[%l_].*$")) ((assignment left: (identifier) @type.definition @@ -108,30 +108,30 @@ ;; Normal parameters (parameters - (identifier) @parameter) + (identifier) @variable.parameter) ;; Lambda parameters (lambda_parameters - (identifier) @parameter) + (identifier) @variable.parameter) (lambda_parameters (tuple_pattern - (identifier) @parameter)) + (identifier) @variable.parameter)) ; Default parameters (keyword_argument - name: (identifier) @parameter) + name: (identifier) @variable.parameter) ; Naming parameters on call-site (default_parameter - name: (identifier) @parameter) + name: (identifier) @variable.parameter) (typed_parameter - (identifier) @parameter) + (identifier) @variable.parameter) (typed_default_parameter - (identifier) @parameter) + (identifier) @variable.parameter) ; Variadic parameters *args, **kwargs (parameters (list_splat_pattern ; *args - (identifier) @parameter)) + (identifier) @variable.parameter)) (parameters (dictionary_splat_pattern ; **kwargs - (identifier) @parameter)) + (identifier) @variable.parameter)) ;; Literals @@ -143,12 +143,12 @@ (#eq? @variable.builtin "cls")) (integer) @number -(float) @float +(float) @number.float (comment) @comment @spell -((module . (comment) @preproc) - (#lua-match? @preproc "^#!/")) +((module . (comment) @keyword.directive) + (#lua-match? @keyword.directive "^#!/")) (string) @string [ @@ -243,14 +243,14 @@ ] @keyword.return ((call - function: (identifier) @include + function: (identifier) @keyword.import arguments: (argument_list - (string) @conceal)) - (#eq? @include "load")) + (string) @string)) + (#eq? @keyword.import "load")) -["if" "elif" "else" "match" "case"] @conditional +["if" "elif" "else" "match" "case"] @keyword.conditional -["for" "while" "break" "continue"] @repeat +["for" "while" "break" "continue"] @keyword.repeat ["(" ")" "[" "]" "{" "}"] @punctuation.bracket @@ -274,7 +274,7 @@ function: (identifier) @_func arguments: (argument_list (keyword_argument - name: (identifier) @field))) + name: (identifier) @variable.member))) (#eq? @_func "struct")) ;; Function calls @@ -284,7 +284,7 @@ (call function: (attribute - attribute: (identifier) @method.call)) + attribute: (identifier) @function.method.call)) ((call function: (identifier) @constructor) diff --git a/queries/strace/highlights.scm b/queries/strace/highlights.scm index 8967542a4..2bc45abb7 100644 --- a/queries/strace/highlights.scm +++ b/queries/strace/highlights.scm @@ -11,7 +11,7 @@ [ (errorName) (errorDescription) -] @exception +] @keyword.exception (syscall) @function.builtin diff --git a/queries/supercollider/highlights.scm b/queries/supercollider/highlights.scm index 43b3087de..0d56de614 100644 --- a/queries/supercollider/highlights.scm +++ b/queries/supercollider/highlights.scm @@ -6,7 +6,7 @@ (block_comment) @comment @spell ; Argument definition -(argument name: (identifier) @parameter) +(argument name: (identifier) @variable.parameter) ; Variables (local_var name: (identifier) @variable) @@ -25,17 +25,17 @@ ; Methods (method_call - name: (method_name) @method) + name: (method_name) @function.method) ; Classes (class) @type ; Literals (number) @number -(float) @float +(float) @number.float (string) @string -(symbol) @string.special +(symbol) @string.special.symbol ; Operators [ @@ -89,9 +89,9 @@ ] @punctuation.delimiter ; control structure -(control_structure) @conditional +(control_structure) @keyword.conditional (escape_sequence) @string.escape ; SinOsc.ar()!2 -(duplicated_statement) @repeat +(duplicated_statement) @keyword.repeat diff --git a/queries/surface/highlights.scm b/queries/surface/highlights.scm index 35de877c9..dc123172d 100644 --- a/queries/surface/highlights.scm +++ b/queries/surface/highlights.scm @@ -1,5 +1,5 @@ -; Surface text is highlighted as such -(text) @text +; Surface text is not highlighted +(text) @none ; Surface has two types of comments, both are highlighted as such (comment) @comment @spell diff --git a/queries/svelte/highlights.scm b/queries/svelte/highlights.scm index 9539f2b51..5581c40c1 100644 --- a/queries/svelte/highlights.scm +++ b/queries/svelte/highlights.scm @@ -11,11 +11,11 @@ ((special_block_keyword) @keyword.coroutine (#eq? @keyword.coroutine "await")) -((special_block_keyword) @exception - (#eq? @exception "catch")) +((special_block_keyword) @keyword.exception + (#eq? @keyword.exception "catch")) -((special_block_keyword) @conditional - (#any-of? @conditional "if" "else")) +((special_block_keyword) @keyword.conditional + (#any-of? @keyword.conditional "if" "else")) [ "{" diff --git a/queries/swift/highlights.scm b/queries/swift/highlights.scm index a73a69356..81a0d931b 100644 --- a/queries/swift/highlights.scm +++ b/queries/swift/highlights.scm @@ -20,15 +20,15 @@ (mutation_modifier) ] @type.qualifier -(function_declaration (simple_identifier) @method) +(function_declaration (simple_identifier) @function.method) (function_declaration ["init" @constructor]) (throws) @keyword (where_keyword) @keyword -(parameter external_name: (simple_identifier) @parameter) -(parameter name: (simple_identifier) @parameter) -(type_parameter (type_identifier) @parameter) -(inheritance_constraint (identifier (simple_identifier) @parameter)) -(equality_constraint (identifier (simple_identifier) @parameter)) +(parameter external_name: (simple_identifier) @variable.parameter) +(parameter name: (simple_identifier) @variable.parameter) +(type_parameter (type_identifier) @variable.parameter) +(inheritance_constraint (identifier (simple_identifier) @variable.parameter)) +(equality_constraint (identifier (simple_identifier) @variable.parameter)) (pattern bound_identifier: (simple_identifier)) @variable [ @@ -65,7 +65,7 @@ (value_argument name: (value_argument_label) @property) -(import_declaration ["import" @include]) +(import_declaration ["import" @keyword.import]) (enum_entry ["case" @keyword]) @@ -84,25 +84,25 @@ (diagnostic) @function.macro ; Statements -(for_statement ["for" @repeat]) -(for_statement ["in" @repeat]) +(for_statement ["for" @keyword.repeat]) +(for_statement ["in" @keyword.repeat]) (for_statement (pattern) @variable) (else) @keyword (as_operator) @keyword -["while" "repeat" "continue" "break"] @repeat +["while" "repeat" "continue" "break"] @keyword.repeat ["let" "var"] @keyword -(guard_statement ["guard" @conditional]) -(if_statement ["if" @conditional]) -(switch_statement ["switch" @conditional]) +(guard_statement ["guard" @keyword.conditional]) +(if_statement ["if" @keyword.conditional]) +(switch_statement ["switch" @keyword.conditional]) (switch_entry ["case" @keyword]) (switch_entry ["fallthrough" @keyword]) (switch_entry (default_keyword) @keyword) "return" @keyword.return (ternary_expression - ["?" ":"] @conditional) + ["?" ":"] @keyword.conditional) ["do" (throw_keyword) (catch_keyword)] @keyword @@ -142,12 +142,12 @@ (oct_literal) (bin_literal) ] @number -(real_literal) @float +(real_literal) @number.float (boolean_literal) @boolean "nil" @constant.builtin ; Regex literals -(regex_literal) @string.regex +(regex_literal) @string.regexp ; Operators (custom_operator) @operator diff --git a/queries/systemtap/highlights.scm b/queries/systemtap/highlights.scm index 54a27b897..55571a1d8 100644 --- a/queries/systemtap/highlights.scm +++ b/queries/systemtap/highlights.scm @@ -22,14 +22,14 @@ name: (identifier) @function) (parameter - name: (identifier) @parameter) + name: (identifier) @variable.parameter) (type) @type.builtin (aggregation_operator) @attribute (member_expression - member: (identifier) @field) + member: (identifier) @variable.member) (call_expression function: (identifier) @function.call) @@ -43,7 +43,7 @@ ((identifier) @variable.builtin (#lua-match? @variable.builtin "^\$+[0-9A-Z_a-z]+\$*$")) -(shebang_line) @preproc +(shebang_line) @keyword.directive (comment) @comment @spell @@ -123,7 +123,7 @@ [ "if" "else" -] @conditional +] @keyword.conditional [ "break" @@ -131,12 +131,12 @@ "for" "foreach" "while" -] @repeat +] @keyword.repeat [ "try" "catch" -] @exception +] @keyword.exception [ "%(" @@ -145,9 +145,9 @@ "%?" (preprocessor_tokens) (embedded_code) -] @preproc +] @keyword.directive -"@define" @define +"@define" @keyword.directive.define "private" @type.qualifier -"global" @storageclass +"global" @keyword.storage diff --git a/queries/t32/highlights.scm b/queries/t32/highlights.scm index d1543efd0..a0e1e3c2d 100644 --- a/queries/t32/highlights.scm +++ b/queries/t32/highlights.scm @@ -79,7 +79,7 @@ [ "?" ":" -] @conditional.ternary) +] @keyword.conditional.ternary) ; Strings and others literal types @@ -98,7 +98,7 @@ (frequency) (percentage) (time) -] @float +] @number.float [ (string) @@ -107,8 +107,8 @@ (hll_escape_sequence) @string.escape -(path) @string.special -(symbol) @symbol +(path) @string.special.path +(symbol) @string.special.symbol [ (character) @@ -138,7 +138,7 @@ ; HLL variables (identifier) @variable -(hll_field_identifier) @field +(hll_field_identifier) @variable.member ; Commands @@ -214,19 +214,19 @@ (parameter_declaration command: (identifier) @keyword (identifier)? @constant.builtin - macro: (macro) @parameter) + macro: (macro) @variable.parameter) ; Control flow (if_block - command: (identifier) @conditional) + command: (identifier) @keyword.conditional) (else_block - command: (identifier) @conditional) + command: (identifier) @keyword.conditional) (while_block - command: (identifier) @repeat) + command: (identifier) @keyword.repeat) (repeat_block - command: (identifier) @repeat) + command: (identifier) @keyword.repeat) (comment) @comment @spell diff --git a/queries/tablegen/highlights.scm b/queries/tablegen/highlights.scm index c541cd165..aea94b4eb 100644 --- a/queries/tablegen/highlights.scm +++ b/queries/tablegen/highlights.scm @@ -1,10 +1,10 @@ ; Preprocs -(preprocessor_directive) @preproc +(preprocessor_directive) @keyword.directive ; Includes -"include" @include +"include" @keyword.import ; Keywords @@ -30,13 +30,13 @@ "if" "else" "then" -] @conditional +] @keyword.conditional ; Repeats [ "foreach" -] @repeat +] @keyword.repeat ; Variables @@ -46,7 +46,7 @@ ; Parameters -(template_arg (identifier) @parameter) +(template_arg (identifier) @variable.parameter) ; Types @@ -85,10 +85,10 @@ ; Fields (instruction - (identifier) @field) + (identifier) @variable.member) (let_instruction - (identifier) @field) + (identifier) @variable.member) ; Functions @@ -148,5 +148,5 @@ ] @comment @spell -((comment) @preproc - (#lua-match? @preproc "^.*RUN")) +((comment) @keyword.directive + (#lua-match? @keyword.directive "^.*RUN")) diff --git a/queries/teal/highlights.scm b/queries/teal/highlights.scm index b6b79dec5..aa71fc5b5 100644 --- a/queries/teal/highlights.scm +++ b/queries/teal/highlights.scm @@ -6,7 +6,7 @@ (#lua-match? @comment.documentation "^[-][-][-]")) ((comment) @comment.documentation (#lua-match? @comment.documentation "^[-][-](%s?)@")) -(shebang_comment) @preproc +(shebang_comment) @keyword.directive (identifier) @variable ((identifier) @variable.builtin (#eq? @variable.builtin "self")) @@ -21,8 +21,8 @@ (format_specifier) @string.escape ;; Basic statements/Keywords -[ "if" "then" "elseif" "else" ] @conditional -[ "for" "while" "repeat" "until" ] @repeat +[ "if" "then" "elseif" "else" ] @keyword.conditional +[ "for" "while" "repeat" "until" ] @keyword.repeat "return" @keyword.return [ "in" "local" (break) (goto) "do" "end" ] @keyword (label) @label @@ -47,7 +47,7 @@ "function" @keyword.function) (function_body "end" @keyword.function) -(arg name: (identifier) @parameter) +(arg name: (identifier) @variable.parameter) (function_signature (arguments @@ -56,8 +56,8 @@ (typeargs "<" @punctuation.bracket - . (_) @parameter - . ("," . (_) @parameter)* + . (_) @variable.parameter + . ("," . (_) @variable.parameter)* . ">" @punctuation.bracket) (function_call diff --git a/queries/templ/highlights.scm b/queries/templ/highlights.scm index a7a0718e6..1187344a9 100644 --- a/queries/templ/highlights.scm +++ b/queries/templ/highlights.scm @@ -29,7 +29,7 @@ [ (expression) (dynamic_class_attribute_value) -] @method +] @function.method (component_import name: (component_identifier) @function) diff --git a/queries/terraform/highlights.scm b/queries/terraform/highlights.scm index 95d0c0451..d75b4284f 100644 --- a/queries/terraform/highlights.scm +++ b/queries/terraform/highlights.scm @@ -4,7 +4,7 @@ ; ; ; local/module/data/var/output -(expression (variable_expr (identifier) @variable.builtin (#any-of? @variable.builtin "data" "var" "local" "module" "output")) (get_attr (identifier) @field)) +(expression (variable_expr (identifier) @variable.builtin (#any-of? @variable.builtin "data" "var" "local" "module" "output")) (get_attr (identifier) @variable.member)) ; path.root/cwd/module (expression (variable_expr (identifier) @type.builtin (#eq? @type.builtin "path")) (get_attr (identifier) @variable.builtin (#any-of? @variable.builtin "root" "cwd" "module"))) diff --git a/queries/textproto/highlights.scm b/queries/textproto/highlights.scm index 8ebb476e5..439ca6875 100644 --- a/queries/textproto/highlights.scm +++ b/queries/textproto/highlights.scm @@ -1,6 +1,6 @@ (string) @string -(field_name) @field +(field_name) @variable.member (comment) @comment diff --git a/queries/thrift/highlights.scm b/queries/thrift/highlights.scm index 6c68dc9a3..a1ccdc9a2 100644 --- a/queries/thrift/highlights.scm +++ b/queries/thrift/highlights.scm @@ -8,7 +8,7 @@ [ "include" "cpp_include" -] @include +] @keyword.import ; Function @@ -17,17 +17,17 @@ ; Fields -(field (identifier) @field) +(field (identifier) @variable.member) ; Parameters (function_definition (parameters - (parameter (identifier) @parameter))) + (parameter (identifier) @variable.parameter))) (throws (parameters - (parameter (identifier) @parameter))) + (parameter (identifier) @variable.parameter))) ; Types @@ -82,7 +82,7 @@ (namespace_declaration (namespace_scope) @tag - [(namespace) @namespace (_ (identifier) @namespace)]) + [(namespace) @module (_ (identifier) @module)]) ; Attributes @@ -104,7 +104,7 @@ [ "throws" -] @exception +] @keyword.exception ; Keywords @@ -177,11 +177,11 @@ (escape_sequence) @string.escape (namespace_uri - (string) @text.uri @string.special) + (string) @string.special.url) (number) @number -(double) @float +(double) @number.float (boolean) @boolean @@ -222,5 +222,5 @@ ((comment) @comment.documentation (#lua-match? @comment.documentation "^///$")) -((comment) @preproc - (#lua-match? @preproc "#!.*")) +((comment) @keyword.directive + (#lua-match? @keyword.directive "#!.*")) diff --git a/queries/tiger/highlights.scm b/queries/tiger/highlights.scm index f4f666d8d..0516341c3 100644 --- a/queries/tiger/highlights.scm +++ b/queries/tiger/highlights.scm @@ -31,11 +31,11 @@ "for" "to" "while" -] @repeat +] @keyword.repeat "new" @keyword.operator -"import" @include +"import" @keyword.import [ "array" @@ -90,17 +90,17 @@ name: (identifier) @function) (method_call - method: (identifier) @method) + method: (identifier) @function.method) (method_declaration - name: (identifier) @method) + name: (identifier) @function.method) (parameters - name: (identifier) @parameter) + name: (identifier) @variable.parameter) ; }}} ; Declarations {{{ (import_declaration - file: (string_literal) @string.special) + file: (string_literal) @string.special.path) ; }}} ; Literals {{{ diff --git a/queries/tlaplus/highlights.scm b/queries/tlaplus/highlights.scm index 0dd0fd939..f1ad576cf 100644 --- a/queries/tlaplus/highlights.scm +++ b/queries/tlaplus/highlights.scm @@ -110,14 +110,14 @@ (pcal_end_if) "either" (pcal_end_either) -] @conditional +] @keyword.conditional [ "while" "do" (pcal_end_while) "with" (pcal_end_with) -] @repeat +] @keyword.repeat ("return") @keyword.return ("print") @function.macro @@ -141,10 +141,10 @@ (string_set) @type ; Namespaces -(extends (identifier_ref) @namespace) -(instance (identifier_ref) @namespace) -(module name: (identifier) @namespace) -(pcal_algorithm name: (identifier) @namespace) +(extends (identifier_ref) @module) +(instance (identifier_ref) @module) +(module name: (identifier) @module) +(pcal_algorithm name: (identifier) @module) ; Operators, functions, and macros (bound_infix_op symbol: (_) @operator) @@ -155,7 +155,7 @@ ((infix_op_symbol) @operator) ((postfix_op_symbol) @operator) (function_definition name: (identifier) @function) -(module_definition name: (_) @include) +(module_definition name: (_) @keyword.import) (operator_definition name: (_) @function.macro) (pcal_macro_decl name: (identifier) @function.macro) (pcal_macro_call name: (identifier) @function.macro) @@ -168,25 +168,25 @@ (constant_declaration (identifier) @constant) (constant_declaration (operator_declaration name: (_) @constant)) (pcal_var_decl (identifier) @variable) -(pcal_with (identifier) @parameter) +(pcal_with (identifier) @variable.parameter) ((".") . (identifier) @attribute) (record_literal (identifier) @attribute) (set_of_records (identifier) @attribute) (variable_declaration (identifier) @variable) ; Parameters -(choose (identifier) @parameter) -(choose (tuple_of_identifiers (identifier) @parameter)) -(lambda (identifier) @parameter) -(module_definition (operator_declaration name: (_) @parameter)) -(module_definition parameter: (identifier) @parameter) -(operator_definition (operator_declaration name: (_) @parameter)) -(operator_definition parameter: (identifier) @parameter) -(pcal_macro_decl parameter: (identifier) @parameter) -(pcal_proc_var_decl (identifier) @parameter) -(quantifier_bound (identifier) @parameter) -(quantifier_bound (tuple_of_identifiers (identifier) @parameter)) -(unbounded_quantification (identifier) @parameter) +(choose (identifier) @variable.parameter) +(choose (tuple_of_identifiers (identifier) @variable.parameter)) +(lambda (identifier) @variable.parameter) +(module_definition (operator_declaration name: (_) @variable.parameter)) +(module_definition parameter: (identifier) @variable.parameter) +(operator_definition (operator_declaration name: (_) @variable.parameter)) +(operator_definition parameter: (identifier) @variable.parameter) +(pcal_macro_decl parameter: (identifier) @variable.parameter) +(pcal_proc_var_decl (identifier) @variable.parameter) +(quantifier_bound (identifier) @variable.parameter) +(quantifier_bound (tuple_of_identifiers (identifier) @variable.parameter)) +(unbounded_quantification (identifier) @variable.parameter) ; Delimiters [ @@ -214,10 +214,10 @@ ] @punctuation.delimiter ; Proofs -(assume_prove (new (identifier) @parameter)) -(assume_prove (new (operator_declaration name: (_) @parameter))) +(assume_prove (new (identifier) @variable.parameter)) +(assume_prove (new (operator_declaration name: (_) @variable.parameter))) (assumption name: (identifier) @constant) -(pick_proof_step (identifier) @parameter) +(pick_proof_step (identifier) @variable.parameter) (proof_step_id "<" @punctuation.bracket) (proof_step_id (level) @label) (proof_step_id (name) @label) @@ -226,7 +226,7 @@ (proof_step_ref (level) @label) (proof_step_ref (name) @label) (proof_step_ref ">" @punctuation.bracket) -(take_proof_step (identifier) @parameter) +(take_proof_step (identifier) @variable.parameter) (theorem name: (identifier) @constant) ; Comments and tags diff --git a/queries/toml/highlights.scm b/queries/toml/highlights.scm index fd6fe7309..a54dc167e 100644 --- a/queries/toml/highlights.scm +++ b/queries/toml/highlights.scm @@ -12,7 +12,7 @@ (comment) @comment @spell (string) @string (integer) @number -(float) @float +(float) @number.float (offset_date_time) @string.special (local_date_time) @string.special (local_date) @string.special diff --git a/queries/tsv/highlights.scm b/queries/tsv/highlights.scm index f1e14af87..d406bd903 100644 --- a/queries/tsv/highlights.scm +++ b/queries/tsv/highlights.scm @@ -1,4 +1,4 @@ (text) @string (number) @number -(float) @float +(float) @number.float (boolean) @boolean diff --git a/queries/turtle/highlights.scm b/queries/turtle/highlights.scm index fac576781..4462d583a 100644 --- a/queries/turtle/highlights.scm +++ b/queries/turtle/highlights.scm @@ -7,7 +7,7 @@ "<" ">" (namespace) -] @namespace +] @module [ (iri_reference) @@ -23,7 +23,7 @@ [ (decimal) (double) -] @float +] @number.float (boolean_literal) @boolean diff --git a/queries/twig/highlights.scm b/queries/twig/highlights.scm index 4e7bfe4f2..a0a19160d 100644 --- a/queries/twig/highlights.scm +++ b/queries/twig/highlights.scm @@ -13,10 +13,10 @@ (keyword) @keyword (attribute) @attribute (tag) @tag -(conditional) @conditional -(repeat) @repeat -(method) @method -(parameter) @parameter +(conditional) @keyword.conditional +(repeat) @keyword.repeat +(method) @function.method +(parameter) @variable.parameter [ "{{" diff --git a/queries/typescript/highlights.scm b/queries/typescript/highlights.scm index 0a81699cd..bc6478a45 100644 --- a/queries/typescript/highlights.scm +++ b/queries/typescript/highlights.scm @@ -1,8 +1,8 @@ ; inherits: ecma -"require" @include +"require" @keyword.import -(import_require_clause source: (string) @text.uri) +(import_require_clause source: (string) @string.special.url) [ "declare" @@ -96,44 +96,44 @@ (template_type ["${" "}"] @punctuation.special) -(conditional_type ["?" ":"] @conditional.ternary) +(conditional_type ["?" ":"] @keyword.conditional.ternary) ;;; Parameters -(required_parameter (identifier) @parameter) -(optional_parameter (identifier) @parameter) +(required_parameter (identifier) @variable.parameter) +(optional_parameter (identifier) @variable.parameter) (required_parameter (rest_pattern - (identifier) @parameter)) + (identifier) @variable.parameter)) ;; ({ a }) => null (required_parameter (object_pattern - (shorthand_property_identifier_pattern) @parameter)) + (shorthand_property_identifier_pattern) @variable.parameter)) ;; ({ a = b }) => null (required_parameter (object_pattern (object_assignment_pattern - (shorthand_property_identifier_pattern) @parameter))) + (shorthand_property_identifier_pattern) @variable.parameter))) ;; ({ a: b }) => null (required_parameter (object_pattern (pair_pattern - value: (identifier) @parameter))) + value: (identifier) @variable.parameter))) ;; ([ a ]) => null (required_parameter (array_pattern - (identifier) @parameter)) + (identifier) @variable.parameter)) ;; a => null (arrow_function - parameter: (identifier) @parameter) + parameter: (identifier) @variable.parameter) ;; global declaration -(ambient_declaration "global" @namespace) +(ambient_declaration "global" @module) ;; function signatures (ambient_declaration @@ -141,11 +141,11 @@ name: (identifier) @function)) ;; method signatures -(method_signature name: (_) @method) +(method_signature name: (_) @function.method) ;; property signatures (property_signature - name: (property_identifier) @method + name: (property_identifier) @function.method type: (type_annotation [ (union_type (parenthesized_type (function_type))) diff --git a/queries/typoscript/highlights.scm b/queries/typoscript/highlights.scm index 9ce80c680..c1c483c3a 100644 --- a/queries/typoscript/highlights.scm +++ b/queries/typoscript/highlights.scm @@ -1,4 +1,4 @@ -(identifier) @field +(identifier) @variable.member (constant) @constant @@ -9,14 +9,14 @@ (condition) (condition_end) (condition_else) -] @conditional +] @keyword.conditional (cobject) @type.builtin [ "@import" "INCLUDE_TYPOSCRIPT" -] @include +] @keyword.import [ (comment) diff --git a/queries/ungrammar/highlights.scm b/queries/ungrammar/highlights.scm index 60355f577..0e4448255 100644 --- a/queries/ungrammar/highlights.scm +++ b/queries/ungrammar/highlights.scm @@ -16,7 +16,7 @@ [ "*" "?" -] @repeat +] @keyword.repeat [ ":" diff --git a/queries/unison/highlights.scm b/queries/unison/highlights.scm index 20e68a1c5..88b2a1373 100644 --- a/queries/unison/highlights.scm +++ b/queries/unison/highlights.scm @@ -41,35 +41,35 @@ (match) (with) (cases) -] @conditional +] @keyword.conditional (blank_pattern) @variable.builtin (pattern) @variable (constructor_or_variable_pattern) @type -(use_clause) @include +(use_clause) @keyword.import ;; Types (record_field name: (wordy_id) @variable type: (wordy_id) @type) (type_name) @type -(ability_declaration type_name: (wordy_id) @type type_arg: (wordy_id) @parameter) +(ability_declaration type_name: (wordy_id) @type type_arg: (wordy_id) @variable.parameter) (effect (wordy_id) @attribute) ;; NOTE: an effect is a special type ;; Namespaces -(path) @namespace -(namespace) @namespace +(path) @module +(namespace) @module ;; Terms -(type_signature term_name: (path) @namespace term_name: (wordy_id) @variable) +(type_signature term_name: (path) @module term_name: (wordy_id) @variable) (type_signature term_name: (wordy_id) @variable) (term_type) @type (function_application function_name: (path) function_name: (wordy_id) @function) (term_definition name: (wordy_id) @variable) -(term_definition param: (wordy_id) @parameter) +(term_definition param: (wordy_id) @variable.parameter) ;; Punctuation [ (type_signature_colon) @@ -85,4 +85,4 @@ "]" ] @punctuation.bracket -(test_watch_expression (wordy_id) @preproc) +(test_watch_expression (wordy_id) @keyword.directive) diff --git a/queries/usd/highlights.scm b/queries/usd/highlights.scm index 73968a647..6ba4ec98f 100644 --- a/queries/usd/highlights.scm +++ b/queries/usd/highlights.scm @@ -1,10 +1,10 @@ (None) @constant.builtin -(asset_path) @text.uri +(asset_path) @string.special.url (attribute_property) @property (bool) @boolean (comment) @comment @spell (custom) @function.builtin -(float) @float +(float) @number.float (integer) @number (orderer) @function.call (prim_path) @string.special @@ -16,12 +16,12 @@ ;; Prefer namespace highlighting, if any. ;; ;; e.g. `rel fizz` - `fizz` uses `@identifier` -;; e.g. `rel foo:bar:fizz` - `foo` and `bar` use `@namespace` and `fizz` uses `@identifier` +;; e.g. `rel foo:bar:fizz` - `foo` and `bar` use `@module` and `fizz` uses `@identifier` ;; (identifier) @variable -(namespace_identifier) @namespace +(namespace_identifier) @module (namespace_identifier - (identifier) @namespace + (identifier) @module ) [ diff --git a/queries/uxntal/highlights.scm b/queries/uxntal/highlights.scm index 795c73d09..ce81e77ef 100644 --- a/queries/uxntal/highlights.scm +++ b/queries/uxntal/highlights.scm @@ -1,8 +1,8 @@ ; Includes (include - "~" @include - _ @text.uri @string.special) + "~" @keyword.import + _ @string.special.url) ; Variables @@ -35,25 +35,25 @@ ; Labels (label - "@" @symbol + "@" @string.special.symbol (identifier) @function) (sublabel_reference - (identifier) @namespace + (identifier) @module "/" @punctuation.delimiter (identifier) @label) ; Repeats -((identifier) @repeat - (#eq? @repeat "while")) +((identifier) @keyword.repeat + (#eq? @keyword.repeat "while")) ; Literals (raw_ascii) @string (hex_literal - "#" @symbol + "#" @string.special.symbol (hex_lit_value) @string.special) (number) @number diff --git a/queries/v/highlights.scm b/queries/v/highlights.scm index dbf059d8f..221b05028 100644 --- a/queries/v/highlights.scm +++ b/queries/v/highlights.scm @@ -3,7 +3,7 @@ [ "import" "module" -] @include +] @keyword.import ; Keywords @@ -38,14 +38,14 @@ "else" "$else" "select" -] @conditional +] @keyword.conditional [ "for" "$for" "continue" "break" -] @repeat +] @keyword.repeat "fn" @keyword.function @@ -56,7 +56,7 @@ "shared" "static" "const" -] @storageclass +] @keyword.storage [ "pub" @@ -77,13 +77,13 @@ ; Namespace (module_clause - (identifier) @namespace) + (identifier) @module) (import_path - (import_name) @namespace) + (import_name) @module) (import_alias - (import_name) @namespace) + (import_name) @module) ; Literals @@ -115,20 +115,20 @@ ; Fields -(selector_expression field: (reference_expression (identifier) @field)) +(selector_expression field: (reference_expression (identifier) @variable.member)) -(field_name) @field +(field_name) @variable.member (struct_field_declaration - name: (identifier) @field) + name: (identifier) @variable.member) ; Parameters (parameter_declaration - name: (identifier) @parameter) + name: (identifier) @variable.parameter) (receiver - name: (identifier) @parameter) + name: (identifier) @variable.parameter) ; Constants @@ -158,11 +158,11 @@ (function_declaration receiver: (receiver) - name: (identifier) @method) + name: (identifier) @function.method) (call_expression name: (selector_expression - field: (reference_expression) @method.call)) + field: (reference_expression) @function.method.call)) (call_expression name: (reference_expression) @function.call) @@ -428,7 +428,7 @@ (int_literal) @number -(float_literal) @float +(float_literal) @number.float [ (c_string_literal) diff --git a/queries/vala/highlights.scm b/queries/vala/highlights.scm index 875bad539..3250adcb4 100644 --- a/queries/vala/highlights.scm +++ b/queries/vala/highlights.scm @@ -4,8 +4,8 @@ (comment) @comment @spell ((comment) @comment.documentation (#lua-match? @comment.documentation "^/[*][*][^*].*[*]/$")) -(symbol) @symbol -(member_access_expression (_) (identifier) @symbol) +(symbol) @string.special.symbol +(member_access_expression (_) (identifier) @string.special.symbol) ; highlight constants ( @@ -14,12 +14,12 @@ ) ( - (member_access_expression (member_access_expression) @include (identifier) @constant) + (member_access_expression (member_access_expression) @keyword.import (identifier) @constant) (#lua-match? @constant "^[%u][%u%d_]*$") ) ; highlight types and probable types -(type (symbol (_)? @namespace (identifier) @type)) +(type (symbol (_)? @module (identifier) @type)) ( (member_access_expression . (identifier) @type) (#match? @type "^[A-Z][A-Za-z_0-9]{2,}$") @@ -27,15 +27,15 @@ ; highlight creation methods in object creation expressions ( - (object_creation_expression (type (symbol (symbol (symbol)? @include (identifier) @type) (identifier) @constructor))) + (object_creation_expression (type (symbol (symbol (symbol)? @keyword.import (identifier) @type) (identifier) @constructor))) (#lua-match? @constructor "^[%l][%l%d_]*$") ) (unqualified_type (symbol . (identifier) @type)) -(unqualified_type (symbol (symbol) @namespace (identifier) @type)) +(unqualified_type (symbol (symbol) @module (identifier) @type)) (attribute) @attribute -(namespace_declaration (symbol) @namespace) +(namespace_declaration (symbol) @module) (method_declaration (symbol (symbol) @type (identifier) @function)) (method_declaration (symbol (identifier) @function)) (local_declaration (assignment (identifier) @variable)) @@ -55,10 +55,10 @@ (method_call_expression (member_access_expression (identifier) @function.macro)) (#match? @function.macro "^assert[A-Za-z_0-9]*|error|info|debug|print|warning|warning_once$") ) -(lambda_expression (identifier) @parameter) -(parameter (identifier) @parameter) +(lambda_expression (identifier) @variable.parameter) +(parameter (identifier) @variable.parameter) (property_declaration (symbol (identifier) @property)) -(field_declaration (identifier) @field) +(field_declaration (identifier) @variable.member) [ (this_access) (base_access) @@ -69,8 +69,8 @@ (escape_sequence) @string.escape (integer) @number (null) @constant.builtin -(real) @float -(regex) @string.regex +(real) @number.float +(regex) @string.regexp (string) @string (string_formatter) @string.special (template_string) @string @@ -82,10 +82,10 @@ ] @type.builtin (if_directive - expression: (_) @preproc + expression: (_) @keyword.directive ) @keyword (elif_directive - expression: (_) @preproc + expression: (_) @keyword.directive ) @keyword (else_directive) @keyword (endif_directive) @keyword @@ -133,10 +133,10 @@ "else" "if" "switch" -] @conditional +] @keyword.conditional ; specially highlight break statements in switch sections -(switch_section (break_statement "break" @conditional)) +(switch_section (break_statement "break" @keyword.conditional)) [ "extern" @@ -145,7 +145,7 @@ "protected" "public" "static" -] @storageclass +] @keyword.storage [ "and" @@ -160,10 +160,10 @@ "typeof" ] @keyword.operator -"using" @include -(using_directive (symbol) @namespace) +"using" @keyword.import +(using_directive (symbol) @module) -(symbol "global::" @namespace) +(symbol "global::" @module) (array_creation_expression "new" @keyword.operator) (object_creation_expression "new" @keyword.operator) @@ -177,7 +177,7 @@ "for" "foreach" "while" -] @repeat +] @keyword.repeat [ "catch" @@ -185,7 +185,7 @@ "throw" "throws" "try" -] @exception +] @keyword.exception [ "return" diff --git a/queries/verilog/highlights.scm b/queries/verilog/highlights.scm index 6d27863f6..1c6e578f6 100644 --- a/queries/verilog/highlights.scm +++ b/queries/verilog/highlights.scm @@ -66,20 +66,20 @@ "forever" "initial" "while" -] @repeat +] @keyword.repeat [ "if" "else" (case_keyword) "endcase" -] @conditional +] @keyword.conditional (comment) @comment @spell (include_compiler_directive) @constant.macro (package_import_declaration - "import" @include) + "import" @keyword.import) (package_import_declaration (package_import_item @@ -162,14 +162,14 @@ (simple_identifier) @type) (method_call_body - (method_identifier) @field) + (method_identifier) @variable.member) (interface_identifier (simple_identifier) @type) (modport_identifier (modport_identifier - (simple_identifier) @field)) + (simple_identifier) @variable.member)) (net_port_type1 (simple_identifier) @type) @@ -182,9 +182,9 @@ [ (default_nettype_compiler_directive) (timescale_compiler_directive) -] @preproc +] @keyword.directive -(include_compiler_directive) @include +(include_compiler_directive) @keyword.import ; begin/end label (seq_block @@ -212,7 +212,7 @@ "new" @constructor) (parameter_identifier - (simple_identifier) @parameter) + (simple_identifier) @variable.parameter) [ (integral_number) @@ -258,12 +258,12 @@ (task_identifier (task_identifier - (simple_identifier) @method)) + (simple_identifier) @function.method)) ;;TODO: fixme ;(assignment_pattern_expression ;(assignment_pattern - ;(parameter_identifier) @field)) + ;(parameter_identifier) @variable.member)) (type_declaration (data_type ["packed"] @type.qualifier)) @@ -290,10 +290,10 @@ (struct_union_member (list_of_variable_decl_assignments (variable_decl_assignment - (simple_identifier) @field))) + (simple_identifier) @variable.member))) (member_identifier - (simple_identifier) @field) + (simple_identifier) @variable.member) (struct_union_member (data_type_or_void diff --git a/queries/vhs/highlights.scm b/queries/vhs/highlights.scm index 67fa3cf8a..70b6ca20a 100644 --- a/queries/vhs/highlights.scm +++ b/queries/vhs/highlights.scm @@ -31,8 +31,9 @@ [ "@" ] @operator (control) @function.macro -(float) @float +(float) @number.float (integer) @number (comment) @comment @spell -[(path) (string) (json)] @string -(time) @symbol +[(string) (json)] @string +(path) @string.special.path +(time) @string.special diff --git a/queries/vim/highlights.scm b/queries/vim/highlights.scm index 9bae16ae9..7b28b4759 100644 --- a/queries/vim/highlights.scm +++ b/queries/vim/highlights.scm @@ -9,7 +9,7 @@ "else" "elseif" "endif" -] @conditional +] @keyword.conditional [ "try" @@ -17,7 +17,7 @@ "finally" "endtry" "throw" -] @exception +] @keyword.exception [ "for" @@ -27,7 +27,7 @@ "endwhile" "break" "continue" -] @repeat +] @keyword.repeat [ "function" @@ -38,8 +38,8 @@ (function_declaration name: (_) @function) (call_expression function: (identifier) @function.call) (call_expression function: (scoped_identifier (identifier) @function.call)) -(parameters (identifier) @parameter) -(default_parameter (identifier) @parameter) +(parameters (identifier) @variable.parameter) +(default_parameter (identifier) @variable.parameter) [ (bang) (spread) ] @punctuation.special @@ -48,7 +48,7 @@ (scope) "a:" "$" -] @namespace +] @module ;; Commands and user defined commands @@ -153,7 +153,7 @@ "" ] @constant.builtin -(augroup_name) @namespace +(augroup_name) @module (au_event) @constant (normal_statement (commands) @constant) @@ -203,12 +203,12 @@ (string_literal) @string (integer_literal) @number -(float_literal) @float +(float_literal) @number.float (comment) @comment @spell (line_continuation_comment) @comment @spell (pattern) @string.special -(pattern_multi) @string.regex -(filename) @string +(pattern_multi) @string.regexp +(filename) @string.special.path (heredoc (body) @string) (heredoc (parameter) @keyword) [ (marker_definition) (endmarker) ] @label @@ -277,7 +277,7 @@ ":" ] @punctuation.delimiter -(ternary_expression ["?" ":"] @conditional.ternary) +(ternary_expression ["?" ":"] @keyword.conditional.ternary) ; Options ((set_value) @number diff --git a/queries/vimdoc/highlights.scm b/queries/vimdoc/highlights.scm index 78ae9dab9..eefc4e74b 100644 --- a/queries/vimdoc/highlights.scm +++ b/queries/vimdoc/highlights.scm @@ -1,31 +1,31 @@ -(h1) @text.title.1 -(h2) @text.title.2 -(h3) @text.title.3 -(column_heading) @text.title.4 +(h1) @markup.heading.1 +(h2) @markup.heading.2 +(h3) @markup.heading.3 +(column_heading) @markup.heading.4 (column_heading - "~" @conceal (#set! conceal "")) + "~" @markup.heading.4.marker (#set! conceal "")) (tag - "*" @conceal (#set! conceal "") + "*" @markup.heading.5.marker (#set! conceal "") text: (_) @label) (taglink - "|" @conceal (#set! conceal "") - text: (_) @text.reference) + "|" @markup.link (#set! conceal "") + text: (_) @markup.link) (optionlink - text: (_) @text.reference) + text: (_) @markup.link) (codespan - "`" @conceal (#set! conceal "") - text: (_) @text.literal) -((codeblock) @text.literal.block (#set! "priority" 90)) + "`" @markup.raw (#set! conceal "") + text: (_) @markup.raw) +((codeblock) @markup.raw.block (#set! "priority" 90)) (codeblock - [">" (language)] @conceal (#set! conceal "")) + [">" (language)] @markup.raw.block (#set! conceal "")) (block - "<" @conceal (#set! conceal "")) -(argument) @parameter + "<" @markup.raw.block (#set! conceal "")) +(argument) @variable.parameter (keycode) @string.special -(url) @text.uri -((note) @text.note - (#any-of? @text.note "Note:" "NOTE:" "Notes:")) -((note) @text.warning - (#any-of? @text.warning "Warning:" "WARNING:")) -((note) @text.danger - (#any-of? @text.danger "Deprecated:" "DEPRECATED:")) +(url) @string.special.url +((note) @comment.hint + (#any-of? @comment.hint "Note:" "NOTE:" "Notes:")) +((note) @comment.warning + (#any-of? @comment.warning "Warning:" "WARNING:")) +((note) @comment.error + (#any-of? @comment.error "Deprecated:" "DEPRECATED:")) diff --git a/queries/vue/highlights.scm b/queries/vue/highlights.scm index ae89d65a0..e53ef4b8a 100644 --- a/queries/vue/highlights.scm +++ b/queries/vue/highlights.scm @@ -20,4 +20,4 @@ [ (directive_modifier) (directive_argument) -] @method +] @function.method diff --git a/queries/wgsl/highlights.scm b/queries/wgsl/highlights.scm index c440bf0fe..6e190f06e 100644 --- a/queries/wgsl/highlights.scm +++ b/queries/wgsl/highlights.scm @@ -1,6 +1,6 @@ (identifier) @variable (int_literal) @number -(float_literal) @float +(float_literal) @number.float (bool_literal) @boolean (type_declaration) @type @@ -9,13 +9,13 @@ (identifier) @function) (parameter - (variable_identifier_declaration (identifier) @parameter)) + (variable_identifier_declaration (identifier) @variable.parameter)) (struct_declaration (identifier) @type) (struct_declaration - (struct_member (variable_identifier_declaration (identifier) @field))) + (struct_member (variable_identifier_declaration (identifier) @variable.member))) (type_constructor_or_function_call_expression (type_declaration) @function.call) @@ -38,7 +38,7 @@ "storage" "uniform" "workgroup" -] @storageclass +] @keyword.storage [ "read" @@ -61,7 +61,7 @@ "break" "continue" "continuing" -] @repeat +] @keyword.repeat [ "if" @@ -69,7 +69,7 @@ "switch" "case" "default" -] @conditional +] @keyword.conditional [ "&" diff --git a/queries/wgsl_bevy/highlights.scm b/queries/wgsl_bevy/highlights.scm index 4ba25a935..d14276733 100644 --- a/queries/wgsl_bevy/highlights.scm +++ b/queries/wgsl_bevy/highlights.scm @@ -9,7 +9,7 @@ "#import" "#define_import_path" "as" -] @include +] @keyword.import "::" @punctuation.delimiter @@ -17,13 +17,13 @@ (import_path ((identifier) @function .))) -(import_path (identifier) @namespace (identifier)) +(import_path (identifier) @module (identifier)) (struct_declaration - (preproc_ifdef (struct_member (variable_identifier_declaration (identifier) @field)))) + (preproc_ifdef (struct_member (variable_identifier_declaration (identifier) @variable.member)))) (struct_declaration (preproc_ifdef - (preproc_else (struct_member (variable_identifier_declaration (identifier) @field))))) + (preproc_else (struct_member (variable_identifier_declaration (identifier) @variable.member))))) (preproc_ifdef name: (identifier) @constant.macro) @@ -33,4 +33,4 @@ "#ifndef" "#endif" "#else" -] @preproc +] @keyword.directive diff --git a/queries/wing/highlights.scm b/queries/wing/highlights.scm index af5ef6ed6..3ef530746 100644 --- a/queries/wing/highlights.scm +++ b/queries/wing/highlights.scm @@ -6,22 +6,22 @@ (custom_type) @type (class_field - name: (identifier) @field) + name: (identifier) @variable.member) (class_definition name: (identifier) @type) (method_definition - name: (identifier) @method) + name: (identifier) @function.method) ; Functions -(keyword_argument_key) @parameter +(keyword_argument_key) @variable.parameter (call caller: (reference (nested_identifier - property: (member_identifier) @method.call))) + property: (member_identifier) @function.method.call))) (call caller: (reference - (reference_identifier) @method.call)) + (reference_identifier) @function.method.call)) ; Primitives diff --git a/queries/xcompose/highlights.scm b/queries/xcompose/highlights.scm index 48366985d..811a67b1d 100644 --- a/queries/xcompose/highlights.scm +++ b/queries/xcompose/highlights.scm @@ -5,7 +5,7 @@ (text) @string -"include" @include +"include" @keyword.import [ (octal) (hex) ] @number diff --git a/queries/xml/highlights.scm b/queries/xml/highlights.scm index e47636ac4..aa913352e 100644 --- a/queries/xml/highlights.scm +++ b/queries/xml/highlights.scm @@ -8,9 +8,9 @@ ;; Processing instructions -(XmlModelPI "xml-model" @preproc) +(XmlModelPI "xml-model" @keyword.directive) -(StyleSheetPI "xml-stylesheet" @preproc) +(StyleSheetPI "xml-stylesheet" @keyword.directive) (PseudoAtt (Name) @tag.attribute) @@ -18,7 +18,7 @@ ;; Doctype declaration -(doctypedecl "DOCTYPE" @define) +(doctypedecl "DOCTYPE" @keyword.directive.define) (doctypedecl (Name) @type.definition) @@ -38,12 +38,12 @@ ;; Text -(CharData) @text @spell +(CharData) @none @spell ((CDSect - (CDStart) @text.environment - (CData) @text.literal - "]]>" @text.environment) + (CDStart) @markup.environment + (CData) @markup.raw + "]]>" @markup.environment) (#set! "priority" 105)) ;; Delimiters & punctuation diff --git a/queries/yaml/highlights.scm b/queries/yaml/highlights.scm index 0fa633dbd..03234a5ce 100644 --- a/queries/yaml/highlights.scm +++ b/queries/yaml/highlights.scm @@ -16,17 +16,17 @@ (yaml_directive) (tag_directive) (reserved_directive) -] @preproc +] @keyword.directive (block_mapping_pair - key: (flow_node [(double_quote_scalar) (single_quote_scalar)] @field)) + key: (flow_node [(double_quote_scalar) (single_quote_scalar)] @variable.member)) (block_mapping_pair - key: (flow_node (plain_scalar (string_scalar) @field))) + key: (flow_node (plain_scalar (string_scalar) @variable.member))) (flow_mapping - (_ key: (flow_node [(double_quote_scalar) (single_quote_scalar)] @field))) + (_ key: (flow_node [(double_quote_scalar) (single_quote_scalar)] @variable.member))) (flow_mapping - (_ key: (flow_node (plain_scalar (string_scalar) @field)))) + (_ key: (flow_node (plain_scalar (string_scalar) @variable.member)))) [ "," diff --git a/queries/yang/highlights.scm b/queries/yang/highlights.scm index c2c302a71..33e5517c3 100644 --- a/queries/yang/highlights.scm +++ b/queries/yang/highlights.scm @@ -6,7 +6,7 @@ ; Keywords (statement_keyword) @keyword -(statement_keyword "import") @include +(statement_keyword "import") @keyword.import (extension_keyword) @function ; Arguments @@ -24,7 +24,7 @@ (string) @string (string (escape_sequence) @string.escape) (unquoted_string) @string -(keypath) @string.special +(keypath) @string.special.path ; Always highlight the value of an enum statement as a string (enum_value) @string @@ -35,7 +35,7 @@ (argument (string) @string.special)) (statement (statement_keyword "pattern") - (argument (string) @string.regex)) + (argument (string) @string.regexp)) ; Punctuation (plus_symbol) @operator diff --git a/queries/yuck/highlights.scm b/queries/yuck/highlights.scm index 16e90441f..c885d909d 100644 --- a/queries/yuck/highlights.scm +++ b/queries/yuck/highlights.scm @@ -7,8 +7,8 @@ ; Includes (list . - ((symbol) @include - (#eq? @include "include"))) + ((symbol) @keyword.import + (#eq? @keyword.import "include"))) ; Keywords @@ -20,9 +20,9 @@ ; Loop -(loop_widget . "for" @repeat . (symbol) @variable . "in" @keyword.operator) +(loop_widget . "for" @keyword.repeat . (symbol) @variable . "in" @keyword.operator) -(loop_widget . "for" @repeat . (symbol) @variable . "in" @keyword.operator . (symbol) @variable) +(loop_widget . "for" @keyword.repeat . (symbol) @variable . "in" @keyword.operator . (symbol) @variable) ; Builtin widgets @@ -84,7 +84,7 @@ (json_object (simplexpr - (ident) @field)) + (ident) @variable.member)) ; Functions @@ -121,13 +121,13 @@ ; Ternary expression (ternary_expression - ["?" ":"] @conditional.ternary) + ["?" ":"] @keyword.conditional.ternary) ; Literals (number) @number -(float) @float +(float) @number.float (boolean) @boolean diff --git a/queries/zig/highlights.scm b/queries/zig/highlights.scm index 9ba764b10..875235412 100644 --- a/queries/zig/highlights.scm +++ b/queries/zig/highlights.scm @@ -10,12 +10,12 @@ variable_type_function: (IDENTIFIER) ] @variable -parameter: (IDENTIFIER) @parameter +parameter: (IDENTIFIER) @variable.parameter [ field_member: (IDENTIFIER) field_access: (IDENTIFIER) -] @field +] @variable.member ;; assume TitleCase is a type ( @@ -48,7 +48,7 @@ parameter: (IDENTIFIER) @parameter function: (IDENTIFIER) @function function_call: (IDENTIFIER) @function.call -exception: "!" @exception +exception: "!" @keyword.exception ( (IDENTIFIER) @variable.builtin @@ -71,12 +71,12 @@ field_constant: (IDENTIFIER) @constant (BUILTINIDENTIFIER) @function.builtin -((BUILTINIDENTIFIER) @include - (#any-of? @include "@import" "@cImport")) +((BUILTINIDENTIFIER) @keyword.import + (#any-of? @keyword.import "@import" "@cImport")) (INTEGER) @number -(FLOAT) @float +(FLOAT) @number.float [ "true" @@ -133,23 +133,23 @@ field_constant: (IDENTIFIER) @constant "if" "else" "switch" -] @conditional +] @keyword.conditional [ "for" "while" "break" "continue" -] @repeat +] @keyword.repeat [ "usingnamespace" -] @include +] @keyword.import [ "try" "catch" -] @exception +] @keyword.exception [ "anytype" @@ -169,7 +169,7 @@ field_constant: (IDENTIFIER) @constant "align" "callconv" "linksection" -] @storageclass +] @keyword.storage [ "comptime" diff --git a/tests/query/highlights/capnp/test.capnp b/tests/query/highlights/capnp/test.capnp index 9ba376c7d..ce12b07ac 100644 --- a/tests/query/highlights/capnp/test.capnp +++ b/tests/query/highlights/capnp/test.capnp @@ -20,15 +20,15 @@ # THE SOFTWARE. @0xd508eebdc2dc42b8; -# <- @preproc +# <- @keyword.directive # ^ @punctuation.delimiter using Cxx = import "c++.capnp"; -# <- @include +# <- @keyword.import # ^^^ @type # ^ @operator -# ^^^^^^ @include -# ^^^^^^^^^^^ @string +# ^^^^^^ @keyword.import +# ^^^^^^^^^^^ @string.special.path # Use a namespace likely to cause trouble if the generated code doesn't use fully-qualified # names for stuff in the capnproto namespace. @@ -53,7 +53,7 @@ enum TestEnum { struct TestAllTypes { # <- @keyword voidField @0 : Void; -# ^^^^^^^^^ @field +# ^^^^^^^^^ @variable.member # ^ @punctuation.special # ^^^^ @type.builtin boolField @1 : Bool; @@ -150,7 +150,7 @@ struct TestUnionDefaults { struct TestUsing { using OuterNestedEnum = TestNestedTypes.NestedEnum; -# ^^^^^ @include +# ^^^^^ @keyword.import using TestNestedTypes.NestedStruct.NestedEnum; outerNestedEnum @1 :OuterNestedEnum = bar; @@ -179,7 +179,7 @@ struct TestWholeFloatDefault { bigField @1 :Float32 = 2e30; const constant :Float32 = 456; const bigConstant :Float32 = 4e30; -# ^^^^ @float +# ^^^^ @number.float } struct TestGenerics(Foo, Bar) { @@ -217,7 +217,7 @@ struct TestGenerics(Foo, Bar) { # ^^^^^^^^^ @keyword # At one time this failed to compile. call @0 () -> (); -# ^^^^ @method +# ^^^^ @function.method # ^^ @punctuation.delimiter } } @@ -225,14 +225,14 @@ struct TestGenerics(Foo, Bar) { interface Interface(Qux) { call @0 Inner2(Text) -> (qux :Qux, gen :TestGenerics(TestAllTypes, TestAnyPointer)); -# ^^^ @parameter -# ^^^ @parameter +# ^^^ @variable.parameter +# ^^^ @variable.parameter } annotation ann(struct) :Foo; # ^^^^^^^^^^ @keyword -# ^^^ @method -# ^^^^^^ @parameter.builtin +# ^^^ @function.method +# ^^^^^^ @variable.parameter.builtin using AliasFoo = Foo; using AliasInner = Inner; @@ -423,7 +423,7 @@ const genericConstant :TestGenerics(TestAllTypes, Text) = (foo = (int16Field = 123), rev = (foo = "text", rev = (foo = (int16Field = 321)))); const embeddedData :Data = embed "testdata/packed"; -# ^^^^^ @include +# ^^^^^ @keyword.import const embeddedText :Text = embed "testdata/short.txt"; const embeddedStruct :TestAllTypes = embed "testdata/binary"; @@ -452,7 +452,7 @@ const anyPointerConstants :TestAnyPointerConstants = ( interface TestInterface { foo @0 (i :UInt32, j :Bool) -> (x :Text); -# ^ @parameter +# ^ @variable.parameter bar @1 () -> (); baz @2 (s: TestAllTypes); } diff --git a/tests/query/highlights/clojure/test.clj b/tests/query/highlights/clojure/test.clj index f40e9b0c4..5c9ca649b 100644 --- a/tests/query/highlights/clojure/test.clj +++ b/tests/query/highlights/clojure/test.clj @@ -1,7 +1,7 @@ (ns test {:clj-kondo/ignore true}) ; <- @punctuation.bracket -; ^ @include -; ^ @namespace +; ^ @keyword.import +; ^ @module ; asdf ;^^^^^^ @comment @@ -19,7 +19,7 @@ ; ^ ^^ ^^ @variable.builtin & -;^ @parameter +;^ @variable.parameter ->abc ;^^^^^ @constructor @@ -31,16 +31,16 @@ ;^^ ^^ ^^ ^^ @variable.builtin (.method) -;^^^^^^^ @method +;^^^^^^^ @function.method (.-field) -;^^^^^^^ @field +;^^^^^^^ @variable.member Abc/method -;^^^^^^^^^^ @field +;^^^^^^^^^^ @variable.member (Abc/method) -;^^^^^^^^^^ @method +;^^^^^^^^^^ @function.method Abc ;^^^ @type diff --git a/tests/query/highlights/cpp/concepts.cpp b/tests/query/highlights/cpp/concepts.cpp index 6fe6af436..09d975c98 100644 --- a/tests/query/highlights/cpp/concepts.cpp +++ b/tests/query/highlights/cpp/concepts.cpp @@ -7,7 +7,7 @@ concept Derived = std::is_base_of::value; template concept Hashable = requires(T a) { // ^ @keyword -// ^ @parameter +// ^ @variable.parameter // ^ @type { std::hash{}(a) } -> std::convertible_to; typename CommonType; // CommonType is valid and names a type diff --git a/tests/query/highlights/cpp/enums-as-constants.cpp b/tests/query/highlights/cpp/enums-as-constants.cpp index ae773e8d3..d6b93d5ec 100644 --- a/tests/query/highlights/cpp/enums-as-constants.cpp +++ b/tests/query/highlights/cpp/enums-as-constants.cpp @@ -11,7 +11,7 @@ void foo(Foo f){ switch ( f ) { case Foo::a: // ^ @type - // ^ @namespace + // ^ @module // ^ @constant break; case Foo::aa: diff --git a/tests/query/highlights/cpp/test.cpp b/tests/query/highlights/cpp/test.cpp index 3f903a55f..4a4c6238a 100644 --- a/tests/query/highlights/cpp/test.cpp +++ b/tests/query/highlights/cpp/test.cpp @@ -1,11 +1,11 @@ #include #include -// ^ @include +// ^ @keyword.import // ^ @string auto main( int argc, char** argv ) -> int // ^ @type.builtin - // ^ @parameter + // ^ @variable.parameter // ^ @type.builtin // ^ @type.builtin // ^ @operator diff --git a/tests/query/highlights/ecma/test.ts b/tests/query/highlights/ecma/test.ts index 9ecd50c76..ecdfa8929 100644 --- a/tests/query/highlights/ecma/test.ts +++ b/tests/query/highlights/ecma/test.ts @@ -6,21 +6,21 @@ class H { // ^ @property #private_method() { - // ^ @method + // ^ @function.method return `${this.pub_field} -- ${this.#priv_field}`; // ^ @property // ^ @property } public_method() { - // ^ @method + // ^ @function.method return this.#private_method(); - // ^ @method.call + // ^ @function.method.call } ok() { return this.public_method(); - // ^ @method.call + // ^ @function.method.call } } diff --git a/tests/query/highlights/fusion/basic.fusion b/tests/query/highlights/fusion/basic.fusion index e63c86eea..16b99f431 100644 --- a/tests/query/highlights/fusion/basic.fusion +++ b/tests/query/highlights/fusion/basic.fusion @@ -1,12 +1,12 @@ include: SomeFile.fusion -//<- @include -// ^ @text.uri +//<- @keyword.import +// ^ @string.special.url namespace: ns = Neos.Fusion.Space //<- @keyword -// ^ @namespace +// ^ @module // ^ @operator -// ^ @namespace +// ^ @module prototype(MyType) < prototype(ns:SuperType) { //<-keyword @@ -14,7 +14,7 @@ prototype(MyType) < prototype(ns:SuperType) { // ^ @type // ^ @punctuation.bracket // ^ @operator -// ^ @namespace +// ^ @module // ^ @type deleteProp > @@ -48,12 +48,12 @@ prototype(MyType) < prototype(ns:SuperType) { property.aliasedType = ns:SomeType //<- @property - // ^ @namespace + // ^ @module // ^ @type property.fullQualifiedType = SomeNamespace:SomeType //<- @property - // ^ @namespace + // ^ @module // ^ @type } diff --git a/tests/query/highlights/fusion/expressions.fusion b/tests/query/highlights/fusion/expressions.fusion index ae6e2db33..b1822dda8 100644 --- a/tests/query/highlights/fusion/expressions.fusion +++ b/tests/query/highlights/fusion/expressions.fusion @@ -76,7 +76,7 @@ logic = ${!foo && !(bar || baz) and not 'string'} // ^operator ternary = ${ check ? true : false} -// ^@conditional.ternary -// ^@conditional.ternary +// ^@keyword.conditional.ternary +// ^@keyword.conditional.ternary diff --git a/tests/query/highlights/gitattributes/test.gitattributes b/tests/query/highlights/gitattributes/test.gitattributes index a16c233e6..4595b94f2 100644 --- a/tests/query/highlights/gitattributes/test.gitattributes +++ b/tests/query/highlights/gitattributes/test.gitattributes @@ -1,5 +1,5 @@ [attr]nodiff -diff -merge -# <- @preproc +# <- @keyword.directive # ^^^^^^ @property # ^ @operator # ^^^^ @variable.builtin @@ -9,7 +9,7 @@ vendor/** linguist-vendored=true # ^ @punctuation.delimiter # ^^ @character.special -# ^^^^^^^^^^^^^^^^^ @parameter +# ^^^^^^^^^^^^^^^^^ @variable.parameter # ^ @operator # ^^^^ @boolean @@ -22,7 +22,7 @@ vendor/** linguist-vendored=true # ^^^^^^^^^ @constant # ^ @punctuation.bracket # ^ @operator -# ^^^^^^^^^^ @parameter +# ^^^^^^^^^^ @variable.parameter "_\u4E00\t\56txt" encoding=UTF-16 # <- @punctuation.special diff --git a/tests/query/highlights/gleam/assert.gleam b/tests/query/highlights/gleam/assert.gleam index d36716a3f..8be39923d 100644 --- a/tests/query/highlights/gleam/assert.gleam +++ b/tests/query/highlights/gleam/assert.gleam @@ -1,6 +1,6 @@ pub fn main() { assert Ok(i) = parse_int("123") - // <- @exception + // <- @keyword.exception // ^^ @constructor // ^ @punctuation.bracket // ^ @variable diff --git a/tests/query/highlights/gleam/function.gleam b/tests/query/highlights/gleam/function.gleam index aed4879dc..ff2b690ca 100644 --- a/tests/query/highlights/gleam/function.gleam +++ b/tests/query/highlights/gleam/function.gleam @@ -3,11 +3,11 @@ pub fn add(x: Int, y: Int) -> Int { // ^^ @keyword.function // ^^^ @function // ^ @punctuation.bracket -// ^ @parameter +// ^ @variable.parameter // ^ @punctuation.delimiter // ^^^ @type.builtin // ^ @punctuation.delimiter -// ^ @parameter +// ^ @variable.parameter // ^ @punctuation.delimiter // ^^^ @type.builtin // ^ @punctuation.bracket @@ -22,7 +22,7 @@ pub fn twice(f: fn(t) -> t, x: t) -> t { // ^ @keyword.function // ^^^^^ @function // ^ @punctuation.bracket -// ^ @parameter +// ^ @variable.parameter // ^ @punctuation.delimiter // ^^ @keyword.function // ^ @punctuation.bracket @@ -31,7 +31,7 @@ pub fn twice(f: fn(t) -> t, x: t) -> t { // ^^ @punctuation.delimiter // ^ @type // ^ @punctuation.delimiter -// ^ @parameter +// ^ @variable.parameter // ^ @punctuation.delimiter // ^ @type // ^ @punctuation.bracket @@ -45,7 +45,7 @@ fn list_of_two(my_value: a) -> List(a) { // <- @keyword.function // ^ @function // ^ @punctuation.bracket -// ^ @parameter +// ^ @variable.parameter // ^ @punctuation.delimiter // ^ @type // ^ @punctuation.bracket @@ -64,19 +64,19 @@ fn replace( // ^ @punctuation.bracket in string: String, // <- @label - // ^^^^^^ @parameter + // ^^^^^^ @variable.parameter // ^ @punctuation.delimiter // ^^^^^^ @type.builtin // ^ @punctuation.delimiter each pattern: String, // <- @label - // ^^^^^^^ @parameter + // ^^^^^^^ @variable.parameter // ^ @punctuation.delimiter // ^^^^^^ @type.builtin // ^ @punctuation.delimiter with replacement: String, // <- @label - // ^^^^^^^^^^^ @parameter + // ^^^^^^^^^^^ @variable.parameter // ^ @punctuation.delimiter // ^^^^^^ @type.builtin // ^ @punctuation.delimiter @@ -109,7 +109,7 @@ pub external fn random_float() -> Float = "rand" "uniform" // ^^ @punctuation.delimiter // ^^^^^ @type.builtin // ^ @operator -// ^^^^^^ @namespace +// ^^^^^^ @module // ^^^^^^^^^ @function pub external fn inspect(a) -> a = "Elixir.IO" "inspect" @@ -123,5 +123,5 @@ pub external fn inspect(a) -> a = "Elixir.IO" "inspect" // ^^ @punctuation.delimiter // ^ @type // ^ @operator -// ^^^^^^^^^^^ @namespace +// ^^^^^^^^^^^ @module // ^^^^^^^^^ @function diff --git a/tests/query/highlights/gleam/import.gleam b/tests/query/highlights/gleam/import.gleam index 3ee141513..ac452d157 100644 --- a/tests/query/highlights/gleam/import.gleam +++ b/tests/query/highlights/gleam/import.gleam @@ -1,18 +1,18 @@ import gleam/io -// <- @include -// ^ @namespace +// <- @keyword.import +// ^ @module // ^ @operator -// ^ @namespace +// ^ @module import cat as kitten -// <- @include -// ^ @namespace +// <- @keyword.import +// ^ @module // ^ @keyword -// ^ @namespace +// ^ @module import animal/cat.{Cat, stroke} -// <- @include -// ^ @namespace +// <- @keyword.import +// ^ @module // ^ @operator // ^ @punctuation.delimiter // ^ @punctuation.bracket diff --git a/tests/query/highlights/hack/as-foreach.hack b/tests/query/highlights/hack/as-foreach.hack index d7a66875b..611027131 100644 --- a/tests/query/highlights/hack/as-foreach.hack +++ b/tests/query/highlights/hack/as-foreach.hack @@ -1,5 +1,5 @@ foreach (($array as vec[]) as $item) {} -// ^ @repeat +// ^ @keyword.repeat // ^ @type # Our expectation test for the code below intentionally includes an ERROR. diff --git a/tests/query/highlights/hack/generics.hack b/tests/query/highlights/hack/generics.hack index 66b008aa4..fc41a86a9 100644 --- a/tests/query/highlights/hack/generics.hack +++ b/tests/query/highlights/hack/generics.hack @@ -7,15 +7,15 @@ class Box { public function __construct(T $data) { // ^ @type - // ^ @parameter + // ^ @variable.parameter // ^ @keyword.function // ^ @type.qualifier - // ^ @method + // ^ @function.method $this->data = $data; } public function getData(): T { - // ^ @method + // ^ @function.method // ^ @type.qualifier return $this->data; // ^ @operator diff --git a/tests/query/highlights/hack/shapes.hack b/tests/query/highlights/hack/shapes.hack index bc8732433..f111689d0 100644 --- a/tests/query/highlights/hack/shapes.hack +++ b/tests/query/highlights/hack/shapes.hack @@ -1,7 +1,7 @@ class C extends Superclass implements Iface { // ^ @keyword ^ @keyword use Trait; - // <- @include + // <- @keyword.import const type X = shape( // <- @keyword ^ @type.builtin "a" => int, diff --git a/tests/query/highlights/hack/use.hack b/tests/query/highlights/hack/use.hack index 353838a18..0b1fde364 100644 --- a/tests/query/highlights/hack/use.hack +++ b/tests/query/highlights/hack/use.hack @@ -8,21 +8,21 @@ use type Space\Type\T; // ^ @keyword use namespace Space\Name\N as M; // ^ @keyword -// ^ @namespace +// ^ @module use namespace Space\Name2\N2, Space\Nothing\N3 as N8, type Space\Type2\N4,; -// ^ @namespace +// ^ @module // ^ @type use namespace Space\Name\N10\{A as A2, B\}; -// ^ @namespace -// ^ @namespace -// ^ @namespace +// ^ @module +// ^ @module +// ^ @module use namespace Space\Name\{\C, Slash as Forward}; use \What\Is\This\{function A as A2, B, const H\S\L as stdlib, function F}; use type \{kind,}; use Q\B\{kind2,}; -// ^ @namespace +// ^ @module use type Q\B\{kind3,}; -// <- @include +// <- @keyword.import diff --git a/tests/query/highlights/haskell/test.hs b/tests/query/highlights/haskell/test.hs index bf7e939a0..7734a448b 100644 --- a/tests/query/highlights/haskell/test.hs +++ b/tests/query/highlights/haskell/test.hs @@ -1,33 +1,33 @@ {-# LANGUAGE QuasiQuotes #-} --- ^ @preproc +-- ^ @keyword.directive module Main --- ^ @include - -- ^ @namespace +-- ^ @keyword.import + -- ^ @module ( main ) where -- ^ @keyword import Prelude hiding (show) --- ^ @include - -- ^ @namespace +-- ^ @keyword.import + -- ^ @module -- ^ @keyword -- ^ @variable import Data.Map (fromList) - -- ^ @namespace + -- ^ @module import qualified Data.Map as Map -- ^ @constructor - -- ^ @namespace + -- ^ @module import qualified Chronos - -- ^ @namespace + -- ^ @module import qualified Chronos as C -- ^ @constructor - -- ^ @namespace + -- ^ @module import FooMod (BarTy (barField)) - -- ^ @field + -- ^ @variable.member x = mempty { field = 5 } - -- ^ @field + -- ^ @variable.member data ADT -- ^ @keyword @@ -62,31 +62,31 @@ newtype Rec -- ^ @constructor { field :: Double -- ^ @punctuation.bracket - -- ^ @field + -- ^ @variable.member -- ^ @type } -- ^ @punctuation.bracket deriving Eq -- ^ @type recordWildCard Rec { field } = field - -- ^ @field + -- ^ @variable.member recordDotSyntax rec = rec.field - -- ^ @field + -- ^ @variable.member main :: IO () -- ^ @function -- ^ @operator -- ^ @type - -- ^ @symbol + -- ^ @string.special.symbol main = undefined -- ^ @function - -- ^ @exception + -- ^ @keyword.exception someFunc0 :: Int -> Int -- ^ @operator someFunc0 x = someFunc1 x - -- ^ @parameter + -- ^ @variable.parameter -- ^ @function.call where -- ^ @keyword @@ -94,9 +94,9 @@ someFunc0 x = someFunc1 x -- ^ @function -- ^ @number scopedTypeParam (x :: Int) = someFunc x - -- ^ @parameter + -- ^ @variable.parameter scopedTypeParam (Just x :: Int) = someFunc x - -- ^ @parameter + -- ^ @variable.parameter someInfix :: Integral a => a -> Double -- ^ @type @@ -118,7 +118,7 @@ someInfix x = fromIntegral x `myAdd` floatVal -- ^ @variable floatVal = 5.5 -- ^ @variable - -- ^ @float + -- ^ @number.float intVal :: Int -- ^ @variable intVal = getInt 5 @@ -138,12 +138,12 @@ someInfix x = fromIntegral x `myAdd` floatVal isInt :: Either Double Int -> Bool -- ^ @function isInt eith@Left{} = False - -- ^ @parameter + -- ^ @variable.parameter isInt eith@(Left x) = False -- ^ @function - -- ^ @parameter + -- ^ @variable.parameter isInt (Left x) = False - -- ^ @parameter + -- ^ @variable.parameter isInt (Right _) = True -- ^ @function @@ -153,19 +153,19 @@ someIOaction = do -- ^ @keyword foo <- SomeModule.someFun <$> getArgs -- ^ @variable - -- ^ @namespace + -- ^ @module -- ^ @function.call -- ^ @operator _ <- someFunc0 =<< someIOAction -- ^ @function.call let bar = SomeModule.doSomething $ "a" "b" -- ^ @variable - -- ^ @namespace + -- ^ @module -- ^ @function.call -- ^ @operator func x y = x + y - 7 -- ^ @function - -- ^ @parameter + -- ^ @variable.parameter -- ^ @variable -- ^ @variable gunc x y = func x $ y + 7 @@ -216,26 +216,26 @@ condVal = if otherwise else True getLambda x = \y -> x `SomeModule.someInfix` y - -- ^ @parameter - -- ^ @namespace + -- ^ @variable.parameter + -- ^ @module -- ^ @operator lambdaTyped = \(y :: Int) -> x - -- ^ @parameter + -- ^ @variable.parameter lambdaPattern = \(Just x) -> x - -- ^ @parameter + -- ^ @variable.parameter lambdaPatternTyped = \(Just x :: Int) -> x - -- ^ @parameter + -- ^ @variable.parameter isVowel = (`elem` "AEIOU") -- ^ @operator isVowelQualified = (`SomeModule.elem` "AEIOU") - -- ^ @namespace + -- ^ @module -- ^ @operator hasVowels = ("AEIOU" `elem`) -- ^ @operator hasVowelsQualified = ("AEIOU" `SomeModule.elem`) - -- ^ @namespace + -- ^ @module -- ^ @operator quasiQuotedString = [qq|Some string|] @@ -243,7 +243,7 @@ quasiQuotedString = [qq|Some string|] -- ^ @function.call -- ^ @string quasiQuotedString2 = [SomeModule.qq|Some string|] - -- ^ @namespace + -- ^ @module -- ^ @function.call composition f g = f . g @@ -270,42 +270,42 @@ appliedComposition f g var = (NS.f . NS.g) var -- ^ @function.call -- ^ @function.call param1 |*| param2 = Qu $ param1 * param2 --- ^ @parameter - -- ^ @parameter +-- ^ @variable.parameter + -- ^ @variable.parameter (param1 :: Int) |*| (param2 :: Int) = Qu $ param1 * param2 --- ^ @parameter - -- ^ @parameter +-- ^ @variable.parameter + -- ^ @variable.parameter (Qu a) |/| (SomeModule.Qu b) = a / b - -- ^ @parameter - -- ^ @parameter + -- ^ @variable.parameter + -- ^ @variable.parameter (Qu a :: Int) |/| (SomeModule.Qu b :: Int) = a / b - -- ^ @parameter - -- ^ @parameter + -- ^ @variable.parameter + -- ^ @variable.parameter (Qu a, b, c :: Int) |/| x = undefined - -- ^ @parameter - -- ^ @parameter - -- ^ @parameter + -- ^ @variable.parameter + -- ^ @variable.parameter + -- ^ @variable.parameter [Qu a, b, c :: Int] >< x = undefined - -- ^ @parameter - -- ^ @parameter - -- ^ @parameter + -- ^ @variable.parameter + -- ^ @variable.parameter + -- ^ @variable.parameter listParam [a, b :: Int, Just c] = undefined - -- ^ @parameter - -- ^ @parameter - -- ^ @parameter + -- ^ @variable.parameter + -- ^ @variable.parameter + -- ^ @variable.parameter tupleParam (a :: Int, b, Just c) = undefined - -- ^ @parameter - -- ^ @parameter - -- ^ @parameter + -- ^ @variable.parameter + -- ^ @variable.parameter + -- ^ @variable.parameter listLambda = \[a, a :: Int, Just c] -> undefined - -- ^ @parameter - -- ^ @parameter - -- ^ @parameter + -- ^ @variable.parameter + -- ^ @variable.parameter + -- ^ @variable.parameter tupleLambda = \(a, b :: Int, Just c) -> undefined - -- ^ @parameter - -- ^ @parameter + -- ^ @variable.parameter + -- ^ @variable.parameter nestedDestructure (Left (Just a)) = undefined - -- ^ @parameter + -- ^ @variable.parameter typeApplication x y = someFun @ty x y -- ^ @variable -- ^ @variable @@ -317,9 +317,9 @@ recordUpdate x y rec = someFun rec {field = 5} (x, x) y -- ^ @variable viewPattern (func -> var) = 5 -- ^ @function.call - -- ^ @parameter + -- ^ @variable.parameter g (func :: a -> b) x = func y - -- ^ @parameter + -- ^ @variable.parameter -- ^ @function lambdaAlias :: LambdaAlias lambdaAlias _ _ _ = undefined diff --git a/tests/query/highlights/hocon/test.conf b/tests/query/highlights/hocon/test.conf index acfe4f975..55f4c03e7 100644 --- a/tests/query/highlights/hocon/test.conf +++ b/tests/query/highlights/hocon/test.conf @@ -1,5 +1,5 @@ HOCON = Human-Optimized Config Object Notation -// ^ @field +// ^ @variable.member // ^ @string // ^ @string // ^ @string @@ -31,7 +31,7 @@ specs url: "https://github.com/lightbend/config/blob/master/HOCON.md" includes: { include required(file("~/prog/tree-sitter-hocon/grammar.js")) // ^ @keyword -//^ @include +//^ @keyword.import // ^ @punctuation.bracket // ^ @punctuation.bracket override = true diff --git a/tests/query/highlights/markdown/test.md b/tests/query/highlights/markdown/test.md index 20953a863..87b28520e 100644 --- a/tests/query/highlights/markdown/test.md +++ b/tests/query/highlights/markdown/test.md @@ -1,28 +1,28 @@ # H1 - + ## H2 - + - Item 1 - Item 2 - + 1. Item 1 2. Item 2 - + ----![image_description](https://example.com/image.jpg "awesome image title") - - - - - - + + + + + + [link_text](#local_reference "link go brr...") - - - - - + + + + + diff --git a/tests/query/highlights/nix/test.nix b/tests/query/highlights/nix/test.nix index d5fb13de8..8ab067a2e 100644 --- a/tests/query/highlights/nix/test.nix +++ b/tests/query/highlights/nix/test.nix @@ -1,16 +1,16 @@ { func1 = param: builtins.readFile param; # ^ @function - # ^ @parameter + # ^ @variable.parameter # ^ @constant.builtin # ^ @function.builtin func2 = { p1, p2 }: p2; # ^ @function - # ^ @parameter + # ^ @variable.parameter readFile' = readFile; # ^ @function.builtin x = func1 ./path/to/file.nix; -# ^ @field +# ^ @variable.member # ^ @function.call - # ^ @string.special + # ^ @string.special.path } diff --git a/tests/query/highlights/python/fields.py b/tests/query/highlights/python/fields.py index fb36a6311..deb280622 100644 --- a/tests/query/highlights/python/fields.py +++ b/tests/query/highlights/python/fields.py @@ -3,10 +3,10 @@ class Fields: # ^^^ @type.builtin # ^^^^ @constant.builtin self.fields = fields -# ^^^^^^ @field +# ^^^^^^ @variable.member self.__dunderfield__ = None -# ^^^^^^^^^^^^^^^ @field +# ^^^^^^^^^^^^^^^ @variable.member self._FunKyFielD = 0 -# ^^^^^^^^^^^ @field +# ^^^^^^^^^^^ @variable.member self.NOT_A_FIELD = "IM NOT A FIELD" # ^^^^^^^^^^^ @constant diff --git a/tests/query/highlights/python/future_import.py b/tests/query/highlights/python/future_import.py index 7495588a9..6790b9b6b 100644 --- a/tests/query/highlights/python/future_import.py +++ b/tests/query/highlights/python/future_import.py @@ -1,4 +1,4 @@ from __future__ import print_function -# ^ @include +# ^ @keyword.import # ^ @constant.builtin -# ^ @include +# ^ @keyword.import diff --git a/tests/query/highlights/python/pattern_matching.py b/tests/query/highlights/python/pattern_matching.py index cd359a48f..2762781b0 100644 --- a/tests/query/highlights/python/pattern_matching.py +++ b/tests/query/highlights/python/pattern_matching.py @@ -1,29 +1,29 @@ match command.split(): -# ^ @conditional +# ^ @keyword.conditional case ["quit"]: - # ^ @conditional + # ^ @keyword.conditional print("Goodbye!") quit_game() case ["look"]: - # ^ @conditional + # ^ @keyword.conditional current_room.describe() case ["get", obj]: - # ^ @conditional + # ^ @keyword.conditional character.get(obj, current_room) case ["go", direction]: - # ^ @conditional + # ^ @keyword.conditional current_room = current_room.neighbor(direction) # The rest of your commands go here match command.split(): -# ^ @conditional +# ^ @keyword.conditional case ["drop", *objects]: - # ^ @conditional + # ^ @keyword.conditional for obj in objects: character.drop(obj, current_room) match command.split(): -# ^ @conditional +# ^ @keyword.conditional case ["quit"]: ... # Code omitted for brevity case ["go", direction]: pass case ["drop", *objects]: pass @@ -32,12 +32,12 @@ match command.split(): # ^^ @@function.macro match command.split(): -# ^ @conditional +# ^ @keyword.conditional case ["north"] | ["go", "north"]: - # ^ @conditional + # ^ @keyword.conditional current_room = current_room.neighbor("north") case ["get", obj] | ["pick", "up", obj] | ["pick", obj, "up"]: - # ^ @conditional + # ^ @keyword.conditional pass match = 2 diff --git a/tests/query/highlights/python/raise_from.py b/tests/query/highlights/python/raise_from.py index 8a48a222b..fb30f4252 100644 --- a/tests/query/highlights/python/raise_from.py +++ b/tests/query/highlights/python/raise_from.py @@ -2,5 +2,5 @@ try: print(1 / 0) except Exception: raise RuntimeError from None - # ^ @exception - # ^ @exception + # ^ @keyword.exception + # ^ @keyword.exception diff --git a/tests/query/highlights/python/yield_from.py b/tests/query/highlights/python/yield_from.py index 2f3238379..6ada002c6 100644 --- a/tests/query/highlights/python/yield_from.py +++ b/tests/query/highlights/python/yield_from.py @@ -1,6 +1,6 @@ from foo import bar -# ^ @include -# ^ @include +# ^ @keyword.import +# ^ @keyword.import def generator(): yield from bar(42) # ^ @keyword.return diff --git a/tests/query/highlights/r/test.r b/tests/query/highlights/r/test.r index b6bfd1ff5..c67df6096 100644 --- a/tests/query/highlights/r/test.r +++ b/tests/query/highlights/r/test.r @@ -1,7 +1,7 @@ init <- 1 # ^ @variable # ^ @operator -# ^ @float +# ^ @number.float r"{(\1\2)}" -> `%r%` # ^ @string @@ -21,27 +21,27 @@ b <- list(TRUE, FALSE, NA, Inf) # ^ @constant.builtin b <- list(name = "r", version = R.version$major) -# ^ @parameter +# ^ @variable.parameter # ^ @string # ^ @operator -# ^ @field +# ^ @variable.member Lang$new(name = "r")$print() -# ^ @method.call +# ^ @function.method.call for(i in 1:10) { -# <- @repeat -# ^ @repeat +# <- @keyword.repeat +# ^ @keyword.repeat } add <- function(a, b = 1, ...) { # ^ @keyword.function -# ^ @parameter -# ^ @parameter +# ^ @variable.parameter +# ^ @variable.parameter # ^ @keyword return(a + b) } base::letters -# ^ @namespace +# ^ @module # ^ @variable diff --git a/tests/query/highlights/rust/for.rs b/tests/query/highlights/rust/for.rs index 27f072847..e8c085fa3 100644 --- a/tests/query/highlights/rust/for.rs +++ b/tests/query/highlights/rust/for.rs @@ -9,7 +9,7 @@ impl Drop for Foo { fn main() { for i in 0..128 { - // <- @repeat + // <- @keyword.repeat println!("{i}"); } } diff --git a/tests/query/highlights/rust/super-crate-imports.rs b/tests/query/highlights/rust/super-crate-imports.rs index 59354a32c..93263098e 100644 --- a/tests/query/highlights/rust/super-crate-imports.rs +++ b/tests/query/highlights/rust/super-crate-imports.rs @@ -1,12 +1,12 @@ use crate::a; -// ^ @namespace +// ^ @module // ^ !keyword use crate::{b, c}; -// ^ @namespace +// ^ @module // ^ !keyword use super::a; -// ^ @namespace +// ^ @module // ^ !keyword use super::{b, c}; -// ^ @namespace +// ^ @module // ^ !keyword diff --git a/tests/query/highlights/smali/baksmali_test_class.smali b/tests/query/highlights/smali/baksmali_test_class.smali index 77eb0c83b..6412f8784 100644 --- a/tests/query/highlights/smali/baksmali_test_class.smali +++ b/tests/query/highlights/smali/baksmali_test_class.smali @@ -7,18 +7,18 @@ # ^ @punctuation.delimiter .source "baksmali_test_class.smali" -# <- @include +# <- @keyword.import .implements Lsome/interface; .implements Lsome/other/interface; .annotation build Lsome/annotation; -# ^^^^^ @storageclass +# ^^^^^ @keyword.storage # ^^^^ @type # ^ @punctuation.delimiter value1 = "test" -# ^^^^^^ @field +# ^^^^^^ @variable.member # ^ @operator # ^^^^^^ @string value2 = .subannotation Lsome/annotation; @@ -50,7 +50,7 @@ .field public static byteNegStaticField:B = 0xAAt .field public static floatStaticField:F = 3.1415926f -# ^^^^^^^^^^ @float +# ^^^^^^^^^^ @number.float .field public static doubleStaticField:D = 3.141592653589793 @@ -73,7 +73,7 @@ .field public static methodStaticField:Ljava/lang/reflect/Method; = Lbaksmali/test/class;->testMethod(ILjava/lang/String;)Ljava/lang/String; # ^^ @punctuation.delimiter -# ^^^^^^^^^^ @method.call +# ^^^^^^^^^^ @function.method.call .field public static arrayStaticField:[I = {1, 2, 3, {1, 2, 3, 4}} # ^ @punctuation.special @@ -81,7 +81,7 @@ # ^ @punctuation.delimiter .field public static enumStaticField:Lsome/enum; = .enum Lsome/enum;->someEnumValue:Lsome/enum; -# ^^^^^^^^^^^^^ @field +# ^^^^^^^^^^^^^ @variable.member .field public static annotationStaticField:Lsome/annotation; = .subannotation Lsome/annotation; value1 = "test" @@ -93,7 +93,7 @@ .field public static staticFieldWithAnnotation:I .annotation runtime La/field/annotation; -# ^^^^^^^ @storageclass +# ^^^^^^^ @keyword.storage this = "is" a = "test" .end annotation @@ -112,13 +112,13 @@ .registers 1 invoke-direct {p0}, Ljava/lang/Object;->()V # ^^^^^^^^^^^^^ @keyword.operator -# ^^ @parameter.builtin +# ^^ @variable.parameter.builtin return-void # ^^^^^^^^^^^ @keyword.return .end method .method public testMethod(ILjava/lang/String;)Ljava/lang/String; -# ^^^^^^^^^^ @method +# ^^^^^^^^^^ @function.method .registers 3 .annotation runtime Lorg/junit/Test; .end annotation @@ -144,9 +144,9 @@ nop try_end: .catch Ljava/lang/Exception; {try_start: .. try_end:} handler: -# ^^^^^^ @exception +# ^^^^^^ @keyword.exception .catchall {try_start: .. try_end:} handler2: -# ^^^^^^^^^ @exception +# ^^^^^^^^^ @keyword.exception # ^^ @operator handler: @@ -232,9 +232,9 @@ nop .source "somefile.java" -# ^^^^^^^ @include +# ^^^^^^^ @keyword.import .line 101 -# ^^^ @text.literal +# ^^^ @string.special nop diff --git a/tests/query/highlights/solidity/test.sol b/tests/query/highlights/solidity/test.sol index 99117bb55..b53dd857d 100644 --- a/tests/query/highlights/solidity/test.sol +++ b/tests/query/highlights/solidity/test.sol @@ -3,11 +3,11 @@ // SPDX-License-Identifier: GPL-3.0 // ^ @comment pragma solidity >=0.7.0 <0.9.0; -// ^ @preproc -// ^ @preproc +// ^ @keyword.directive +// ^ @keyword.directive import * as something from "anotherFile"; -// ^ ^ ^ @include +// ^ ^ ^ @keyword.import /// @title Voting with delegation. // <- @comment @@ -21,7 +21,7 @@ contract Ballot { // ^ @type uint weight; // weight is accumulated by delegation // ^ @type.builtin -// ^ @field +// ^ @variable.member bool voted; // if true, that person already voted address delegate; // person delegated to uint vote; // index of the voted proposal @@ -63,7 +63,7 @@ contract Ballot { // appends it to the end of `proposals`. proposals.push(Proposal({ name: proposalNames[i], -// ^ @field +// ^ @variable.member voteCount: 0 })); } @@ -74,7 +74,7 @@ contract Ballot { function giveRightToVote(address voter) external { // ^ @keyword.function // ^ @function -// ^ @parameter +// ^ @variable.parameter // If the first argument of `require` evaluates // to `false`, execution terminates and all // changes to the state and to Ether balances diff --git a/tests/query/highlights/t32/keywords.cmm b/tests/query/highlights/t32/keywords.cmm index a4013d72f..f04df3ed1 100644 --- a/tests/query/highlights/t32/keywords.cmm +++ b/tests/query/highlights/t32/keywords.cmm @@ -3,15 +3,15 @@ PRIVATE &password ; ^ @variable.builtin ENTRY &password ; <- @keyword -; ^ @parameter +; ^ @variable.parameter ENTRY %LINE &salt ; <- @keyword ; ^ @constant.builtin -; ^ @parameter +; ^ @variable.parameter IF "&password"=="" -; <- @conditional +; <- @keyword.conditional ; ^ @string ; ^ @variable.builtin ; ^ @operator @@ -21,7 +21,7 @@ IF "&password"=="" ; ^ @keyword.return ) ELSE -; <- @conditional +; <- @keyword.conditional ( PRIVATE &pass @@ -33,9 +33,9 @@ ELSE GOSUB verify_password "&password" ; ^ @function.call RETURNVALUES &pass -; ^ @parameter +; ^ @variable.parameter WAIT 10.ms -; ^ @float +; ^ @number.float ) IF !&pass @@ -63,7 +63,7 @@ FramePOS ,,,,Maximized ; ^ @punctuation.delimiter ; ^ @constant.builtin WinPOS 0% 50% 100% 35% -; ^ @float +; ^ @number.float COVerage.ListFunc ENDDO @@ -80,11 +80,11 @@ verify_password: ; <- @function ( PARAMETERS &password -; ^ @parameter +; ^ @variable.parameter SYStem.Option.KEYCODE "&password" SYStem.JtagClock 1kHz -; ^ @float +; ^ @number.float SYStem.Mode.Attach Data.Set N: EAXI:0x34000000 %Long 0x34000100 0x34000021 /verify @@ -107,7 +107,7 @@ SUBROUTINE start_debug COVerage.ListModule %MULTI.OBC \sieve ; ^ @keyword ; ^ @constant.builtin -; ^ @symbol +; ^ @string.special.symbol Var.DRAW flags[0..16] /Alternate 3 ; ^ @keyword diff --git a/tests/query/highlights/t32/literals.cmm b/tests/query/highlights/t32/literals.cmm index 8c63ce96d..a9d72e441 100644 --- a/tests/query/highlights/t32/literals.cmm +++ b/tests/query/highlights/t32/literals.cmm @@ -8,19 +8,19 @@ sYmbol.NEW _InitialSP 0x34000100 ; ^ @number DO ~~~~/test.cmm -; ^ @string.special +; ^ @string.special.path WAIT 1.ns -; ^ @float +; ^ @number.float SYStem.JtagClock 100.GHZ -; ^ @float +; ^ @number.float DATA.SET P:&HEAD+0x4 %LONG DATA.LONG(EA:&HEAD+0x4)&0xFFFFFF ; ^ @constant.builtin List `main` -; ^ @symbol +; ^ @string.special.symbol &range = 'a'--'z'||'0'--'9' ; ^ @character @@ -34,6 +34,6 @@ Data.Set N: 0xffff800000 0y0011xx01xx&&a ; ^ @operator WinPOS 0% 85% 100% 15% -; ^ @float +; ^ @number.float // vim: set ft=t32: diff --git a/tests/query/highlights/t32/var.cmm b/tests/query/highlights/t32/var.cmm index de67278a0..8e251afef 100644 --- a/tests/query/highlights/t32/var.cmm +++ b/tests/query/highlights/t32/var.cmm @@ -34,7 +34,7 @@ Var.Assign (*ap)[2..4] = &a Var.Assign sp = &s.n+offset ; ^ @variable ; ^ @variable -; ^ @field +; ^ @variable.member ; ^ @variable Var.Assign padd = (CAddition const * volatile)&d ; ^ @variable diff --git a/tests/query/highlights/tiger/functions.tig b/tests/query/highlights/tiger/functions.tig index 6505d20fe..706f1991a 100644 --- a/tests/query/highlights/tiger/functions.tig +++ b/tests/query/highlights/tiger/functions.tig @@ -1,9 +1,9 @@ primitive print(s: string) /* ^ @function */ -/* ^ @parameter */ +/* ^ @variable.parameter */ function func(a: int) : int = (print("Hello World!"); a) /* ^ @function */ -/* ^ @parameter */ +/* ^ @variable.parameter */ /* ^ @function.builtin */ /* vim: set ft=tiger: */ diff --git a/tests/query/highlights/tiger/identifiers.tig b/tests/query/highlights/tiger/identifiers.tig index e712e57de..e38749071 100644 --- a/tests/query/highlights/tiger/identifiers.tig +++ b/tests/query/highlights/tiger/identifiers.tig @@ -22,9 +22,9 @@ var array := int_array[12] of 27; /* ^ @type */ primitive func(a: int, b: string) : array -/* ^ @parameter */ +/* ^ @variable.parameter */ /* ^ @type.builtin */ -/* ^ @parameter */ +/* ^ @variable.parameter */ /* ^ @type.builtin */ /* ^ @type */ /* vim: set ft=tiger: */ diff --git a/tests/query/highlights/tiger/imports.tig b/tests/query/highlights/tiger/imports.tig index f20a0bc1a..1c7ce308d 100644 --- a/tests/query/highlights/tiger/imports.tig +++ b/tests/query/highlights/tiger/imports.tig @@ -1,4 +1,4 @@ import "lib.tih" -/* <- @include */ -/* ^ @string.special */ +/* <- @keyword.import */ +/* ^ @string.special.path */ /* vim: set ft=tiger: */ diff --git a/tests/query/highlights/tiger/keywords.tig b/tests/query/highlights/tiger/keywords.tig index 7deb0288d..c92cd929a 100644 --- a/tests/query/highlights/tiger/keywords.tig +++ b/tests/query/highlights/tiger/keywords.tig @@ -10,7 +10,7 @@ let /* <- @keyword.function */ import "lib.tih" - /* <- @include */ + /* <- @keyword.import */ type array_of_int = array of int /* <- @keyword */ @@ -28,13 +28,13 @@ in /* ^ @keyword */ for i := 12 to 27 do 42; - /* <- @repeat */ - /* ^ @repeat */ - /* ^ @repeat */ + /* <- @keyword.repeat */ + /* ^ @keyword.repeat */ + /* ^ @keyword.repeat */ while 12 do break - /* <- @repeat */ - /* ^ @repeat */ + /* <- @keyword.repeat */ + /* ^ @keyword.repeat */ /* ^ @keyword */ end diff --git a/tests/query/highlights/tiger/object-oriented.tig b/tests/query/highlights/tiger/object-oriented.tig index 607efec8c..bf1632485 100644 --- a/tests/query/highlights/tiger/object-oriented.tig +++ b/tests/query/highlights/tiger/object-oriented.tig @@ -13,7 +13,7 @@ let method meth() : int = self.a /* <- @keyword.function */ - /* ^ @method */ + /* ^ @function.method */ /* ^ @variable.builtin */ } @@ -24,6 +24,6 @@ in /* ^ @property */ object.meth() - /* ^ @method */ + /* ^ @function.method */ end /* vim: set ft=tiger: */ diff --git a/tests/query/highlights/typescript/as.ts b/tests/query/highlights/typescript/as.ts index 71221f410..30be1ffae 100644 --- a/tests/query/highlights/typescript/as.ts +++ b/tests/query/highlights/typescript/as.ts @@ -1,8 +1,8 @@ import * as foo from 'foo'; -// ^ @include +// ^ @keyword.import export { foo as bar }; -// ^ @include +// ^ @keyword.import const n = 5 as number; // ^ @keyword.operator diff --git a/tests/query/highlights/usd/prims.usda b/tests/query/highlights/usd/prims.usda index eeeeae920..da9a5d6fe 100644 --- a/tests/query/highlights/usd/prims.usda +++ b/tests/query/highlights/usd/prims.usda @@ -4,8 +4,8 @@ def Xform "cube" ( asset[] payloadAssetDependencies = [@fizz.usd@, @buzz.usd@] # <- @type # ^ @keyword - # ^ @text.uri - # ^ @text.uri + # ^ @string.special.url + # ^ @string.special.url } ) { @@ -13,13 +13,13 @@ def Xform "cube" ( def "root" ( add references = @foo.usda@ (offset = 1; scale = 2.0) - # <- @text.uri + # <- @string.special.url # ^ @string.special # ^ @keyword # ^ @number # ^ @punctuation.delimiter # ^ @keyword - # ^ @float + # ^ @number.float ) { } @@ -93,7 +93,7 @@ over "Parent" ( # <- @function.call # ^ @keyword # ^ @string.special - # ^ @text.uri + # ^ @string.special.url # ^ @string.special ) { @@ -107,12 +107,12 @@ def "foo" # ^ @property -414: 14.4 # <- @number - # ^ @float + # ^ @number.float 10: 201.0, # <- @number - # ^ @float + # ^ @number.float 10.123: 201.0123, - # <- @float - # ^ @float + # <- @number.float + # ^ @number.float } } diff --git a/tests/query/highlights/usd/properties.usda b/tests/query/highlights/usd/properties.usda index e518c73f7..790ccfab7 100644 --- a/tests/query/highlights/usd/properties.usda +++ b/tests/query/highlights/usd/properties.usda @@ -11,11 +11,11 @@ token[] purpose = ["default", "render"] rel material:binding:collection:Erasers = None # <- @type -# ^ @namespace +# ^ @module # ^ @punctuation.delimiter -# ^ @namespace +# ^ @module # ^ @punctuation.delimiter -# ^ @namespace +# ^ @module # ^ @punctuation.delimiter # ^ @variable # ^ @constant.builtin diff --git a/tests/query/highlights/usd/subLayers.usda b/tests/query/highlights/usd/subLayers.usda index 24581b90a..ddd1dd7af 100644 --- a/tests/query/highlights/usd/subLayers.usda +++ b/tests/query/highlights/usd/subLayers.usda @@ -3,7 +3,7 @@ subLayers = [ # <- @keyword @./model_sub.usda@ (offset = 1) - # <- @text.uri + # <- @string.special.url # ^ @keyword ] ) diff --git a/tests/query/highlights/wing/class.w b/tests/query/highlights/wing/class.w index b102db891..c210fc611 100644 --- a/tests/query/highlights/wing/class.w +++ b/tests/query/highlights/wing/class.w @@ -6,7 +6,7 @@ class Foo { // ^ @variable // ^ @punctuation.bracket name: str; -//^ @field +//^ @variable.member // ^ @type.builtin // ^ @punctuation.delimiter new(name: str) { diff --git a/tests/query/highlights/wing/nested_method.w b/tests/query/highlights/wing/nested_method.w index 8a454b34c..4fe5ceb6a 100644 --- a/tests/query/highlights/wing/nested_method.w +++ b/tests/query/highlights/wing/nested_method.w @@ -1,4 +1,4 @@ test1.test2.test3(); // <- @variable // ^ @property -// ^ @method.call +// ^ @function.method.call diff --git a/tests/query/highlights/xhp-intro.hack b/tests/query/highlights/xhp-intro.hack index ccbe60c57..06f7e30a2 100644 --- a/tests/query/highlights/xhp-intro.hack +++ b/tests/query/highlights/xhp-intro.hack @@ -38,7 +38,7 @@ final xhp class a_post extends x\element { 'document.getElementById("'.$id.'").submit(); return false;', ); $anchor->setAttribute('href', '#'); - // ^ @method.call + // ^ @function.method.call return $form; } From fc0fceb43a8a6dee9ffa669de8b641493e64c276 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Thu, 4 Jan 2024 19:18:49 +0100 Subject: [PATCH 0784/2494] test(queries): print ALL errors at end --- scripts/check-queries.lua | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/scripts/check-queries.lua b/scripts/check-queries.lua index a84df85c4..959969645 100755 --- a/scripts/check-queries.lua +++ b/scripts/check-queries.lua @@ -51,7 +51,7 @@ local function do_check() local query_types = queries.built_in_query_groups local captures = extract_captures() - local last_error + local errors = {} io_print "::group::Check parsers" @@ -66,8 +66,7 @@ local function do_check() io_print("Checking " .. lang .. " " .. query_type .. string.format(" (%.02fms)", duration * 1e-6)) if not ok then local err_msg = lang .. " (" .. query_type .. "): " .. query - io_print(err_msg) - last_error = err_msg + errors[#errors + 1] = err_msg else if query then for _, capture in ipairs(query.captures) do @@ -79,8 +78,7 @@ local function do_check() ) if not is_valid then local error = string.format("(x) Invalid capture @%s in %s for %s.", capture, query_type, lang) - io_print(error) - last_error = error + errors[#errors + 1] = error end end end @@ -90,10 +88,12 @@ local function do_check() io_print "::endgroup::" - if last_error then - io_print() - io_print "Last error: " - error(last_error) + if #errors > 0 then + io_print "\nCheck failed!\nErrors:" + for _, err in ipairs(errors) do + print(err) + end + error() end return timings end @@ -129,8 +129,5 @@ if ok then io_print "Check successful!" vim.cmd "q" else - io_print "Check failed:" - io_print(result) - io_print "\n" vim.cmd "cq" end From 15de22a2e19fb5c79bbcff0e2d12f4b1dd44e069 Mon Sep 17 00:00:00 2001 From: Pham Huy Hoang Date: Fri, 5 Jan 2024 02:21:00 +0900 Subject: [PATCH 0785/2494] feat: query formatting script Usage: - nvim -l scripts/format-queries.lua /path/to/file.scm - nvim -l scripts/format-queries.lua /path/to/dir fixup: add `format-ignore` directive to query/highlights.scm --- queries/query/highlights.scm | 3 + scripts/format-queries.lua | 396 +++++++++++++++++++++++++++++++++++ 2 files changed, 399 insertions(+) create mode 100755 scripts/format-queries.lua diff --git a/queries/query/highlights.scm b/queries/query/highlights.scm index 030e3d44f..8601b1365 100644 --- a/queries/query/highlights.scm +++ b/queries/query/highlights.scm @@ -33,6 +33,9 @@ ((program . (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)) diff --git a/scripts/format-queries.lua b/scripts/format-queries.lua new file mode 100755 index 000000000..88933c630 --- /dev/null +++ b/scripts/format-queries.lua @@ -0,0 +1,396 @@ +#!/usr/bin/env -S nvim -l + +local ts = vim.treesitter +local get_node_text = ts.get_node_text + +---@type string[] +local files + +if not _G.arg[1] then + error "Must specify specify file or directory to format!" +elseif _G.arg[1]:match ".*%.scm$" then + files = { _G.arg[1] } +else + files = vim.fn.split(vim.fn.glob(_G.arg[1] .. "/**/*.scm")) +end + +ts.query.add_predicate("has-type?", function(match, _, _, pred) + local node = match[pred[2]] + if not node then + return true + end + + local types = { unpack(pred, 3) } + return vim.tbl_contains(types, node:type()) +end, true) + +ts.query.add_predicate("is-start-of-line?", function(match, _, _, pred) + local node = match[pred[2]] + if not node then + return true + end + local start_row, start_col = node:start() + return vim.fn.indent(start_row + 1) == start_col +end) + +--- Control the indent here. Change to \t if uses tab instead +local indent_str = " " + +-- Query to control the formatter +local format_queries = [[ +;;query +;; Ignore next node with `; format-ignore` +( + (comment) @_pattern + . + (_) @format.ignore + (#lua-match? @_pattern "^;+%s*format%-ignore")) + +;; {{{ +;; Add newlines to top level nodes +;; {{{ +;; Preserve inline comments +(program + . (_) + (_) @_comment + . + (comment) @format.prepend-newline + (#not-has-type? @_comment comment) + (#is-start-of-line? @format.prepend-newline)) +(program + . (_) + (comment) @_comment + . + (comment) @format.prepend-newline + (#not-is-start-of-line? @_comment) + (#is-start-of-line? @format.prepend-newline)) +;; }}} +;; Making sure all top-level patterns are separated +(program + (_) @format.append-newline) +(program + (_) @format.cancel-append .) +(program + . (_) + [ + (list) + (grouping) + (named_node) + (anonymous_node) + ] @format.prepend-newline) +(program + (comment) @_comment + . + [ + (list) + (grouping) + (named_node) + (anonymous_node) + ] @format.cancel-prepend + (#is-start-of-line? @_comment)) +;; }}} + +;; delims +[ + ":" + "." +] @format.append-space +( + "." @format.prepend-space @format.cancel-append + . + ")") + +;; List handler +;; Only starts indent if 2 or more elements +(list + "[" @format.indent.begin + . + (_) + . + (_) + "]" @format.indent.dedent) +;; Otherwise, remove brackets +(list + "[" @format.remove + . + (_) @format.cancel-append + . + "]" @format.remove) +;; [ ... ] @capture1 @capture2 +(list + (capture) @format.prepend-space) +;; Append newlines for nodes inside the list +(list + (_) @format.append-newline + (#not-has-type? @format.append-newline capture)) + +;; (_), "_" and _ handler +;; Start indents if it's one of these patterns +(named_node + [ + "_" + name: (identifier) + ] @format.indent.begin + . + [ + (list) ; (foo [...]) + (grouping) ; (foo ((foo))) + (negated_field) ; (foo !field) + (field_definition) ; (foo field: (...)) + (named_node) ; (foo (bar)) + (predicate) ; (named_node (#set!)) + (anonymous_node) + "." + ]) +;; Honoring comment's position within a node +(named_node + [ + "_" + name: (identifier) + ] @format.indent.begin + . + (comment) @_comment + (#is-start-of-line? @_comment)) +(named_node + [ + "_" + name: (identifier) + ] @format.indent.begin @format.cancel-append + . + "."? @format.prepend-newline + . + (comment) @format.prepend-space + (#not-is-start-of-line? @format.prepend-space)) + +;; Add newlines for other nodes, in case the top node is indented +(named_node + [ + (list) + (grouping) + (negated_field) + (field_definition) + (named_node) + (predicate) + (anonymous_node) + "." + ] @format.append-newline) +(named_node + (list + "[" . (_) @format.append-newline . "]")) + +;; Collapse closing parentheses +(named_node + [ + "_" + name: (identifier) + ] + (_) @format.cancel-append + . + ")" + (#not-has-type? @format.cancel-append comment)) + +;; All captures should be separated with a space +(named_node + (capture) @format.prepend-space) +(anonymous_node + (capture) @format.prepend-space) + +;; Workaround to just use the string's content +(anonymous_node (identifier) @format.keep) +(field_definition + name: (_) + ":" @format.indent.begin @format.append-newline ; surpress trailing whitespaces with forced newlines + [ + (named_node [ (named_node) (list) (grouping) (anonymous_node) (field_definition) ]) + (list "[" . (_) . (_) "]") + (grouping) + ]) + +; ( (_) ) handler +(grouping + "(" + . + [ + (named_node) ; ((foo)) + (list) ; ([foo] (...)) + (anonymous_node) ; ("foo") + (grouping . (anonymous_node)) ; (("foo")) + ] @format.indent.begin + . + (_)) +(grouping + "(" + . + (grouping) @format.indent.begin + (predicate)) +(grouping + "(" + [ + (anonymous_node) + (named_node) + (list) + (predicate) + "." + ] @format.append-newline + (_) .) +;; Collapsing closing parens +(grouping + (_) @format.cancel-append . ")" + (#not-has-type? @format.cancel-append comment)) +(grouping + (capture) @format.prepend-space) + +(predicate + (parameters + (_) @format.prepend-space)) +;; Workaround to keep the string's content +(string) @format.keep + +;; Comment related handlers +(comment) @format.append-newline +;; comment styling. Feel free to change in the future +((comment) @format.replace + (#gsub! @format.replace "^;+(%s*.-)%s*$" ";%1")) +;; Preserve end of line comments +( + [ + "." + ":" + (list) + (grouping) + (named_node) + (anonymous_node) + (negated_field) + ] @format.cancel-append + . + (quantifier)? + . + "."? @format.prepend-newline ; Make sure anchor are not eol but start of newline + . + (comment) @format.prepend-space + (#not-is-start-of-line? @format.prepend-space)) +]] + +---@param lines string[] +---@param lines_to_append string[] +local function append_lines(lines, lines_to_append) + for i = 1, #lines_to_append, 1 do + lines[#lines] = lines[#lines] .. lines_to_append[i] + if i ~= #lines_to_append then + lines[#lines + 1] = "" + end + end +end + +---@param bufnr integer +---@param node TSNode +---@param lines string[] +---@param q table +---@param level integer +local function iter(bufnr, node, lines, q, level) + --- Sometimes 2 queries apply append twice. This is to prevent the case from happening + local apply_newline = false + for child, _ in node:iter_children() do + local id = child:id() + repeat + if apply_newline then + apply_newline = false + lines[#lines + 1] = string.rep(indent_str, level) + end + if q["format.ignore"][id] then + local text = vim.split(get_node_text(child, bufnr):gsub("\r\n?", "\n"), "\n", { trimempty = true }) + append_lines(lines, text) + break + elseif q["format.remove"][id] then + break + end + if not q["format.cancel-prepend"][id] then + if q["format.prepend-newline"][id] then + lines[#lines + 1] = string.rep(indent_str, level) + elseif q["format.prepend-space"][id] then + lines[#lines] = lines[#lines] .. " " + end + end + if q["format.replace"][id] then + append_lines(lines, vim.split(q["format.replace"][id].text, "\n", { trimempty = true })) + elseif child:named_child_count() == 0 or q["format.keep"][id] then + append_lines( + lines, + vim.split(string.gsub(get_node_text(child, bufnr), "\r\n?", "\n"), "\n+", { trimempty = true }) + ) + else + iter(bufnr, child, lines, q, level) + end + if q["format.indent.begin"][id] then + level = level + 1 + apply_newline = true + break + end + if q["format.indent.dedent"][id] then + if string.match(lines[#lines], "^%s*" .. get_node_text(child, bufnr)) then + lines[#lines] = string.sub(lines[#lines], 1 + #string.rep(indent_str, 1)) + end + end + if q["format.indent.end"][id] then + level = math.max(level - 1, 0) + if string.match(lines[#lines], "^%s*" .. get_node_text(child, bufnr)) then + lines[#lines] = string.sub(lines[#lines], 1 + #string.rep(indent_str, 1)) + end + break + end + until true + repeat + if q["format.cancel-append"][id] then + apply_newline = false + end + if not q["format.cancel-append"][id] then + if q["format.append-newline"][id] then + apply_newline = true + elseif q["format.append-space"][id] then + lines[#lines] = lines[#lines] .. " " + end + end + until true + end +end + +---@param bufnr integer +---@param queries string +local function format(bufnr, queries) + local lines = { "" } + -- stylua: ignore + local map = { + ['format.ignore'] = {}, -- Ignore the node and its children + ['format.indent.begin'] = {}, -- +1 shiftwidth for all nodes after this + ['format.indent.end'] = {}, -- -1 shiftwidth for all nodes after this + ['format.indent.dedent'] = {}, -- -1 shiftwidth for this line only + ['format.prepend-space'] = {}, -- Prepend a space before inserting the node + ['format.prepend-newline'] = {}, -- Prepend a \n before inserting the node + ['format.append-space'] = {}, -- Append a space after inserting the node + ['format.append-newline'] = {}, -- Append a newline after inserting the node + ['format.cancel-append'] = {}, -- Cancel any `@format.append-*` applied to the node + ['format.cancel-prepend'] = {}, -- Cancel any `@format.prepend-*` applied to the node + ['format.keep'] = {}, -- String content is not exposed as a syntax node. This is a workaround for it + ['format.replace'] = {}, -- Dedicated capture used to store results of `(#gsub!)` + ['format.remove'] = {}, -- Do not add the syntax node to the result, i.e. brackets [], parens () + } + local root = ts.get_parser(bufnr, "query"):parse(true)[1]:root() + local query = ts.query.parse("query", queries) + for id, node, metadata in query:iter_captures(root, bufnr) do + if query.captures[id]:sub(1, 1) ~= "_" then + map[query.captures[id]][node:id()] = metadata and (metadata[id] and metadata[id] or metadata) or {} + end + end + + iter(bufnr, root, lines, map, 0) + vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, lines) +end + +for _, file in ipairs(files) do + local buf = vim.fn.bufadd(file) + vim.fn.bufload(file) + vim.api.nvim_set_current_buf(buf) + format(buf, format_queries) +end + +vim.cmd "silent wa!" From edee83272efe9b597bc27e8060539cdffa3b12a8 Mon Sep 17 00:00:00 2001 From: Pham Huy Hoang Date: Fri, 5 Jan 2024 03:19:54 +0900 Subject: [PATCH 0786/2494] refactor: manual pre-cleanup Moving comments, adding `format-ignore` to lines that will be better with it --- queries/apex/highlights.scm | 2 +- queries/apex/locals.scm | 2 +- queries/arduino/highlights.scm | 138 ++++----- queries/bash/highlights.scm | 3 +- queries/bitbake/highlights.scm | 47 ++- queries/c/highlights.scm | 8 +- queries/c/injections.scm | 88 +++--- queries/clojure/highlights.scm | 295 +++++++++--------- queries/cmake/highlights.scm | 32 +- queries/commonlisp/highlights.scm | 10 +- queries/elixir/locals.scm | 241 ++++++++------- queries/gdscript/highlights.scm | 249 +++++++-------- queries/go/locals.scm | 4 +- queries/hcl/highlights.scm | 2 +- queries/ispc/highlights.scm | 256 +++++++-------- queries/janet_simple/highlights.scm | 463 ++++++++++++++-------------- queries/java/indents.scm | 1 + queries/java/locals.scm | 1 + queries/jq/highlights.scm | 383 +++++++++++------------ queries/julia/highlights.scm | 421 ++++++++++++------------- queries/julia/locals.scm | 3 +- queries/lua/highlights.scm | 3 +- queries/lua/injections.scm | 7 +- queries/luau/highlights.scm | 3 +- queries/mlir/highlights.scm | 1 + queries/nix/highlights.scm | 22 +- queries/ocaml/indents.scm | 1 + queries/pug/highlights.scm | 25 +- queries/python/highlights.scm | 47 ++- queries/rst/highlights.scm | 64 ++-- queries/scheme/highlights.scm | 151 ++++----- queries/squirrel/highlights.scm | 1 + queries/starlark/highlights.scm | 62 ++-- queries/swift/highlights.scm | 2 +- queries/swift/indents.scm | 1 + queries/usd/highlights.scm | 211 +++++++------ queries/usd/indents.scm | 1 + 37 files changed, 1656 insertions(+), 1595 deletions(-) diff --git a/queries/apex/highlights.scm b/queries/apex/highlights.scm index 729a84d15..692fccb1b 100644 --- a/queries/apex/highlights.scm +++ b/queries/apex/highlights.scm @@ -136,7 +136,7 @@ [ (boolean_type) (void_type) -] @type.builtin;; +] @type.builtin ; Fields diff --git a/queries/apex/locals.scm b/queries/apex/locals.scm index 6ffa8648f..5661b911d 100644 --- a/queries/apex/locals.scm +++ b/queries/apex/locals.scm @@ -22,7 +22,7 @@ ; loops (for_statement) @local.scope -(for_statement ; "for" body in case there are no braces +(for_statement ; "for" body in case there are no braces body: (_) @local.scope) (do_statement body: (_) @local.scope) diff --git a/queries/arduino/highlights.scm b/queries/arduino/highlights.scm index a4e74ae89..a2e121a06 100644 --- a/queries/arduino/highlights.scm +++ b/queries/arduino/highlights.scm @@ -1,75 +1,75 @@ ; inherits: cpp ((identifier) @function.builtin - (#any-of? @function.builtin - ; Digital I/O - "digitalRead" - "digitalWrite" - "pinMode" - ; Analog I/O - "analogRead" - "analogReference" - "analogWrite" - ; Zero, Due & MKR Family - "analogReadResolution" - "analogWriteResolution" - ; Advanced I/O - "noTone" - "pulseIn" - "pulseInLong" - "shiftIn" - "shiftOut" - "tone" - ; Time - "delay" - "delayMicroseconds" - "micros" - "millis" - ; Math - "abs" - "constrain" - "map" - "max" - "min" - "pow" - "sq" - "sqrt" - ; Trigonometry - "cos" - "sin" - "tan" - ; Characters - "isAlpha" - "isAlphaNumeric" - "isAscii" - "isControl" - "isDigit" - "isGraph" - "isHexadecimalDigit" - "isLowerCase" - "isPrintable" - "isPunct" - "isSpace" - "isUpperCase" - "isWhitespace" - ; Random Numbers - "random" - "randomSeed" - ; Bits and Bytes - "bit" - "bitClear" - "bitRead" - "bitSet" - "bitWrite" - "highByte" - "lowByte" - ; External Interrupts - "attachInterrupt" - "detachInterrupt" - ; Interrupts - "interrupts" - "noInterrupts" - )) + ; format-ignore + (#any-of? @function.builtin + ; Digital I/O + "digitalRead" + "digitalWrite" + "pinMode" + ; Analog I/O + "analogRead" + "analogReference" + "analogWrite" + ; Zero, Due & MKR Family + "analogReadResolution" + "analogWriteResolution" + ; Advanced I/O + "noTone" + "pulseIn" + "pulseInLong" + "shiftIn" + "shiftOut" + "tone" + ; Time + "delay" + "delayMicroseconds" + "micros" + "millis" + ; Math + "abs" + "constrain" + "map" + "max" + "min" + "pow" + "sq" + "sqrt" + ; Trigonometry + "cos" + "sin" + "tan" + ; Characters + "isAlpha" + "isAlphaNumeric" + "isAscii" + "isControl" + "isDigit" + "isGraph" + "isHexadecimalDigit" + "isLowerCase" + "isPrintable" + "isPunct" + "isSpace" + "isUpperCase" + "isWhitespace" + ; Random Numbers + "random" + "randomSeed" + ; Bits and Bytes + "bit" + "bitClear" + "bitRead" + "bitSet" + "bitWrite" + "highByte" + "lowByte" + ; External Interrupts + "attachInterrupt" + "detachInterrupt" + ; Interrupts + "interrupts" + "noInterrupts")) ((identifier) @type.builtin (#any-of? @type.builtin diff --git a/queries/bash/highlights.scm b/queries/bash/highlights.scm index 033f9fbee..5820680ef 100644 --- a/queries/bash/highlights.scm +++ b/queries/bash/highlights.scm @@ -127,7 +127,8 @@ (command_name (word) @function.call) ((command_name (word) @function.builtin) - (#any-of? @function.builtin + ; format-ignore + (#any-of? @function.builtin "alias" "bg" "bind" "break" "builtin" "caller" "cd" "command" "compgen" "complete" "compopt" "continue" "coproc" "dirs" "disown" "echo" "enable" "eval" diff --git a/queries/bitbake/highlights.scm b/queries/bitbake/highlights.scm index c4f51d624..eafe60b4d 100644 --- a/queries/bitbake/highlights.scm +++ b/queries/bitbake/highlights.scm @@ -109,15 +109,11 @@ (#lua-match? @constant.builtin "^__[a-zA-Z0-9_]*__$")) ((python_identifier) @constant.builtin - (#any-of? @constant.builtin - ;; https://docs.python.org/3/library/constants.html - "NotImplemented" - "Ellipsis" - "quit" - "exit" - "copyright" - "credits" - "license")) + ; format-ignore + (#any-of? @constant.builtin + ; https://docs.python.org/3/library/constants.html + "NotImplemented" "Ellipsis" + "quit" "exit" "copyright" "credits" "license")) ((assignment left: (python_identifier) @type.definition @@ -338,21 +334,22 @@ (type_conversion) @function.macro ([(identifier) (python_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")) + ; format-ignore + (#any-of? @type.builtin + ; https://docs.python.org/3/library/exceptions.html + "BaseException" "Exception" "ArithmeticError" "BufferError" "LookupError" "AssertionError" "AttributeError" + "EOFError" "FloatingPointError" "GeneratorExit" "ImportError" "ModuleNotFoundError" "IndexError" "KeyError" + "KeyboardInterrupt" "MemoryError" "NameError" "NotImplementedError" "OSError" "OverflowError" "RecursionError" + "ReferenceError" "RuntimeError" "StopIteration" "StopAsyncIteration" "SyntaxError" "IndentationError" "TabError" + "SystemError" "SystemExit" "TypeError" "UnboundLocalError" "UnicodeError" "UnicodeEncodeError" "UnicodeDecodeError" + "UnicodeTranslateError" "ValueError" "ZeroDivisionError" "EnvironmentError" "IOError" "WindowsError" + "BlockingIOError" "ChildProcessError" "ConnectionError" "BrokenPipeError" "ConnectionAbortedError" + "ConnectionRefusedError" "ConnectionResetError" "FileExistsError" "FileNotFoundError" "InterruptedError" + "IsADirectoryError" "NotADirectoryError" "PermissionError" "ProcessLookupError" "TimeoutError" "Warning" + "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")) (comment) @comment @spell diff --git a/queries/c/highlights.scm b/queries/c/highlights.scm index 33c30f095..0a6145e3e 100644 --- a/queries/c/highlights.scm +++ b/queries/c/highlights.scm @@ -124,12 +124,12 @@ ((preproc_arg) @function.macro (#set! "priority" 90)) (preproc_defined) @function.macro -(((field_expression - (field_identifier) @property)) @_parent +((field_expression + (field_identifier) @property) @_parent (#not-has-parent? @_parent template_method function_declarator call_expression)) (field_designator) @property -(((field_identifier) @property) +((field_identifier) @property (#has-ancestor? @property field_declaration) (#not-has-ancestor? @property function_declarator)) @@ -168,6 +168,7 @@ value: (identifier) @constant) ((identifier) @constant.builtin + ; format-ignore (#any-of? @constant.builtin "stderr" "stdin" "stdout" "__FILE__" "__LINE__" "__DATE__" "__TIME__" @@ -181,6 +182,7 @@ "__FUNCTION__" "__func__" "__PRETTY_FUNCTION__" "__VA_ARGS__" "__VA_OPT__")) (preproc_def (preproc_arg) @constant.builtin + ; format-ignore (#any-of? @constant.builtin "stderr" "stdin" "stdout" "__FILE__" "__LINE__" "__DATE__" "__TIME__" diff --git a/queries/c/injections.scm b/queries/c/injections.scm index 086dede9e..c025b0f07 100644 --- a/queries/c/injections.scm +++ b/queries/c/injections.scm @@ -16,59 +16,65 @@ function: (identifier) @_function arguments: (argument_list . (string_literal (string_content) @injection.content))) - (#any-of? @_function "printf" "printf_s" - "vprintf" "vprintf_s" - "scanf" "scanf_s" - "vscanf" "vscanf_s" - "wprintf" "wprintf_s" - "vwprintf" "vwprintf_s" - "wscanf" "wscanf_s" - "vwscanf" "vwscanf_s" - "cscanf" "_cscanf" - "printw" - "scanw") + ; format-ignore + (#any-of? @_function + "printf" "printf_s" + "vprintf" "vprintf_s" + "scanf" "scanf_s" + "vscanf" "vscanf_s" + "wprintf" "wprintf_s" + "vwprintf" "vwprintf_s" + "wscanf" "wscanf_s" + "vwscanf" "vwscanf_s" + "cscanf" "_cscanf" + "printw" + "scanw") (#set! injection.language "printf")) ((call_expression function: (identifier) @_function arguments: (argument_list (_) . (string_literal (string_content) @injection.content))) - (#any-of? @_function "fprintf" "fprintf_s" - "sprintf" - "dprintf" - "fscanf" "fscanf_s" - "sscanf" "sscanf_s" - "vsscanf" "vsscanf_s" - "vfprintf" "vfprintf_s" - "vsprintf" - "vdprintf" - "fwprintf" "fwprintf_s" - "vfwprintf" "vfwprintf_s" - "fwscanf" "fwscanf_s" - "swscanf" "swscanf_s" - "vswscanf" "vswscanf_s" - "vfscanf" "vfscanf_s" - "vfwscanf" "vfwscanf_s" - "wprintw" - "vw_printw" "vwprintw" - "wscanw" - "vw_scanw" "vwscanw") + ; format-ignore + (#any-of? @_function + "fprintf" "fprintf_s" + "sprintf" + "dprintf" + "fscanf" "fscanf_s" + "sscanf" "sscanf_s" + "vsscanf" "vsscanf_s" + "vfprintf" "vfprintf_s" + "vsprintf" + "vdprintf" + "fwprintf" "fwprintf_s" + "vfwprintf" "vfwprintf_s" + "fwscanf" "fwscanf_s" + "swscanf" "swscanf_s" + "vswscanf" "vswscanf_s" + "vfscanf" "vfscanf_s" + "vfwscanf" "vfwscanf_s" + "wprintw" + "vw_printw" "vwprintw" + "wscanw" + "vw_scanw" "vwscanw") (#set! injection.language "printf")) ((call_expression function: (identifier) @_function arguments: (argument_list (_) . (_) . (string_literal (string_content) @injection.content))) - (#any-of? @_function "sprintf_s" - "snprintf" "snprintf_s" - "vsprintf_s" - "vsnprintf" "vsnprintf_s" - "swprintf" "swprintf_s" - "snwprintf_s" - "vswprintf" "vswprintf_s" - "vsnwprintf_s" - "mvprintw" - "mvscanw") + ; format-ignore + (#any-of? @_function + "sprintf_s" + "snprintf" "snprintf_s" + "vsprintf_s" + "vsnprintf" "vsnprintf_s" + "swprintf" "swprintf_s" + "snwprintf_s" + "vswprintf" "vswprintf_s" + "vsnwprintf_s" + "mvprintw" + "mvscanw") (#set! injection.language "printf")) ((call_expression diff --git a/queries/clojure/highlights.scm b/queries/clojure/highlights.scm index d0b0bf0cb..974a17c0a 100644 --- a/queries/clojure/highlights.scm +++ b/queries/clojure/highlights.scm @@ -67,19 +67,20 @@ ; Builtin dynamic variables ((sym_lit) @variable.builtin - (#any-of? @variable.builtin - "*agent*" "*allow-unresolved-vars*" "*assert*" - "*clojure-version*" "*command-line-args*" - "*compile-files*" "*compile-path*" "*compiler-options*" - "*data-readers*" "*default-data-reader-fn*" - "*err*" "*file*" "*flush-on-newline*" "*fn-loader*" - "*in*" "*math-context*" "*ns*" "*out*" - "*print-dup*" "*print-length*" "*print-level*" - "*print-meta*" "*print-namespace-maps*" "*print-readably*" - "*read-eval*" "*reader-resolver*" - "*source-path*" "*suppress-read*" - "*unchecked-math*" "*use-context-classloader*" - "*verbose-defrecords*" "*warn-on-reflection*")) + ; format-ignore + (#any-of? @variable.builtin + "*agent*" "*allow-unresolved-vars*" "*assert*" + "*clojure-version*" "*command-line-args*" + "*compile-files*" "*compile-path*" "*compiler-options*" + "*data-readers*" "*default-data-reader-fn*" + "*err*" "*file*" "*flush-on-newline*" "*fn-loader*" + "*in*" "*math-context*" "*ns*" "*out*" + "*print-dup*" "*print-length*" "*print-level*" + "*print-meta*" "*print-namespace-maps*" "*print-readably*" + "*read-eval*" "*reader-resolver*" + "*source-path*" "*suppress-read*" + "*unchecked-math*" "*use-context-classloader*" + "*verbose-defrecords*" "*warn-on-reflection*")) ; Builtin repl variables ((sym_lit) @variable.builtin @@ -172,17 +173,18 @@ ; Builtin macros ;; TODO: Do all these items belong here? ((sym_lit) @function.macro - (#any-of? @function.macro - "." ".." "->" "->>" "amap" "areduce" "as->" "assert" - "binding" "bound-fn" "delay" "do" "dosync" - "doto" "extend-protocol" "extend-type" - "gen-class" "gen-interface" "io!" "lazy-cat" - "lazy-seq" "let" "letfn" "locking" "memfn" "monitor-enter" - "monitor-exit" "proxy" "proxy-super" "pvalues" - "refer-clojure" "reify" "set!" "some->" "some->>" - "time" "unquote" "unquote-splicing" "var" "vswap!" - "with-bindings" "with-in-str" "with-loading-context" "with-local-vars" - "with-open" "with-out-str" "with-precision" "with-redefs")) + ; format-ignore + (#any-of? @function.macro + "." ".." "->" "->>" "amap" "areduce" "as->" "assert" + "binding" "bound-fn" "delay" "do" "dosync" + "doto" "extend-protocol" "extend-type" + "gen-class" "gen-interface" "io!" "lazy-cat" + "lazy-seq" "let" "letfn" "locking" "memfn" "monitor-enter" + "monitor-exit" "proxy" "proxy-super" "pvalues" + "refer-clojure" "reify" "set!" "some->" "some->>" + "time" "unquote" "unquote-splicing" "var" "vswap!" + "with-bindings" "with-in-str" "with-loading-context" "with-local-vars" + "with-open" "with-out-str" "with-precision" "with-redefs")) ; All builtin functions ; (->> (ns-publics *ns*) @@ -191,128 +193,129 @@ ; clojure.pprint/pprint)) ;; ...and then lots of manual filtering... ((sym_lit) @function.builtin - (#any-of? @function.builtin - "->ArrayChunk" "->Eduction" "->Vec" "->VecNode" "->VecSeq" - "-cache-protocol-fn" "-reset-methods" "PrintWriter-on" - "StackTraceElement->vec" "Throwable->map" "accessor" - "aclone" "add-classpath" "add-tap" "add-watch" "agent" - "agent-error" "agent-errors" "aget" "alength" "alias" - "all-ns" "alter" "alter-meta!" "alter-var-root" "ancestors" - "any?" "apply" "array-map" "aset" "aset-boolean" "aset-byte" - "aset-char" "aset-double" "aset-float" "aset-int" - "aset-long" "aset-short" "assoc" "assoc!" "assoc-in" - "associative?" "atom" "bases" "bean" "bigdec" "bigint" "biginteger" - "bit-and" "bit-and-not" "bit-clear" "bit-flip" "bit-not" "bit-or" - "bit-set" "bit-shift-left" "bit-shift-right" "bit-test" - "bit-xor" "boolean" "boolean-array" "boolean?" - "booleans" "bound-fn*" "bound?" "bounded-count" - "butlast" "byte" "byte-array" "bytes" "bytes?" - "cast" "cat" "char" "char-array" "char-escape-string" - "char-name-string" "char?" "chars" "chunk" "chunk-append" - "chunk-buffer" "chunk-cons" "chunk-first" "chunk-next" - "chunk-rest" "chunked-seq?" "class" "class?" - "clear-agent-errors" "clojure-version" "coll?" - "commute" "comp" "comparator" "compare" "compare-and-set!" - "compile" "complement" "completing" "concat" "conj" - "conj!" "cons" "constantly" "construct-proxy" "contains?" - "count" "counted?" "create-ns" "create-struct" "cycle" - "dec" "dec'" "decimal?" "dedupe" "default-data-readers" - "delay?" "deliver" "denominator" "deref" "derive" - "descendants" "destructure" "disj" "disj!" "dissoc" - "dissoc!" "distinct" "distinct?" "doall" "dorun" "double" - "double-array" "eduction" "empty" "empty?" "ensure" "ensure-reduced" - "enumeration-seq" "error-handler" "error-mode" "eval" - "even?" "every-pred" "every?" "extend" "extenders" "extends?" - "false?" "ffirst" "file-seq" "filter" "filterv" "find" - "find-keyword" "find-ns" "find-protocol-impl" - "find-protocol-method" "find-var" "first" "flatten" - "float" "float-array" "float?" "floats" "flush" "fn?" - "fnext" "fnil" "force" "format" "frequencies" - "future-call" "future-cancel" "future-cancelled?" - "future-done?" "future?" "gensym" "get" "get-in" - "get-method" "get-proxy-class" "get-thread-bindings" - "get-validator" "group-by" "halt-when" "hash" - "hash-combine" "hash-map" "hash-ordered-coll" "hash-set" - "hash-unordered-coll" "ident?" "identical?" "identity" - "ifn?" "in-ns" "inc" "inc'" "indexed?" "init-proxy" - "inst-ms" "inst-ms*" "inst?" "instance?" "int" "int-array" - "int?" "integer?" "interleave" "intern" "interpose" "into" - "into-array" "ints" "isa?" "iterate" "iterator-seq" "juxt" - "keep" "keep-indexed" "key" "keys" "keyword" "keyword?" - "last" "line-seq" "list" "list*" "list?" "load" "load-file" - "load-reader" "load-string" "loaded-libs" "long" "long-array" - "longs" "macroexpand" "macroexpand-1" "make-array" "make-hierarchy" - "map" "map-entry?" "map-indexed" "map?" "mapcat" "mapv" - "max" "max-key" "memoize" "merge" "merge-with" "meta" - "method-sig" "methods" "min" "min-key" "mix-collection-hash" - "mod" "munge" "name" "namespace" "namespace-munge" "nat-int?" - "neg-int?" "neg?" "newline" "next" "nfirst" "nil?" "nnext" - "not-any?" "not-empty" "not-every?" "ns-aliases" - "ns-imports" "ns-interns" "ns-map" "ns-name" "ns-publics" - "ns-refers" "ns-resolve" "ns-unalias" "ns-unmap" "nth" - "nthnext" "nthrest" "num" "number?" "numerator" "object-array" - "odd?" "parents" "partial" "partition" "partition-all" - "partition-by" "pcalls" "peek" "persistent!" "pmap" "pop" - "pop!" "pop-thread-bindings" "pos-int?" "pos?" "pr" - "pr-str" "prefer-method" "prefers" "primitives-classnames" - "print" "print-ctor" "print-dup" "print-method" "print-simple" - "print-str" "printf" "println" "println-str" "prn" "prn-str" - "promise" "proxy-call-with-super" "proxy-mappings" "proxy-name" - "push-thread-bindings" "qualified-ident?" "qualified-keyword?" - "qualified-symbol?" "quot" "rand" "rand-int" "rand-nth" "random-sample" - "range" "ratio?" "rational?" "rationalize" "re-find" "re-groups" - "re-matcher" "re-matches" "re-pattern" "re-seq" "read" - "read+string" "read-line" "read-string" "reader-conditional" - "reader-conditional?" "realized?" "record?" "reduce" - "reduce-kv" "reduced" "reduced?" "reductions" "ref" "ref-history-count" - "ref-max-history" "ref-min-history" "ref-set" "refer" - "release-pending-sends" "rem" "remove" "remove-all-methods" - "remove-method" "remove-ns" "remove-tap" "remove-watch" - "repeat" "repeatedly" "replace" "replicate" - "requiring-resolve" "reset!" "reset-meta!" "reset-vals!" - "resolve" "rest" "restart-agent" "resultset-seq" "reverse" - "reversible?" "rseq" "rsubseq" "run!" "satisfies?" - "second" "select-keys" "send" "send-off" "send-via" - "seq" "seq?" "seqable?" "seque" "sequence" "sequential?" - "set" "set-agent-send-executor!" "set-agent-send-off-executor!" - "set-error-handler!" "set-error-mode!" "set-validator!" - "set?" "short" "short-array" "shorts" "shuffle" - "shutdown-agents" "simple-ident?" "simple-keyword?" - "simple-symbol?" "slurp" "some" "some-fn" "some?" - "sort" "sort-by" "sorted-map" "sorted-map-by" - "sorted-set" "sorted-set-by" "sorted?" "special-symbol?" - "spit" "split-at" "split-with" "str" "string?" - "struct" "struct-map" "subs" "subseq" "subvec" "supers" - "swap!" "swap-vals!" "symbol" "symbol?" "tagged-literal" - "tagged-literal?" "take" "take-last" "take-nth" "take-while" - "tap>" "test" "the-ns" "thread-bound?" "to-array" - "to-array-2d" "trampoline" "transduce" "transient" - "tree-seq" "true?" "type" "unchecked-add" "unchecked-add-int" - "unchecked-byte" "unchecked-char" "unchecked-dec" - "unchecked-dec-int" "unchecked-divide-int" "unchecked-double" - "unchecked-float" "unchecked-inc" "unchecked-inc-int" - "unchecked-int" "unchecked-long" "unchecked-multiply" - "unchecked-multiply-int" "unchecked-negate" "unchecked-negate-int" - "unchecked-remainder-int" "unchecked-short" "unchecked-subtract" - "unchecked-subtract-int" "underive" "unquote" - "unquote-splicing" "unreduced" "unsigned-bit-shift-right" - "update" "update-in" "update-proxy" "uri?" "uuid?" - "val" "vals" "var-get" "var-set" "var?" "vary-meta" "vec" - "vector" "vector-of" "vector?" "volatile!" "volatile?" - "vreset!" "with-bindings*" "with-meta" "with-redefs-fn" "xml-seq" - "zero?" "zipmap" - ;; earlier - "drop" "drop-last" "drop-while" - "double?" "doubles" - "ex-data" "ex-info" - ;; 1.10 - "ex-cause" "ex-message" - ;; 1.11 - "NaN?" "abs" "infinite?" "iteration" "random-uuid" - "parse-boolean" "parse-double" "parse-long" "parse-uuid" - "seq-to-map-for-destructuring" "update-keys" "update-vals" - ;; 1.12 - "partitionv" "partitionv-all" "splitv-at")) + ; format-ignore + (#any-of? @function.builtin + "->ArrayChunk" "->Eduction" "->Vec" "->VecNode" "->VecSeq" + "-cache-protocol-fn" "-reset-methods" "PrintWriter-on" + "StackTraceElement->vec" "Throwable->map" "accessor" + "aclone" "add-classpath" "add-tap" "add-watch" "agent" + "agent-error" "agent-errors" "aget" "alength" "alias" + "all-ns" "alter" "alter-meta!" "alter-var-root" "ancestors" + "any?" "apply" "array-map" "aset" "aset-boolean" "aset-byte" + "aset-char" "aset-double" "aset-float" "aset-int" + "aset-long" "aset-short" "assoc" "assoc!" "assoc-in" + "associative?" "atom" "bases" "bean" "bigdec" "bigint" "biginteger" + "bit-and" "bit-and-not" "bit-clear" "bit-flip" "bit-not" "bit-or" + "bit-set" "bit-shift-left" "bit-shift-right" "bit-test" + "bit-xor" "boolean" "boolean-array" "boolean?" + "booleans" "bound-fn*" "bound?" "bounded-count" + "butlast" "byte" "byte-array" "bytes" "bytes?" + "cast" "cat" "char" "char-array" "char-escape-string" + "char-name-string" "char?" "chars" "chunk" "chunk-append" + "chunk-buffer" "chunk-cons" "chunk-first" "chunk-next" + "chunk-rest" "chunked-seq?" "class" "class?" + "clear-agent-errors" "clojure-version" "coll?" + "commute" "comp" "comparator" "compare" "compare-and-set!" + "compile" "complement" "completing" "concat" "conj" + "conj!" "cons" "constantly" "construct-proxy" "contains?" + "count" "counted?" "create-ns" "create-struct" "cycle" + "dec" "dec'" "decimal?" "dedupe" "default-data-readers" + "delay?" "deliver" "denominator" "deref" "derive" + "descendants" "destructure" "disj" "disj!" "dissoc" + "dissoc!" "distinct" "distinct?" "doall" "dorun" "double" + "double-array" "eduction" "empty" "empty?" "ensure" "ensure-reduced" + "enumeration-seq" "error-handler" "error-mode" "eval" + "even?" "every-pred" "every?" "extend" "extenders" "extends?" + "false?" "ffirst" "file-seq" "filter" "filterv" "find" + "find-keyword" "find-ns" "find-protocol-impl" + "find-protocol-method" "find-var" "first" "flatten" + "float" "float-array" "float?" "floats" "flush" "fn?" + "fnext" "fnil" "force" "format" "frequencies" + "future-call" "future-cancel" "future-cancelled?" + "future-done?" "future?" "gensym" "get" "get-in" + "get-method" "get-proxy-class" "get-thread-bindings" + "get-validator" "group-by" "halt-when" "hash" + "hash-combine" "hash-map" "hash-ordered-coll" "hash-set" + "hash-unordered-coll" "ident?" "identical?" "identity" + "ifn?" "in-ns" "inc" "inc'" "indexed?" "init-proxy" + "inst-ms" "inst-ms*" "inst?" "instance?" "int" "int-array" + "int?" "integer?" "interleave" "intern" "interpose" "into" + "into-array" "ints" "isa?" "iterate" "iterator-seq" "juxt" + "keep" "keep-indexed" "key" "keys" "keyword" "keyword?" + "last" "line-seq" "list" "list*" "list?" "load" "load-file" + "load-reader" "load-string" "loaded-libs" "long" "long-array" + "longs" "macroexpand" "macroexpand-1" "make-array" "make-hierarchy" + "map" "map-entry?" "map-indexed" "map?" "mapcat" "mapv" + "max" "max-key" "memoize" "merge" "merge-with" "meta" + "method-sig" "methods" "min" "min-key" "mix-collection-hash" + "mod" "munge" "name" "namespace" "namespace-munge" "nat-int?" + "neg-int?" "neg?" "newline" "next" "nfirst" "nil?" "nnext" + "not-any?" "not-empty" "not-every?" "ns-aliases" + "ns-imports" "ns-interns" "ns-map" "ns-name" "ns-publics" + "ns-refers" "ns-resolve" "ns-unalias" "ns-unmap" "nth" + "nthnext" "nthrest" "num" "number?" "numerator" "object-array" + "odd?" "parents" "partial" "partition" "partition-all" + "partition-by" "pcalls" "peek" "persistent!" "pmap" "pop" + "pop!" "pop-thread-bindings" "pos-int?" "pos?" "pr" + "pr-str" "prefer-method" "prefers" "primitives-classnames" + "print" "print-ctor" "print-dup" "print-method" "print-simple" + "print-str" "printf" "println" "println-str" "prn" "prn-str" + "promise" "proxy-call-with-super" "proxy-mappings" "proxy-name" + "push-thread-bindings" "qualified-ident?" "qualified-keyword?" + "qualified-symbol?" "quot" "rand" "rand-int" "rand-nth" "random-sample" + "range" "ratio?" "rational?" "rationalize" "re-find" "re-groups" + "re-matcher" "re-matches" "re-pattern" "re-seq" "read" + "read+string" "read-line" "read-string" "reader-conditional" + "reader-conditional?" "realized?" "record?" "reduce" + "reduce-kv" "reduced" "reduced?" "reductions" "ref" "ref-history-count" + "ref-max-history" "ref-min-history" "ref-set" "refer" + "release-pending-sends" "rem" "remove" "remove-all-methods" + "remove-method" "remove-ns" "remove-tap" "remove-watch" + "repeat" "repeatedly" "replace" "replicate" + "requiring-resolve" "reset!" "reset-meta!" "reset-vals!" + "resolve" "rest" "restart-agent" "resultset-seq" "reverse" + "reversible?" "rseq" "rsubseq" "run!" "satisfies?" + "second" "select-keys" "send" "send-off" "send-via" + "seq" "seq?" "seqable?" "seque" "sequence" "sequential?" + "set" "set-agent-send-executor!" "set-agent-send-off-executor!" + "set-error-handler!" "set-error-mode!" "set-validator!" + "set?" "short" "short-array" "shorts" "shuffle" + "shutdown-agents" "simple-ident?" "simple-keyword?" + "simple-symbol?" "slurp" "some" "some-fn" "some?" + "sort" "sort-by" "sorted-map" "sorted-map-by" + "sorted-set" "sorted-set-by" "sorted?" "special-symbol?" + "spit" "split-at" "split-with" "str" "string?" + "struct" "struct-map" "subs" "subseq" "subvec" "supers" + "swap!" "swap-vals!" "symbol" "symbol?" "tagged-literal" + "tagged-literal?" "take" "take-last" "take-nth" "take-while" + "tap>" "test" "the-ns" "thread-bound?" "to-array" + "to-array-2d" "trampoline" "transduce" "transient" + "tree-seq" "true?" "type" "unchecked-add" "unchecked-add-int" + "unchecked-byte" "unchecked-char" "unchecked-dec" + "unchecked-dec-int" "unchecked-divide-int" "unchecked-double" + "unchecked-float" "unchecked-inc" "unchecked-inc-int" + "unchecked-int" "unchecked-long" "unchecked-multiply" + "unchecked-multiply-int" "unchecked-negate" "unchecked-negate-int" + "unchecked-remainder-int" "unchecked-short" "unchecked-subtract" + "unchecked-subtract-int" "underive" "unquote" + "unquote-splicing" "unreduced" "unsigned-bit-shift-right" + "update" "update-in" "update-proxy" "uri?" "uuid?" + "val" "vals" "var-get" "var-set" "var?" "vary-meta" "vec" + "vector" "vector-of" "vector?" "volatile!" "volatile?" + "vreset!" "with-bindings*" "with-meta" "with-redefs-fn" "xml-seq" + "zero?" "zipmap" + ;; earlier + "drop" "drop-last" "drop-while" + "double?" "doubles" + "ex-data" "ex-info" + ;; 1.10 + "ex-cause" "ex-message" + ;; 1.11 + "NaN?" "abs" "infinite?" "iteration" "random-uuid" + "parse-boolean" "parse-double" "parse-long" "parse-uuid" + "seq-to-map-for-destructuring" "update-keys" "update-vals" + ;; 1.12 + "partitionv" "partitionv-all" "splitv-at")) diff --git a/queries/cmake/highlights.scm b/queries/cmake/highlights.scm index bdad657e3..13544661f 100644 --- a/queries/cmake/highlights.scm +++ b/queries/cmake/highlights.scm @@ -91,13 +91,15 @@ (argument_list (argument) @keyword.operator ) - (#any-of? @keyword.operator "NOT" "AND" "OR" - "COMMAND" "POLICY" "TARGET" "TEST" "DEFINED" "IN_LIST" - "EXISTS" "IS_NEWER_THAN" "IS_DIRECTORY" "IS_SYMLINK" "IS_ABSOLUTE" - "MATCHES" - "LESS" "GREATER" "EQUAL" "LESS_EQUAL" "GREATER_EQUAL" - "STRLESS" "STRGREATER" "STREQUAL" "STRLESS_EQUAL" "STRGREATER_EQUAL" - "VERSION_LESS" "VERSION_GREATER" "VERSION_EQUAL" "VERSION_LESS_EQUAL" "VERSION_GREATER_EQUAL" + ; format-ignore + (#any-of? @keyword.operator + "NOT" "AND" "OR" + "COMMAND" "POLICY" "TARGET" "TEST" "DEFINED" "IN_LIST" + "EXISTS" "IS_NEWER_THAN" "IS_DIRECTORY" "IS_SYMLINK" "IS_ABSOLUTE" + "MATCHES" + "LESS" "GREATER" "EQUAL" "LESS_EQUAL" "GREATER_EQUAL" + "STRLESS" "STRGREATER" "STREQUAL" "STRLESS_EQUAL" "STRGREATER_EQUAL" + "VERSION_LESS" "VERSION_GREATER" "VERSION_EQUAL" "VERSION_LESS_EQUAL" "VERSION_GREATER_EQUAL" ) ) (elseif_command @@ -105,13 +107,15 @@ (argument_list (argument) @keyword.operator ) - (#any-of? @keyword.operator "NOT" "AND" "OR" - "COMMAND" "POLICY" "TARGET" "TEST" "DEFINED" "IN_LIST" - "EXISTS" "IS_NEWER_THAN" "IS_DIRECTORY" "IS_SYMLINK" "IS_ABSOLUTE" - "MATCHES" - "LESS" "GREATER" "EQUAL" "LESS_EQUAL" "GREATER_EQUAL" - "STRLESS" "STRGREATER" "STREQUAL" "STRLESS_EQUAL" "STRGREATER_EQUAL" - "VERSION_LESS" "VERSION_GREATER" "VERSION_EQUAL" "VERSION_LESS_EQUAL" "VERSION_GREATER_EQUAL" + ; format-ignore + (#any-of? @keyword.operator + "NOT" "AND" "OR" + "COMMAND" "POLICY" "TARGET" "TEST" "DEFINED" "IN_LIST" + "EXISTS" "IS_NEWER_THAN" "IS_DIRECTORY" "IS_SYMLINK" "IS_ABSOLUTE" + "MATCHES" + "LESS" "GREATER" "EQUAL" "LESS_EQUAL" "GREATER_EQUAL" + "STRLESS" "STRGREATER" "STREQUAL" "STRLESS_EQUAL" "STRGREATER_EQUAL" + "VERSION_LESS" "VERSION_GREATER" "VERSION_EQUAL" "VERSION_LESS_EQUAL" "VERSION_GREATER_EQUAL" ) ) diff --git a/queries/commonlisp/highlights.scm b/queries/commonlisp/highlights.scm index 4c6501de6..42da34d0e 100644 --- a/queries/commonlisp/highlights.scm +++ b/queries/commonlisp/highlights.scm @@ -110,9 +110,10 @@ (list_lit . (sym_lit) @function.macro - ;; Generated via https://github.com/theHamsta/nvim-treesitter-commonlisp/blob/22fdc9fd6ed594176cc7299cc6f68dd21c94c63b/scripts/generate-symbols.lisp#L1-L21 - (#any-of? @function.macro - "do*" "step" "handler-bind" "decf" "prog1" "destructuring-bind" "defconstant" "do" "lambda" "with-standard-io-syntax" "case" "restart-bind" "ignore-errors" "with-slots" "prog2" "defclass" "define-condition" "print-unreadable-object" "defvar" "when" "with-open-file" "prog" "incf" "declaim" "and" "loop-finish" "multiple-value-bind" "pop" "psetf" "defmacro" "with-open-stream" "define-modify-macro" "defsetf" "formatter" "call-method" "handler-case" "pushnew" "or" "with-hash-table-iterator" "ecase" "cond" "defun" "remf" "ccase" "define-compiler-macro" "dotimes" "multiple-value-list" "assert" "deftype" "with-accessors" "trace" "with-simple-restart" "do-symbols" "nth-value" "define-symbol-macro" "psetq" "rotatef" "dolist" "check-type" "multiple-value-setq" "push" "pprint-pop" "loop" "define-setf-expander" "pprint-exit-if-list-exhausted" "with-condition-restarts" "defstruct" "with-input-from-string" "with-compilation-unit" "defgeneric" "with-output-to-string" "untrace" "defparameter" "ctypecase" "do-external-symbols" "etypecase" "do-all-symbols" "with-package-iterator" "unless" "defmethod" "in-package" "defpackage" "return" "typecase" "shiftf" "setf" "pprint-logical-block" "time" "restart-case" "prog*" "define-method-combination" "optimize")) + ;; Generated via https://github.com/theHamsta/nvim-treesitter-commonlisp/blob/22fdc9fd6ed594176cc7299cc6f68dd21c94c63b/scripts/generate-symbols.lisp#L1-L21 + ; format-ignore + (#any-of? @function.macro + "do*" "step" "handler-bind" "decf" "prog1" "destructuring-bind" "defconstant" "do" "lambda" "with-standard-io-syntax" "case" "restart-bind" "ignore-errors" "with-slots" "prog2" "defclass" "define-condition" "print-unreadable-object" "defvar" "when" "with-open-file" "prog" "incf" "declaim" "and" "loop-finish" "multiple-value-bind" "pop" "psetf" "defmacro" "with-open-stream" "define-modify-macro" "defsetf" "formatter" "call-method" "handler-case" "pushnew" "or" "with-hash-table-iterator" "ecase" "cond" "defun" "remf" "ccase" "define-compiler-macro" "dotimes" "multiple-value-list" "assert" "deftype" "with-accessors" "trace" "with-simple-restart" "do-symbols" "nth-value" "define-symbol-macro" "psetq" "rotatef" "dolist" "check-type" "multiple-value-setq" "push" "pprint-pop" "loop" "define-setf-expander" "pprint-exit-if-list-exhausted" "with-condition-restarts" "defstruct" "with-input-from-string" "with-compilation-unit" "defgeneric" "with-output-to-string" "untrace" "defparameter" "ctypecase" "do-external-symbols" "etypecase" "do-all-symbols" "with-package-iterator" "unless" "defmethod" "in-package" "defpackage" "return" "typecase" "shiftf" "setf" "pprint-logical-block" "time" "restart-case" "prog*" "define-method-combination" "optimize")) ;; constant ((sym_lit) @constant @@ -128,8 +129,9 @@ . (sym_lit) @function.builtin ;; Generated via https://github.com/theHamsta/nvim-treesitter-commonlisp/blob/22fdc9fd6ed594176cc7299cc6f68dd21c94c63b/scripts/generate-symbols.lisp#L1-L21 + ; format-ignore (#any-of? @function.builtin - "apropos-list" "subst" "substitute" "pprint-linear" "file-namestring" "write-char" "do*" "slot-exists-p" "file-author" "macro-function" "rassoc" "make-echo-stream" "arithmetic-error-operation" "position-if-not" "list" "cdadr" "lisp-implementation-type" "vector-push" "let" "length" "string-upcase" "adjoin" "digit-char" "step" "member-if" "handler-bind" "lognot" "apply" "gcd" "slot-unbound" "stringp" "values-list" "stable-sort" "decode-float" "make-list" "rplaca" "isqrt" "export" "synonym-stream-symbol" "function-keywords" "replace" "tanh" "maphash" "code-char" "decf" "array-displacement" "string-not-lessp" "slot-value" "remove-if" "cell-error-name" "vectorp" "cdddar" "two-way-stream-output-stream" "parse-integer" "get-internal-real-time" "fourth" "make-string" "slot-missing" "byte-size" "string-trim" "nstring-downcase" "cdaddr" "<" "labels" "interactive-stream-p" "fifth" "max" "logxor" "pathname-name" "function" "realp" "eql" "logand" "short-site-name" "prog1" "user-homedir-pathname" "list-all-packages" "exp" "cadar" "read-char-no-hang" "package-error-package" "stream-external-format" "bit-andc2" "nsubstitute-if" "mapcar" "complement" "load-logical-pathname-translations" "pprint-newline" "oddp" "caaar" "destructuring-bind" "copy-alist" "acos" "go" "bit-nor" "defconstant" "fceiling" "tenth" "nreverse" "=" "nunion" "slot-boundp" "string>" "count-if" "atom" "char=" "random-state-p" "row-major-aref" "bit-andc1" "translate-pathname" "simple-vector-p" "coerce" "substitute-if-not" "zerop" "invalid-method-error" "compile" "realpart" "remove-if-not" "pprint-tab" "hash-table-rehash-threshold" "invoke-restart" "if" "count" "/=" "do" "initialize-instance" "abs" "schar" "simple-condition-format-control" "delete-package" "subst-if" "lambda" "hash-table-count" "array-has-fill-pointer-p" "bit" "with-standard-io-syntax" "parse-namestring" "proclaim" "array-in-bounds-p" "multiple-value-call" "rplacd" "some" "graphic-char-p" "read-from-string" "consp" "cadaar" "acons" "every" "make-pathname" "mask-field" "case" "set-macro-character" "bit-and" "restart-bind" "echo-stream-input-stream" "compile-file" "fill-pointer" "numberp" "acosh" "array-dimensions" "documentation" "minusp" "inspect" "copy-structure" "integer-length" "ensure-generic-function" "char>=" "quote" "lognor" "make-two-way-stream" "ignore-errors" "tailp" "with-slots" "fboundp" "logical-pathname-translations" "equal" "float-sign" "shadow" "sleep" "numerator" "prog2" "getf" "ldb-test" "round" "locally" "echo-stream-output-stream" "log" "get-macro-character" "alphanumericp" "find-method" "nintersection" "defclass" "define-condition" "print-unreadable-object" "defvar" "broadcast-stream-streams" "floatp" "subst-if-not" "integerp" "translate-logical-pathname" "subsetp" "when" "write-string" "with-open-file" "clrhash" "apropos" "intern" "min" "string-greaterp" "import" "nset-difference" "prog" "incf" "both-case-p" "multiple-value-prog1" "characterp" "streamp" "digit-char-p" "random" "string-lessp" "make-string-input-stream" "copy-symbol" "read-sequence" "logcount" "bit-not" "boundp" "encode-universal-time" "third" "declaim" "map" "cons" "set-syntax-from-char" "and" "cis" "symbol-plist" "loop-finish" "standard-char-p" "multiple-value-bind" "asin" "string" "pop" "complex" "fdefinition" "psetf" "type-error-datum" "output-stream-p" "floor" "write-line" "<=" "defmacro" "rational" "hash-table-test" "with-open-stream" "read-char" "string-capitalize" "get-properties" "y-or-n-p" "use-package" "remove" "compiler-macro-function" "read" "package-nicknames" "remove-duplicates" "make-load-form-saving-slots" "dribble" "define-modify-macro" "make-dispatch-macro-character" "close" "cosh" "open" "finish-output" "string-downcase" "car" "nstring-capitalize" "software-type" "read-preserving-whitespace" "cadr" "fround" "nsublis" "defsetf" "find-all-symbols" "char>" "no-applicable-method" "compute-restarts" "pathname" "bit-orc2" "write-sequence" "pprint-tabular" "symbol-value" "char-name" "get-decoded-time" "formatter" "bit-vector-p" "intersection" "pathname-type" "clear-input" "call-method" "princ-to-string" "symbolp" "make-load-form" "nsubst" "pprint-dispatch" "handler-case" "method-combination-error" "probe-file" "atan" "string<" "type-error-expected-type" "pushnew" "unread-char" "print" "or" "with-hash-table-iterator" "make-sequence" "ecase" "unwind-protect" "require" "sixth" "get-dispatch-macro-character" "char-not-lessp" "read-byte" "tagbody" "file-error-pathname" "catch" "rationalp" "char-downcase" "char-int" "array-rank" "cond" "last" "make-string-output-stream" "array-dimension" "host-namestring" "input-stream-p" "decode-universal-time" "defun" "eval-when" "char-code" "pathname-directory" "evenp" "subseq" "pprint" "ftruncate" "make-instance" "pathname-host" "logbitp" "remf" "1+" "copy-pprint-dispatch" "char-upcase" "error" "read-line" "second" "make-package" "directory" "special-operator-p" "open-stream-p" "rassoc-if-not" "ccase" "equalp" "substitute-if" "*" "char/=" "cdr" "sqrt" "lcm" "logical-pathname" "eval" "define-compiler-macro" "nsubstitute-if-not" "mapcon" "imagpart" "set-exclusive-or" "simple-condition-format-arguments" "expt" "concatenate" "file-position" "macrolet" "keywordp" "hash-table-rehash-size" "+" "eighth" "use-value" "char-equal" "bit-xor" "format" "byte" "dotimes" "namestring" "char-not-equal" "multiple-value-list" "assert" "append" "notany" "typep" "delete-file" "makunbound" "cdaar" "file-write-date" ">" "cdddr" "write-to-string" "funcall" "member-if-not" "deftype" "readtable-case" "with-accessors" "truename" "constantp" "rassoc-if" "caaadr" "tree-equal" "nset-exclusive-or" "nsubstitute" "make-instances-obsolete" "package-use-list" "invoke-debugger" "provide" "count-if-not" "trace" "logandc1" "nthcdr" "char<=" "functionp" "with-simple-restart" "set-dispatch-macro-character" "logorc2" "unexport" "rest" "unbound-slot-instance" "make-hash-table" "hash-table-p" "reinitialize-instance" "nth" "do-symbols" "nreconc" "macroexpand" "store-value" "float-precision" "remprop" "nth-value" "define-symbol-macro" "update-instance-for-redefined-class" "identity" "progv" "progn" "return-from" "readtablep" "rem" "symbol-name" "psetq" "wild-pathname-p" "char" "list*" "char<" "plusp" "pairlis" "cddar" "pprint-indent" "union" "compiled-function-p" "rotatef" "abort" "machine-type" "concatenated-stream-streams" "string-right-trim" "enough-namestring" "arithmetic-error-operands" "ceiling" "dolist" "delete" "make-condition" "string-left-trim" "integer-decode-float" "check-type" "notevery" "function-lambda-expression" "-" "multiple-value-setq" "name-char" "push" "pprint-pop" "compile-file-pathname" "list-length" "nstring-upcase" "eq" "find-if" "method-qualifiers" "caadr" "cddr" "string=" "let*" "remove-method" "pathname-match-p" "find-package" "truncate" "caaddr" "get-setf-expansion" "loop" "define-setf-expander" "caddr" "package-shadowing-symbols" "force-output" "slot-makunbound" "string-not-greaterp" "cdadar" "cdaadr" "logandc2" "make-array" "merge-pathnames" "sin" "1-" "machine-version" "ffloor" "packagep" "set-pprint-dispatch" "flet" "gensym" "pprint-exit-if-list-exhausted" "cos" "get" "mapl" "delete-if" "with-condition-restarts" "atanh" "copy-list" "fill" "char-not-greaterp" "bit-orc1" "mod" "package-used-by-list" "warn" "add-method" "simple-string-p" "find-restart" "describe" "pathname-version" "peek-char" "yes-or-no-p" "complexp" "aref" "not" "position-if" "string>=" "defstruct" "float-radix" "ninth" "caadar" "subtypep" "set" "butlast" "allocate-instance" "with-input-from-string" "assoc" "write" "make-random-state" "bit-eqv" "float-digits" "long-site-name" "with-compilation-unit" "delete-duplicates" "make-symbol" "room" "cdar" "pprint-fill" "defgeneric" "macroexpand-1" "scale-float" "cdaaar" "update-instance-for-different-class" "array-row-major-index" "ed" "file-string-length" "ensure-directories-exist" "copy-readtable" "string<=" "seventh" "with-output-to-string" "signum" "elt" "untrace" "null" "defparameter" "block" "prin1" "revappend" "gentemp" "ctypecase" "ash" "sxhash" "listp" "do-external-symbols" "bit-ior" "etypecase" "sort" "change-class" "find-class" "alpha-char-p" "map-into" "terpri" "do-all-symbols" "ldb" "logorc1" "search" "fmakunbound" "load" "character" "string-not-equal" "pathnamep" "make-broadcast-stream" "arrayp" "mapcan" "cerror" "invoke-restart-interactively" "assoc-if-not" "with-package-iterator" "get-internal-run-time" "read-delimited-list" "unless" "lower-case-p" "restart-name" "/" "boole" "defmethod" "float" "software-version" "vector-pop" "vector-push-extend" "caar" "ldiff" "member" "find-symbol" "reduce" "svref" "describe-object" "logior" "string-equal" "type-of" "position" "cddadr" "pathname-device" "get-output-stream-string" "symbol-package" "tan" "compute-applicable-methods" "cddddr" "nsubst-if-not" "sublis" "set-difference" "two-way-stream-input-stream" "adjustable-array-p" "machine-instance" "signal" "conjugate" "caaaar" "endp" "lisp-implementation-version" "cddaar" "package-name" "adjust-array" "bit-nand" "gethash" "in-package" "symbol-function" "make-concatenated-stream" "defpackage" "class-of" "no-next-method" "logeqv" "deposit-field" "disassemble" "unuse-package" "copy-tree" "find" "asinh" "class-name" "rename-file" "values" "print-not-readable-object" "mismatch" "cadadr" "shadowing-import" "delete-if-not" "maplist" "listen" "return" "stream-element-type" "unintern" "merge" "make-synonym-stream" "prin1-to-string" "nsubst-if" "byte-position" "phase" "muffle-warning" "remhash" "continue" "load-time-value" "hash-table-size" "upgraded-complex-part-type" "char-lessp" "sbit" "upgraded-array-element-type" "file-length" "typecase" "cadddr" "first" "rationalize" "logtest" "find-if-not" "dpb" "mapc" "sinh" "char-greaterp" "shiftf" "denominator" "get-universal-time" "nconc" "setf" "lognand" "rename-package" "pprint-logical-block" "break" "symbol-macrolet" "the" "fresh-line" "clear-output" "assoc-if" "string/=" "princ" "directory-namestring" "stream-error-stream" "array-element-type" "setq" "copy-seq" "time" "restart-case" "prog*" "shared-initialize" "array-total-size" "simple-bit-vector-p" "define-method-combination" "write-byte" "constantly" "caddar" "print-object" "vector" "throw" "reverse" ">=" "upper-case-p" "nbutlast")) + "apropos-list" "subst" "substitute" "pprint-linear" "file-namestring" "write-char" "do*" "slot-exists-p" "file-author" "macro-function" "rassoc" "make-echo-stream" "arithmetic-error-operation" "position-if-not" "list" "cdadr" "lisp-implementation-type" "vector-push" "let" "length" "string-upcase" "adjoin" "digit-char" "step" "member-if" "handler-bind" "lognot" "apply" "gcd" "slot-unbound" "stringp" "values-list" "stable-sort" "decode-float" "make-list" "rplaca" "isqrt" "export" "synonym-stream-symbol" "function-keywords" "replace" "tanh" "maphash" "code-char" "decf" "array-displacement" "string-not-lessp" "slot-value" "remove-if" "cell-error-name" "vectorp" "cdddar" "two-way-stream-output-stream" "parse-integer" "get-internal-real-time" "fourth" "make-string" "slot-missing" "byte-size" "string-trim" "nstring-downcase" "cdaddr" "<" "labels" "interactive-stream-p" "fifth" "max" "logxor" "pathname-name" "function" "realp" "eql" "logand" "short-site-name" "prog1" "user-homedir-pathname" "list-all-packages" "exp" "cadar" "read-char-no-hang" "package-error-package" "stream-external-format" "bit-andc2" "nsubstitute-if" "mapcar" "complement" "load-logical-pathname-translations" "pprint-newline" "oddp" "caaar" "destructuring-bind" "copy-alist" "acos" "go" "bit-nor" "defconstant" "fceiling" "tenth" "nreverse" "=" "nunion" "slot-boundp" "string>" "count-if" "atom" "char=" "random-state-p" "row-major-aref" "bit-andc1" "translate-pathname" "simple-vector-p" "coerce" "substitute-if-not" "zerop" "invalid-method-error" "compile" "realpart" "remove-if-not" "pprint-tab" "hash-table-rehash-threshold" "invoke-restart" "if" "count" "/=" "do" "initialize-instance" "abs" "schar" "simple-condition-format-control" "delete-package" "subst-if" "lambda" "hash-table-count" "array-has-fill-pointer-p" "bit" "with-standard-io-syntax" "parse-namestring" "proclaim" "array-in-bounds-p" "multiple-value-call" "rplacd" "some" "graphic-char-p" "read-from-string" "consp" "cadaar" "acons" "every" "make-pathname" "mask-field" "case" "set-macro-character" "bit-and" "restart-bind" "echo-stream-input-stream" "compile-file" "fill-pointer" "numberp" "acosh" "array-dimensions" "documentation" "minusp" "inspect" "copy-structure" "integer-length" "ensure-generic-function" "char>=" "quote" "lognor" "make-two-way-stream" "ignore-errors" "tailp" "with-slots" "fboundp" "logical-pathname-translations" "equal" "float-sign" "shadow" "sleep" "numerator" "prog2" "getf" "ldb-test" "round" "locally" "echo-stream-output-stream" "log" "get-macro-character" "alphanumericp" "find-method" "nintersection" "defclass" "define-condition" "print-unreadable-object" "defvar" "broadcast-stream-streams" "floatp" "subst-if-not" "integerp" "translate-logical-pathname" "subsetp" "when" "write-string" "with-open-file" "clrhash" "apropos" "intern" "min" "string-greaterp" "import" "nset-difference" "prog" "incf" "both-case-p" "multiple-value-prog1" "characterp" "streamp" "digit-char-p" "random" "string-lessp" "make-string-input-stream" "copy-symbol" "read-sequence" "logcount" "bit-not" "boundp" "encode-universal-time" "third" "declaim" "map" "cons" "set-syntax-from-char" "and" "cis" "symbol-plist" "loop-finish" "standard-char-p" "multiple-value-bind" "asin" "string" "pop" "complex" "fdefinition" "psetf" "type-error-datum" "output-stream-p" "floor" "write-line" "<=" "defmacro" "rational" "hash-table-test" "with-open-stream" "read-char" "string-capitalize" "get-properties" "y-or-n-p" "use-package" "remove" "compiler-macro-function" "read" "package-nicknames" "remove-duplicates" "make-load-form-saving-slots" "dribble" "define-modify-macro" "make-dispatch-macro-character" "close" "cosh" "open" "finish-output" "string-downcase" "car" "nstring-capitalize" "software-type" "read-preserving-whitespace" "cadr" "fround" "nsublis" "defsetf" "find-all-symbols" "char>" "no-applicable-method" "compute-restarts" "pathname" "bit-orc2" "write-sequence" "pprint-tabular" "symbol-value" "char-name" "get-decoded-time" "formatter" "bit-vector-p" "intersection" "pathname-type" "clear-input" "call-method" "princ-to-string" "symbolp" "make-load-form" "nsubst" "pprint-dispatch" "handler-case" "method-combination-error" "probe-file" "atan" "string<" "type-error-expected-type" "pushnew" "unread-char" "print" "or" "with-hash-table-iterator" "make-sequence" "ecase" "unwind-protect" "require" "sixth" "get-dispatch-macro-character" "char-not-lessp" "read-byte" "tagbody" "file-error-pathname" "catch" "rationalp" "char-downcase" "char-int" "array-rank" "cond" "last" "make-string-output-stream" "array-dimension" "host-namestring" "input-stream-p" "decode-universal-time" "defun" "eval-when" "char-code" "pathname-directory" "evenp" "subseq" "pprint" "ftruncate" "make-instance" "pathname-host" "logbitp" "remf" "1+" "copy-pprint-dispatch" "char-upcase" "error" "read-line" "second" "make-package" "directory" "special-operator-p" "open-stream-p" "rassoc-if-not" "ccase" "equalp" "substitute-if" "*" "char/=" "cdr" "sqrt" "lcm" "logical-pathname" "eval" "define-compiler-macro" "nsubstitute-if-not" "mapcon" "imagpart" "set-exclusive-or" "simple-condition-format-arguments" "expt" "concatenate" "file-position" "macrolet" "keywordp" "hash-table-rehash-size" "+" "eighth" "use-value" "char-equal" "bit-xor" "format" "byte" "dotimes" "namestring" "char-not-equal" "multiple-value-list" "assert" "append" "notany" "typep" "delete-file" "makunbound" "cdaar" "file-write-date" ">" "cdddr" "write-to-string" "funcall" "member-if-not" "deftype" "readtable-case" "with-accessors" "truename" "constantp" "rassoc-if" "caaadr" "tree-equal" "nset-exclusive-or" "nsubstitute" "make-instances-obsolete" "package-use-list" "invoke-debugger" "provide" "count-if-not" "trace" "logandc1" "nthcdr" "char<=" "functionp" "with-simple-restart" "set-dispatch-macro-character" "logorc2" "unexport" "rest" "unbound-slot-instance" "make-hash-table" "hash-table-p" "reinitialize-instance" "nth" "do-symbols" "nreconc" "macroexpand" "store-value" "float-precision" "remprop" "nth-value" "define-symbol-macro" "update-instance-for-redefined-class" "identity" "progv" "progn" "return-from" "readtablep" "rem" "symbol-name" "psetq" "wild-pathname-p" "char" "list*" "char<" "plusp" "pairlis" "cddar" "pprint-indent" "union" "compiled-function-p" "rotatef" "abort" "machine-type" "concatenated-stream-streams" "string-right-trim" "enough-namestring" "arithmetic-error-operands" "ceiling" "dolist" "delete" "make-condition" "string-left-trim" "integer-decode-float" "check-type" "notevery" "function-lambda-expression" "-" "multiple-value-setq" "name-char" "push" "pprint-pop" "compile-file-pathname" "list-length" "nstring-upcase" "eq" "find-if" "method-qualifiers" "caadr" "cddr" "string=" "let*" "remove-method" "pathname-match-p" "find-package" "truncate" "caaddr" "get-setf-expansion" "loop" "define-setf-expander" "caddr" "package-shadowing-symbols" "force-output" "slot-makunbound" "string-not-greaterp" "cdadar" "cdaadr" "logandc2" "make-array" "merge-pathnames" "sin" "1-" "machine-version" "ffloor" "packagep" "set-pprint-dispatch" "flet" "gensym" "pprint-exit-if-list-exhausted" "cos" "get" "mapl" "delete-if" "with-condition-restarts" "atanh" "copy-list" "fill" "char-not-greaterp" "bit-orc1" "mod" "package-used-by-list" "warn" "add-method" "simple-string-p" "find-restart" "describe" "pathname-version" "peek-char" "yes-or-no-p" "complexp" "aref" "not" "position-if" "string>=" "defstruct" "float-radix" "ninth" "caadar" "subtypep" "set" "butlast" "allocate-instance" "with-input-from-string" "assoc" "write" "make-random-state" "bit-eqv" "float-digits" "long-site-name" "with-compilation-unit" "delete-duplicates" "make-symbol" "room" "cdar" "pprint-fill" "defgeneric" "macroexpand-1" "scale-float" "cdaaar" "update-instance-for-different-class" "array-row-major-index" "ed" "file-string-length" "ensure-directories-exist" "copy-readtable" "string<=" "seventh" "with-output-to-string" "signum" "elt" "untrace" "null" "defparameter" "block" "prin1" "revappend" "gentemp" "ctypecase" "ash" "sxhash" "listp" "do-external-symbols" "bit-ior" "etypecase" "sort" "change-class" "find-class" "alpha-char-p" "map-into" "terpri" "do-all-symbols" "ldb" "logorc1" "search" "fmakunbound" "load" "character" "string-not-equal" "pathnamep" "make-broadcast-stream" "arrayp" "mapcan" "cerror" "invoke-restart-interactively" "assoc-if-not" "with-package-iterator" "get-internal-run-time" "read-delimited-list" "unless" "lower-case-p" "restart-name" "/" "boole" "defmethod" "float" "software-version" "vector-pop" "vector-push-extend" "caar" "ldiff" "member" "find-symbol" "reduce" "svref" "describe-object" "logior" "string-equal" "type-of" "position" "cddadr" "pathname-device" "get-output-stream-string" "symbol-package" "tan" "compute-applicable-methods" "cddddr" "nsubst-if-not" "sublis" "set-difference" "two-way-stream-input-stream" "adjustable-array-p" "machine-instance" "signal" "conjugate" "caaaar" "endp" "lisp-implementation-version" "cddaar" "package-name" "adjust-array" "bit-nand" "gethash" "in-package" "symbol-function" "make-concatenated-stream" "defpackage" "class-of" "no-next-method" "logeqv" "deposit-field" "disassemble" "unuse-package" "copy-tree" "find" "asinh" "class-name" "rename-file" "values" "print-not-readable-object" "mismatch" "cadadr" "shadowing-import" "delete-if-not" "maplist" "listen" "return" "stream-element-type" "unintern" "merge" "make-synonym-stream" "prin1-to-string" "nsubst-if" "byte-position" "phase" "muffle-warning" "remhash" "continue" "load-time-value" "hash-table-size" "upgraded-complex-part-type" "char-lessp" "sbit" "upgraded-array-element-type" "file-length" "typecase" "cadddr" "first" "rationalize" "logtest" "find-if-not" "dpb" "mapc" "sinh" "char-greaterp" "shiftf" "denominator" "get-universal-time" "nconc" "setf" "lognand" "rename-package" "pprint-logical-block" "break" "symbol-macrolet" "the" "fresh-line" "clear-output" "assoc-if" "string/=" "princ" "directory-namestring" "stream-error-stream" "array-element-type" "setq" "copy-seq" "time" "restart-case" "prog*" "shared-initialize" "array-total-size" "simple-bit-vector-p" "define-method-combination" "write-byte" "constantly" "caddar" "print-object" "vector" "throw" "reverse" ">=" "upper-case-p" "nbutlast")) (list_lit . diff --git a/queries/elixir/locals.scm b/queries/elixir/locals.scm index ae37b9ca8..59e55eae0 100644 --- a/queries/elixir/locals.scm +++ b/queries/elixir/locals.scm @@ -1,41 +1,21 @@ ; References (identifier) @local.reference + (alias) @local.reference ; Module Definitions (call - target: ((identifier) @_identifier (#eq? @_identifier "defmodule")) - (arguments (alias) @local.definition.type)) + target: + ((identifier) @_identifier + (#eq? @_identifier "defmodule")) + (arguments + (alias) @local.definition.type)) ; Pattern Match Definitions -(binary_operator left: [ - (identifier) @local.definition.var - (_ (identifier) @local.definition.var) - (_ (_ (identifier) @local.definition.var)) - (_ (_ (_ (identifier) @local.definition.var))) - (_ (_ (_ (_ (identifier) @local.definition.var)))) - (_ (_ (_ (_ (_ (identifier) @local.definition.var))))) - (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))) - (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))))))))) -] operator: "=") - -; Stab Clause Definitions -(stab_clause - left: [ - (arguments [ +(binary_operator + ; format-ignore + left: + [ (identifier) @local.definition.var (_ (identifier) @local.definition.var) (_ (_ (identifier) @local.definition.var)) @@ -57,9 +37,15 @@ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))))))) (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))))))))) (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))))))))) - ]) - (binary_operator - left: (arguments [ + ] + operator: "=") +; Stab Clause Definitions +; format-ignore +(stab_clause + left: + [ + (arguments + [ (identifier) @local.definition.var (_ (identifier) @local.definition.var) (_ (_ (identifier) @local.definition.var)) @@ -81,84 +67,131 @@ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))))))) (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))))))))) (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))))))))) - ]) operator: "when") -]) + ]) + (binary_operator + left: + (arguments + ; format-ignore + [ + (identifier) @local.definition.var + (_ (identifier) @local.definition.var) + (_ (_ (identifier) @local.definition.var)) + (_ (_ (_ (identifier) @local.definition.var))) + (_ (_ (_ (_ (identifier) @local.definition.var)))) + (_ (_ (_ (_ (_ (identifier) @local.definition.var))))) + (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))) + (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var))))))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.var)))))))))))))))))))) + ]) + operator: "when") + ]) ; Aliases +; format-ignore (call - target: ((identifier) @_identifier (#any-of? @_identifier "require" "alias" "use" "import")) - (arguments [ - (alias) @local.definition.import - (_ (alias) @local.definition.import) - (_ (_ (alias) @local.definition.import)) - (_ (_ (_ (alias) @local.definition.import))) - (_ (_ (_ (_ (alias) @local.definition.import)))) - ] -)) + target: + ((identifier) @_identifier + (#any-of? @_identifier "require" "alias" "use" "import")) + (arguments + [ + (alias) @local.definition.import + (_ (alias) @local.definition.import) + (_ (_ (alias) @local.definition.import)) + (_ (_ (_ (alias) @local.definition.import))) + (_ (_ (_ (_ (alias) @local.definition.import)))) + ])) ; Local Function Definitions & Scopes +; format-ignore (call - target: ((identifier) @_identifier (#any-of? @_identifier "def" "defp" "defmacro" "defmacrop" "defguard" "defguardp" "defn" "defnp" "for")) - (arguments [ - (identifier) @local.definition.function - (binary_operator left: (identifier) @local.definition.function operator: "when") - (binary_operator (identifier) @local.definition.parameter) - (call target: (identifier) @local.definition.function (arguments [ - (identifier) @local.definition.parameter - (_ (identifier) @local.definition.parameter) - (_ (_ (identifier) @local.definition.parameter)) - (_ (_ (_ (identifier) @local.definition.parameter))) - (_ (_ (_ (_ (identifier) @local.definition.parameter)))) - (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))) - (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))) - (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))))))))))) - ])) - ]?) (#set! definition.function.scope parent) - (do_block)? -) @local.scope - + target: + ((identifier) @_identifier + (#any-of? @_identifier "def" "defp" "defmacro" "defmacrop" "defguard" "defguardp" "defn" "defnp" "for")) + (arguments + [ + (identifier) @local.definition.function + (binary_operator + left: (identifier) @local.definition.function + operator: "when") + (binary_operator + (identifier) @local.definition.parameter) + (call + target: (identifier) @local.definition.function + (arguments + [ + (identifier) @local.definition.parameter + (_ (identifier) @local.definition.parameter) + (_ (_ (identifier) @local.definition.parameter)) + (_ (_ (_ (identifier) @local.definition.parameter))) + (_ (_ (_ (_ (identifier) @local.definition.parameter)))) + (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))) + (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))) + (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))))))))))) + ])) + ]?) + (#set! definition.function.scope parent)(do_block)?) @local.scope ; ExUnit Test Definitions & Scopes +; format-ignore (call - target: ((identifier) @_identifier (#eq? @_identifier "test")) - (arguments [ - (string) - ((string) . "," . [ - (identifier) @local.definition.parameter - (_ (identifier) @local.definition.parameter) - (_ (_ (identifier) @local.definition.parameter)) - (_ (_ (_ (identifier) @local.definition.parameter))) - (_ (_ (_ (_ (identifier) @local.definition.parameter)))) - (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))) - (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))) - (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))))))))) - (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))))))))))) - ]) -]) (do_block)?) @local.scope - + target: + ((identifier) @_identifier + (#eq? @_identifier "test")) + (arguments + [ + (string) + ((string) + . + "," + . + [ + (identifier) @local.definition.parameter + (_ (identifier) @local.definition.parameter) + (_ (_ (identifier) @local.definition.parameter)) + (_ (_ (_ (identifier) @local.definition.parameter))) + (_ (_ (_ (_ (identifier) @local.definition.parameter)))) + (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))) + (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))) + (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter))))))))))))))))))) + (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (_ (identifier) @local.definition.parameter)))))))))))))))))))) + ]) + ]) + (do_block)?) @local.scope ; Stab Clause Scopes (stab_clause) @local.scope diff --git a/queries/gdscript/highlights.scm b/queries/gdscript/highlights.scm index 1b4edbc7e..21e0b8e0b 100644 --- a/queries/gdscript/highlights.scm +++ b/queries/gdscript/highlights.scm @@ -82,7 +82,7 @@ ;; Match Pattern -(underscore) @constant ; The "_" pattern. +(underscore) @constant ; The "_" pattern. (pattern_open_ending) @operator ; The ".." pattern. ;; Alternations @@ -179,21 +179,22 @@ ;; Built-in Annotations ((annotation "@" @attribute (identifier) @attribute) - (#any-of? @attribute - ; @GDScript - "export" "export_category" "export_color_no_alpha" "export_dir" - "export_enum" "export_exp_easing" "export_file" "export_flags" - "export_flags_2d_navigation" "export_flags_2d_physics" - "export_flags_2d_render" "export_flags_3d_navigation" - "export_flags_3d_physics" "export_flags_3d_render" "export_global_dir" - "export_global_file" "export_group" "export_multiline" "export_node_path" - "export_placeholder" "export_range" "export_subgroup" "icon" "onready" - "rpc" "tool" "warning_ignore" - )) + ; format-ignore + (#any-of? @attribute + ; @GDScript + "export" "export_category" "export_color_no_alpha" "export_dir" + "export_enum" "export_exp_easing" "export_file" "export_flags" + "export_flags_2d_navigation" "export_flags_2d_physics" + "export_flags_2d_render" "export_flags_3d_navigation" + "export_flags_3d_physics" "export_flags_3d_render" "export_global_dir" + "export_global_file" "export_group" "export_multiline" "export_node_path" + "export_placeholder" "export_range" "export_subgroup" "icon" "onready" + "rpc" "tool" "warning_ignore")) ;; Builtin Types ([(identifier) (type)] @type.builtin + ; format-ignore (#any-of? @type.builtin ; from godot-vscode-plugin "Vector2" "Vector2i" "Vector3" "Vector3i" @@ -222,122 +223,122 @@ ;; Builtin Funcs (call (identifier) @function.builtin - (#any-of? @function.builtin - ; @GlobalScope - "abs" "absf" "absi" "acos" "asin" "atan" "atan2" "bezier_derivative" - "bezier_interpolate" "bytes_to_var" "bytes_to_var_with_objects" "ceil" "ceilf" - "ceili" "clamp" "clampf" "clampi" "cos" "cosh" "cubic_interpolate" - "cubic_interpolate_angle" "cubic_interpolate_angle_in_time" - "cubic_interpolate_in_time" "db_to_linear" "deg_to_rad" "ease" "error_string" - "exp" "floor" "floorf" "floori" "fmod" "fposmod" "hash" "instance_from_id" - "inverse_lerp" "is_equal_approx" "is_finite" "is_inf" "is_instance_id_valid" - "is_instance_valid" "is_nan" "is_same" "is_zero_approx" "lerp" "lerp_angle" - "lerpf" "linear_to_db" "log" "max" "maxf" "maxi" "min" "minf" "mini" - "move_toward" "nearest_po2" "pingpong" "posmod" "pow" "print" "print_rich" - "print_verbose" "printerr" "printraw" "prints" "printt" "push_error" - "push_warning" "rad_to_deg" "rand_from_seed" "randf" "randf_range" "randfn" - "randi" "randi_range" "randomize" "remap" "rid_allocate_id" "rid_from_int64" - "round" "roundf" "roundi" "seed" "sign" "signf" "signi" "sin" "sinh" - "smoothstep" "snapped" "snappedf" "snappedi" "sqrt" "step_decimals" "str" - "str_to_var" "tan" "tanh" "typeof" "var_to_bytes" "var_to_bytes_with_objects" - "var_to_str" "weakref" "wrap" "wrapf" "wrapi" + ; format-ignore + (#any-of? @function.builtin + ; @GlobalScope + "abs" "absf" "absi" "acos" "asin" "atan" "atan2" "bezier_derivative" + "bezier_interpolate" "bytes_to_var" "bytes_to_var_with_objects" "ceil" "ceilf" + "ceili" "clamp" "clampf" "clampi" "cos" "cosh" "cubic_interpolate" + "cubic_interpolate_angle" "cubic_interpolate_angle_in_time" + "cubic_interpolate_in_time" "db_to_linear" "deg_to_rad" "ease" "error_string" + "exp" "floor" "floorf" "floori" "fmod" "fposmod" "hash" "instance_from_id" + "inverse_lerp" "is_equal_approx" "is_finite" "is_inf" "is_instance_id_valid" + "is_instance_valid" "is_nan" "is_same" "is_zero_approx" "lerp" "lerp_angle" + "lerpf" "linear_to_db" "log" "max" "maxf" "maxi" "min" "minf" "mini" + "move_toward" "nearest_po2" "pingpong" "posmod" "pow" "print" "print_rich" + "print_verbose" "printerr" "printraw" "prints" "printt" "push_error" + "push_warning" "rad_to_deg" "rand_from_seed" "randf" "randf_range" "randfn" + "randi" "randi_range" "randomize" "remap" "rid_allocate_id" "rid_from_int64" + "round" "roundf" "roundi" "seed" "sign" "signf" "signi" "sin" "sinh" + "smoothstep" "snapped" "snappedf" "snappedi" "sqrt" "step_decimals" "str" + "str_to_var" "tan" "tanh" "typeof" "var_to_bytes" "var_to_bytes_with_objects" + "var_to_str" "weakref" "wrap" "wrapf" "wrapi" - ; @GDScript - "Color8" "assert" "char" "convert" "dict_to_inst" "get_stack" "inst_to_dict" - "is_instance_of" "len" "print_debug" "print_stack" "range" - "type_exists" - )) + ; @GDScript + "Color8" "assert" "char" "convert" "dict_to_inst" "get_stack" "inst_to_dict" + "is_instance_of" "len" "print_debug" "print_stack" "range" + "type_exists")) ;; Builtin Constants ((identifier) @constant.builtin - (#any-of? @constant.builtin - ; @GDScript - "PI" "TAU" "INF" "NAN" + ; format-ignore + (#any-of? @constant.builtin + ; @GDScript + "PI" "TAU" "INF" "NAN" - ; @GlobalScope - "SIDE_LEFT" "SIDE_TOP" "SIDE_RIGHT" "SIDE_BOTTOM" "CORNER_TOP_LEFT" "CORNER_TOP_RIGHT" "CORNER_BOTTOM_RIGHT" - "CORNER_BOTTOM_LEFT" "VERTICAL" "HORIZONTAL" "CLOCKWISE" "COUNTERCLOCKWISE" "HORIZONTAL_ALIGNMENT_LEFT" - "HORIZONTAL_ALIGNMENT_CENTER" "HORIZONTAL_ALIGNMENT_RIGHT" "HORIZONTAL_ALIGNMENT_FILL" "VERTICAL_ALIGNMENT_TOP" - "VERTICAL_ALIGNMENT_CENTER" "VERTICAL_ALIGNMENT_BOTTOM" "VERTICAL_ALIGNMENT_FILL" "INLINE_ALIGNMENT_TOP_TO" - "INLINE_ALIGNMENT_CENTER_TO" "INLINE_ALIGNMENT_BASELINE_TO" "INLINE_ALIGNMENT_BOTTOM_TO" "INLINE_ALIGNMENT_TO_TOP" - "INLINE_ALIGNMENT_TO_CENTER" "INLINE_ALIGNMENT_TO_BASELINE" "INLINE_ALIGNMENT_TO_BOTTOM" "INLINE_ALIGNMENT_TOP" - "INLINE_ALIGNMENT_CENTER" "INLINE_ALIGNMENT_BOTTOM" "INLINE_ALIGNMENT_IMAGE_MASK" "INLINE_ALIGNMENT_TEXT_MASK" - "EULER_ORDER_XYZ" "EULER_ORDER_XZY" "EULER_ORDER_YXZ" "EULER_ORDER_YZX" "EULER_ORDER_ZXY" "EULER_ORDER_ZYX" "KEY_NONE" - "KEY_SPECIAL" "KEY_ESCAPE" "KEY_TAB" "KEY_BACKTAB" "KEY_BACKSPACE" "KEY_ENTER" "KEY_KP_ENTER" "KEY_INSERT" "KEY_DELETE" - "KEY_PAUSE" "KEY_PRINT" "KEY_SYSREQ" "KEY_CLEAR" "KEY_HOME" "KEY_END" "KEY_LEFT" "KEY_UP" "KEY_RIGHT" "KEY_DOWN" - "KEY_PAGEUP" "KEY_PAGEDOWN" "KEY_SHIFT" "KEY_CTRL" "KEY_META" "KEY_ALT" "KEY_CAPSLOCK" "KEY_NUMLOCK" "KEY_SCROLLLOCK" - "KEY_F1" "KEY_F2" "KEY_F3" "KEY_F4" "KEY_F5" "KEY_F6" "KEY_F7" "KEY_F8" "KEY_F9" "KEY_F10" "KEY_F11" "KEY_F12" - "KEY_F13" "KEY_F14" "KEY_F15" "KEY_F16" "KEY_F17" "KEY_F18" "KEY_F19" "KEY_F20" "KEY_F21" "KEY_F22" "KEY_F23" "KEY_F24" - "KEY_F25" "KEY_F26" "KEY_F27" "KEY_F28" "KEY_F29" "KEY_F30" "KEY_F31" "KEY_F32" "KEY_F33" "KEY_F34" "KEY_F35" - "KEY_KP_MULTIPLY" "KEY_KP_DIVIDE" "KEY_KP_SUBTRACT" "KEY_KP_PERIOD" "KEY_KP_ADD" "KEY_KP_0" "KEY_KP_1" "KEY_KP_2" - "KEY_KP_3" "KEY_KP_4" "KEY_KP_5" "KEY_KP_6" "KEY_KP_7" "KEY_KP_8" "KEY_KP_9" "KEY_MENU" "KEY_HYPER" "KEY_HELP" - "KEY_BACK" "KEY_FORWARD" "KEY_STOP" "KEY_REFRESH" "KEY_VOLUMEDOWN" "KEY_VOLUMEMUTE" "KEY_VOLUMEUP" "KEY_MEDIAPLAY" - "KEY_MEDIASTOP" "KEY_MEDIAPREVIOUS" "KEY_MEDIANEXT" "KEY_MEDIARECORD" "KEY_HOMEPAGE" "KEY_FAVORITES" "KEY_SEARCH" - "KEY_STANDBY" "KEY_OPENURL" "KEY_LAUNCHMAIL" "KEY_LAUNCHMEDIA" "KEY_LAUNCH0" "KEY_LAUNCH1" "KEY_LAUNCH2" "KEY_LAUNCH3" - "KEY_LAUNCH4" "KEY_LAUNCH5" "KEY_LAUNCH6" "KEY_LAUNCH7" "KEY_LAUNCH8" "KEY_LAUNCH9" "KEY_LAUNCHA" "KEY_LAUNCHB" - "KEY_LAUNCHC" "KEY_LAUNCHD" "KEY_LAUNCHE" "KEY_LAUNCHF" "KEY_UNKNOWN" "KEY_SPACE" "KEY_EXCLAM" "KEY_QUOTEDBL" - "KEY_NUMBERSIGN" "KEY_DOLLAR" "KEY_PERCENT" "KEY_AMPERSAND" "KEY_APOSTROPHE" "KEY_PARENLEFT" "KEY_PARENRIGHT" - "KEY_ASTERISK" "KEY_PLUS" "KEY_COMMA" "KEY_MINUS" "KEY_PERIOD" "KEY_SLASH" "KEY_0" "KEY_1" "KEY_2" "KEY_3" "KEY_4" - "KEY_5" "KEY_6" "KEY_7" "KEY_8" "KEY_9" "KEY_COLON" "KEY_SEMICOLON" "KEY_LESS" "KEY_EQUAL" "KEY_GREATER" "KEY_QUESTION" - "KEY_AT" "KEY_A" "KEY_B" "KEY_C" "KEY_D" "KEY_E" "KEY_F" "KEY_G" "KEY_H" "KEY_I" "KEY_J" "KEY_K" "KEY_L" "KEY_M" - "KEY_N" "KEY_O" "KEY_P" "KEY_Q" "KEY_R" "KEY_S" "KEY_T" "KEY_U" "KEY_V" "KEY_W" "KEY_X" "KEY_Y" "KEY_Z" - "KEY_BRACKETLEFT" "KEY_BACKSLASH" "KEY_BRACKETRIGHT" "KEY_ASCIICIRCUM" "KEY_UNDERSCORE" "KEY_QUOTELEFT" "KEY_BRACELEFT" - "KEY_BAR" "KEY_BRACERIGHT" "KEY_ASCIITILDE" "KEY_YEN" "KEY_SECTION" "KEY_GLOBE" "KEY_KEYBOARD" "KEY_JIS_EISU" - "KEY_JIS_KANA" "KEY_CODE_MASK" "KEY_MODIFIER_MASK" "KEY_MASK_CMD_OR_CTRL" "KEY_MASK_SHIFT" "KEY_MASK_ALT" - "KEY_MASK_META" "KEY_MASK_CTRL" "KEY_MASK_KPAD" "KEY_MASK_GROUP_SWITCH" "MOUSE_BUTTON_NONE" "MOUSE_BUTTON_LEFT" - "MOUSE_BUTTON_RIGHT" "MOUSE_BUTTON_MIDDLE" "MOUSE_BUTTON_WHEEL_UP" "MOUSE_BUTTON_WHEEL_DOWN" "MOUSE_BUTTON_WHEEL_LEFT" - "MOUSE_BUTTON_WHEEL_RIGHT" "MOUSE_BUTTON_XBUTTON1" "MOUSE_BUTTON_XBUTTON2" "MOUSE_BUTTON_MASK_LEFT" - "MOUSE_BUTTON_MASK_RIGHT" "MOUSE_BUTTON_MASK_MIDDLE" "MOUSE_BUTTON_MASK_MB_XBUTTON1" "MOUSE_BUTTON_MASK_MB_XBUTTON2" - "JOY_BUTTON_INVALID" "JOY_BUTTON_A" "JOY_BUTTON_B" "JOY_BUTTON_X" "JOY_BUTTON_Y" "JOY_BUTTON_BACK" "JOY_BUTTON_GUIDE" - "JOY_BUTTON_START" "JOY_BUTTON_LEFT_STICK" "JOY_BUTTON_RIGHT_STICK" "JOY_BUTTON_LEFT_SHOULDER" - "JOY_BUTTON_RIGHT_SHOULDER" "JOY_BUTTON_DPAD_UP" "JOY_BUTTON_DPAD_DOWN" "JOY_BUTTON_DPAD_LEFT" "JOY_BUTTON_DPAD_RIGHT" - "JOY_BUTTON_MISC1" "JOY_BUTTON_PADDLE1" "JOY_BUTTON_PADDLE2" "JOY_BUTTON_PADDLE3" "JOY_BUTTON_PADDLE4" - "JOY_BUTTON_TOUCHPAD" "JOY_BUTTON_SDL_MAX" "JOY_BUTTON_MAX" "JOY_AXIS_INVALID" "JOY_AXIS_LEFT_X" "JOY_AXIS_LEFT_Y" - "JOY_AXIS_RIGHT_X" "JOY_AXIS_RIGHT_Y" "JOY_AXIS_TRIGGER_LEFT" "JOY_AXIS_TRIGGER_RIGHT" "JOY_AXIS_SDL_MAX" - "JOY_AXIS_MAX" "MIDI_MESSAGE_NONE" "MIDI_MESSAGE_NOTE_OFF" "MIDI_MESSAGE_NOTE_ON" "MIDI_MESSAGE_AFTERTOUCH" - "MIDI_MESSAGE_CONTROL_CHANGE" "MIDI_MESSAGE_PROGRAM_CHANGE" "MIDI_MESSAGE_CHANNEL_PRESSURE" "MIDI_MESSAGE_PITCH_BEND" - "MIDI_MESSAGE_SYSTEM_EXCLUSIVE" "MIDI_MESSAGE_QUARTER_FRAME" "MIDI_MESSAGE_SONG_POSITION_POINTER" - "MIDI_MESSAGE_SONG_SELECT" "MIDI_MESSAGE_TUNE_REQUEST" "MIDI_MESSAGE_TIMING_CLOCK" "MIDI_MESSAGE_START" - "MIDI_MESSAGE_CONTINUE" "MIDI_MESSAGE_STOP" "MIDI_MESSAGE_ACTIVE_SENSING" "MIDI_MESSAGE_SYSTEM_RESET" "OK" "FAILED" - "ERR_UNAVAILABLE" "ERR_UNCONFIGURED" "ERR_UNAUTHORIZED" "ERR_PARAMETER_RANGE_ERROR" "ERR_OUT_OF_MEMORY" - "ERR_FILE_NOT_FOUND" "ERR_FILE_BAD_DRIVE" "ERR_FILE_BAD_PATH" "ERR_FILE_NO_PERMISSION" "ERR_FILE_ALREADY_IN_USE" - "ERR_FILE_CANT_OPEN" "ERR_FILE_CANT_WRITE" "ERR_FILE_CANT_READ" "ERR_FILE_UNRECOGNIZED" "ERR_FILE_CORRUPT" - "ERR_FILE_MISSING_DEPENDENCIES" "ERR_FILE_EOF" "ERR_CANT_OPEN" "ERR_CANT_CREATE" "ERR_QUERY_FAILED" - "ERR_ALREADY_IN_USE" "ERR_LOCKED" "ERR_TIMEOUT" "ERR_CANT_CONNECT" "ERR_CANT_RESOLVE" "ERR_CONNECTION_ERROR" - "ERR_CANT_ACQUIRE_RESOURCE" "ERR_CANT_FORK" "ERR_INVALID_DATA" "ERR_INVALID_PARAMETER" "ERR_ALREADY_EXISTS" - "ERR_DOES_NOT_EXIST" "ERR_DATABASE_CANT_READ" "ERR_DATABASE_CANT_WRITE" "ERR_COMPILATION_FAILED" "ERR_METHOD_NOT_FOUND" - "ERR_LINK_FAILED" "ERR_SCRIPT_FAILED" "ERR_CYCLIC_LINK" "ERR_INVALID_DECLARATION" "ERR_DUPLICATE_SYMBOL" - "ERR_PARSE_ERROR" "ERR_BUSY" "ERR_SKIP" "ERR_HELP" "ERR_BUG" "ERR_PRINTER_ON_FIRE" "PROPERTY_HINT_NONE" - "PROPERTY_HINT_RANGE" "PROPERTY_HINT_ENUM" "PROPERTY_HINT_ENUM_SUGGESTION" "PROPERTY_HINT_EXP_EASING" - "PROPERTY_HINT_LINK" "PROPERTY_HINT_FLAGS" "PROPERTY_HINT_LAYERS_2D_RENDER" "PROPERTY_HINT_LAYERS_2D_PHYSICS" - "PROPERTY_HINT_LAYERS_2D_NAVIGATION" "PROPERTY_HINT_LAYERS_3D_RENDER" "PROPERTY_HINT_LAYERS_3D_PHYSICS" - "PROPERTY_HINT_LAYERS_3D_NAVIGATION" "PROPERTY_HINT_FILE" "PROPERTY_HINT_DIR" "PROPERTY_HINT_GLOBAL_FILE" - "PROPERTY_HINT_GLOBAL_DIR" "PROPERTY_HINT_RESOURCE_TYPE" "PROPERTY_HINT_MULTILINE_TEXT" "PROPERTY_HINT_EXPRESSION" - "PROPERTY_HINT_PLACEHOLDER_TEXT" "PROPERTY_HINT_COLOR_NO_ALPHA" "PROPERTY_HINT_OBJECT_ID" "PROPERTY_HINT_TYPE_STRING" - "PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE" "PROPERTY_HINT_OBJECT_TOO_BIG" "PROPERTY_HINT_NODE_PATH_VALID_TYPES" - "PROPERTY_HINT_SAVE_FILE" "PROPERTY_HINT_GLOBAL_SAVE_FILE" "PROPERTY_HINT_INT_IS_OBJECTID" - "PROPERTY_HINT_INT_IS_POINTER" "PROPERTY_HINT_ARRAY_TYPE" "PROPERTY_HINT_LOCALE_ID" "PROPERTY_HINT_LOCALIZABLE_STRING" - "PROPERTY_HINT_NODE_TYPE" "PROPERTY_HINT_HIDE_QUATERNION_EDIT" "PROPERTY_HINT_PASSWORD" "PROPERTY_HINT_MAX" - "PROPERTY_USAGE_NONE" "PROPERTY_USAGE_STORAGE" "PROPERTY_USAGE_EDITOR" "PROPERTY_USAGE_INTERNAL" - "PROPERTY_USAGE_CHECKABLE" "PROPERTY_USAGE_CHECKED" "PROPERTY_USAGE_GROUP" "PROPERTY_USAGE_CATEGORY" - "PROPERTY_USAGE_SUBGROUP" "PROPERTY_USAGE_CLASS_IS_BITFIELD" "PROPERTY_USAGE_NO_INSTANCE_STATE" - "PROPERTY_USAGE_RESTART_IF_CHANGED" "PROPERTY_USAGE_SCRIPT_VARIABLE" "PROPERTY_USAGE_STORE_IF_NULL" - "PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED" "PROPERTY_USAGE_SCRIPT_DEFAULT_VALUE" "PROPERTY_USAGE_CLASS_IS_ENUM" - "PROPERTY_USAGE_NIL_IS_VARIANT" "PROPERTY_USAGE_ARRAY" "PROPERTY_USAGE_ALWAYS_DUPLICATE" - "PROPERTY_USAGE_NEVER_DUPLICATE" "PROPERTY_USAGE_HIGH_END_GFX" "PROPERTY_USAGE_NODE_PATH_FROM_SCENE_ROOT" - "PROPERTY_USAGE_RESOURCE_NOT_PERSISTENT" "PROPERTY_USAGE_KEYING_INCREMENTS" "PROPERTY_USAGE_DEFERRED_SET_RESOURCE" - "PROPERTY_USAGE_EDITOR_INSTANTIATE_OBJECT" "PROPERTY_USAGE_EDITOR_BASIC_SETTING" "PROPERTY_USAGE_READ_ONLY" - "PROPERTY_USAGE_DEFAULT" "PROPERTY_USAGE_NO_EDITOR" "METHOD_FLAG_NORMAL" "METHOD_FLAG_EDITOR" "METHOD_FLAG_CONST" - "METHOD_FLAG_VIRTUAL" "METHOD_FLAG_VARARG" "METHOD_FLAG_STATIC" "METHOD_FLAG_OBJECT_CORE" "METHOD_FLAGS_DEFAULT" - "TYPE_NIL" "TYPE_BOOL" "TYPE_INT" "TYPE_FLOAT" "TYPE_STRING" "TYPE_VECTOR2" "TYPE_VECTOR2I" "TYPE_RECT2" "TYPE_RECT2I" - "TYPE_VECTOR3" "TYPE_VECTOR3I" "TYPE_TRANSFORM2D" "TYPE_VECTOR4" "TYPE_VECTOR4I" "TYPE_PLANE" "TYPE_QUATERNION" - "TYPE_AABB" "TYPE_BASIS" "TYPE_TRANSFORM3D" "TYPE_PROJECTION" "TYPE_COLOR" "TYPE_STRING_NAME" "TYPE_NODE_PATH" - "TYPE_RID" "TYPE_OBJECT" "TYPE_CALLABLE" "TYPE_SIGNAL" "TYPE_DICTIONARY" "TYPE_ARRAY" "TYPE_PACKED_BYTE_ARRAY" - "TYPE_PACKED_INT32_ARRAY" "TYPE_PACKED_INT64_ARRAY" "TYPE_PACKED_FLOAT32_ARRAY" "TYPE_PACKED_FLOAT64_ARRAY" - "TYPE_PACKED_STRING_ARRAY" "TYPE_PACKED_VECTOR2_ARRAY" "TYPE_PACKED_VECTOR3_ARRAY" "TYPE_PACKED_COLOR_ARRAY" "TYPE_MAX" - "OP_EQUAL" "OP_NOT_EQUAL" "OP_LESS" "OP_LESS_EQUAL" "OP_GREATER" "OP_GREATER_EQUAL" "OP_ADD" "OP_SUBTRACT" - "OP_MULTIPLY" "OP_DIVIDE" "OP_NEGATE" "OP_POSITIVE" "OP_MODULE" "OP_POWER" "OP_SHIFT_LEFT" "OP_SHIFT_RIGHT" - "OP_BIT_AND" "OP_BIT_OR" "OP_BIT_XOR" "OP_BIT_NEGATE" "OP_AND" "OP_OR" "OP_XOR" "OP_NOT" "OP_IN" "OP_MAX" - )) + ; @GlobalScope + "SIDE_LEFT" "SIDE_TOP" "SIDE_RIGHT" "SIDE_BOTTOM" "CORNER_TOP_LEFT" "CORNER_TOP_RIGHT" "CORNER_BOTTOM_RIGHT" + "CORNER_BOTTOM_LEFT" "VERTICAL" "HORIZONTAL" "CLOCKWISE" "COUNTERCLOCKWISE" "HORIZONTAL_ALIGNMENT_LEFT" + "HORIZONTAL_ALIGNMENT_CENTER" "HORIZONTAL_ALIGNMENT_RIGHT" "HORIZONTAL_ALIGNMENT_FILL" "VERTICAL_ALIGNMENT_TOP" + "VERTICAL_ALIGNMENT_CENTER" "VERTICAL_ALIGNMENT_BOTTOM" "VERTICAL_ALIGNMENT_FILL" "INLINE_ALIGNMENT_TOP_TO" + "INLINE_ALIGNMENT_CENTER_TO" "INLINE_ALIGNMENT_BASELINE_TO" "INLINE_ALIGNMENT_BOTTOM_TO" "INLINE_ALIGNMENT_TO_TOP" + "INLINE_ALIGNMENT_TO_CENTER" "INLINE_ALIGNMENT_TO_BASELINE" "INLINE_ALIGNMENT_TO_BOTTOM" "INLINE_ALIGNMENT_TOP" + "INLINE_ALIGNMENT_CENTER" "INLINE_ALIGNMENT_BOTTOM" "INLINE_ALIGNMENT_IMAGE_MASK" "INLINE_ALIGNMENT_TEXT_MASK" + "EULER_ORDER_XYZ" "EULER_ORDER_XZY" "EULER_ORDER_YXZ" "EULER_ORDER_YZX" "EULER_ORDER_ZXY" "EULER_ORDER_ZYX" "KEY_NONE" + "KEY_SPECIAL" "KEY_ESCAPE" "KEY_TAB" "KEY_BACKTAB" "KEY_BACKSPACE" "KEY_ENTER" "KEY_KP_ENTER" "KEY_INSERT" "KEY_DELETE" + "KEY_PAUSE" "KEY_PRINT" "KEY_SYSREQ" "KEY_CLEAR" "KEY_HOME" "KEY_END" "KEY_LEFT" "KEY_UP" "KEY_RIGHT" "KEY_DOWN" + "KEY_PAGEUP" "KEY_PAGEDOWN" "KEY_SHIFT" "KEY_CTRL" "KEY_META" "KEY_ALT" "KEY_CAPSLOCK" "KEY_NUMLOCK" "KEY_SCROLLLOCK" + "KEY_F1" "KEY_F2" "KEY_F3" "KEY_F4" "KEY_F5" "KEY_F6" "KEY_F7" "KEY_F8" "KEY_F9" "KEY_F10" "KEY_F11" "KEY_F12" + "KEY_F13" "KEY_F14" "KEY_F15" "KEY_F16" "KEY_F17" "KEY_F18" "KEY_F19" "KEY_F20" "KEY_F21" "KEY_F22" "KEY_F23" "KEY_F24" + "KEY_F25" "KEY_F26" "KEY_F27" "KEY_F28" "KEY_F29" "KEY_F30" "KEY_F31" "KEY_F32" "KEY_F33" "KEY_F34" "KEY_F35" + "KEY_KP_MULTIPLY" "KEY_KP_DIVIDE" "KEY_KP_SUBTRACT" "KEY_KP_PERIOD" "KEY_KP_ADD" "KEY_KP_0" "KEY_KP_1" "KEY_KP_2" + "KEY_KP_3" "KEY_KP_4" "KEY_KP_5" "KEY_KP_6" "KEY_KP_7" "KEY_KP_8" "KEY_KP_9" "KEY_MENU" "KEY_HYPER" "KEY_HELP" + "KEY_BACK" "KEY_FORWARD" "KEY_STOP" "KEY_REFRESH" "KEY_VOLUMEDOWN" "KEY_VOLUMEMUTE" "KEY_VOLUMEUP" "KEY_MEDIAPLAY" + "KEY_MEDIASTOP" "KEY_MEDIAPREVIOUS" "KEY_MEDIANEXT" "KEY_MEDIARECORD" "KEY_HOMEPAGE" "KEY_FAVORITES" "KEY_SEARCH" + "KEY_STANDBY" "KEY_OPENURL" "KEY_LAUNCHMAIL" "KEY_LAUNCHMEDIA" "KEY_LAUNCH0" "KEY_LAUNCH1" "KEY_LAUNCH2" "KEY_LAUNCH3" + "KEY_LAUNCH4" "KEY_LAUNCH5" "KEY_LAUNCH6" "KEY_LAUNCH7" "KEY_LAUNCH8" "KEY_LAUNCH9" "KEY_LAUNCHA" "KEY_LAUNCHB" + "KEY_LAUNCHC" "KEY_LAUNCHD" "KEY_LAUNCHE" "KEY_LAUNCHF" "KEY_UNKNOWN" "KEY_SPACE" "KEY_EXCLAM" "KEY_QUOTEDBL" + "KEY_NUMBERSIGN" "KEY_DOLLAR" "KEY_PERCENT" "KEY_AMPERSAND" "KEY_APOSTROPHE" "KEY_PARENLEFT" "KEY_PARENRIGHT" + "KEY_ASTERISK" "KEY_PLUS" "KEY_COMMA" "KEY_MINUS" "KEY_PERIOD" "KEY_SLASH" "KEY_0" "KEY_1" "KEY_2" "KEY_3" "KEY_4" + "KEY_5" "KEY_6" "KEY_7" "KEY_8" "KEY_9" "KEY_COLON" "KEY_SEMICOLON" "KEY_LESS" "KEY_EQUAL" "KEY_GREATER" "KEY_QUESTION" + "KEY_AT" "KEY_A" "KEY_B" "KEY_C" "KEY_D" "KEY_E" "KEY_F" "KEY_G" "KEY_H" "KEY_I" "KEY_J" "KEY_K" "KEY_L" "KEY_M" + "KEY_N" "KEY_O" "KEY_P" "KEY_Q" "KEY_R" "KEY_S" "KEY_T" "KEY_U" "KEY_V" "KEY_W" "KEY_X" "KEY_Y" "KEY_Z" + "KEY_BRACKETLEFT" "KEY_BACKSLASH" "KEY_BRACKETRIGHT" "KEY_ASCIICIRCUM" "KEY_UNDERSCORE" "KEY_QUOTELEFT" "KEY_BRACELEFT" + "KEY_BAR" "KEY_BRACERIGHT" "KEY_ASCIITILDE" "KEY_YEN" "KEY_SECTION" "KEY_GLOBE" "KEY_KEYBOARD" "KEY_JIS_EISU" + "KEY_JIS_KANA" "KEY_CODE_MASK" "KEY_MODIFIER_MASK" "KEY_MASK_CMD_OR_CTRL" "KEY_MASK_SHIFT" "KEY_MASK_ALT" + "KEY_MASK_META" "KEY_MASK_CTRL" "KEY_MASK_KPAD" "KEY_MASK_GROUP_SWITCH" "MOUSE_BUTTON_NONE" "MOUSE_BUTTON_LEFT" + "MOUSE_BUTTON_RIGHT" "MOUSE_BUTTON_MIDDLE" "MOUSE_BUTTON_WHEEL_UP" "MOUSE_BUTTON_WHEEL_DOWN" "MOUSE_BUTTON_WHEEL_LEFT" + "MOUSE_BUTTON_WHEEL_RIGHT" "MOUSE_BUTTON_XBUTTON1" "MOUSE_BUTTON_XBUTTON2" "MOUSE_BUTTON_MASK_LEFT" + "MOUSE_BUTTON_MASK_RIGHT" "MOUSE_BUTTON_MASK_MIDDLE" "MOUSE_BUTTON_MASK_MB_XBUTTON1" "MOUSE_BUTTON_MASK_MB_XBUTTON2" + "JOY_BUTTON_INVALID" "JOY_BUTTON_A" "JOY_BUTTON_B" "JOY_BUTTON_X" "JOY_BUTTON_Y" "JOY_BUTTON_BACK" "JOY_BUTTON_GUIDE" + "JOY_BUTTON_START" "JOY_BUTTON_LEFT_STICK" "JOY_BUTTON_RIGHT_STICK" "JOY_BUTTON_LEFT_SHOULDER" + "JOY_BUTTON_RIGHT_SHOULDER" "JOY_BUTTON_DPAD_UP" "JOY_BUTTON_DPAD_DOWN" "JOY_BUTTON_DPAD_LEFT" "JOY_BUTTON_DPAD_RIGHT" + "JOY_BUTTON_MISC1" "JOY_BUTTON_PADDLE1" "JOY_BUTTON_PADDLE2" "JOY_BUTTON_PADDLE3" "JOY_BUTTON_PADDLE4" + "JOY_BUTTON_TOUCHPAD" "JOY_BUTTON_SDL_MAX" "JOY_BUTTON_MAX" "JOY_AXIS_INVALID" "JOY_AXIS_LEFT_X" "JOY_AXIS_LEFT_Y" + "JOY_AXIS_RIGHT_X" "JOY_AXIS_RIGHT_Y" "JOY_AXIS_TRIGGER_LEFT" "JOY_AXIS_TRIGGER_RIGHT" "JOY_AXIS_SDL_MAX" + "JOY_AXIS_MAX" "MIDI_MESSAGE_NONE" "MIDI_MESSAGE_NOTE_OFF" "MIDI_MESSAGE_NOTE_ON" "MIDI_MESSAGE_AFTERTOUCH" + "MIDI_MESSAGE_CONTROL_CHANGE" "MIDI_MESSAGE_PROGRAM_CHANGE" "MIDI_MESSAGE_CHANNEL_PRESSURE" "MIDI_MESSAGE_PITCH_BEND" + "MIDI_MESSAGE_SYSTEM_EXCLUSIVE" "MIDI_MESSAGE_QUARTER_FRAME" "MIDI_MESSAGE_SONG_POSITION_POINTER" + "MIDI_MESSAGE_SONG_SELECT" "MIDI_MESSAGE_TUNE_REQUEST" "MIDI_MESSAGE_TIMING_CLOCK" "MIDI_MESSAGE_START" + "MIDI_MESSAGE_CONTINUE" "MIDI_MESSAGE_STOP" "MIDI_MESSAGE_ACTIVE_SENSING" "MIDI_MESSAGE_SYSTEM_RESET" "OK" "FAILED" + "ERR_UNAVAILABLE" "ERR_UNCONFIGURED" "ERR_UNAUTHORIZED" "ERR_PARAMETER_RANGE_ERROR" "ERR_OUT_OF_MEMORY" + "ERR_FILE_NOT_FOUND" "ERR_FILE_BAD_DRIVE" "ERR_FILE_BAD_PATH" "ERR_FILE_NO_PERMISSION" "ERR_FILE_ALREADY_IN_USE" + "ERR_FILE_CANT_OPEN" "ERR_FILE_CANT_WRITE" "ERR_FILE_CANT_READ" "ERR_FILE_UNRECOGNIZED" "ERR_FILE_CORRUPT" + "ERR_FILE_MISSING_DEPENDENCIES" "ERR_FILE_EOF" "ERR_CANT_OPEN" "ERR_CANT_CREATE" "ERR_QUERY_FAILED" + "ERR_ALREADY_IN_USE" "ERR_LOCKED" "ERR_TIMEOUT" "ERR_CANT_CONNECT" "ERR_CANT_RESOLVE" "ERR_CONNECTION_ERROR" + "ERR_CANT_ACQUIRE_RESOURCE" "ERR_CANT_FORK" "ERR_INVALID_DATA" "ERR_INVALID_PARAMETER" "ERR_ALREADY_EXISTS" + "ERR_DOES_NOT_EXIST" "ERR_DATABASE_CANT_READ" "ERR_DATABASE_CANT_WRITE" "ERR_COMPILATION_FAILED" "ERR_METHOD_NOT_FOUND" + "ERR_LINK_FAILED" "ERR_SCRIPT_FAILED" "ERR_CYCLIC_LINK" "ERR_INVALID_DECLARATION" "ERR_DUPLICATE_SYMBOL" + "ERR_PARSE_ERROR" "ERR_BUSY" "ERR_SKIP" "ERR_HELP" "ERR_BUG" "ERR_PRINTER_ON_FIRE" "PROPERTY_HINT_NONE" + "PROPERTY_HINT_RANGE" "PROPERTY_HINT_ENUM" "PROPERTY_HINT_ENUM_SUGGESTION" "PROPERTY_HINT_EXP_EASING" + "PROPERTY_HINT_LINK" "PROPERTY_HINT_FLAGS" "PROPERTY_HINT_LAYERS_2D_RENDER" "PROPERTY_HINT_LAYERS_2D_PHYSICS" + "PROPERTY_HINT_LAYERS_2D_NAVIGATION" "PROPERTY_HINT_LAYERS_3D_RENDER" "PROPERTY_HINT_LAYERS_3D_PHYSICS" + "PROPERTY_HINT_LAYERS_3D_NAVIGATION" "PROPERTY_HINT_FILE" "PROPERTY_HINT_DIR" "PROPERTY_HINT_GLOBAL_FILE" + "PROPERTY_HINT_GLOBAL_DIR" "PROPERTY_HINT_RESOURCE_TYPE" "PROPERTY_HINT_MULTILINE_TEXT" "PROPERTY_HINT_EXPRESSION" + "PROPERTY_HINT_PLACEHOLDER_TEXT" "PROPERTY_HINT_COLOR_NO_ALPHA" "PROPERTY_HINT_OBJECT_ID" "PROPERTY_HINT_TYPE_STRING" + "PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE" "PROPERTY_HINT_OBJECT_TOO_BIG" "PROPERTY_HINT_NODE_PATH_VALID_TYPES" + "PROPERTY_HINT_SAVE_FILE" "PROPERTY_HINT_GLOBAL_SAVE_FILE" "PROPERTY_HINT_INT_IS_OBJECTID" + "PROPERTY_HINT_INT_IS_POINTER" "PROPERTY_HINT_ARRAY_TYPE" "PROPERTY_HINT_LOCALE_ID" "PROPERTY_HINT_LOCALIZABLE_STRING" + "PROPERTY_HINT_NODE_TYPE" "PROPERTY_HINT_HIDE_QUATERNION_EDIT" "PROPERTY_HINT_PASSWORD" "PROPERTY_HINT_MAX" + "PROPERTY_USAGE_NONE" "PROPERTY_USAGE_STORAGE" "PROPERTY_USAGE_EDITOR" "PROPERTY_USAGE_INTERNAL" + "PROPERTY_USAGE_CHECKABLE" "PROPERTY_USAGE_CHECKED" "PROPERTY_USAGE_GROUP" "PROPERTY_USAGE_CATEGORY" + "PROPERTY_USAGE_SUBGROUP" "PROPERTY_USAGE_CLASS_IS_BITFIELD" "PROPERTY_USAGE_NO_INSTANCE_STATE" + "PROPERTY_USAGE_RESTART_IF_CHANGED" "PROPERTY_USAGE_SCRIPT_VARIABLE" "PROPERTY_USAGE_STORE_IF_NULL" + "PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED" "PROPERTY_USAGE_SCRIPT_DEFAULT_VALUE" "PROPERTY_USAGE_CLASS_IS_ENUM" + "PROPERTY_USAGE_NIL_IS_VARIANT" "PROPERTY_USAGE_ARRAY" "PROPERTY_USAGE_ALWAYS_DUPLICATE" + "PROPERTY_USAGE_NEVER_DUPLICATE" "PROPERTY_USAGE_HIGH_END_GFX" "PROPERTY_USAGE_NODE_PATH_FROM_SCENE_ROOT" + "PROPERTY_USAGE_RESOURCE_NOT_PERSISTENT" "PROPERTY_USAGE_KEYING_INCREMENTS" "PROPERTY_USAGE_DEFERRED_SET_RESOURCE" + "PROPERTY_USAGE_EDITOR_INSTANTIATE_OBJECT" "PROPERTY_USAGE_EDITOR_BASIC_SETTING" "PROPERTY_USAGE_READ_ONLY" + "PROPERTY_USAGE_DEFAULT" "PROPERTY_USAGE_NO_EDITOR" "METHOD_FLAG_NORMAL" "METHOD_FLAG_EDITOR" "METHOD_FLAG_CONST" + "METHOD_FLAG_VIRTUAL" "METHOD_FLAG_VARARG" "METHOD_FLAG_STATIC" "METHOD_FLAG_OBJECT_CORE" "METHOD_FLAGS_DEFAULT" + "TYPE_NIL" "TYPE_BOOL" "TYPE_INT" "TYPE_FLOAT" "TYPE_STRING" "TYPE_VECTOR2" "TYPE_VECTOR2I" "TYPE_RECT2" "TYPE_RECT2I" + "TYPE_VECTOR3" "TYPE_VECTOR3I" "TYPE_TRANSFORM2D" "TYPE_VECTOR4" "TYPE_VECTOR4I" "TYPE_PLANE" "TYPE_QUATERNION" + "TYPE_AABB" "TYPE_BASIS" "TYPE_TRANSFORM3D" "TYPE_PROJECTION" "TYPE_COLOR" "TYPE_STRING_NAME" "TYPE_NODE_PATH" + "TYPE_RID" "TYPE_OBJECT" "TYPE_CALLABLE" "TYPE_SIGNAL" "TYPE_DICTIONARY" "TYPE_ARRAY" "TYPE_PACKED_BYTE_ARRAY" + "TYPE_PACKED_INT32_ARRAY" "TYPE_PACKED_INT64_ARRAY" "TYPE_PACKED_FLOAT32_ARRAY" "TYPE_PACKED_FLOAT64_ARRAY" + "TYPE_PACKED_STRING_ARRAY" "TYPE_PACKED_VECTOR2_ARRAY" "TYPE_PACKED_VECTOR3_ARRAY" "TYPE_PACKED_COLOR_ARRAY" "TYPE_MAX" + "OP_EQUAL" "OP_NOT_EQUAL" "OP_LESS" "OP_LESS_EQUAL" "OP_GREATER" "OP_GREATER_EQUAL" "OP_ADD" "OP_SUBTRACT" + "OP_MULTIPLY" "OP_DIVIDE" "OP_NEGATE" "OP_POSITIVE" "OP_MODULE" "OP_POWER" "OP_SHIFT_LEFT" "OP_SHIFT_RIGHT" + "OP_BIT_AND" "OP_BIT_OR" "OP_BIT_XOR" "OP_BIT_NEGATE" "OP_AND" "OP_OR" "OP_XOR" "OP_NOT" "OP_IN" "OP_MAX")) diff --git a/queries/go/locals.scm b/queries/go/locals.scm index 5702a2b93..20d8cd618 100644 --- a/queries/go/locals.scm +++ b/queries/go/locals.scm @@ -1,11 +1,11 @@ ( (function_declaration - name: (identifier) @local.definition.function) ;@function + name: (identifier) @local.definition.function) ; @function ) ( (method_declaration - name: (field_identifier) @local.definition.method); @function.method + name: (field_identifier) @local.definition.method) ; @function.method ) (short_var_declaration diff --git a/queries/hcl/highlights.scm b/queries/hcl/highlights.scm index bb0de9816..7aa8b86fe 100644 --- a/queries/hcl/highlights.scm +++ b/queries/hcl/highlights.scm @@ -58,7 +58,7 @@ [ (quoted_template_start) ; " - (quoted_template_end); " + (quoted_template_end) ; " (template_literal) ; non-interpolation/directive content ] @string diff --git a/queries/ispc/highlights.scm b/queries/ispc/highlights.scm index 804b6ee63..6b1d2bd96 100644 --- a/queries/ispc/highlights.scm +++ b/queries/ispc/highlights.scm @@ -92,134 +92,134 @@ ((type_identifier) @type.builtin (#lua-match? @type.builtin "^RNGState")) +; format-ignore (call_expression function: (identifier) @function.builtin (#any-of? @function.builtin - "abs" - "acos" - "all" - "alloca" - "and" - "any" - "aos_to_soa2" - "aos_to_soa3" - "aos_to_soa4" - "asin" - "assert" - "assume" - "atan" - "atan2" - "atomic_add_global" - "atomic_add_local" - "atomic_and_global" - "atomic_and_local" - "atomic_compare_exchange_global" - "atomic_compare_exchange_local" - "atomic_max_global" - "atomic_max_local" - "atomic_min_global" - "atomic_min_local" - "atomic_or_global" - "atomic_or_local" - "atomic_subtract_global" - "atomic_subtract_local" - "atomic_swap_global" - "atomic_swap_local" - "atomic_xor_global" - "atomic_xor_local" - "avg_down" - "avg_up" - "broadcast" - "ceil" - "clamp" - "clock" - "cos" - "count_leading_zeros" - "count_trailing_zeros" - "doublebits" - "exclusive_scan_add" - "exclusive_scan_and" - "exclusive_scan_or" - "exp" - "extract" - "fastmath" - "float16bits" - "floatbits" - "float_to_half" - "float_to_half_fast" - "float_to_srgb8" - "floor" - "frandom" - "frexp" - "half_to_float" - "half_to_float_fast" - "insert" - "intbits" - "invoke_sycl" - "isnan" - "ISPCAlloc" - "ISPCLaunch" - "ISPCSync" - "lanemask" - "ldexp" - "log" - "max" - "memcpy" - "memcpy64" - "memmove" - "memmove64" - "memory_barrier" - "memset" - "memset64" - "min" - "none" - "num_cores" - "or" - "packed_load_active" - "packed_store_active" - "packed_store_active2" - "packmask" - "popcnt" - "pow" - "prefetch_l1" - "prefetch_l2" - "prefetch_l3" - "prefetch_nt" - "prefetchw_l1" - "prefetchw_l2" - "prefetchw_l3" - "print" - "random" - "rcp" - "rcp_fast" - "rdrand" - "reduce_add" - "reduce_equal" - "reduce_max" - "reduce_min" - "rotate" - "round" - "rsqrt" - "rsqrt_fast" - "saturating_add" - "saturating_div" - "saturating_mul" - "saturating_sub" - "seed_rng" - "select" - "shift" - "shuffle" - "signbits" - "sign_extend" - "sin" - "sincos" - "soa_to_aos2" - "soa_to_aos3" - "soa_to_aos4" - "sqrt" - "streaming_load" - "streaming_load_uniform" - "streaming_store" - "tan" - "trunc" - )) + "abs" + "acos" + "all" + "alloca" + "and" + "any" + "aos_to_soa2" + "aos_to_soa3" + "aos_to_soa4" + "asin" + "assert" + "assume" + "atan" + "atan2" + "atomic_add_global" + "atomic_add_local" + "atomic_and_global" + "atomic_and_local" + "atomic_compare_exchange_global" + "atomic_compare_exchange_local" + "atomic_max_global" + "atomic_max_local" + "atomic_min_global" + "atomic_min_local" + "atomic_or_global" + "atomic_or_local" + "atomic_subtract_global" + "atomic_subtract_local" + "atomic_swap_global" + "atomic_swap_local" + "atomic_xor_global" + "atomic_xor_local" + "avg_down" + "avg_up" + "broadcast" + "ceil" + "clamp" + "clock" + "cos" + "count_leading_zeros" + "count_trailing_zeros" + "doublebits" + "exclusive_scan_add" + "exclusive_scan_and" + "exclusive_scan_or" + "exp" + "extract" + "fastmath" + "float16bits" + "floatbits" + "float_to_half" + "float_to_half_fast" + "float_to_srgb8" + "floor" + "frandom" + "frexp" + "half_to_float" + "half_to_float_fast" + "insert" + "intbits" + "invoke_sycl" + "isnan" + "ISPCAlloc" + "ISPCLaunch" + "ISPCSync" + "lanemask" + "ldexp" + "log" + "max" + "memcpy" + "memcpy64" + "memmove" + "memmove64" + "memory_barrier" + "memset" + "memset64" + "min" + "none" + "num_cores" + "or" + "packed_load_active" + "packed_store_active" + "packed_store_active2" + "packmask" + "popcnt" + "pow" + "prefetch_l1" + "prefetch_l2" + "prefetch_l3" + "prefetch_nt" + "prefetchw_l1" + "prefetchw_l2" + "prefetchw_l3" + "print" + "random" + "rcp" + "rcp_fast" + "rdrand" + "reduce_add" + "reduce_equal" + "reduce_max" + "reduce_min" + "rotate" + "round" + "rsqrt" + "rsqrt_fast" + "saturating_add" + "saturating_div" + "saturating_mul" + "saturating_sub" + "seed_rng" + "select" + "shift" + "shuffle" + "signbits" + "sign_extend" + "sin" + "sincos" + "soa_to_aos2" + "soa_to_aos3" + "soa_to_aos4" + "sqrt" + "streaming_load" + "streaming_load_uniform" + "streaming_store" + "tan" + "trunc")) diff --git a/queries/janet_simple/highlights.scm b/queries/janet_simple/highlights.scm index 25ce38635..c1408ec68 100644 --- a/queries/janet_simple/highlights.scm +++ b/queries/janet_simple/highlights.scm @@ -57,51 +57,53 @@ ;; (print name)))) ((sym_lit) @function.macro - (#any-of? @function.macro - ;; special forms - "break" - "def" "do" - "fn" - "if" - "quasiquote" "quote" - "set" "splice" - "unquote" "upscope" - "var" - "while" - ;; macros - "%=" "*=" - "++" "+=" - "--" "-=" - "->" "->>" "-?>" "-?>>" - "/=" - "and" "as->" "as-macro" "as?->" "assert" - "case" "catseq" "chr" "comment" "compif" "comptime" "compwhen" - "cond" "coro" - "def-" "default" "defdyn" "defer" "defmacro" "defmacro-" - "defn" "defn-" - "delay" "doc" - "each" "eachk" "eachp" - "eachy" ;; XXX: obsolete - "edefer" - "ev/do-thread" "ev/gather" "ev/spawn" "ev/spawn-thread" - "ev/with-deadline" - "ffi/defbind" - "fiber-fn" - "for" "forever" "forv" - "generate" - "if-let" "if-not" "if-with" "import" - "juxt" - "label" "let" "loop" - "match" - "or" - "prompt" "protect" - "repeat" - "seq" "short-fn" - "tabseq" "toggle" "tracev" "try" - "unless" "use" - "var-" "varfn" - "when" "when-let" "when-with" - "with" "with-dyns" "with-syms" "with-vars")) + ; format-ignore + (#any-of? @function.macro + ; special forms + "break" + "def" "do" + "fn" + "if" + "quasiquote" "quote" + "set" "splice" + "unquote" "upscope" + "var" + "while" + ; macros + "%=" "*=" + "++" "+=" + "--" "-=" + "->" "->>" "-?>" "-?>>" + "/=" + "and" "as->" "as-macro" "as?->" "assert" + "case" "catseq" "chr" "comment" "compif" "comptime" "compwhen" + "cond" "coro" + "def-" "default" "defdyn" "defer" "defmacro" "defmacro-" + "defn" "defn-" + "delay" "doc" + "each" "eachk" "eachp" + "eachy" + ; XXX: obsolete + "edefer" + "ev/do-thread" "ev/gather" "ev/spawn" "ev/spawn-thread" + "ev/with-deadline" + "ffi/defbind" + "fiber-fn" + "for" "forever" "forv" + "generate" + "if-let" "if-not" "if-with" "import" + "juxt" + "label" "let" "loop" + "match" + "or" + "prompt" "protect" + "repeat" + "seq" "short-fn" + "tabseq" "toggle" "tracev" "try" + "unless" "use" + "var-" "varfn" + "when" "when-let" "when-with" + "with" "with-dyns" "with-syms" "with-vars")) ;; All builtin functions ;; @@ -113,189 +115,190 @@ ;; (print name)))) ((sym_lit) @function.builtin - (#any-of? @function.builtin - "%" "*" "+" "-" "/" - "<" "<=" "=" ">" ">=" - ;; debugging -- start janet with -d and use (debug) to see these - ".break" ".breakall" ".bytecode" - ".clear" ".clearall" - ".disasm" - ".fiber" ".fn" ".frame" - ".locals" - ".next" ".nextc" - ".ppasm" - ".signal" ".slot" ".slots" ".source" ".stack" ".step" - ;; back to regularly scheduled program - "abstract?" "accumulate" "accumulate2" "all" "all-bindings" - "all-dynamics" "any?" "apply" - "array" - "array/clear" "array/concat" "array/ensure" "array/fill" - "array/insert" "array/new" "array/new-filled" "array/peek" - "array/pop" "array/push" "array/remove" "array/slice" "array/trim" - "array?" - "asm" - "bad-compile" "bad-parse" - "band" "blshift" "bnot" - "boolean?" - "bor" "brshift" "brushift" - "buffer" - "buffer/bit" "buffer/bit-clear" "buffer/bit-set" - "buffer/bit-toggle" "buffer/blit" "buffer/clear" "buffer/fill" - "buffer/format" "buffer/new" "buffer/new-filled" "buffer/popn" - "buffer/push" "buffer/push-at" "buffer/push-byte" - "buffer/push-string" "buffer/push-word" "buffer/slice" - "buffer/trim" - "buffer?" - "bxor" - "bytes?" - "cancel" - "cfunction?" - "cli-main" - "cmp" "comp" "compare" "compare<" "compare<=" "compare=" - "compare>" "compare>=" - "compile" "complement" "count" "curenv" - "debug" - "debug/arg-stack" "debug/break" "debug/fbreak" "debug/lineage" - "debug/stack" "debug/stacktrace" "debug/step" "debug/unbreak" - "debug/unfbreak" - "debugger" "debugger-on-status" - "dec" "deep-not=" "deep=" "defglobal" "describe" - "dictionary?" - "disasm" "distinct" "div" "doc*" "doc-format" "doc-of" "dofile" - "drop" "drop-until" "drop-while" "dyn" - "eflush" "empty?" "env-lookup" - "eprin" "eprinf" "eprint" "eprintf" "error" "errorf" - "ev/acquire-lock" "ev/acquire-rlock" "ev/acquire-wlock" - "ev/all-tasks" "ev/call" "ev/cancel" "ev/capacity" "ev/chan" - "ev/chan-close" "ev/chunk" "ev/close" "ev/count" "ev/deadline" - "ev/full" "ev/give" "ev/give-supervisor" "ev/go" "ev/lock" - "ev/read" "ev/release-lock" "ev/release-rlock" - "ev/release-wlock" "ev/rselect" "ev/rwlock" "ev/select" - "ev/sleep" "ev/take" "ev/thread" "ev/thread-chan" "ev/write" - "eval" "eval-string" "even?" "every?" "extreme" - "false?" - "ffi/align" "ffi/call" "ffi/calling-convetions" "ffi/close" - "ffi/context" "ffi/free" "ffi/jitfn" "ffi/lookup" "ffi/malloc" - "ffi/native" "ffi/pointer-buffer" "ffi/pointer-cfunction" - "ffi/read" "ffi/signature" "ffi/size" "ffi/struct" - "ffi/trampoline" "ffi/write" - "fiber/can-resume?" "fiber/current" "fiber/getenv" - "fiber/last-value" "fiber/maxstack" "fiber/new" "fiber/root" - "fiber/setenv" "fiber/setmaxstack" "fiber/status" - "fiber?" - "file/close" "file/flush" "file/lines" "file/open" "file/read" - "file/seek" "file/tell" "file/temp" "file/write" - "filter" "find" "find-index" "first" "flatten" "flatten-into" - "flush" "flycheck" "freeze" "frequencies" "from-pairs" - "function?" - "gccollect" "gcinterval" "gcsetinterval" - "gensym" "get" "get-in" "getline" "getproto" "group-by" - "has-key?" "has-value?" "hash" - "idempotent?" "identity" "import*" "in" "inc" "index-of" - "indexed?" - "int/s64" "int/to-bytes" "int/to-number" "int/u64" - "int?" - "interleave" "interpose" "invert" - "juxt*" - "keep" "keep-syntax" "keep-syntax!" "keys" - "keyword" - "keyword/slice" - "keyword?" - "kvs" - "last" "length" "load-image" - "macex" "macex1" "maclintf" - "make-env" "make-image" "map" "mapcat" "marshal" - "math/abs" "math/acos" "math/acosh" "math/asin" "math/asinh" - "math/atan" "math/atan2" "math/atanh" "math/cbrt" "math/ceil" - "math/cos" "math/cosh" "math/erf" "math/erfc" "math/exp" - "math/exp2" "math/expm1" "math/floor" "math/gamma" "math/gcd" - "math/hypot" "math/lcm" "math/log" "math/log-gamma" - "math/log10" "math/log1p" "math/log2" "math/next" "math/pow" - "math/random" "math/rng" "math/rng-buffer" "math/rng-int" - "math/rng-uniform" "math/round" "math/seedrandom" "math/sin" - "math/sinh" "math/sqrt" "math/tan" "math/tanh" "math/trunc" - "max" "max-of" "mean" "memcmp" "merge" "merge-into" - "merge-module" "min" "min-of" "mod" - "module/add-paths" "module/expand-path" "module/find" - "module/value" - "nan?" "nat?" "native" "neg?" - "net/accept" "net/accept-loop" "net/address" - "net/address-unpack" "net/chunk" "net/close" "net/connect" - "net/flush" "net/listen" "net/localname" "net/peername" - "net/read" "net/recv-from" "net/send-to" "net/server" - "net/setsockopt" "net/shutdown" "net/write" - "next" - "nil?" - "not" "not=" - "number?" - "odd?" "one?" - "os/arch" "os/cd" "os/chmod" "os/clock" "os/compiler" - "os/cpu-count" "os/cryptorand" "os/cwd" "os/date" "os/dir" - "os/environ" "os/execute" "os/exit" "os/getenv" "os/link" - "os/lstat" "os/mkdir" "os/mktime" "os/open" "os/perm-int" - "os/perm-string" "os/pipe" "os/proc-close" "os/proc-kill" - "os/proc-wait" "os/readlink" "os/realpath" "os/rename" - "os/rm" "os/rmdir" "os/setenv" "os/shell" "os/sleep" - "os/spawn" "os/stat" "os/symlink" "os/time" "os/touch" - "os/umask" "os/which" - "pairs" - "parse" "parse-all" - "parser/byte" "parser/clone" "parser/consume" "parser/eof" - "parser/error" "parser/flush" "parser/has-more" - "parser/insert" "parser/new" "parser/produce" "parser/state" - "parser/status" "parser/where" - "partial" "partition" "partition-by" - "peg/compile" "peg/find" "peg/find-all" "peg/match" - "peg/replace" "peg/replace-all" - "pos?" "postwalk" "pp" "prewalk" - "prin" "prinf" "print" "printf" - "product" "propagate" "put" "put-in" - "quit" - "range" "reduce" "reduce2" "repl" "require" "resume" - "return" "reverse" "reverse!" "run-context" - "sandbox" "scan-number" "setdyn" "signal" "slice" "slurp" - "some" "sort" "sort-by" "sorted" "sorted-by" "spit" - "string" - "string/ascii-lower" "string/ascii-upper" "string/bytes" - "string/check-set" "string/find" "string/find-all" - "string/format" "string/from-bytes" "string/has-prefix?" - "string/has-suffix?" "string/join" "string/repeat" - "string/replace" "string/replace-all" "string/reverse" - "string/slice" "string/split" "string/trim" "string/triml" - "string/trimr" - "string?" - "struct" - "struct/getproto" "struct/proto-flatten" "struct/to-table" - "struct/with-proto" - "struct?" - "sum" - "symbol" - "symbol/slice" - "symbol?" - "table" - "table/clear" "table/clone" "table/getproto" "table/new" - "table/proto-flatten" "table/rawget" "table/setproto" - "table/to-struct" - "table?" - "take" "take-until" "take-while" - ;; XXX: obsolete - "tarray/buffer" "tarray/copy-bytes" "tarray/length" - "tarray/new" "tarray/properties" "tarray/slice" - "tarray/swap-bytes" - ;; XXX: obsolete - "thread/close" "thread/current" "thread/exit" "thread/new" - "thread/receive" "thread/send" - ;; end of obsolete - "trace" "true?" "truthy?" - "tuple" - "tuple/brackets" "tuple/setmap" "tuple/slice" - "tuple/sourcemap" "tuple/type" - "tuple?" - "type" - "unmarshal" "untrace" "update" "update-in" - "values" "varglobal" - "walk" "warn-compile" - "xprin" "xprinf" "xprint" "xprintf" - "yield" - "zero?" "zipcoll")) + ; format-ignore + (#any-of? @function.builtin + "%" "*" "+" "-" "/" + "<" "<=" "=" ">" ">=" + ; debugging -- start janet with -d and use (debug) to see these + ".break" ".breakall" ".bytecode" + ".clear" ".clearall" + ".disasm" + ".fiber" ".fn" ".frame" + ".locals" + ".next" ".nextc" + ".ppasm" + ".signal" ".slot" ".slots" ".source" ".stack" ".step" + ; back to regularly scheduled program + "abstract?" "accumulate" "accumulate2" "all" "all-bindings" + "all-dynamics" "any?" "apply" + "array" + "array/clear" "array/concat" "array/ensure" "array/fill" + "array/insert" "array/new" "array/new-filled" "array/peek" + "array/pop" "array/push" "array/remove" "array/slice" "array/trim" + "array?" + "asm" + "bad-compile" "bad-parse" + "band" "blshift" "bnot" + "boolean?" + "bor" "brshift" "brushift" + "buffer" + "buffer/bit" "buffer/bit-clear" "buffer/bit-set" + "buffer/bit-toggle" "buffer/blit" "buffer/clear" "buffer/fill" + "buffer/format" "buffer/new" "buffer/new-filled" "buffer/popn" + "buffer/push" "buffer/push-at" "buffer/push-byte" + "buffer/push-string" "buffer/push-word" "buffer/slice" + "buffer/trim" + "buffer?" + "bxor" + "bytes?" + "cancel" + "cfunction?" + "cli-main" + "cmp" "comp" "compare" "compare<" "compare<=" "compare=" + "compare>" "compare>=" + "compile" "complement" "count" "curenv" + "debug" + "debug/arg-stack" "debug/break" "debug/fbreak" "debug/lineage" + "debug/stack" "debug/stacktrace" "debug/step" "debug/unbreak" + "debug/unfbreak" + "debugger" "debugger-on-status" + "dec" "deep-not=" "deep=" "defglobal" "describe" + "dictionary?" + "disasm" "distinct" "div" "doc*" "doc-format" "doc-of" "dofile" + "drop" "drop-until" "drop-while" "dyn" + "eflush" "empty?" "env-lookup" + "eprin" "eprinf" "eprint" "eprintf" "error" "errorf" + "ev/acquire-lock" "ev/acquire-rlock" "ev/acquire-wlock" + "ev/all-tasks" "ev/call" "ev/cancel" "ev/capacity" "ev/chan" + "ev/chan-close" "ev/chunk" "ev/close" "ev/count" "ev/deadline" + "ev/full" "ev/give" "ev/give-supervisor" "ev/go" "ev/lock" + "ev/read" "ev/release-lock" "ev/release-rlock" + "ev/release-wlock" "ev/rselect" "ev/rwlock" "ev/select" + "ev/sleep" "ev/take" "ev/thread" "ev/thread-chan" "ev/write" + "eval" "eval-string" "even?" "every?" "extreme" + "false?" + "ffi/align" "ffi/call" "ffi/calling-convetions" "ffi/close" + "ffi/context" "ffi/free" "ffi/jitfn" "ffi/lookup" "ffi/malloc" + "ffi/native" "ffi/pointer-buffer" "ffi/pointer-cfunction" + "ffi/read" "ffi/signature" "ffi/size" "ffi/struct" + "ffi/trampoline" "ffi/write" + "fiber/can-resume?" "fiber/current" "fiber/getenv" + "fiber/last-value" "fiber/maxstack" "fiber/new" "fiber/root" + "fiber/setenv" "fiber/setmaxstack" "fiber/status" + "fiber?" + "file/close" "file/flush" "file/lines" "file/open" "file/read" + "file/seek" "file/tell" "file/temp" "file/write" + "filter" "find" "find-index" "first" "flatten" "flatten-into" + "flush" "flycheck" "freeze" "frequencies" "from-pairs" + "function?" + "gccollect" "gcinterval" "gcsetinterval" + "gensym" "get" "get-in" "getline" "getproto" "group-by" + "has-key?" "has-value?" "hash" + "idempotent?" "identity" "import*" "in" "inc" "index-of" + "indexed?" + "int/s64" "int/to-bytes" "int/to-number" "int/u64" + "int?" + "interleave" "interpose" "invert" + "juxt*" + "keep" "keep-syntax" "keep-syntax!" "keys" + "keyword" + "keyword/slice" + "keyword?" + "kvs" + "last" "length" "load-image" + "macex" "macex1" "maclintf" + "make-env" "make-image" "map" "mapcat" "marshal" + "math/abs" "math/acos" "math/acosh" "math/asin" "math/asinh" + "math/atan" "math/atan2" "math/atanh" "math/cbrt" "math/ceil" + "math/cos" "math/cosh" "math/erf" "math/erfc" "math/exp" + "math/exp2" "math/expm1" "math/floor" "math/gamma" "math/gcd" + "math/hypot" "math/lcm" "math/log" "math/log-gamma" + "math/log10" "math/log1p" "math/log2" "math/next" "math/pow" + "math/random" "math/rng" "math/rng-buffer" "math/rng-int" + "math/rng-uniform" "math/round" "math/seedrandom" "math/sin" + "math/sinh" "math/sqrt" "math/tan" "math/tanh" "math/trunc" + "max" "max-of" "mean" "memcmp" "merge" "merge-into" + "merge-module" "min" "min-of" "mod" + "module/add-paths" "module/expand-path" "module/find" + "module/value" + "nan?" "nat?" "native" "neg?" + "net/accept" "net/accept-loop" "net/address" + "net/address-unpack" "net/chunk" "net/close" "net/connect" + "net/flush" "net/listen" "net/localname" "net/peername" + "net/read" "net/recv-from" "net/send-to" "net/server" + "net/setsockopt" "net/shutdown" "net/write" + "next" + "nil?" + "not" "not=" + "number?" + "odd?" "one?" + "os/arch" "os/cd" "os/chmod" "os/clock" "os/compiler" + "os/cpu-count" "os/cryptorand" "os/cwd" "os/date" "os/dir" + "os/environ" "os/execute" "os/exit" "os/getenv" "os/link" + "os/lstat" "os/mkdir" "os/mktime" "os/open" "os/perm-int" + "os/perm-string" "os/pipe" "os/proc-close" "os/proc-kill" + "os/proc-wait" "os/readlink" "os/realpath" "os/rename" + "os/rm" "os/rmdir" "os/setenv" "os/shell" "os/sleep" + "os/spawn" "os/stat" "os/symlink" "os/time" "os/touch" + "os/umask" "os/which" + "pairs" + "parse" "parse-all" + "parser/byte" "parser/clone" "parser/consume" "parser/eof" + "parser/error" "parser/flush" "parser/has-more" + "parser/insert" "parser/new" "parser/produce" "parser/state" + "parser/status" "parser/where" + "partial" "partition" "partition-by" + "peg/compile" "peg/find" "peg/find-all" "peg/match" + "peg/replace" "peg/replace-all" + "pos?" "postwalk" "pp" "prewalk" + "prin" "prinf" "print" "printf" + "product" "propagate" "put" "put-in" + "quit" + "range" "reduce" "reduce2" "repl" "require" "resume" + "return" "reverse" "reverse!" "run-context" + "sandbox" "scan-number" "setdyn" "signal" "slice" "slurp" + "some" "sort" "sort-by" "sorted" "sorted-by" "spit" + "string" + "string/ascii-lower" "string/ascii-upper" "string/bytes" + "string/check-set" "string/find" "string/find-all" + "string/format" "string/from-bytes" "string/has-prefix?" + "string/has-suffix?" "string/join" "string/repeat" + "string/replace" "string/replace-all" "string/reverse" + "string/slice" "string/split" "string/trim" "string/triml" + "string/trimr" + "string?" + "struct" + "struct/getproto" "struct/proto-flatten" "struct/to-table" + "struct/with-proto" + "struct?" + "sum" + "symbol" + "symbol/slice" + "symbol?" + "table" + "table/clear" "table/clone" "table/getproto" "table/new" + "table/proto-flatten" "table/rawget" "table/setproto" + "table/to-struct" + "table?" + "take" "take-until" "take-while" + ; XXX: obsolete + "tarray/buffer" "tarray/copy-bytes" "tarray/length" + "tarray/new" "tarray/properties" "tarray/slice" + "tarray/swap-bytes" + ; XXX: obsolete + "thread/close" "thread/current" "thread/exit" "thread/new" + "thread/receive" "thread/send" + ; end of obsolete + "trace" "true?" "truthy?" + "tuple" + "tuple/brackets" "tuple/setmap" "tuple/slice" + "tuple/sourcemap" "tuple/type" + "tuple?" + "type" + "unmarshal" "untrace" "update" "update-in" + "values" "varglobal" + "walk" "warn-compile" + "xprin" "xprinf" "xprint" "xprintf" + "yield" + "zero?" "zipcoll")) diff --git a/queries/java/indents.scm b/queries/java/indents.scm index 73fb386e3..8ce928eb8 100644 --- a/queries/java/indents.scm +++ b/queries/java/indents.scm @@ -1,3 +1,4 @@ +; format-ignore [ ; ... refers to the portion that this indent query will have effects on (class_body) ; { ... } of `class X` diff --git a/queries/java/locals.scm b/queries/java/locals.scm index 0e8758b6d..5de5f5ff5 100644 --- a/queries/java/locals.scm +++ b/queries/java/locals.scm @@ -70,6 +70,7 @@ name: (identifier) @local.definition.parameter) (catch_formal_parameter name: (identifier) @local.definition.parameter) + (inferred_parameters (identifier) @local.definition.parameter) ; (x,y) -> ... (lambda_expression parameters: (identifier) @local.definition.parameter) ; x -> ... diff --git a/queries/jq/highlights.scm b/queries/jq/highlights.scm index e9967e95e..968ba87a0 100644 --- a/queries/jq/highlights.scm +++ b/queries/jq/highlights.scm @@ -59,197 +59,198 @@ ; jq -n 'builtins | map(split("/")[0]) | unique | .[]' ((funcname) @function.builtin - (#any-of? @function.builtin - "IN" - "INDEX" - "JOIN" - "acos" - "acosh" - "add" - "all" - "any" - "arrays" - "ascii_downcase" - "ascii_upcase" - "asin" - "asinh" - "atan" - "atan2" - "atanh" - "booleans" - "bsearch" - "builtins" - "capture" - "cbrt" - "ceil" - "combinations" - "contains" - "copysign" - "cos" - "cosh" - "debug" - "del" - "delpaths" - "drem" - "empty" - "endswith" - "env" - "erf" - "erfc" - "error" - "exp" - "exp10" - "exp2" - "explode" - "expm1" - "fabs" - "fdim" - "finites" - "first" - "flatten" - "floor" - "fma" - "fmax" - "fmin" - "fmod" - "format" - "frexp" - "from_entries" - "fromdate" - "fromdateiso8601" - "fromjson" - "fromstream" - "gamma" - "get_jq_origin" - "get_prog_origin" - "get_search_list" - "getpath" - "gmtime" - "group_by" - "gsub" - "halt" - "halt_error" - "has" - "hypot" - "implode" - "in" - "index" - "indices" - "infinite" - "input" - "input_filename" - "input_line_number" - "inputs" - "inside" - "isempty" - "isfinite" - "isinfinite" - "isnan" - "isnormal" - "iterables" - "j0" - "j1" - "jn" - "join" - "keys" - "keys_unsorted" - "last" - "ldexp" - "leaf_paths" - "length" - "lgamma" - "lgamma_r" - "limit" - "localtime" - "log" - "log10" - "log1p" - "log2" - "logb" - "ltrimstr" - "map" - "map_values" - "match" - "max" - "max_by" - "min" - "min_by" - "mktime" - "modf" - "modulemeta" - "nan" - "nearbyint" - "nextafter" - "nexttoward" - "normals" - "not" - "now" - "nth" - "nulls" - "numbers" - "objects" - "path" - "paths" - "pow" - "pow10" - "range" - "recurse" - "recurse_down" - "remainder" - "repeat" - "reverse" - "rindex" - "rint" - "round" - "rtrimstr" - "scalars" - "scalars_or_empty" - "scalb" - "scalbln" - "scan" - "select" - "setpath" - "significand" - "sin" - "sinh" - "sort" - "sort_by" - "split" - "splits" - "sqrt" - "startswith" - "stderr" - "strflocaltime" - "strftime" - "strings" - "strptime" - "sub" - "tan" - "tanh" - "test" - "tgamma" - "to_entries" - "todate" - "todateiso8601" - "tojson" - "tonumber" - "tostream" - "tostring" - "transpose" - "trunc" - "truncate_stream" - "type" - "unique" - "unique_by" - "until" - "utf8bytelength" - "values" - "walk" - "while" - "with_entries" - "y0" - "y1" - "yn")) + ; format-ignore + (#any-of? @function.builtin + "IN" + "INDEX" + "JOIN" + "acos" + "acosh" + "add" + "all" + "any" + "arrays" + "ascii_downcase" + "ascii_upcase" + "asin" + "asinh" + "atan" + "atan2" + "atanh" + "booleans" + "bsearch" + "builtins" + "capture" + "cbrt" + "ceil" + "combinations" + "contains" + "copysign" + "cos" + "cosh" + "debug" + "del" + "delpaths" + "drem" + "empty" + "endswith" + "env" + "erf" + "erfc" + "error" + "exp" + "exp10" + "exp2" + "explode" + "expm1" + "fabs" + "fdim" + "finites" + "first" + "flatten" + "floor" + "fma" + "fmax" + "fmin" + "fmod" + "format" + "frexp" + "from_entries" + "fromdate" + "fromdateiso8601" + "fromjson" + "fromstream" + "gamma" + "get_jq_origin" + "get_prog_origin" + "get_search_list" + "getpath" + "gmtime" + "group_by" + "gsub" + "halt" + "halt_error" + "has" + "hypot" + "implode" + "in" + "index" + "indices" + "infinite" + "input" + "input_filename" + "input_line_number" + "inputs" + "inside" + "isempty" + "isfinite" + "isinfinite" + "isnan" + "isnormal" + "iterables" + "j0" + "j1" + "jn" + "join" + "keys" + "keys_unsorted" + "last" + "ldexp" + "leaf_paths" + "length" + "lgamma" + "lgamma_r" + "limit" + "localtime" + "log" + "log10" + "log1p" + "log2" + "logb" + "ltrimstr" + "map" + "map_values" + "match" + "max" + "max_by" + "min" + "min_by" + "mktime" + "modf" + "modulemeta" + "nan" + "nearbyint" + "nextafter" + "nexttoward" + "normals" + "not" + "now" + "nth" + "nulls" + "numbers" + "objects" + "path" + "paths" + "pow" + "pow10" + "range" + "recurse" + "recurse_down" + "remainder" + "repeat" + "reverse" + "rindex" + "rint" + "round" + "rtrimstr" + "scalars" + "scalars_or_empty" + "scalb" + "scalbln" + "scan" + "select" + "setpath" + "significand" + "sin" + "sinh" + "sort" + "sort_by" + "split" + "splits" + "sqrt" + "startswith" + "stderr" + "strflocaltime" + "strftime" + "strings" + "strptime" + "sub" + "tan" + "tanh" + "test" + "tgamma" + "to_entries" + "todate" + "todateiso8601" + "tojson" + "tonumber" + "tostream" + "tostring" + "transpose" + "trunc" + "truncate_stream" + "type" + "unique" + "unique_by" + "until" + "utf8bytelength" + "values" + "walk" + "while" + "with_entries" + "y0" + "y1" + "yn")) ; Keywords diff --git a/queries/julia/highlights.scm b/queries/julia/highlights.scm index 20a154618..21ae1adb0 100644 --- a/queries/julia/highlights.scm +++ b/queries/julia/highlights.scm @@ -127,216 +127,217 @@ ;; type_names = sort(union(get_types(Core), get_types(Base))) ;; ((identifier) @type.builtin - (#any-of? @type.builtin - "AbstractArray" - "AbstractChannel" - "AbstractChar" - "AbstractDict" - "AbstractDisplay" - "AbstractFloat" - "AbstractIrrational" - "AbstractLock" - "AbstractMatch" - "AbstractMatrix" - "AbstractPattern" - "AbstractRange" - "AbstractSet" - "AbstractSlices" - "AbstractString" - "AbstractUnitRange" - "AbstractVecOrMat" - "AbstractVector" - "Any" - "ArgumentError" - "Array" - "AssertionError" - "Atomic" - "BigFloat" - "BigInt" - "BitArray" - "BitMatrix" - "BitSet" - "BitVector" - "Bool" - "BoundsError" - "By" - "CanonicalIndexError" - "CapturedException" - "CartesianIndex" - "CartesianIndices" - "Cchar" - "Cdouble" - "Cfloat" - "Channel" - "Char" - "Cint" - "Cintmax_t" - "Clong" - "Clonglong" - "Cmd" - "Colon" - "ColumnSlices" - "Complex" - "ComplexF16" - "ComplexF32" - "ComplexF64" - "ComposedFunction" - "CompositeException" - "ConcurrencyViolationError" - "Condition" - "Cptrdiff_t" - "Cshort" - "Csize_t" - "Cssize_t" - "Cstring" - "Cuchar" - "Cuint" - "Cuintmax_t" - "Culong" - "Culonglong" - "Cushort" - "Cvoid" - "Cwchar_t" - "Cwstring" - "DataType" - "DenseArray" - "DenseMatrix" - "DenseVecOrMat" - "DenseVector" - "Dict" - "DimensionMismatch" - "Dims" - "DivideError" - "DomainError" - "EOFError" - "Enum" - "ErrorException" - "Exception" - "ExponentialBackOff" - "Expr" - "Float16" - "Float32" - "Float64" - "Function" - "GlobalRef" - "HTML" - "IO" - "IOBuffer" - "IOContext" - "IOStream" - "IdDict" - "IndexCartesian" - "IndexLinear" - "IndexStyle" - "InexactError" - "InitError" - "Int" - "Int128" - "Int16" - "Int32" - "Int64" - "Int8" - "Integer" - "InterruptException" - "InvalidStateException" - "Irrational" - "KeyError" - "LazyString" - "LinRange" - "LineNumberNode" - "LinearIndices" - "LoadError" - "Lt" - "MIME" - "Matrix" - "Method" - "MethodError" - "Missing" - "MissingException" - "Module" - "NTuple" - "NamedTuple" - "Nothing" - "Number" - "Ordering" - "OrdinalRange" - "OutOfMemoryError" - "OverflowError" - "Pair" - "ParseError" - "PartialQuickSort" - "Perm" - "PermutedDimsArray" - "Pipe" - "ProcessFailedException" - "Ptr" - "QuoteNode" - "Rational" - "RawFD" - "ReadOnlyMemoryError" - "Real" - "ReentrantLock" - "Ref" - "Regex" - "RegexMatch" - "Returns" - "ReverseOrdering" - "RoundingMode" - "RowSlices" - "SegmentationFault" - "Set" - "Signed" - "Slices" - "Some" - "SpinLock" - "StackFrame" - "StackOverflowError" - "StackTrace" - "Stateful" - "StepRange" - "StepRangeLen" - "StridedArray" - "StridedMatrix" - "StridedVecOrMat" - "StridedVector" - "String" - "StringIndexError" - "SubArray" - "SubString" - "SubstitutionString" - "Symbol" - "SystemError" - "Task" - "TaskFailedException" - "Text" - "TextDisplay" - "Timer" - "Tmstruct" - "Tuple" - "Type" - "TypeError" - "TypeVar" - "UInt" - "UInt128" - "UInt16" - "UInt32" - "UInt64" - "UInt8" - "UndefInitializer" - "UndefKeywordError" - "UndefRefError" - "UndefVarError" - "Union" - "UnionAll" - "UnitRange" - "Unsigned" - "Val" - "VecElement" - "VecOrMat" - "Vector" - "VersionNumber" - "WeakKeyDict" - "WeakRef")) + ; format-ignore + (#any-of? @type.builtin + "AbstractArray" + "AbstractChannel" + "AbstractChar" + "AbstractDict" + "AbstractDisplay" + "AbstractFloat" + "AbstractIrrational" + "AbstractLock" + "AbstractMatch" + "AbstractMatrix" + "AbstractPattern" + "AbstractRange" + "AbstractSet" + "AbstractSlices" + "AbstractString" + "AbstractUnitRange" + "AbstractVecOrMat" + "AbstractVector" + "Any" + "ArgumentError" + "Array" + "AssertionError" + "Atomic" + "BigFloat" + "BigInt" + "BitArray" + "BitMatrix" + "BitSet" + "BitVector" + "Bool" + "BoundsError" + "By" + "CanonicalIndexError" + "CapturedException" + "CartesianIndex" + "CartesianIndices" + "Cchar" + "Cdouble" + "Cfloat" + "Channel" + "Char" + "Cint" + "Cintmax_t" + "Clong" + "Clonglong" + "Cmd" + "Colon" + "ColumnSlices" + "Complex" + "ComplexF16" + "ComplexF32" + "ComplexF64" + "ComposedFunction" + "CompositeException" + "ConcurrencyViolationError" + "Condition" + "Cptrdiff_t" + "Cshort" + "Csize_t" + "Cssize_t" + "Cstring" + "Cuchar" + "Cuint" + "Cuintmax_t" + "Culong" + "Culonglong" + "Cushort" + "Cvoid" + "Cwchar_t" + "Cwstring" + "DataType" + "DenseArray" + "DenseMatrix" + "DenseVecOrMat" + "DenseVector" + "Dict" + "DimensionMismatch" + "Dims" + "DivideError" + "DomainError" + "EOFError" + "Enum" + "ErrorException" + "Exception" + "ExponentialBackOff" + "Expr" + "Float16" + "Float32" + "Float64" + "Function" + "GlobalRef" + "HTML" + "IO" + "IOBuffer" + "IOContext" + "IOStream" + "IdDict" + "IndexCartesian" + "IndexLinear" + "IndexStyle" + "InexactError" + "InitError" + "Int" + "Int128" + "Int16" + "Int32" + "Int64" + "Int8" + "Integer" + "InterruptException" + "InvalidStateException" + "Irrational" + "KeyError" + "LazyString" + "LinRange" + "LineNumberNode" + "LinearIndices" + "LoadError" + "Lt" + "MIME" + "Matrix" + "Method" + "MethodError" + "Missing" + "MissingException" + "Module" + "NTuple" + "NamedTuple" + "Nothing" + "Number" + "Ordering" + "OrdinalRange" + "OutOfMemoryError" + "OverflowError" + "Pair" + "ParseError" + "PartialQuickSort" + "Perm" + "PermutedDimsArray" + "Pipe" + "ProcessFailedException" + "Ptr" + "QuoteNode" + "Rational" + "RawFD" + "ReadOnlyMemoryError" + "Real" + "ReentrantLock" + "Ref" + "Regex" + "RegexMatch" + "Returns" + "ReverseOrdering" + "RoundingMode" + "RowSlices" + "SegmentationFault" + "Set" + "Signed" + "Slices" + "Some" + "SpinLock" + "StackFrame" + "StackOverflowError" + "StackTrace" + "Stateful" + "StepRange" + "StepRangeLen" + "StridedArray" + "StridedMatrix" + "StridedVecOrMat" + "StridedVector" + "String" + "StringIndexError" + "SubArray" + "SubString" + "SubstitutionString" + "Symbol" + "SystemError" + "Task" + "TaskFailedException" + "Text" + "TextDisplay" + "Timer" + "Tmstruct" + "Tuple" + "Type" + "TypeError" + "TypeVar" + "UInt" + "UInt128" + "UInt16" + "UInt32" + "UInt64" + "UInt8" + "UndefInitializer" + "UndefKeywordError" + "UndefRefError" + "UndefVarError" + "Union" + "UnionAll" + "UnitRange" + "Unsigned" + "Val" + "VecElement" + "VecOrMat" + "Vector" + "VersionNumber" + "WeakKeyDict" + "WeakRef")) ((identifier) @variable.builtin (#any-of? @variable.builtin "begin" "end") diff --git a/queries/julia/locals.scm b/queries/julia/locals.scm index dd00f8a9b..9e607cfd1 100644 --- a/queries/julia/locals.scm +++ b/queries/julia/locals.scm @@ -52,8 +52,9 @@ parameter: (identifier) @local.definition.parameter (_)) +;; Single parameter arrow function (function_expression - . (identifier) @local.definition.parameter) ;; Single parameter arrow function + . (identifier) @local.definition.parameter) ;;; Function/macro definitions diff --git a/queries/lua/highlights.scm b/queries/lua/highlights.scm index 0cb861596..ea87c0da0 100644 --- a/queries/lua/highlights.scm +++ b/queries/lua/highlights.scm @@ -220,8 +220,9 @@ (function_call (identifier) @function.builtin + ; format-ignore (#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" "load" "loadfile" "loadstring" "module" "next" "pairs" "pcall" "print" "rawequal" "rawget" "rawlen" "rawset" "require" "select" "setfenv" "setmetatable" diff --git a/queries/lua/injections.scm b/queries/lua/injections.scm index 03e057dfe..2ce156574 100644 --- a/queries/lua/injections.scm +++ b/queries/lua/injections.scm @@ -67,14 +67,15 @@ . (string content: (_) @injection.content) - . (_) .) ; Limiting predicate handling to only functions with 4 arguments + . (_) + .) ; 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: ; (arguments ; . (_) ; . (_) @@ -86,7 +87,7 @@ ; ; (function_call ; name: (_) @_map -; arguments: +; arguments: ; (arguments ; . (_) ; . (_) diff --git a/queries/luau/highlights.scm b/queries/luau/highlights.scm index 5fdfb5006..328401f26 100644 --- a/queries/luau/highlights.scm +++ b/queries/luau/highlights.scm @@ -184,8 +184,9 @@ (function_call (identifier) @function.builtin + ; format-ignore (#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" "load" "loadfile" "loadstring" "module" "next" "pairs" "pcall" "print" "rawequal" "rawget" "rawlen" "rawset" "require" "select" "setfenv" "setmetatable" diff --git a/queries/mlir/highlights.scm b/queries/mlir/highlights.scm index ff768a19d..6d7f4c2d7 100644 --- a/queries/mlir/highlights.scm +++ b/queries/mlir/highlights.scm @@ -23,6 +23,7 @@ (arith_cmp_predicate) ] @keyword +; format-ignore [ "module" "unrealized_conversion_cast" diff --git a/queries/nix/highlights.scm b/queries/nix/highlights.scm index 0f6caf4e2..bcabbbc65 100644 --- a/queries/nix/highlights.scm +++ b/queries/nix/highlights.scm @@ -98,18 +98,20 @@ ) ; builtin functions (without builtins prefix) -(variable_expression name: (identifier) @function.builtin (#any-of? @function.builtin - ; nix eval --impure --expr 'with builtins; filter (x: !(elem x [ "abort" "derivation" "import" "throw" ]) && isFunction builtins.${x}) (attrNames builtins)' - "add" "addErrorContext" "all" "any" "appendContext" "attrNames" "attrValues" "baseNameOf" "bitAnd" "bitOr" "bitXor" "break" "catAttrs" "ceil" "compareVersions" "concatLists" "concatMap" "concatStringsSep" "deepSeq" "derivationStrict" "dirOf" "div" "elem" "elemAt" "fetchGit" "fetchMercurial" "fetchTarball" "fetchTree" "fetchurl" "filter" "filterSource" "findFile" "floor" "foldl'" "fromJSON" "fromTOML" "functionArgs" "genList" "genericClosure" "getAttr" "getContext" "getEnv" "getFlake" "groupBy" "hasAttr" "hasContext" "hashFile" "hashString" "head" "intersectAttrs" "isAttrs" "isBool" "isFloat" "isFunction" "isInt" "isList" "isNull" "isPath" "isString" "length" "lessThan" "listToAttrs" "map" "mapAttrs" "match" "mul" "parseDrvName" "partition" "path" "pathExists" "placeholder" "readDir" "readFile" "removeAttrs" "replaceStrings" "scopedImport" "seq" "sort" "split" "splitVersion" "storePath" "stringLength" "sub" "substring" "tail" "toFile" "toJSON" "toPath" "toString" "toXML" "trace" "traceVerbose" "tryEval" "typeOf" "unsafeDiscardOutputDependency" "unsafeDiscardStringContext" "unsafeGetAttrPos" "zipAttrsWith" - ; primops, `__` in `nix repl` - "__add" "__filter" "__isFunction" "__split" "__addErrorContext" "__filterSource" "__isInt" "__splitVersion" "__all" "__findFile" "__isList" "__storeDir" "__any" "__floor" "__isPath" "__storePath" "__appendContext" "__foldl'" "__isString" "__stringLength" "__attrNames" "__fromJSON" "__langVersion" "__sub" "__attrValues" "__functionArgs" "__length" "__substring" "__bitAnd" "__genList" "__lessThan" "__tail" "__bitOr" "__genericClosure" "__listToAttrs" "__toFile" "__bitXor" "__getAttr" "__mapAttrs" "__toJSON" "__catAttrs" "__getContext" "__match" "__toPath" "__ceil" "__getEnv" "__mul" "__toXML" "__compareVersions" "__getFlake" "__nixPath" "__trace" "__concatLists" "__groupBy" "__nixVersion" "__traceVerbose" "__concatMap" "__hasAttr" "__parseDrvName" "__tryEval" "__concatStringsSep" "__hasContext" "__partition" "__typeOf" "__currentSystem" "__hashFile" "__path" "__unsafeDiscardOutputDependency" "__currentTime" "__hashString" "__pathExists" "__unsafeDiscardStringContext" "__deepSeq" "__head" "__readDir" "__unsafeGetAttrPos" "__div" "__intersectAttrs" "__readFile" "__zipAttrsWith" "__elem" "__isAttrs" "__replaceStrings" "__elemAt" "__isBool" "__seq" "__fetchurl" "__isFloat" "__sort" -)) +(variable_expression name: (identifier) @function.builtin + ; format-ignore + (#any-of? @function.builtin + ; nix eval --impure --expr 'with builtins; filter (x: !(elem x [ "abort" "derivation" "import" "throw" ]) && isFunction builtins.${x}) (attrNames builtins)' + "add" "addErrorContext" "all" "any" "appendContext" "attrNames" "attrValues" "baseNameOf" "bitAnd" "bitOr" "bitXor" "break" "catAttrs" "ceil" "compareVersions" "concatLists" "concatMap" "concatStringsSep" "deepSeq" "derivationStrict" "dirOf" "div" "elem" "elemAt" "fetchGit" "fetchMercurial" "fetchTarball" "fetchTree" "fetchurl" "filter" "filterSource" "findFile" "floor" "foldl'" "fromJSON" "fromTOML" "functionArgs" "genList" "genericClosure" "getAttr" "getContext" "getEnv" "getFlake" "groupBy" "hasAttr" "hasContext" "hashFile" "hashString" "head" "intersectAttrs" "isAttrs" "isBool" "isFloat" "isFunction" "isInt" "isList" "isNull" "isPath" "isString" "length" "lessThan" "listToAttrs" "map" "mapAttrs" "match" "mul" "parseDrvName" "partition" "path" "pathExists" "placeholder" "readDir" "readFile" "removeAttrs" "replaceStrings" "scopedImport" "seq" "sort" "split" "splitVersion" "storePath" "stringLength" "sub" "substring" "tail" "toFile" "toJSON" "toPath" "toString" "toXML" "trace" "traceVerbose" "tryEval" "typeOf" "unsafeDiscardOutputDependency" "unsafeDiscardStringContext" "unsafeGetAttrPos" "zipAttrsWith" + ; primops, `__` in `nix repl` + "__add" "__filter" "__isFunction" "__split" "__addErrorContext" "__filterSource" "__isInt" "__splitVersion" "__all" "__findFile" "__isList" "__storeDir" "__any" "__floor" "__isPath" "__storePath" "__appendContext" "__foldl'" "__isString" "__stringLength" "__attrNames" "__fromJSON" "__langVersion" "__sub" "__attrValues" "__functionArgs" "__length" "__substring" "__bitAnd" "__genList" "__lessThan" "__tail" "__bitOr" "__genericClosure" "__listToAttrs" "__toFile" "__bitXor" "__getAttr" "__mapAttrs" "__toJSON" "__catAttrs" "__getContext" "__match" "__toPath" "__ceil" "__getEnv" "__mul" "__toXML" "__compareVersions" "__getFlake" "__nixPath" "__trace" "__concatLists" "__groupBy" "__nixVersion" "__traceVerbose" "__concatMap" "__hasAttr" "__parseDrvName" "__tryEval" "__concatStringsSep" "__hasContext" "__partition" "__typeOf" "__currentSystem" "__hashFile" "__path" "__unsafeDiscardOutputDependency" "__currentTime" "__hashString" "__pathExists" "__unsafeDiscardStringContext" "__deepSeq" "__head" "__readDir" "__unsafeGetAttrPos" "__div" "__intersectAttrs" "__readFile" "__zipAttrsWith" "__elem" "__isAttrs" "__replaceStrings" "__elemAt" "__isBool" "__seq" "__fetchurl" "__isFloat" "__sort")) ; constants -(variable_expression name: (identifier) @constant.builtin (#any-of? @constant.builtin - ; nix eval --impure --expr 'with builtins; filter (x: !(isFunction builtins.${x} || isBool builtins.${x})) (attrNames builtins)' - "builtins" "currentSystem" "currentTime" "langVersion" "nixPath" "nixVersion" "null" "storeDir" -)) +(variable_expression name: (identifier) @constant.builtin + ; format-ignore + (#any-of? @constant.builtin + ; nix eval --impure --expr 'with builtins; filter (x: !(isFunction builtins.${x} || isBool builtins.${x})) (attrNames builtins)' + "builtins" "currentSystem" "currentTime" "langVersion" "nixPath" "nixVersion" "null" "storeDir")) ; string interpolation (this was very annoying to get working properly) (interpolation "${" @punctuation.special (_) "}" @punctuation.special) @none diff --git a/queries/ocaml/indents.scm b/queries/ocaml/indents.scm index 48049dd0d..d821abbd7 100644 --- a/queries/ocaml/indents.scm +++ b/queries/ocaml/indents.scm @@ -1,3 +1,4 @@ +; format-ignore [ (let_binding) ; let = ... (type_binding) diff --git a/queries/pug/highlights.scm b/queries/pug/highlights.scm index cdd9d1d83..7ac2c7c63 100644 --- a/queries/pug/highlights.scm +++ b/queries/pug/highlights.scm @@ -2,18 +2,19 @@ (tag_name) @tag ((tag_name) @constant.builtin - ; https://www.script-example.com/html-tag-liste - (#any-of? @constant.builtin - "head" "title" "base" "link" "meta" "style" - "body" "article" "section" "nav" "aside" "h1" "h2" "h3" "h4" "h5" "h6" "hgroup" "header" "footer" "address" - "p" "hr" "pre" "blockquote" "ol" "ul" "menu" "li" "dl" "dt" "dd" "figure" "figcaption" "main" "div" - "a" "em" "strong" "small" "s" "cite" "q" "dfn" "abbr" "ruby" "rt" "rp" "data" "time" "code" "var" "samp" "kbd" "sub" "sup" "i" "b" "u" "mark" "bdi" "bdo" "span" "br" "wbr" - "ins" "del" - "picture" "source" "img" "iframe" "embed" "object" "param" "video" "audio" "track" "map" "area" - "table" "caption" "colgroup" "col" "tbody" "thead" "tfoot" "tr" "td" "th " - "form" "label" "input" "button" "select" "datalist" "optgroup" "option" "textarea" "output" "progress" "meter" "fieldset" "legend" - "details" "summary" "dialog" - "script" "noscript" "template" "slot" "canvas")) + ; https://www.script-example.com/html-tag-liste + ; format-ignore + (#any-of? @constant.builtin + "head" "title" "base" "link" "meta" "style" + "body" "article" "section" "nav" "aside" "h1" "h2" "h3" "h4" "h5" "h6" "hgroup" "header" "footer" "address" + "p" "hr" "pre" "blockquote" "ol" "ul" "menu" "li" "dl" "dt" "dd" "figure" "figcaption" "main" "div" + "a" "em" "strong" "small" "s" "cite" "q" "dfn" "abbr" "ruby" "rt" "rp" "data" "time" "code" "var" "samp" "kbd" "sub" "sup" "i" "b" "u" "mark" "bdi" "bdo" "span" "br" "wbr" + "ins" "del" + "picture" "source" "img" "iframe" "embed" "object" "param" "video" "audio" "track" "map" "area" + "table" "caption" "colgroup" "col" "tbody" "thead" "tfoot" "tr" "td" "th " + "form" "label" "input" "button" "select" "datalist" "optgroup" "option" "textarea" "output" "progress" "meter" "fieldset" "legend" + "details" "summary" "dialog" + "script" "noscript" "template" "slot" "canvas")) (id) @constant (class) @property diff --git a/queries/python/highlights.scm b/queries/python/highlights.scm index 9ba1fcf14..8d272185c 100644 --- a/queries/python/highlights.scm +++ b/queries/python/highlights.scm @@ -17,15 +17,11 @@ (#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")) + ; format-ignore + (#any-of? @constant.builtin + ; https://docs.python.org/3/library/constants.html + "NotImplemented" "Ellipsis" + "quit" "exit" "copyright" "credits" "license")) "_" @constant.builtin ; match wildcard @@ -336,22 +332,23 @@ (#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")) + ; format-ignore + (#any-of? @type.builtin + ; https://docs.python.org/3/library/exceptions.html + "BaseException" "Exception" "ArithmeticError" "BufferError" "LookupError" "AssertionError" "AttributeError" + "EOFError" "FloatingPointError" "GeneratorExit" "ImportError" "ModuleNotFoundError" "IndexError" "KeyError" + "KeyboardInterrupt" "MemoryError" "NameError" "NotImplementedError" "OSError" "OverflowError" "RecursionError" + "ReferenceError" "RuntimeError" "StopIteration" "StopAsyncIteration" "SyntaxError" "IndentationError" "TabError" + "SystemError" "SystemExit" "TypeError" "UnboundLocalError" "UnicodeError" "UnicodeEncodeError" "UnicodeDecodeError" + "UnicodeTranslateError" "ValueError" "ZeroDivisionError" "EnvironmentError" "IOError" "WindowsError" + "BlockingIOError" "ChildProcessError" "ConnectionError" "BrokenPipeError" "ConnectionAbortedError" + "ConnectionRefusedError" "ConnectionResetError" "FileExistsError" "FileNotFoundError" "InterruptedError" + "IsADirectoryError" "NotADirectoryError" "PermissionError" "ProcessLookupError" "TimeoutError" "Warning" + "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 diff --git a/queries/rst/highlights.scm b/queries/rst/highlights.scm index b3b2b0a88..d83a21427 100644 --- a/queries/rst/highlights.scm +++ b/queries/rst/highlights.scm @@ -32,18 +32,18 @@ ((directive name: (type) @function.builtin) - (#any-of? - @function.builtin - ; https://docutils.sourceforge.io/docs/ref/rst/directives.html - "attention" "caution" "danger" "error" "hint" "important" "note" "tip" "warning" "admonition" - "image" "figure" - "topic" "sidebar" "line-block" "parsed-literal" "code" "math" "rubric" "epigraph" "highlights" "pull-quote" "compound" "container" - "table" "csv-table" "list-table" - "contents" "sectnum" "section-numbering" "header" "footer" - "target-notes" - "meta" - "replace" "unicode" "date" - "raw" "class" "role" "default-role" "title" "restructuredtext-test-directive")) + ; format-ignore + (#any-of? @function.builtin + ; https://docutils.sourceforge.io/docs/ref/rst/directives.html + "attention" "caution" "danger" "error" "hint" "important" "note" "tip" "warning" "admonition" + "image" "figure" + "topic" "sidebar" "line-block" "parsed-literal" "code" "math" "rubric" "epigraph" "highlights" "pull-quote" "compound" "container" + "table" "csv-table" "list-table" + "contents" "sectnum" "section-numbering" "header" "footer" + "target-notes" + "meta" + "replace" "unicode" "date" + "raw" "class" "role" "default-role" "title" "restructuredtext-test-directive")) ;; Blocks @@ -89,26 +89,26 @@ (role) @function ((role) @function.builtin - (#any-of? - @function.builtin - ; https://docutils.sourceforge.io/docs/ref/rst/roles.html - ":emphasis:" - ":literal:" - ":code:" - ":math:" - ":pep-reference:" - ":PEP:" - ":rfc-reference:" - ":RFC:" - ":strong:" - ":subscript:" - ":sub:" - ":superscript:" - ":sup:" - ":title-reference:" - ":title:" - ":t:" - ":raw:")) + ; format-ignore + (#any-of? @function.builtin + ; https://docutils.sourceforge.io/docs/ref/rst/roles.html + ":emphasis:" + ":literal:" + ":code:" + ":math:" + ":pep-reference:" + ":PEP:" + ":rfc-reference:" + ":RFC:" + ":strong:" + ":subscript:" + ":sub:" + ":superscript:" + ":sup:" + ":title-reference:" + ":title:" + ":t:" + ":raw:")) [ "interpreted_text" diff --git a/queries/scheme/highlights.scm b/queries/scheme/highlights.scm index f555920ba..fdd494d8b 100644 --- a/queries/scheme/highlights.scm +++ b/queries/scheme/highlights.scm @@ -104,79 +104,80 @@ ;; procedures in R5RS and R6RS but not in R6RS-lib ((symbol) @function.builtin - (#any-of? @function.builtin - ;; eq - "eqv?" "eq?" "equal?" - ;; number - "number?" "complex?" "real?" "rational?" "integer?" - "exact?" "inexact?" - "zero?" "positive?" "negative?" "odd?" "even?" "finite?" "infinite?" "nan?" - "max" "min" - "abs" "quotient" "remainder" "modulo" - "div" "div0" "mod" "mod0" "div-and-mod" "div0-and-mod0" - "gcd" "lcm" "numerator" "denominator" - "floor" "ceiling" "truncate" "round" - "rationalize" - "exp" "log" "sin" "cos" "tan" "asin" "acos" "atan" - "sqrt" "expt" - "exact-integer-sqrt" - "make-rectangular" "make-polar" "real-part" "imag-part" "magnitude" "angle" - "real-valued" "rational-valued?" "integer-valued?" - "exact" "inexact" "exact->inexact" "inexact->exact" - "number->string" "string->number" - ;; boolean - "boolean?" "not" "boolean=?" - ;; pair - "pair?" "cons" - "car" "cdr" - "caar" "cadr" "cdar" "cddr" - "caaar" "caadr" "cadar" "caddr" "cdaar" "cdadr" "cddar" "cdddr" - "caaaar" "caaadr" "caadar" "caaddr" "cadaar" "cadadr" "caddar" "cadddr" - "cdaaar" "cdaadr" "cdadar" "cdaddr" "cddaar" "cddadr" "cdddar" "cddddr" - "set-car!" "set-cdr!" - ;; list - "null?" "list?" - "list" "length" "append" "reverse" "list-tail" "list-ref" - "map" "for-each" - "memq" "memv" "member" "assq" "assv" "assoc" - ;; symbol - "symbol?" "symbol->string" "string->symbol" "symbol=?" - ;; char - "char?" "char=?" "char?" "char<=?" "char>=?" - "char-ci=?" "char-ci?" "char-ci<=?" "char-ci>=?" - "char-alphabetic?" "char-numeric?" "char-whitespace?" "char-upper-case?" "char-lower-case?" - "char->integer" "integer->char" - "char-upcase" "char-downcase" - ;; string - "string?" "make-string" "string" "string-length" "string-ref" "string-set!" - "string=?" "string-ci=?" "string?" "string<=?" "string>=?" - "string-ci?" "string-ci<=?" "string-ci>=?" - "substring" "string-append" "string->list" "list->string" - "string-for-each" - "string-copy" "string-fill!" - "string-upcase" "string-downcase" - ;; vector - "vector?" "make-vector" "vector" "vector-length" "vector-ref" "vector-set!" - "vector->list" "list->vector" "vector-fill!" "vector-map" "vector-for-each" - ;; bytevector - "bytevector?" "native-endianness" - "make-bytevector" "bytevector-length" "bytevector=?" "bytevector-fill!" - "bytevector-copy!" "bytevector-copy" - ;; error - "error" "assertion-violation" - ;; control - "procedure?" "apply" "force" - "call-with-current-continuation" "call/cc" - "values" "call-with-values" "dynamic-wind" - "eval" "scheme-report-environment" "null-environment" "interaction-environment" - ;; IO - "call-with-input-file" "call-with-output-file" "input-port?" "output-port?" - "current-input-port" "current-output-port" "with-input-from-file" "with-output-to-file" - "open-input-file" "open-output-file" "close-input-port" "close-output-port" - ;; input - "read" "read-char" "peek-char" "eof-object?" "char-ready?" - ;; output - "write" "display" "newline" "write-char" - ;; system - "load" "transcript-on" "transcript-off")) + ; format-ignore + (#any-of? @function.builtin + ; eq + "eqv?" "eq?" "equal?" + ; number + "number?" "complex?" "real?" "rational?" "integer?" + "exact?" "inexact?" + "zero?" "positive?" "negative?" "odd?" "even?" "finite?" "infinite?" "nan?" + "max" "min" + "abs" "quotient" "remainder" "modulo" + "div" "div0" "mod" "mod0" "div-and-mod" "div0-and-mod0" + "gcd" "lcm" "numerator" "denominator" + "floor" "ceiling" "truncate" "round" + "rationalize" + "exp" "log" "sin" "cos" "tan" "asin" "acos" "atan" + "sqrt" "expt" + "exact-integer-sqrt" + "make-rectangular" "make-polar" "real-part" "imag-part" "magnitude" "angle" + "real-valued" "rational-valued?" "integer-valued?" + "exact" "inexact" "exact->inexact" "inexact->exact" + "number->string" "string->number" + ; boolean + "boolean?" "not" "boolean=?" + ; pair + "pair?" "cons" + "car" "cdr" + "caar" "cadr" "cdar" "cddr" + "caaar" "caadr" "cadar" "caddr" "cdaar" "cdadr" "cddar" "cdddr" + "caaaar" "caaadr" "caadar" "caaddr" "cadaar" "cadadr" "caddar" "cadddr" + "cdaaar" "cdaadr" "cdadar" "cdaddr" "cddaar" "cddadr" "cdddar" "cddddr" + "set-car!" "set-cdr!" + ; list + "null?" "list?" + "list" "length" "append" "reverse" "list-tail" "list-ref" + "map" "for-each" + "memq" "memv" "member" "assq" "assv" "assoc" + ; symbol + "symbol?" "symbol->string" "string->symbol" "symbol=?" + ; char + "char?" "char=?" "char?" "char<=?" "char>=?" + "char-ci=?" "char-ci?" "char-ci<=?" "char-ci>=?" + "char-alphabetic?" "char-numeric?" "char-whitespace?" "char-upper-case?" "char-lower-case?" + "char->integer" "integer->char" + "char-upcase" "char-downcase" + ; string + "string?" "make-string" "string" "string-length" "string-ref" "string-set!" + "string=?" "string-ci=?" "string?" "string<=?" "string>=?" + "string-ci?" "string-ci<=?" "string-ci>=?" + "substring" "string-append" "string->list" "list->string" + "string-for-each" + "string-copy" "string-fill!" + "string-upcase" "string-downcase" + ; vector + "vector?" "make-vector" "vector" "vector-length" "vector-ref" "vector-set!" + "vector->list" "list->vector" "vector-fill!" "vector-map" "vector-for-each" + ; bytevector + "bytevector?" "native-endianness" + "make-bytevector" "bytevector-length" "bytevector=?" "bytevector-fill!" + "bytevector-copy!" "bytevector-copy" + ; error + "error" "assertion-violation" + ; control + "procedure?" "apply" "force" + "call-with-current-continuation" "call/cc" + "values" "call-with-values" "dynamic-wind" + "eval" "scheme-report-environment" "null-environment" "interaction-environment" + ; IO + "call-with-input-file" "call-with-output-file" "input-port?" "output-port?" + "current-input-port" "current-output-port" "with-input-from-file" "with-output-to-file" + "open-input-file" "open-output-file" "close-input-port" "close-output-port" + ; input + "read" "read-char" "peek-char" "eof-object?" "char-ready?" + ; output + "write" "display" "newline" "write-char" + ; system + "load" "transcript-on" "transcript-off")) diff --git a/queries/squirrel/highlights.scm b/queries/squirrel/highlights.scm index 5fa20881c..e7ac9150e 100644 --- a/queries/squirrel/highlights.scm +++ b/queries/squirrel/highlights.scm @@ -158,6 +158,7 @@ function: (global_variable "::" (_) @function.builtin) function: (deref_expression "." (_) @function.builtin) ] + ; format-ignore (#any-of? @function.builtin ; General Methods "assert" "array" "callee" "collectgarbage" "compilestring" diff --git a/queries/starlark/highlights.scm b/queries/starlark/highlights.scm index 8d99963d5..9707632a5 100644 --- a/queries/starlark/highlights.scm +++ b/queries/starlark/highlights.scm @@ -17,15 +17,11 @@ (#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")) + ; format-ignore + (#any-of? @constant.builtin + ; https://docs.python.org/3/library/constants.html + "NotImplemented" "Ellipsis" + "quit" "exit" "copyright" "credits" "license")) ((attribute attribute: (identifier) @variable.member) @@ -64,13 +60,14 @@ ;; 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" "fail" "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" - "struct" "sum" "super" "tuple" "type" "vars" "zip" "__import__")) + ; format-ignore + (#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" "fail" "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" + "struct" "sum" "super" "tuple" "type" "vars" "zip" "__import__")) ;; Function definitions (function_definition @@ -89,22 +86,23 @@ (#eq? @_isinstance "isinstance")) ((identifier) @type.builtin - (#any-of? @type.builtin - ;; https://docs.python.org/3/library/exceptions.html - "ArithmeticError" "BufferError" "LookupError" "AssertionError" "AttributeError" - "EOFError" "FloatingPointError" "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" "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")) + ; format-ignore + (#any-of? @type.builtin + ; https://docs.python.org/3/library/exceptions.html + "ArithmeticError" "BufferError" "LookupError" "AssertionError" "AttributeError" + "EOFError" "FloatingPointError" "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" "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")) ;; Normal parameters (parameters diff --git a/queries/swift/highlights.scm b/queries/swift/highlights.scm index 81a0d931b..336497839 100644 --- a/queries/swift/highlights.scm +++ b/queries/swift/highlights.scm @@ -73,7 +73,7 @@ (call_expression (simple_identifier) @function.call) ; foo() (call_expression ; foo.bar.baz(): highlight the baz() (navigation_expression - (navigation_suffix (simple_identifier) @function.call))) + (navigation_suffix (simple_identifier) @function.call))) (call_expression (prefix_expression (simple_identifier) @function.call)) ; .foo() ((navigation_expression diff --git a/queries/swift/indents.scm b/queries/swift/indents.scm index 39ad59405..63d1c9011 100644 --- a/queries/swift/indents.scm +++ b/queries/swift/indents.scm @@ -1,3 +1,4 @@ +; format-ignore [ ; ... refers to the section that will get affected by this indent.begin capture (protocol_body) ; protocol Foo { ... } diff --git a/queries/usd/highlights.scm b/queries/usd/highlights.scm index 6ba4ec98f..180b6d219 100644 --- a/queries/usd/highlights.scm +++ b/queries/usd/highlights.scm @@ -39,128 +39,125 @@ (attribute_type) @type ( - ;; Reference: https://openusd.org/release/api/sdf_page_front.html (attribute_type) @type.builtin - (#any-of? @type.builtin - ;; Scalar types - "asset" "asset[]" - "bool" "bool[]" - "double" "double[]" - "float" "float[]" - "half" "half[]" - "int" "int[]" - "int64" "int64[]" - "string" "string[]" - "timecode" "timecode[]" - "token" "token[]" - "uchar" "uchar[]" - "uint" "uint[]" - "uint64" "uint64[]" + ;format-ignore + (#any-of? @type.builtin + ;; Reference: https://openusd.org/release/api/sdf_page_front.html + ;; Scalar types + "asset" "asset[]" + "bool" "bool[]" + "double" "double[]" + "float" "float[]" + "half" "half[]" + "int" "int[]" + "int64" "int64[]" + "string" "string[]" + "timecode" "timecode[]" + "token" "token[]" + "uchar" "uchar[]" + "uint" "uint[]" + "uint64" "uint64[]" - ;; Dimensioned Types - "double2" "double2[]" - "double3" "double3[]" - "double4" "double4[]" - "float2" "float2[]" - "float3" "float3[]" - "float4" "float4[]" - "half2" "half2[]" - "half3" "half3[]" - "half4" "half4[]" - "int2" "int2[]" - "int3" "int3[]" - "int4" "int4[]" - "matrix2d" "matrix2d[]" - "matrix3d" "matrix3d[]" - "matrix4d" "matrix4d[]" - "quatd" "quatd[]" - "quatf" "quatf[]" - "quath" "quath[]" + ;; Dimensioned Types + "double2" "double2[]" + "double3" "double3[]" + "double4" "double4[]" + "float2" "float2[]" + "float3" "float3[]" + "float4" "float4[]" + "half2" "half2[]" + "half3" "half3[]" + "half4" "half4[]" + "int2" "int2[]" + "int3" "int3[]" + "int4" "int4[]" + "matrix2d" "matrix2d[]" + "matrix3d" "matrix3d[]" + "matrix4d" "matrix4d[]" + "quatd" "quatd[]" + "quatf" "quatf[]" + "quath" "quath[]" - ;; Extra Types - "color3f" "color3f[]" - "normal3f" "normal3f[]" - "point3f" "point3f[]" - "texCoord2f" "texCoord2f[]" - "vector3d" "vector3d[]" - "vector3f" "vector3f[]" - "vector3h" "vector3h[]" + ;; Extra Types + "color3f" "color3f[]" + "normal3f" "normal3f[]" + "point3f" "point3f[]" + "texCoord2f" "texCoord2f[]" + "vector3d" "vector3d[]" + "vector3f" "vector3f[]" + "vector3h" "vector3h[]" - "dictionary" + "dictionary" - ;; Deprecated Types - "EdgeIndex" "EdgeIndex[]" - "FaceIndex" "FaceIndex[]" - "Matrix4d" "Matrix4d[]" - "PointIndex" "PointIndex[]" - "PointFloat" "PointFloat[]" - "Transform" "Transform[]" - "Vec3f" "Vec3f[]" - ) -) + ;; Deprecated Types + "EdgeIndex" "EdgeIndex[]" + "FaceIndex" "FaceIndex[]" + "Matrix4d" "Matrix4d[]" + "PointIndex" "PointIndex[]" + "PointFloat" "PointFloat[]" + "Transform" "Transform[]" + "Vec3f" "Vec3f[]")) ( (identifier) @keyword - (#any-of? @keyword + ; format-ignore + (#any-of? @keyword + ; Reference: https://openusd.org/release/api/sdf_page_front.html + ; LIVRPS names + "inherits" + "payload" + "references" + "specializes" + "variantSets" + "variants" - ;; Reference: https://openusd.org/release/api/sdf_page_front.html - ;; LIVRPS names - "inherits" - "payload" - "references" - "specializes" - "variantSets" - "variants" + ; assetInfo names + "assetInfo" + "identifier" + "name" + "payloadAssetDependencies" + "version" - ; assetInfo names - "assetInfo" - "identifier" - "name" - "payloadAssetDependencies" - "version" + ; clips names + "clips" - ;; clips names - "clips" + "active" + "assetPaths" + "manifestAssetPath" + "primPath" + "templateAssetPath" + "templateEndTime" + "templateStartTime" + "templateStride" + "times" - "active" - "assetPaths" - "manifestAssetPath" - "primPath" - "templateAssetPath" - "templateEndTime" - "templateStartTime" - "templateStride" - "times" + ; customData names + "customData" - ;; customData names - "customData" + "apiSchemaAutoApplyTo" + "apiSchemaOverridePropertyNames" + "className" + "extraPlugInfo" + "isUsdShadeContainer" + "libraryName" + "providesUsdShadeConnectableAPIBehavior" + "requiresUsdShadeEncapsulation" + "skipCodeGeneration" - "apiSchemaAutoApplyTo" - "apiSchemaOverridePropertyNames" - "className" - "extraPlugInfo" - "isUsdShadeContainer" - "libraryName" - "providesUsdShadeConnectableAPIBehavior" - "requiresUsdShadeEncapsulation" - "skipCodeGeneration" + ; Layer metadata names + "colorConfiguration" + "colorManagementSystem" + "customLayerData" + "defaultPrim" + "doc" + "endTimeCode" + "framesPerSecond" + "owner" + "startTimeCode" + "subLayers" - ;; Layer metadata names - "colorConfiguration" - "colorManagementSystem" - "customLayerData" - "defaultPrim" - "doc" - "endTimeCode" - "framesPerSecond" - "owner" - "startTimeCode" - "subLayers" - - ;; Prim metadata - "instanceable" - ) -) + ; Prim metadata + "instanceable")) ;; Common attribute metadata ( diff --git a/queries/usd/indents.scm b/queries/usd/indents.scm index 4af153034..78146d188 100644 --- a/queries/usd/indents.scm +++ b/queries/usd/indents.scm @@ -1,3 +1,4 @@ +; format-ignore [ (block) ; The {}s in `def "foo" { ... Attributes / Prims here ... }` (dictionary) ; The {}s in `dictionary foo = { string "foo" = "bar" }` From 79975d6557bcf9f5ca1c29268de14ce3f6801401 Mon Sep 17 00:00:00 2001 From: Pham Huy Hoang Date: Sat, 6 Jan 2024 02:51:48 +0900 Subject: [PATCH 0787/2494] ci: add query lint job --- .github/workflows/lint.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index a643f796d..3092c418f 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -31,3 +31,19 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} version: latest args: --check . + + format-queries: + name: Lint queries + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Prepare + run: | + wget https://github.com/neovim/neovim/releases/download/nightly/nvim-linux64.tar.gz + tar -zxf nvim-linux64.tar.gz + sudo ln -s "$PWD"/nvim-linux64/bin/nvim /usr/local/bin + + - name: Lint + run: | + nvim -l scripts/format-queries.lua queries + git diff --exit-code From 57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9 Mon Sep 17 00:00:00 2001 From: Pham Huy Hoang Date: Sat, 6 Jan 2024 15:05:50 +0900 Subject: [PATCH 0788/2494] chore: query formatting --- queries/ada/folds.scm | 23 +- queries/ada/highlights.scm | 390 +++++++---- queries/ada/locals.scm | 106 ++- queries/agda/folds.scm | 4 +- queries/agda/highlights.scm | 57 +- queries/angular/highlights.scm | 43 +- queries/apex/folds.scm | 8 +- queries/apex/highlights.scm | 149 ++-- queries/apex/locals.scm | 36 +- queries/arduino/highlights.scm | 20 +- queries/arduino/injections.scm | 6 +- queries/astro/highlights.scm | 25 +- queries/astro/injections.scm | 18 +- queries/authzed/highlights.scm | 15 +- queries/authzed/injections.scm | 2 +- queries/awk/highlights.scm | 206 +++--- queries/awk/injections.scm | 16 +- queries/bash/highlights.scm | 196 +++--- queries/bash/injections.scm | 47 +- queries/bash/locals.scm | 3 +- queries/bass/highlights.scm | 94 +-- queries/bass/indents.scm | 15 +- queries/bass/injections.scm | 4 +- queries/bass/locals.scm | 15 +- queries/beancount/folds.scm | 4 +- queries/beancount/highlights.scm | 43 +- queries/bibtex/folds.scm | 4 +- queries/bibtex/highlights.scm | 1 - queries/bibtex/indents.scm | 8 +- queries/bicep/folds.scm | 6 - queries/bicep/highlights.scm | 60 +- queries/bicep/indents.scm | 15 +- queries/bicep/injections.scm | 4 +- queries/bicep/locals.scm | 6 - queries/bitbake/folds.scm | 5 - queries/bitbake/highlights.scm | 190 +++-- queries/bitbake/indents.scm | 132 ++-- queries/bitbake/injections.scm | 13 +- queries/bitbake/locals.scm | 80 ++- queries/blueprint/highlights.scm | 47 +- queries/c/folds.scm | 34 +- queries/c/highlights.scm | 129 ++-- queries/c/indents.scm | 64 +- queries/c/injections.scm | 52 +- queries/c/locals.scm | 48 +- queries/c_sharp/folds.scm | 21 +- queries/c_sharp/highlights.scm | 363 +++++----- queries/c_sharp/injections.scm | 4 +- queries/c_sharp/locals.scm | 14 +- queries/cairo/folds.scm | 5 - queries/cairo/highlights.scm | 250 ++++--- queries/cairo/indents.scm | 31 +- queries/cairo/injections.scm | 6 +- queries/cairo/locals.scm | 37 +- queries/capnp/highlights.scm | 36 +- queries/capnp/indents.scm | 10 +- queries/capnp/injections.scm | 4 +- queries/capnp/locals.scm | 23 +- queries/chatito/folds.scm | 6 +- queries/chatito/highlights.scm | 47 +- queries/chatito/indents.scm | 9 +- queries/chatito/injections.scm | 4 +- queries/chatito/locals.scm | 20 +- queries/clojure/folds.scm | 3 +- queries/clojure/highlights.scm | 262 +++---- queries/clojure/injections.scm | 4 +- queries/cmake/folds.scm | 12 +- queries/cmake/highlights.scm | 237 ++++--- queries/cmake/indents.scm | 17 +- queries/comment/highlights.scm | 20 +- queries/commonlisp/folds.scm | 3 +- queries/commonlisp/highlights.scm | 128 ++-- queries/commonlisp/locals.scm | 129 ++-- queries/cooklang/highlights.scm | 18 +- queries/corn/folds.scm | 6 +- queries/corn/highlights.scm | 6 + queries/corn/indents.scm | 28 +- queries/corn/locals.scm | 11 +- queries/cpon/highlights.scm | 24 +- queries/cpon/injections.scm | 4 +- queries/cpon/locals.scm | 3 +- queries/cpp/folds.scm | 21 +- queries/cpp/highlights.scm | 168 +++-- queries/cpp/indents.scm | 6 +- queries/cpp/injections.scm | 5 +- queries/cpp/locals.scm | 41 +- queries/css/folds.scm | 4 +- queries/css/highlights.scm | 125 ++-- queries/css/indents.scm | 4 +- queries/css/injections.scm | 4 +- queries/csv/highlights.scm | 1 - queries/cuda/highlights.scm | 6 +- queries/cuda/injections.scm | 6 +- queries/cue/highlights.scm | 85 +-- queries/cue/indents.scm | 15 +- queries/cue/injections.scm | 4 +- queries/cue/locals.scm | 5 +- queries/d/highlights.scm | 79 +-- queries/d/indents.scm | 9 +- queries/d/injections.scm | 6 +- queries/dart/folds.scm | 3 - queries/dart/highlights.scm | 220 +++--- queries/dart/indents.scm | 17 +- queries/dart/injections.scm | 4 +- queries/dart/locals.scm | 24 +- queries/devicetree/highlights.scm | 40 +- queries/devicetree/indents.scm | 4 +- queries/devicetree/injections.scm | 4 +- queries/devicetree/locals.scm | 2 +- queries/dhall/folds.scm | 4 - queries/dhall/highlights.scm | 184 ++--- queries/dhall/injections.scm | 4 +- queries/diff/highlights.scm | 13 +- queries/dockerfile/highlights.scm | 10 +- queries/dockerfile/injections.scm | 10 +- queries/dot/highlights.scm | 19 +- queries/dot/injections.scm | 6 +- queries/doxygen/highlights.scm | 14 +- queries/doxygen/injections.scm | 5 +- queries/dtd/folds.scm | 4 +- queries/dtd/highlights.scm | 124 ++-- queries/dtd/locals.scm | 10 +- queries/ebnf/highlights.scm | 35 +- queries/ecma/highlights.scm | 207 +++--- queries/ecma/indents.scm | 52 +- queries/ecma/injections.scm | 155 ++-- queries/ecma/locals.scm | 15 +- queries/eds/highlights.scm | 67 +- queries/eex/highlights.scm | 1 - queries/eex/injections.scm | 8 +- queries/elixir/highlights.scm | 182 ++--- queries/elixir/indents.scm | 4 +- queries/elixir/injections.scm | 49 +- queries/elixir/locals.scm | 2 +- queries/elm/highlights.scm | 108 +-- queries/elm/injections.scm | 8 +- queries/elsa/highlights.scm | 13 +- queries/elsa/injections.scm | 4 +- queries/elvish/highlights.scm | 157 ++++- queries/elvish/injections.scm | 4 +- queries/embedded_template/injections.scm | 8 +- queries/erlang/highlights.scm | 138 ++-- queries/facility/highlights.scm | 4 +- queries/facility/indents.scm | 7 +- queries/facility/injections.scm | 5 +- queries/fennel/folds.scm | 12 +- queries/fennel/highlights.scm | 82 +-- queries/fennel/injections.scm | 4 +- queries/fennel/locals.scm | 38 +- queries/firrtl/folds.scm | 8 +- queries/firrtl/highlights.scm | 86 ++- queries/firrtl/indents.scm | 10 +- queries/firrtl/injections.scm | 4 +- queries/firrtl/locals.scm | 37 +- queries/fish/folds.scm | 12 +- queries/fish/highlights.scm | 217 +++--- queries/fish/indents.scm | 18 +- queries/fish/injections.scm | 4 +- queries/fish/locals.scm | 7 +- queries/foam/folds.scm | 9 +- queries/foam/highlights.scm | 43 +- queries/foam/indents.scm | 10 +- queries/foam/injections.scm | 22 +- queries/foam/locals.scm | 12 +- queries/fortran/folds.scm | 18 +- queries/fortran/highlights.scm | 60 +- queries/fsh/highlights.scm | 10 +- queries/func/highlights.scm | 40 +- queries/fusion/highlights.scm | 92 +-- queries/fusion/indents.scm | 19 +- queries/fusion/locals.scm | 12 +- queries/gdscript/folds.scm | 8 +- queries/gdscript/highlights.scm | 165 +++-- queries/gdscript/indents.scm | 71 +- queries/gdscript/injections.scm | 4 +- queries/gdscript/locals.scm | 117 ++-- queries/git_config/folds.scm | 1 + queries/git_config/highlights.scm | 30 +- queries/git_rebase/highlights.scm | 1 - queries/git_rebase/injections.scm | 9 +- queries/gitattributes/highlights.scm | 9 +- queries/gitattributes/injections.scm | 4 +- queries/gitattributes/locals.scm | 10 +- queries/gitcommit/highlights.scm | 46 +- queries/gitcommit/injections.scm | 6 +- queries/gitignore/highlights.scm | 6 +- queries/gleam/folds.scm | 2 +- queries/gleam/highlights.scm | 104 ++- queries/gleam/indents.scm | 4 +- queries/gleam/injections.scm | 8 +- queries/gleam/locals.scm | 19 +- queries/glimmer/folds.scm | 5 +- queries/glimmer/highlights.scm | 92 ++- queries/glimmer/indents.scm | 36 +- queries/glimmer/locals.scm | 8 +- queries/glsl/highlights.scm | 3 +- queries/glsl/injections.scm | 6 +- queries/gn/highlights.scm | 32 +- queries/go/folds.scm | 35 +- queries/go/highlights.scm | 153 ++-- queries/go/indents.scm | 24 +- queries/go/injections.scm | 45 +- queries/go/locals.scm | 90 ++- queries/godot_resource/folds.scm | 4 +- queries/godot_resource/highlights.scm | 14 +- queries/godot_resource/locals.scm | 4 +- queries/gomod/highlights.scm | 5 +- queries/gomod/injections.scm | 2 +- queries/gosum/highlights.scm | 9 +- queries/gowork/highlights.scm | 4 +- queries/gowork/injections.scm | 2 +- queries/gpg/highlights.scm | 31 +- queries/gpg/injections.scm | 2 +- queries/graphql/highlights.scm | 25 +- queries/graphql/injections.scm | 2 +- queries/groovy/highlights.scm | 53 +- queries/groovy/injections.scm | 8 +- queries/gstlaunch/highlights.scm | 21 +- queries/hack/highlights.scm | 179 +++-- queries/hare/folds.scm | 3 - queries/hare/highlights.scm | 114 +-- queries/hare/indents.scm | 20 +- queries/hare/injections.scm | 18 +- queries/hare/locals.scm | 44 +- queries/haskell/folds.scm | 6 +- queries/haskell/highlights.scm | 707 +++++++++++-------- queries/haskell/injections.scm | 77 +- queries/haskell_persistent/folds.scm | 4 +- queries/haskell_persistent/highlights.scm | 28 +- queries/hcl/folds.scm | 8 +- queries/hcl/highlights.scm | 36 +- queries/hcl/indents.scm | 1 + queries/hcl/injections.scm | 2 +- queries/heex/highlights.scm | 17 +- queries/heex/injections.scm | 2 +- queries/hjson/highlights.scm | 19 +- queries/hjson/indents.scm | 1 - queries/hjson/injections.scm | 2 +- queries/hlsl/highlights.scm | 14 +- queries/hlsl/injections.scm | 4 +- queries/hocon/highlights.scm | 62 +- queries/hocon/injections.scm | 2 +- queries/hoon/folds.scm | 10 +- queries/hoon/highlights.scm | 6 +- queries/hoon/locals.scm | 2 +- queries/html/highlights.scm | 1 - queries/html/injections.scm | 7 +- queries/html_tags/highlights.scm | 111 ++- queries/html_tags/indents.scm | 37 +- queries/html_tags/injections.scm | 85 ++- queries/htmldjango/highlights.scm | 40 +- queries/htmldjango/indents.scm | 2 + queries/htmldjango/injections.scm | 4 +- queries/http/highlights.scm | 26 +- queries/http/injections.scm | 10 +- queries/hurl/folds.scm | 1 - queries/hurl/highlights.scm | 26 +- queries/hurl/indents.scm | 2 +- queries/hurl/injections.scm | 4 +- queries/ini/highlights.scm | 13 +- queries/ispc/folds.scm | 1 - queries/ispc/highlights.scm | 76 +- queries/ispc/indents.scm | 11 +- queries/ispc/locals.scm | 8 +- queries/janet_simple/folds.scm | 3 +- queries/janet_simple/highlights.scm | 94 +-- queries/janet_simple/injections.scm | 2 +- queries/java/highlights.scm | 98 +-- queries/java/indents.scm | 8 +- queries/java/injections.scm | 16 +- queries/java/locals.scm | 54 +- queries/javascript/highlights.scm | 24 +- queries/javascript/locals.scm | 29 +- queries/jq/highlights.scm | 50 +- queries/jq/injections.scm | 40 +- queries/jq/locals.scm | 9 +- queries/jsdoc/highlights.scm | 1 + queries/json/highlights.scm | 32 +- queries/json5/highlights.scm | 2 +- queries/json5/injections.scm | 2 +- queries/jsonc/highlights.scm | 1 - queries/jsonc/indents.scm | 1 - queries/jsonc/injections.scm | 2 +- queries/jsonnet/folds.scm | 16 +- queries/jsonnet/highlights.scm | 41 +- queries/jsonnet/locals.scm | 19 +- queries/jsx/highlights.scm | 56 +- queries/jsx/indents.scm | 11 +- queries/jsx/injections.scm | 14 +- queries/julia/folds.scm | 3 - queries/julia/highlights.scm | 262 ++++--- queries/julia/indents.scm | 4 - queries/julia/injections.scm | 23 +- queries/julia/locals.scm | 47 +- queries/kconfig/highlights.scm | 36 +- queries/kconfig/indents.scm | 3 +- queries/kconfig/locals.scm | 13 +- queries/kdl/folds.scm | 1 - queries/kdl/highlights.scm | 54 +- queries/kdl/indents.scm | 13 +- queries/kdl/injections.scm | 4 +- queries/kdl/locals.scm | 12 +- queries/kotlin/folds.scm | 26 +- queries/kotlin/highlights.scm | 498 ++++++------- queries/kotlin/injections.scm | 31 +- queries/kotlin/locals.scm | 110 ++- queries/kusto/highlights.scm | 10 +- queries/kusto/injections.scm | 2 +- queries/lalrpop/highlights.scm | 45 +- queries/lalrpop/injections.scm | 11 +- queries/lalrpop/locals.scm | 2 +- queries/latex/folds.scm | 1 - queries/latex/highlights.scm | 308 +++++--- queries/latex/injections.scm | 28 +- queries/ledger/folds.scm | 4 +- queries/ledger/highlights.scm | 72 +- queries/ledger/indents.scm | 4 +- queries/ledger/injections.scm | 4 +- queries/leo/highlights.scm | 200 +++--- queries/leo/indents.scm | 44 +- queries/leo/injections.scm | 2 +- queries/linkerscript/highlights.scm | 86 ++- queries/linkerscript/locals.scm | 17 +- queries/liquidsoap/folds.scm | 38 +- queries/liquidsoap/highlights.scm | 40 +- queries/liquidsoap/indents.scm | 54 +- queries/liquidsoap/locals.scm | 38 +- queries/llvm/highlights.scm | 30 +- queries/lua/folds.scm | 20 +- queries/lua/highlights.scm | 231 +++--- queries/lua/indents.scm | 1 - queries/lua/injections.scm | 143 ++-- queries/lua/locals.scm | 29 +- queries/luadoc/highlights.scm | 95 ++- queries/luap/highlights.scm | 13 +- queries/luau/folds.scm | 5 +- queries/luau/highlights.scm | 221 +++--- queries/luau/indents.scm | 5 +- queries/luau/injections.scm | 36 +- queries/luau/locals.scm | 29 +- queries/m68k/highlights.scm | 30 +- queries/m68k/injections.scm | 2 +- queries/m68k/locals.scm | 9 +- queries/make/folds.scm | 12 +- queries/make/highlights.scm | 241 +++---- queries/make/injections.scm | 7 +- queries/markdown/folds.scm | 16 +- queries/markdown/highlights.scm | 68 +- queries/markdown/indents.scm | 4 +- queries/markdown/injections.scm | 28 +- queries/markdown_inline/highlights.scm | 37 +- queries/markdown_inline/injections.scm | 8 +- queries/matlab/folds.scm | 24 +- queries/matlab/highlights.scm | 136 ++-- queries/matlab/indents.scm | 20 +- queries/matlab/injections.scm | 2 +- queries/matlab/locals.scm | 33 +- queries/menhir/highlights.scm | 66 +- queries/menhir/injections.scm | 2 +- queries/mermaid/highlights.scm | 334 +++++---- queries/meson/folds.scm | 14 +- queries/meson/highlights.scm | 15 +- queries/meson/injections.scm | 2 +- queries/mlir/highlights.scm | 22 +- queries/mlir/locals.scm | 11 +- queries/nasm/highlights.scm | 35 +- queries/nickel/highlights.scm | 39 +- queries/nickel/indents.scm | 10 +- queries/nim/folds.scm | 8 - queries/nim/highlights.scm | 817 +++++++++++++--------- queries/nim/injections.scm | 43 +- queries/nim/locals.scm | 340 +++++---- queries/nim_format_string/highlights.scm | 12 +- queries/nim_format_string/injections.scm | 4 +- queries/ninja/highlights.scm | 110 +-- queries/ninja/indents.scm | 1 - queries/nix/highlights.scm | 87 ++- queries/nix/injections.scm | 240 ++++--- queries/nix/locals.scm | 35 +- queries/nqc/highlights.scm | 5 +- queries/objc/folds.scm | 1 - queries/objc/highlights.scm | 169 +++-- queries/objc/injections.scm | 1 - queries/objdump/highlights.scm | 41 +- queries/ocaml/highlights.scm | 261 +++++-- queries/ocaml/indents.scm | 51 +- queries/ocaml/injections.scm | 2 +- queries/ocaml/locals.scm | 42 +- queries/ocamllex/highlights.scm | 60 +- queries/ocamllex/injections.scm | 4 +- queries/odin/highlights.scm | 183 +++-- queries/odin/injections.scm | 2 +- queries/odin/locals.scm | 52 +- queries/pascal/folds.scm | 6 +- queries/pascal/highlights.scm | 688 ++++++++++-------- queries/pascal/indents.scm | 53 +- queries/pascal/injections.scm | 3 +- queries/pascal/locals.scm | 70 +- queries/pem/highlights.scm | 5 +- queries/pem/injections.scm | 2 +- queries/perl/folds.scm | 26 +- queries/perl/highlights.scm | 232 ++++-- queries/perl/injections.scm | 8 +- queries/php/highlights.scm | 332 +++++---- queries/php/indents.scm | 14 +- queries/php/injections.scm | 47 +- queries/php/locals.scm | 35 +- queries/phpdoc/highlights.scm | 56 +- queries/pioasm/highlights.scm | 91 ++- queries/pioasm/injections.scm | 14 +- queries/po/folds.scm | 1 - queries/po/highlights.scm | 17 +- queries/po/injections.scm | 2 +- queries/pod/highlights.scm | 19 +- queries/poe_filter/highlights.scm | 19 +- queries/poe_filter/injections.scm | 2 +- queries/pony/folds.scm | 8 +- queries/pony/highlights.scm | 185 +++-- queries/pony/indents.scm | 39 +- queries/pony/injections.scm | 4 +- queries/pony/locals.scm | 15 +- queries/prisma/folds.scm | 10 +- queries/prisma/highlights.scm | 19 +- queries/promql/highlights.scm | 5 +- queries/promql/injections.scm | 4 +- queries/properties/highlights.scm | 36 +- queries/properties/injections.scm | 2 +- queries/properties/locals.scm | 6 +- queries/proto/highlights.scm | 12 +- queries/prql/highlights.scm | 26 +- queries/prql/injections.scm | 6 +- queries/psv/highlights.scm | 1 - queries/pug/highlights.scm | 81 ++- queries/pug/injections.scm | 4 +- queries/puppet/highlights.scm | 149 ++-- queries/puppet/locals.scm | 42 +- queries/purescript/highlights.scm | 270 ++++--- queries/purescript/injections.scm | 2 +- queries/purescript/locals.scm | 15 +- queries/pymanifest/highlights.scm | 11 +- queries/pymanifest/injections.scm | 2 +- queries/python/folds.scm | 5 - queries/python/highlights.scm | 258 ++++--- queries/python/indents.scm | 138 ++-- queries/python/injections.scm | 20 +- queries/python/locals.scm | 102 +-- queries/ql/folds.scm | 10 +- queries/ql/highlights.scm | 38 +- queries/ql/injections.scm | 4 +- queries/ql/locals.scm | 43 +- queries/qmldir/highlights.scm | 8 +- queries/qmldir/injections.scm | 2 +- queries/qmljs/highlights.scm | 93 +-- queries/query/highlights.scm | 80 ++- queries/query/indents.scm | 8 +- queries/query/injections.scm | 38 +- queries/query/locals.scm | 12 +- queries/r/highlights.scm | 138 ++-- queries/r/indents.scm | 14 +- queries/r/injections.scm | 2 +- queries/r/locals.scm | 15 +- queries/racket/folds.scm | 3 +- queries/racket/highlights.scm | 174 +++-- queries/racket/injections.scm | 4 +- queries/rasi/folds.scm | 2 +- queries/rasi/highlights.scm | 133 +++- queries/rasi/indents.scm | 3 +- queries/rasi/locals.scm | 11 +- queries/rbs/highlights.scm | 109 +-- queries/rbs/injections.scm | 2 +- queries/re2c/highlights.scm | 30 +- queries/re2c/indents.scm | 8 +- queries/re2c/injections.scm | 4 +- queries/regex/highlights.scm | 52 +- queries/rego/highlights.scm | 42 +- queries/rego/injections.scm | 2 +- queries/requirements/highlights.scm | 39 +- queries/requirements/injections.scm | 2 +- queries/rnoweb/folds.scm | 4 +- queries/rnoweb/highlights.scm | 2 +- queries/rnoweb/injections.scm | 4 +- queries/robot/highlights.scm | 44 +- queries/robot/indents.scm | 44 +- queries/ron/highlights.scm | 50 +- queries/ron/indents.scm | 15 +- queries/ron/injections.scm | 2 +- queries/ron/locals.scm | 27 +- queries/rst/highlights.scm | 58 +- queries/rst/injections.scm | 108 ++- queries/rst/locals.scm | 25 +- queries/ruby/highlights.scm | 341 +++++---- queries/ruby/injections.scm | 14 +- queries/ruby/locals.scm | 84 ++- queries/rust/folds.scm | 4 - queries/rust/highlights.scm | 244 ++++--- queries/rust/indents.scm | 60 +- queries/rust/injections.scm | 48 +- queries/rust/locals.scm | 85 +-- queries/scala/folds.scm | 27 +- queries/scala/highlights.scm | 157 +++-- queries/scala/injections.scm | 4 +- queries/scala/locals.scm | 15 +- queries/scfg/highlights.scm | 6 +- queries/scfg/injections.scm | 2 +- queries/scheme/folds.scm | 3 +- queries/scheme/highlights.scm | 154 ++-- queries/scheme/injections.scm | 2 +- queries/scss/highlights.scm | 47 +- queries/scss/indents.scm | 7 +- queries/slang/folds.scm | 11 +- queries/slang/highlights.scm | 43 +- queries/slang/indents.scm | 1 - queries/slang/injections.scm | 4 +- queries/slint/highlights.scm | 217 +++--- queries/slint/indents.scm | 12 +- queries/smali/highlights.scm | 93 +-- queries/smali/indents.scm | 5 +- queries/smali/injections.scm | 2 +- queries/smali/locals.scm | 3 +- queries/smithy/highlights.scm | 43 +- queries/snakemake/highlights.scm | 87 ++- queries/snakemake/injections.scm | 4 +- queries/solidity/highlights.scm | 140 ++-- queries/soql/highlights.scm | 25 +- queries/sosl/highlights.scm | 8 +- queries/sparql/highlights.scm | 73 +- queries/sparql/indents.scm | 1 + queries/sparql/injections.scm | 2 +- queries/sparql/locals.scm | 16 +- queries/sql/highlights.scm | 155 ++-- queries/sql/indents.scm | 32 +- queries/sql/injections.scm | 5 +- queries/squirrel/folds.scm | 4 - queries/squirrel/highlights.scm | 123 ++-- queries/squirrel/indents.scm | 25 +- queries/squirrel/injections.scm | 2 +- queries/squirrel/locals.scm | 44 +- queries/ssh_config/highlights.scm | 67 +- queries/ssh_config/indents.scm | 8 +- queries/ssh_config/injections.scm | 25 +- queries/starlark/folds.scm | 5 - queries/starlark/highlights.scm | 192 +++-- queries/starlark/indents.scm | 37 +- queries/starlark/locals.scm | 67 +- queries/strace/highlights.scm | 9 +- queries/supercollider/folds.scm | 9 +- queries/supercollider/highlights.scm | 68 +- queries/supercollider/indents.scm | 6 +- queries/supercollider/injections.scm | 4 +- queries/supercollider/locals.scm | 38 +- queries/surface/highlights.scm | 4 +- queries/surface/indents.scm | 2 +- queries/surface/injections.scm | 4 +- queries/svelte/folds.scm | 14 +- queries/svelte/highlights.scm | 1 - queries/svelte/injections.scm | 47 +- queries/swift/highlights.scm | 253 +++++-- queries/swift/indents.scm | 38 +- queries/swift/locals.scm | 31 +- queries/sxhkdrc/folds.scm | 4 +- queries/sxhkdrc/highlights.scm | 9 + queries/sxhkdrc/injections.scm | 2 +- queries/systemtap/highlights.scm | 11 +- queries/systemtap/injections.scm | 4 +- queries/t32/highlights.scm | 68 +- queries/t32/injections.scm | 2 +- queries/t32/locals.scm | 16 +- queries/tablegen/folds.scm | 2 +- queries/tablegen/highlights.scm | 84 +-- queries/tablegen/indents.scm | 22 +- queries/tablegen/locals.scm | 14 +- queries/teal/folds.scm | 22 +- queries/teal/highlights.scm | 251 +++++-- queries/teal/injections.scm | 51 +- queries/teal/locals.scm | 31 +- queries/templ/highlights.scm | 4 +- queries/templ/injections.scm | 12 +- queries/terraform/highlights.scm | 38 +- queries/textproto/highlights.scm | 7 +- queries/textproto/indents.scm | 13 +- queries/thrift/folds.scm | 1 - queries/thrift/highlights.scm | 102 +-- queries/thrift/indents.scm | 17 +- queries/thrift/injections.scm | 2 +- queries/thrift/locals.scm | 57 +- queries/tiger/folds.scm | 3 - queries/tiger/highlights.scm | 75 +- queries/tiger/indents.scm | 74 +- queries/tiger/injections.scm | 3 +- queries/tiger/locals.scm | 14 +- queries/tlaplus/highlights.scm | 339 ++++++--- queries/tlaplus/injections.scm | 4 +- queries/tlaplus/locals.scm | 149 +++- queries/todotxt/highlights.scm | 20 +- queries/toml/highlights.scm | 22 +- queries/toml/injections.scm | 2 +- queries/tsv/highlights.scm | 3 + queries/turtle/highlights.scm | 15 +- queries/turtle/indents.scm | 8 +- queries/turtle/injections.scm | 2 +- queries/twig/highlights.scm | 70 +- queries/twig/injections.scm | 5 +- queries/typescript/folds.scm | 1 - queries/typescript/highlights.scm | 137 ++-- queries/typescript/indents.scm | 1 - queries/typescript/locals.scm | 13 +- queries/typoscript/highlights.scm | 13 +- queries/typoscript/indents.scm | 2 +- queries/typoscript/injections.scm | 4 +- queries/udev/highlights.scm | 48 +- queries/udev/injections.scm | 16 +- queries/udev/locals.scm | 18 +- queries/ungrammar/highlights.scm | 4 +- queries/ungrammar/injections.scm | 3 +- queries/unison/highlights.scm | 65 +- queries/unison/injections.scm | 2 +- queries/usd/folds.scm | 4 +- queries/usd/highlights.scm | 73 +- queries/usd/indents.scm | 31 +- queries/uxntal/folds.scm | 1 - queries/uxntal/highlights.scm | 35 +- queries/uxntal/indents.scm | 10 +- queries/uxntal/injections.scm | 4 +- queries/uxntal/locals.scm | 9 +- queries/v/folds.scm | 14 +- queries/v/highlights.scm | 272 +------ queries/v/indents.scm | 25 +- queries/v/injections.scm | 27 +- queries/v/locals.scm | 33 +- queries/vala/folds.scm | 1 - queries/vala/highlights.scm | 410 ++++++----- queries/verilog/highlights.scm | 147 ++-- queries/verilog/injections.scm | 2 +- queries/verilog/locals.scm | 59 +- queries/vhs/highlights.scm | 23 +- queries/vim/folds.scm | 4 +- queries/vim/highlights.scm | 234 ++++--- queries/vim/injections.scm | 68 +- queries/vim/locals.scm | 16 +- queries/vimdoc/highlights.scm | 55 +- queries/vimdoc/injections.scm | 2 +- queries/vue/highlights.scm | 5 +- queries/vue/indents.scm | 9 +- queries/vue/injections.scm | 93 +-- queries/wgsl/folds.scm | 16 +- queries/wgsl/highlights.scm | 146 ++-- queries/wgsl/indents.scm | 20 +- queries/wgsl_bevy/folds.scm | 5 +- queries/wgsl_bevy/highlights.scm | 38 +- queries/wing/highlights.scm | 38 +- queries/wing/locals.scm | 1 + queries/xcompose/highlights.scm | 30 +- queries/xcompose/injections.scm | 2 +- queries/xcompose/locals.scm | 6 +- queries/xml/highlights.scm | 72 +- queries/xml/injections.scm | 44 +- queries/xml/locals.scm | 38 +- queries/yaml/highlights.scm | 71 +- queries/yaml/indents.scm | 3 +- queries/yaml/injections.scm | 127 ++-- queries/yaml/locals.scm | 7 +- queries/yang/folds.scm | 4 +- queries/yang/highlights.scm | 65 +- queries/yang/indents.scm | 19 +- queries/yang/injections.scm | 12 +- queries/yuck/highlights.scm | 91 +-- queries/yuck/indents.scm | 33 +- queries/yuck/injections.scm | 3 +- queries/yuck/locals.scm | 2 +- queries/zig/folds.scm | 12 +- queries/zig/highlights.scm | 104 ++- queries/zig/indents.scm | 3 +- queries/zig/injections.scm | 5 +- queries/zig/locals.scm | 1 + 674 files changed, 18466 insertions(+), 12648 deletions(-) diff --git a/queries/ada/folds.scm b/queries/ada/folds.scm index b8b5735bb..8e3defac4 100644 --- a/queries/ada/folds.scm +++ b/queries/ada/folds.scm @@ -1,14 +1,13 @@ -;; Support for folding in Ada -;; za toggles folding a package, subprogram, if statement or loop - +; Support for folding in Ada +; za toggles folding a package, subprogram, if statement or loop [ - (package_declaration) - (generic_package_declaration) - (package_body) - (subprogram_body) - (block_statement) - (if_statement) - (loop_statement) - (gnatprep_declarative_if_statement) - (gnatprep_if_statement) + (package_declaration) + (generic_package_declaration) + (package_body) + (subprogram_body) + (block_statement) + (if_statement) + (loop_statement) + (gnatprep_declarative_if_statement) + (gnatprep_if_statement) ] @fold diff --git a/queries/ada/highlights.scm b/queries/ada/highlights.scm index a88935b2a..c15c4d9e3 100644 --- a/queries/ada/highlights.scm +++ b/queries/ada/highlights.scm @@ -1,190 +1,288 @@ -;; highlight queries. -;; See the syntax at https://tree-sitter.github.io/tree-sitter/using-parsers#pattern-matching-with-queries -;; See also https://github.com/nvim-treesitter/nvim-treesitter/blob/master/CONTRIBUTING.md#parser-configurations -;; for a list of recommended @ tags, though not all of them have matching -;; highlights in neovim. +; highlight queries. +; See the syntax at https://tree-sitter.github.io/tree-sitter/using-parsers#pattern-matching-with-queries +; See also https://github.com/nvim-treesitter/nvim-treesitter/blob/master/CONTRIBUTING.md#parser-configurations +; for a list of recommended @ tags, though not all of them have matching +; highlights in neovim. +[ + "abort" + "abs" + "abstract" + "accept" + "access" + "all" + "array" + "at" + "begin" + "declare" + "delay" + "delta" + "digits" + "do" + "end" + "entry" + "exit" + "generic" + "interface" + "is" + "limited" + "null" + "of" + "others" + "out" + "pragma" + "private" + "range" + "synchronized" + "tagged" + "task" + "terminate" + "until" + "when" +] @keyword [ - "abort" - "abs" - "abstract" - "accept" - "access" - "all" - "array" - "at" - "begin" - "declare" - "delay" - "delta" - "digits" - "do" - "end" - "entry" - "exit" - "generic" - "interface" - "is" - "limited" - "null" - "of" - "others" - "out" - "pragma" - "private" - "range" - "synchronized" - "tagged" - "task" - "terminate" - "until" - "when" -] @keyword -[ - "aliased" - "constant" - "renames" + "aliased" + "constant" + "renames" ] @keyword.storage + [ - "mod" - "new" - "protected" - "record" - "subtype" - "type" + "mod" + "new" + "protected" + "record" + "subtype" + "type" ] @keyword.type + [ - "with" - "use" + "with" + "use" ] @keyword.import + [ - "body" - "function" - "overriding" - "procedure" - "package" - "separate" + "body" + "function" + "overriding" + "procedure" + "package" + "separate" ] @keyword.function + [ - "and" - "in" - "not" - "or" - "xor" + "and" + "in" + "not" + "or" + "xor" ] @keyword.operator + [ - "while" - "loop" - "for" - "parallel" - "reverse" - "some" + "while" + "loop" + "for" + "parallel" + "reverse" + "some" ] @keyword.repeat + +"return" @keyword.return + [ - "return" -] @keyword.return -[ - "case" - "if" - "else" - "then" - "elsif" - "select" + "case" + "if" + "else" + "then" + "elsif" + "select" ] @keyword.conditional + [ - "exception" - "raise" + "exception" + "raise" ] @keyword.exception + (comment) @comment @spell + (string_literal) @string + (character_literal) @string + (numeric_literal) @number -;; Highlight the name of subprograms -(procedure_specification name: (_) @function) -(function_specification name: (_) @function) -(package_declaration name: (_) @function) -(package_body name: (_) @function) -(generic_instantiation name: (_) @function) -(entry_declaration . (identifier) @function) +; Highlight the name of subprograms +(procedure_specification + name: (_) @function) -;; Some keywords should take different categories depending on the context -(use_clause "use" @keyword.import "type" @keyword.import) -(with_clause "private" @keyword.import) -(with_clause "limited" @keyword.import) -(use_clause (_) @module) -(with_clause (_) @module) +(function_specification + name: (_) @function) -(loop_statement "end" @keyword.repeat) -(if_statement "end" @keyword.conditional) -(loop_parameter_specification "in" @keyword.repeat) -(loop_parameter_specification "in" @keyword.repeat) -(iterator_specification ["in" "of"] @keyword.repeat) -(range_attribute_designator "range" @keyword.repeat) +(package_declaration + name: (_) @function) -(raise_statement "with" @keyword.exception) +(package_body + name: (_) @function) -(gnatprep_declarative_if_statement) @keyword.directive -(gnatprep_if_statement) @keyword.directive -(gnatprep_identifier) @keyword.directive +(generic_instantiation + name: (_) @function) -(subprogram_declaration "is" @keyword.function "abstract" @keyword.function) -(aspect_specification "with" @keyword.function) +(entry_declaration + . + (identifier) @function) -(full_type_declaration "is" @keyword.type) -(subtype_declaration "is" @keyword.type) -(record_definition "end" @keyword.type) -(full_type_declaration (_ "access" @keyword.type)) -(array_type_definition "array" @keyword.type "of" @keyword.type) -(access_to_object_definition "access" @keyword.type) -(access_to_object_definition "access" @keyword.type - [ - (general_access_modifier "constant" @keyword.type) - (general_access_modifier "all" @keyword.type) - ] -) -(range_constraint "range" @keyword.type) -(signed_integer_type_definition "range" @keyword.type) -(index_subtype_definition "range" @keyword.type) -(record_type_definition "abstract" @keyword.type) -(record_type_definition "tagged" @keyword.type) -(record_type_definition "limited" @keyword.type) -(record_type_definition (record_definition "null" @keyword.type)) -(private_type_declaration "is" @keyword.type "private" @keyword.type) -(private_type_declaration "tagged" @keyword.type) -(private_type_declaration "limited" @keyword.type) -(task_type_declaration "task" @keyword.type "is" @keyword.type) +; Some keywords should take different categories depending on the context +(use_clause + "use" @keyword.import + "type" @keyword.import) -;; Gray the body of expression functions +(with_clause + "private" @keyword.import) + +(with_clause + "limited" @keyword.import) + +(use_clause + (_) @module) + +(with_clause + (_) @module) + +(loop_statement + "end" @keyword.repeat) + +(if_statement + "end" @keyword.conditional) + +(loop_parameter_specification + "in" @keyword.repeat) + +(loop_parameter_specification + "in" @keyword.repeat) + +(iterator_specification + [ + "in" + "of" + ] @keyword.repeat) + +(range_attribute_designator + "range" @keyword.repeat) + +(raise_statement + "with" @keyword.exception) + +(gnatprep_declarative_if_statement) @keyword.directive + +(gnatprep_if_statement) @keyword.directive + +(gnatprep_identifier) @keyword.directive + +(subprogram_declaration + "is" @keyword.function + "abstract" @keyword.function) + +(aspect_specification + "with" @keyword.function) + +(full_type_declaration + "is" @keyword.type) + +(subtype_declaration + "is" @keyword.type) + +(record_definition + "end" @keyword.type) + +(full_type_declaration + (_ + "access" @keyword.type)) + +(array_type_definition + "array" @keyword.type + "of" @keyword.type) + +(access_to_object_definition + "access" @keyword.type) + +(access_to_object_definition + "access" @keyword.type + [ + (general_access_modifier + "constant" @keyword.type) + (general_access_modifier + "all" @keyword.type) + ]) + +(range_constraint + "range" @keyword.type) + +(signed_integer_type_definition + "range" @keyword.type) + +(index_subtype_definition + "range" @keyword.type) + +(record_type_definition + "abstract" @keyword.type) + +(record_type_definition + "tagged" @keyword.type) + +(record_type_definition + "limited" @keyword.type) + +(record_type_definition + (record_definition + "null" @keyword.type)) + +(private_type_declaration + "is" @keyword.type + "private" @keyword.type) + +(private_type_declaration + "tagged" @keyword.type) + +(private_type_declaration + "limited" @keyword.type) + +(task_type_declaration + "task" @keyword.type + "is" @keyword.type) + +; Gray the body of expression functions (expression_function_declaration - (function_specification) - "is" - (_) @attribute -) -(subprogram_declaration (aspect_specification) @attribute) + (function_specification) + "is" + (_) @attribute) -;; Highlight full subprogram specifications +(subprogram_declaration + (aspect_specification) @attribute) + +; Highlight full subprogram specifications ;(subprogram_body ; [ ; (procedure_specification) ; (function_specification) ; ] @function.spec ;) - ((comment) @comment.documentation - . [ - (entry_declaration) - (subprogram_declaration) - (parameter_specification) - ]) + . + [ + (entry_declaration) + (subprogram_declaration) + (parameter_specification) + ]) -(compilation_unit - . (comment) @comment.documentation) +(compilation_unit + . + (comment) @comment.documentation) (component_list (component_declaration) - . (comment) @comment.documentation) + . + (comment) @comment.documentation) -(enumeration_type_definition +(enumeration_type_definition (identifier) - . (comment) @comment.documentation) + . + (comment) @comment.documentation) diff --git a/queries/ada/locals.scm b/queries/ada/locals.scm index 2d61b3123..bdfc38be8 100644 --- a/queries/ada/locals.scm +++ b/queries/ada/locals.scm @@ -1,33 +1,91 @@ -;; Better highlighting by referencing to the definition, for variable -;; references. However, this is not yet supported by neovim -;; See https://tree-sitter.github.io/tree-sitter/syntax-highlighting#local-variables - +; Better highlighting by referencing to the definition, for variable +; references. However, this is not yet supported by neovim +; See https://tree-sitter.github.io/tree-sitter/syntax-highlighting#local-variables (compilation) @local.scope + (package_declaration) @local.scope + (package_body) @local.scope + (subprogram_declaration) @local.scope + (subprogram_body) @local.scope + (block_statement) @local.scope -(with_clause (identifier) @local.definition.import) -(procedure_specification name: (_) @local.definition.function) -(function_specification name: (_) @local.definition.function) -(package_declaration name: (_) @local.definition.var) -(package_body name: (_) @local.definition.var) -(generic_instantiation . name: (_) @local.definition.var) -(component_declaration . (identifier) @local.definition.var) -(exception_declaration . (identifier) @local.definition.var) -(formal_object_declaration . (identifier) @local.definition.var) -(object_declaration . (identifier) @local.definition.var) -(parameter_specification . (identifier) @local.definition.var) -(full_type_declaration . (identifier) @local.definition.type) -(private_type_declaration . (identifier) @local.definition.type) -(private_extension_declaration . (identifier) @local.definition.type) -(incomplete_type_declaration . (identifier) @local.definition.type) -(protected_type_declaration . (identifier) @local.definition.type) -(formal_complete_type_declaration . (identifier) @local.definition.type) -(formal_incomplete_type_declaration . (identifier) @local.definition.type) -(task_type_declaration . (identifier) @local.definition.type) -(subtype_declaration . (identifier) @local.definition.type) +(with_clause + (identifier) @local.definition.import) + +(procedure_specification + name: (_) @local.definition.function) + +(function_specification + name: (_) @local.definition.function) + +(package_declaration + name: (_) @local.definition.var) + +(package_body + name: (_) @local.definition.var) + +(generic_instantiation + . + name: (_) @local.definition.var) + +(component_declaration + . + (identifier) @local.definition.var) + +(exception_declaration + . + (identifier) @local.definition.var) + +(formal_object_declaration + . + (identifier) @local.definition.var) + +(object_declaration + . + (identifier) @local.definition.var) + +(parameter_specification + . + (identifier) @local.definition.var) + +(full_type_declaration + . + (identifier) @local.definition.type) + +(private_type_declaration + . + (identifier) @local.definition.type) + +(private_extension_declaration + . + (identifier) @local.definition.type) + +(incomplete_type_declaration + . + (identifier) @local.definition.type) + +(protected_type_declaration + . + (identifier) @local.definition.type) + +(formal_complete_type_declaration + . + (identifier) @local.definition.type) + +(formal_incomplete_type_declaration + . + (identifier) @local.definition.type) + +(task_type_declaration + . + (identifier) @local.definition.type) + +(subtype_declaration + . + (identifier) @local.definition.type) (identifier) @local.reference diff --git a/queries/agda/folds.scm b/queries/agda/folds.scm index e3258efb9..5e1051f8f 100644 --- a/queries/agda/folds.scm +++ b/queries/agda/folds.scm @@ -1,4 +1,4 @@ [ - (record) - (module) + (record) + (module) ] @fold diff --git a/queries/agda/highlights.scm b/queries/agda/highlights.scm index 6ff55d2fc..657e657f9 100644 --- a/queries/agda/highlights.scm +++ b/queries/agda/highlights.scm @@ -1,43 +1,52 @@ - -;; Constants +; Constants (integer) @number -;; Variables and Symbols +; Variables and Symbols +(typed_binding + (atom + (qid) @variable)) -(typed_binding (atom (qid) @variable)) (untyped_binding) @variable -(typed_binding (expr) @type) + +(typed_binding + (expr) @type) (id) @function + (bid) @function -(function_name (atom (qid) @function)) +(function_name + (atom + (qid) @function)) + (field_name) @function - -[(data_name) (record_name)] @constructor +[ + (data_name) + (record_name) +] @constructor ; Set (SetN) @type.builtin -(expr . (atom) @function) +(expr + . + (atom) @function) ((atom) @boolean (#any-of? @boolean "true" "false" "True" "False")) -;; Imports and Module Declarations - -"import" @keyword.import +; Imports and Module Declarations +"import" @keyword.import (module_name) @module -;; Pragmas and comments - +; Pragmas and comments (pragma) @keyword.directive (comment) @comment @spell -;; Keywords +; Keywords [ "where" "data" @@ -62,20 +71,16 @@ "infixl" "infixr" "record" -] -@keyword - -;;;(expr -;;; f_name: (atom) @function) -;; Brackets +] @keyword +;(expr +; f_name: (atom) @function) +; Brackets [ "(" ")" "{" - "}"] -@punctuation.bracket + "}" +] @punctuation.bracket -[ - "=" -] @operator +"=" @operator diff --git a/queries/angular/highlights.scm b/queries/angular/highlights.scm index 42d69c28a..a109dc179 100644 --- a/queries/angular/highlights.scm +++ b/queries/angular/highlights.scm @@ -1,12 +1,19 @@ (identifier) @variable -(pipe_sequence "|" @operator) + +(pipe_sequence + "|" @operator) + (string) @string + (number) @number + (pipe_call name: (identifier) @function) + (pipe_call - arguments: (pipe_arguments - (identifier) @variable.parameter)) + arguments: + (pipe_arguments + (identifier) @variable.parameter)) (structural_assignment operator: (identifier) @keyword) @@ -18,32 +25,34 @@ function: (identifier) @function) (call_expression - function: ((identifier) @function.builtin - (#eq? @function.builtin "$any"))) + function: + ((identifier) @function.builtin + (#eq? @function.builtin "$any"))) [ -"let" -"as" + "let" + "as" ] @keyword [ -"(" -")" -"[" -"]" -"{" -"}" + "(" + ")" + "[" + "]" + "{" + "}" ] @punctuation.bracket [ -";" -"." -"," -"?." + ";" + "." + "," + "?." ] @punctuation.delimiter ((identifier) @boolean (#any-of? @boolean "true" "false")) + ((identifier) @variable.builtin (#any-of? @variable.builtin "this" "\$event" "null")) diff --git a/queries/apex/folds.scm b/queries/apex/folds.scm index 0ffc550e9..fdfc2a1ed 100644 --- a/queries/apex/folds.scm +++ b/queries/apex/folds.scm @@ -1,6 +1,6 @@ [ - (class_body) - (constructor_declaration) - (argument_list) - (annotation_argument_list) + (class_body) + (constructor_declaration) + (argument_list) + (annotation_argument_list) ] @fold diff --git a/queries/apex/highlights.scm b/queries/apex/highlights.scm index 692fccb1b..64ff9168c 100644 --- a/queries/apex/highlights.scm +++ b/queries/apex/highlights.scm @@ -1,7 +1,5 @@ ; inherits: soql - -;;; Apex + SOQL - +; Apex + SOQL [ "[" "]" @@ -17,16 +15,14 @@ ":" "?" ";" - ] @punctuation.delimiter - -;; Default general color defination +] @punctuation.delimiter +; Default general color defination (identifier) @variable (type_identifier) @type -;; Methods - +; Methods (method_declaration name: (identifier) @function.method) @@ -35,13 +31,11 @@ (super) @function.builtin -;; Annotations - +; Annotations (annotation name: (identifier) @attribute) -;; Types - +; Types (interface_declaration name: (identifier) @type) @@ -49,7 +43,7 @@ name: (identifier) @type) (class_declaration - (superclass) @type) + (superclass) @type) (enum_declaration name: (identifier) @type) @@ -57,8 +51,11 @@ (enum_constant name: (identifier) @constant) -(type_arguments "<" @punctuation.delimiter) -(type_arguments ">" @punctuation.delimiter) +(type_arguments + "<" @punctuation.delimiter) + +(type_arguments + ">" @punctuation.delimiter) ((field_access object: (identifier) @type)) @@ -68,11 +65,11 @@ ((scoped_identifier scope: (identifier) @type) - (#match? @type "^[A-Z]")) + (#match? @type "^[A-Z]")) ((method_invocation object: (identifier) @type) - (#match? @type "^[A-Z]")) + (#match? @type "^[A-Z]")) (method_declaration (formal_parameters @@ -86,16 +83,21 @@ (assignment_operator) @operator -(update_expression ["++" "--"] @operator) +(update_expression + [ + "++" + "--" + ] @operator) (trigger_declaration name: (identifier) @type object: (identifier) @type (trigger_event) @keyword - ("," (trigger_event) @keyword)*) + ("," + (trigger_event) @keyword)*) [ - "@" + "@" "=" "!=" "<=" @@ -103,35 +105,39 @@ ] @operator (binary_expression - operator: [ - ">" - "<" - "==" - "===" - "!==" - "&&" - "||" - "+" - "-" - "*" - "/" - "&" - "|" - "^" - "%" - "<<" - ">>" - ">>>"] @operator) + operator: + [ + ">" + "<" + "==" + "===" + "!==" + "&&" + "||" + "+" + "-" + "*" + "/" + "&" + "|" + "^" + "%" + "<<" + ">>" + ">>>" + ] @operator) (unary_expression - operator: [ - "+" - "-" - "!" - "~" - ]) @operator + operator: + [ + "+" + "-" + "!" + "~" + ]) @operator -(map_initializer "=>" @operator) +(map_initializer + "=>" @operator) [ (boolean_type) @@ -139,18 +145,27 @@ ] @type.builtin ; Fields - (field_declaration - declarator: (variable_declarator - name: (identifier) @variable.member)) + declarator: + (variable_declarator + name: (identifier) @variable.member)) (field_access field: (identifier) @variable.member) ; Variables - (field_declaration - (modifiers (modifier ["final" "static"])(modifier ["final" "static"])) + (modifiers + (modifier + [ + "final" + "static" + ]) + (modifier + [ + "final" + "static" + ])) (variable_declarator name: (identifier) @constant)) @@ -163,7 +178,6 @@ (this) @variable.builtin ; Literals - [ (int) (decimal) @@ -179,16 +193,15 @@ (null_literal) @constant.builtin -;; ;; Keywords - +; ;; Keywords [ - "abstract" - "final" - "private" - "protected" - "public" - "static" - ] @type.qualifier + "abstract" + "final" + "private" + "protected" + "public" + "static" +] @type.qualifier [ "if" @@ -203,16 +216,14 @@ "break" ] @keyword.repeat -[ - "return" -] @keyword.return +"return" @keyword.return [ - "throw" - "finally" - "try" - "catch" - ] @keyword.exception + "throw" + "finally" + "try" + "catch" +] @keyword.exception "new" @keyword.operator diff --git a/queries/apex/locals.scm b/queries/apex/locals.scm index 5661b911d..d3cbfa73b 100644 --- a/queries/apex/locals.scm +++ b/queries/apex/locals.scm @@ -1,41 +1,46 @@ ; declarations - (class_declaration) @local.scope + (method_declaration) @local.scope + (constructor_declaration) @local.scope + (enum_declaration) @local.scope + (enhanced_for_statement) @local.scope ; if/else - (if_statement) @local.scope + (if_statement consequence: (_) @local.scope) ; if body in case there are no braces + (if_statement alternative: (_) @local.scope) ; else body in case there are no braces ; try/catch - (try_statement) @local.scope ; covers try+catch, individual try and catch are covered by (block) + (catch_clause) @local.scope ; needed because `Exception` variable ; loops - (for_statement) @local.scope -(for_statement ; "for" body in case there are no braces + +(for_statement ; "for" body in case there are no braces body: (_) @local.scope) + (do_statement body: (_) @local.scope) + (while_statement body: (_) @local.scope) ; Functions - (constructor_declaration) @local.scope + (method_declaration) @local.scope -;; definitions - +; definitions (enum_declaration name: (identifier) @local.definition.enum) @@ -43,10 +48,11 @@ name: (identifier) @local.definition.method) (local_variable_declaration - declarator: (variable_declarator - name: (identifier) @local.definition.var)) + declarator: + (variable_declarator + name: (identifier) @local.definition.var)) -(enhanced_for_statement +(enhanced_for_statement name: (identifier) @local.definition.var) (formal_parameter @@ -56,11 +62,11 @@ name: (identifier) @local.definition.parameter) (field_declaration - declarator: (variable_declarator - name: (identifier) @local.definition.field)) - -;; REFERENCES + declarator: + (variable_declarator + name: (identifier) @local.definition.field)) +; REFERENCES (identifier) @local.reference (type_identifier) @local.reference diff --git a/queries/arduino/highlights.scm b/queries/arduino/highlights.scm index a2e121a06..9620f1f73 100644 --- a/queries/arduino/highlights.scm +++ b/queries/arduino/highlights.scm @@ -1,5 +1,4 @@ ; inherits: cpp - ((identifier) @function.builtin ; format-ignore (#any-of? @function.builtin @@ -72,25 +71,10 @@ "noInterrupts")) ((identifier) @type.builtin - (#any-of? @type.builtin - "Serial" - "SPI" - "Stream" - "Wire" - "Keyboard" - "Mouse" - "String" - )) + (#any-of? @type.builtin "Serial" "SPI" "Stream" "Wire" "Keyboard" "Mouse" "String")) ((identifier) @constant.builtin - (#any-of? @constant.builtin - "HIGH" - "LOW" - "INPUT" - "OUTPUT" - "INPUT_PULLUP" - "LED_BUILTIN" - )) + (#any-of? @constant.builtin "HIGH" "LOW" "INPUT" "OUTPUT" "INPUT_PULLUP" "LED_BUILTIN")) (function_definition (function_declarator diff --git a/queries/arduino/injections.scm b/queries/arduino/injections.scm index 6ccfef83f..b637d9b2b 100644 --- a/queries/arduino/injections.scm +++ b/queries/arduino/injections.scm @@ -1,5 +1,5 @@ ((preproc_arg) @injection.content - (#set! injection.language "arduino")) + (#set! injection.language "arduino")) -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/astro/highlights.scm b/queries/astro/highlights.scm index 91ccbffb3..650a489e4 100644 --- a/queries/astro/highlights.scm +++ b/queries/astro/highlights.scm @@ -1,13 +1,20 @@ ; inherits: html +"---" @punctuation.delimiter -[ "---" ] @punctuation.delimiter - -[ "{" "}" ] @punctuation.special +[ + "{" + "}" +] @punctuation.special ; custom components get `@type` highlighting -((start_tag (tag_name) @type) - (#lua-match? @type "^[A-Z]")) -((end_tag (tag_name) @type) - (#lua-match? @type "^[A-Z]")) -((erroneous_end_tag (erroneous_end_tag_name) @type) - (#lua-match? @type "^[A-Z]")) +((start_tag + (tag_name) @type) + (#lua-match? @type "^[A-Z]")) + +((end_tag + (tag_name) @type) + (#lua-match? @type "^[A-Z]")) + +((erroneous_end_tag + (erroneous_end_tag_name) @type) + (#lua-match? @type "^[A-Z]")) diff --git a/queries/astro/injections.scm b/queries/astro/injections.scm index b8f1ccefc..9b1f285db 100644 --- a/queries/astro/injections.scm +++ b/queries/astro/injections.scm @@ -1,5 +1,4 @@ ; inherits: html_tags - (frontmatter (raw_text) @injection.content (#set! injection.language "typescript")) @@ -13,11 +12,12 @@ (#set! injection.language "typescript")) (style_element - (start_tag - (attribute - (attribute_name) @_lang_attr - (quoted_attribute_value (attribute_value) @_lang_value))) - (raw_text) @injection.content - (#eq? @_lang_attr "lang") - (#eq? @_lang_value "scss") - (#set! injection.language "scss")) + (start_tag + (attribute + (attribute_name) @_lang_attr + (quoted_attribute_value + (attribute_value) @_lang_value))) + (raw_text) @injection.content + (#eq? @_lang_attr "lang") + (#eq? @_lang_value "scss") + (#set! injection.language "scss")) diff --git a/queries/authzed/highlights.scm b/queries/authzed/highlights.scm index 7a4b85d1f..2009b78e3 100644 --- a/queries/authzed/highlights.scm +++ b/queries/authzed/highlights.scm @@ -11,7 +11,8 @@ (identifier) @type)) ; relations -(rel_expression (identifier) @property) +(rel_expression + (identifier) @property) (relation (rel_expression @@ -20,16 +21,18 @@ (identifier) @constant)) ; permissions -(perm_expression (identifier) @property) +(perm_expression + (identifier) @property) (call_expression - function: (selector_expression - operand: (identifier) @constant - field: (field_identifier) @function.method)) + function: + (selector_expression + operand: (identifier) @constant + field: (field_identifier) @function.method)) (perm_expression (stabby) @operator - . + . (identifier) @function) ; misc diff --git a/queries/authzed/injections.scm b/queries/authzed/injections.scm index 321c90add..2f0e58eb6 100644 --- a/queries/authzed/injections.scm +++ b/queries/authzed/injections.scm @@ -1,2 +1,2 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/awk/highlights.scm b/queries/awk/highlights.scm index 6d3b7ff0b..90c9f3437 100644 --- a/queries/awk/highlights.scm +++ b/queries/awk/highlights.scm @@ -1,67 +1,54 @@ ; adapted from https://github.com/Beaglefoot/tree-sitter-awk - [ (identifier) (field_ref) ] @variable -(field_ref (_) @variable) + +(field_ref + (_) @variable) ; https://www.gnu.org/software/gawk/manual/html_node/Auto_002dset.html ((identifier) @constant.builtin - (#any-of? @constant.builtin - "ARGC" - "ARGV" - "ARGIND" - "ENVIRON" - "ERRNO" - "FILENAME" - "FNR" - "NF" - "FUNCTAB" - "NR" - "PROCINFO" - "RLENGTH" - "RSTART" - "RT" - "SYMTAB")) + (#any-of? @constant.builtin "ARGC" "ARGV" "ARGIND" "ENVIRON" "ERRNO" "FILENAME" "FNR" "NF" "FUNCTAB" "NR" "PROCINFO" "RLENGTH" "RSTART" "RT" "SYMTAB")) ; https://www.gnu.org/software/gawk/manual/html_node/User_002dmodified.html ((identifier) @variable.builtin - (#any-of? @variable.builtin - "BINMODE" - "CONVFMT" - "FIELDWIDTHS" - "FPAT" - "FS" - "IGNORECASE" - "LINT" - "OFMT" - "OFS" - "ORS" - "PREC" - "ROUNDMODE" - "RS" - "SUBSEP" - "TEXTDOMAIN")) + (#any-of? @variable.builtin "BINMODE" "CONVFMT" "FIELDWIDTHS" "FPAT" "FS" "IGNORECASE" "LINT" "OFMT" "OFS" "ORS" "PREC" "ROUNDMODE" "RS" "SUBSEP" "TEXTDOMAIN")) (number) @number (string) @string + (regex) @string.regexp + (escape_sequence) @string.escape (comment) @comment @spell -((program . (comment) @keyword.directive) +((program + . + (comment) @keyword.directive) (#lua-match? @keyword.directive "^#!/")) -(ns_qualified_name (namespace) @module) -(ns_qualified_name "::" @punctuation.delimiter) +(ns_qualified_name + (namespace) @module) -(func_def name: (_ (identifier) @function) @function) -(func_call name: (_ (identifier) @function) @function) +(ns_qualified_name + "::" @punctuation.delimiter) -(func_def (param_list (identifier) @variable.parameter)) +(func_def + name: + (_ + (identifier) @function) @function) + +(func_call + name: + (_ + (identifier) @function) @function) + +(func_def + (param_list + (identifier) @variable.parameter)) [ "print" @@ -110,80 +97,95 @@ "@namespace" @keyword.directive [ - "BEGIN" - "END" - "BEGINFILE" - "ENDFILE" + "BEGIN" + "END" + "BEGINFILE" + "ENDFILE" ] @label -(binary_exp [ - "^" - "**" - "*" - "/" - "%" - "+" - "-" - "<" - ">" - "<=" - ">=" - "==" - "!=" - "~" - "!~" - "in" - "&&" - "||" -] @operator) +(binary_exp + [ + "^" + "**" + "*" + "/" + "%" + "+" + "-" + "<" + ">" + "<=" + ">=" + "==" + "!=" + "~" + "!~" + "in" + "&&" + "||" + ] @operator) -(unary_exp [ - "!" - "+" - "-" -] @operator) +(unary_exp + [ + "!" + "+" + "-" + ] @operator) -(assignment_exp [ - "=" - "+=" - "-=" - "*=" - "/=" - "%=" - "^=" -] @operator) +(assignment_exp + [ + "=" + "+=" + "-=" + "*=" + "/=" + "%=" + "^=" + ] @operator) -(ternary_exp [ - "?" - ":" -] @keyword.conditional.ternary) +(ternary_exp + [ + "?" + ":" + ] @keyword.conditional.ternary) -(update_exp [ - "++" - "--" -] @operator) +(update_exp + [ + "++" + "--" + ] @operator) -(redirected_io_statement [ - ">" - ">>" -] @operator) +(redirected_io_statement + [ + ">" + ">>" + ] @operator) -(piped_io_statement [ - "|" - "|&" -] @operator) +(piped_io_statement + [ + "|" + "|&" + ] @operator) -(piped_io_exp [ - "|" - "|&" -] @operator) +(piped_io_exp + [ + "|" + "|&" + ] @operator) -(field_ref "$" @punctuation.delimiter) +(field_ref + "$" @punctuation.delimiter) -(regex "/" @punctuation.delimiter) -(regex_constant "@" @punctuation.delimiter) +(regex + "/" @punctuation.delimiter) -[ ";" "," ] @punctuation.delimiter +(regex_constant + "@" @punctuation.delimiter) + +[ + ";" + "," +] @punctuation.delimiter [ "(" diff --git a/queries/awk/injections.scm b/queries/awk/injections.scm index 24db57d67..3e67da245 100644 --- a/queries/awk/injections.scm +++ b/queries/awk/injections.scm @@ -1,13 +1,17 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) ((regex) @injection.content - (#set! injection.language "regex")) + (#set! injection.language "regex")) ((print_statement - (exp_list . (string) @injection.content)) - (#set! injection.language "printf")) + (exp_list + . + (string) @injection.content)) + (#set! injection.language "printf")) ((printf_statement - (exp_list . (string) @injection.content)) - (#set! injection.language "printf")) + (exp_list + . + (string) @injection.content)) + (#set! injection.language "printf")) diff --git a/queries/bash/highlights.scm b/queries/bash/highlights.scm index 5820680ef..21346ded8 100644 --- a/queries/bash/highlights.scm +++ b/queries/bash/highlights.scm @@ -1,84 +1,89 @@ [ - "(" ")" - "{" "}" - "[" "]" - "[[" "]]" - "((" "))" + "(" + ")" + "{" + "}" + "[" + "]" + "[[" + "]]" + "((" + "))" ] @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) + (raw_string) + (ansi_c_string) + (heredoc_body) ] @string [ - (heredoc_start) - (heredoc_end) + (heredoc_start) + (heredoc_end) ] @label -(variable_assignment (word) @string) -(command argument: "$" @string) ; bare dollar +(variable_assignment + (word) @string) + +(command + argument: "$" @string) ; bare dollar [ - "if" - "then" - "else" - "elif" - "fi" - "case" - "in" - "esac" + "if" + "then" + "else" + "elif" + "fi" + "case" + "in" + "esac" ] @keyword.conditional [ - "for" - "do" - "done" - "select" - "until" - "while" + "for" + "do" + "done" + "select" + "until" + "while" ] @keyword.repeat [ @@ -97,36 +102,54 @@ ; trap -l ((word) @constant.builtin - (#match? @constant.builtin "^SIG(HUP|INT|QUIT|ILL|TRAP|ABRT|BUS|FPE|KILL|USR[12]|SEGV|PIPE|ALRM|TERM|STKFLT|CHLD|CONT|STOP|TSTP|TT(IN|OU)|URG|XCPU|XFSZ|VTALRM|PROF|WINCH|IO|PWR|SYS|RTMIN([+]([1-9]|1[0-5]))?|RTMAX(-([1-9]|1[0-4]))?)$")) + (#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 - (#any-of? @boolean "true" "false")) + (#any-of? @boolean "true" "false")) (comment) @comment @spell (test_operator) @operator -(command_substitution "$(" @punctuation.bracket) -(process_substitution "<(" @punctuation.bracket) +(command_substitution + "$(" @punctuation.bracket) + +(process_substitution + "<(" @punctuation.bracket) (arithmetic_expansion - [ "$((" "((" ] @punctuation.special + [ + "$((" + "((" + ] @punctuation.special "))" @punctuation.special) -(arithmetic_expansion "," @punctuation.delimiter) +(arithmetic_expansion + "," @punctuation.delimiter) -(ternary_expression [ "?" ":" ] @keyword.conditional.ternary) +(ternary_expression + [ + "?" + ":" + ] @keyword.conditional.ternary) -(binary_expression operator: _ @operator) -(unary_expression operator: _ @operator) -(postfix_expression operator: _ @operator) +(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.call) -((command_name (word) @function.builtin) +((command_name + (word) @function.builtin) ; format-ignore (#any-of? @function.builtin "alias" "bg" "bind" "break" "builtin" "caller" "cd" @@ -140,14 +163,17 @@ "ulimit" "umask" "unalias" "wait")) (command - argument: [ - (word) @variable.parameter - (concatenation (word) @variable.parameter) - ]) + argument: + [ + (word) @variable.parameter + (concatenation + (word) @variable.parameter) + ]) (number) @number + ((word) @number - (#lua-match? @number "^[0-9]+$")) + (#lua-match? @number "^[0-9]+$")) (file_redirect destination: (word) @variable.parameter) @@ -156,24 +182,30 @@ (simple_expansion "$" @punctuation.special) @none + (expansion "${" @punctuation.special "}" @punctuation.special) @none -(expansion operator: _ @punctuation.special) -(expansion "@" . operator: _ @character.special) +(expansion + operator: _ @punctuation.special) + +(expansion + "@" + . + operator: _ @character.special) ((expansion (subscript index: (word) @character.special)) - (#any-of? @character.special "@" "*")) + (#any-of? @character.special "@" "*")) "``" @punctuation.special (variable_name) @variable ((variable_name) @constant - (#lua-match? @constant "^[A-Z][A-Z_0-9]*$")) + (#lua-match? @constant "^[A-Z][A-Z_0-9]*$")) (case_item value: (word) @variable.parameter) @@ -183,5 +215,7 @@ (extglob_pattern) ] @string.regexp -((program . (comment) @keyword.directive) - (#lua-match? @keyword.directive "^#!/")) +((program + . + (comment) @keyword.directive) + (#lua-match? @keyword.directive "^#!/")) diff --git a/queries/bash/injections.scm b/queries/bash/injections.scm index 516df3b3d..83bb6359e 100644 --- a/queries/bash/injections.scm +++ b/queries/bash/injections.scm @@ -1,35 +1,52 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) ((regex) @injection.content - (#set! injection.language "regex")) + (#set! injection.language "regex")) ((heredoc_redirect (heredoc_body) @injection.content (heredoc_end) @injection.language) - (#downcase! @injection.language)) + (#downcase! @injection.language)) ; printf 'format' ((command name: (command_name) @_command - . argument: [(string) (raw_string)] @injection.content) - (#eq? @_command "printf") - (#set! injection.language "printf")) + . + argument: + [ + (string) + (raw_string) + ] @injection.content) + (#eq? @_command "printf") + (#set! injection.language "printf")) ; printf -v var 'format' ((command name: (command_name) @_command argument: (word) @_arg - . (_) . argument: [(string) (raw_string)] @injection.content) - (#eq? @_command "printf") - (#eq? @_arg "-v") - (#set! injection.language "printf")) + . + (_) + . + argument: + [ + (string) + (raw_string) + ] @injection.content) + (#eq? @_command "printf") + (#eq? @_arg "-v") + (#set! injection.language "printf")) ; printf -- 'format' ((command name: (command_name) @_command argument: (word) @_arg - . argument: [(string) (raw_string)] @injection.content) - (#eq? @_command "printf") - (#eq? @_arg "--") - (#set! injection.language "printf")) + . + argument: + [ + (string) + (raw_string) + ] @injection.content) + (#eq? @_command "printf") + (#eq? @_arg "--") + (#set! injection.language "printf")) diff --git a/queries/bash/locals.scm b/queries/bash/locals.scm index 2b9cfec70..347f51fa2 100644 --- a/queries/bash/locals.scm +++ b/queries/bash/locals.scm @@ -2,7 +2,7 @@ (function_definition) @local.scope ; Definitions -(variable_assignment +(variable_assignment name: (variable_name) @local.definition.var) (function_definition @@ -10,4 +10,5 @@ ; References (variable_name) @local.reference + (word) @local.reference diff --git a/queries/bass/highlights.scm b/queries/bass/highlights.scm index 3a16cbb34..8a92a59e9 100644 --- a/queries/bass/highlights.scm +++ b/queries/bass/highlights.scm @@ -1,54 +1,56 @@ -;; Variables +; Variables +(list + (symbol) @variable) -(list (symbol) @variable) +(cons + (symbol) @variable) -(cons (symbol) @variable) +(scope + (symbol) @variable) -(scope (symbol) @variable) - -(symbind (symbol) @variable) - -;; Constants +(symbind + (symbol) @variable) +; Constants ((symbol) @constant (#lua-match? @constant "^_*[A-Z][A-Z0-9_]*$")) -;; Functions - -(list - . (symbol) @function) - -;; Namespaces +; Functions +(list + . + (symbol) @function) +; Namespaces (symbind (symbol) @module - . (keyword)) - -;; Includes + . + (keyword)) +; Includes ((symbol) @keyword.import (#any-of? @keyword.import "use" "import" "load")) -;; Keywords - +; Keywords ((symbol) @keyword (#any-of? @keyword "do" "doc")) -;; Special Functions - +; Special Functions ; Keywords construct a symbol - (keyword) @constructor ((list - . (symbol) @keyword.function - . (symbol) @function + . + (symbol) @keyword.function + . + (symbol) @function (symbol)? @variable.parameter) (#any-of? @keyword.function "def" "defop" "defn" "fn")) ((cons - . (symbol) @keyword.function - . (symbol) @function + . + (symbol) @keyword.function + . + (symbol) @function (symbol)? @variable.parameter) (#any-of? @keyword.function "def" "defop" "defn" "fn")) @@ -58,33 +60,38 @@ ((symbol) @function.macro (#any-of? @function.macro "op" "current-scope" "quote" "let" "provide" "module" "or" "and" "curryfn" "for" "$" "linux")) -;; Conditionals - +; Conditionals ((symbol) @keyword.conditional (#any-of? @keyword.conditional "if" "case" "cond" "when")) -;; Repeats - +; Repeats ((symbol) @keyword.repeat (#any-of? @keyword.repeat "each")) -;; Operators +; Operators +((symbol) @operator + (#any-of? @operator "&" "*" "+" "-" "<" "<=" "=" ">" ">=")) -((symbol) @operator (#any-of? @operator "&" "*" "+" "-" "<" "<=" "=" ">" ">=")) +; Punctuation +[ + "(" + ")" +] @punctuation.bracket -;; Punctuation +[ + "{" + "}" +] @punctuation.bracket -[ "(" ")" ] @punctuation.bracket - -[ "{" "}" ] @punctuation.bracket - -[ "[" "]" ] @punctuation.bracket +[ + "[" + "]" +] @punctuation.bracket ((symbol) @punctuation.delimiter (#eq? @punctuation.delimiter "->")) -;; Literals - +; Literals (string) @string (escape_sequence) @string.escape @@ -100,10 +107,7 @@ (null) ] @constant.builtin -[ - "^" -] @character.special - -;; Comments +"^" @character.special +; Comments (comment) @comment @spell diff --git a/queries/bass/indents.scm b/queries/bass/indents.scm index 60c5df4eb..27b976f21 100644 --- a/queries/bass/indents.scm +++ b/queries/bass/indents.scm @@ -10,11 +10,20 @@ "]" ] @indent.end -[ "(" ")" ] @indent.branch +[ + "(" + ")" +] @indent.branch -[ "{" "}" ] @indent.branch +[ + "{" + "}" +] @indent.branch -[ "[" "]" ] @indent.branch +[ + "[" + "]" +] @indent.branch [ (ERROR) diff --git a/queries/bass/injections.scm b/queries/bass/injections.scm index 6adae45a2..2f0e58eb6 100644 --- a/queries/bass/injections.scm +++ b/queries/bass/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/bass/locals.scm b/queries/bass/locals.scm index c28a78dd5..daed7e5e1 100644 --- a/queries/bass/locals.scm +++ b/queries/bass/locals.scm @@ -1,5 +1,4 @@ ; Scopes - [ (list) (scope) @@ -7,19 +6,21 @@ ] @local.scope ; References - (symbol) @local.reference ; Definitions - ((list - . (symbol) @_fnkw - . (symbol) @local.definition.function + . + (symbol) @_fnkw + . + (symbol) @local.definition.function (symbol)? @local.definition.parameter) (#any-of? @_fnkw "def" "defop" "defn" "fn")) ((cons - . (symbol) @_fnkw - . (symbol) @local.definition.function + . + (symbol) @_fnkw + . + (symbol) @local.definition.function (symbol)? @local.definition.parameter) (#any-of? @_fnkw "def" "defop" "defn" "fn")) diff --git a/queries/beancount/folds.scm b/queries/beancount/folds.scm index ffe319500..9f1b6cbed 100644 --- a/queries/beancount/folds.scm +++ b/queries/beancount/folds.scm @@ -1,4 +1,4 @@ [ - (transaction) - (section) + (transaction) + (section) ] @fold diff --git a/queries/beancount/highlights.scm b/queries/beancount/highlights.scm index 191dc519e..1e23d28f4 100644 --- a/queries/beancount/highlights.scm +++ b/queries/beancount/highlights.scm @@ -1,24 +1,57 @@ (date) @variable.member + (txn) @attribute + (account) @type + (amount) @number + (incomplete_amount) @number + (compound_amount) @number + (amount_tolerance) @number + (currency) @property + (key) @label + (string) @string + (narration) @string @spell + (payee) @string @spell + (tag) @constant + (link) @constant + [ - (minus) (plus) (slash) (asterisk) + (minus) + (plus) + (slash) + (asterisk) ] @operator + (comment) @comment @spell + [ - (balance) (open) (close) (commodity) (pad) - (event) (price) (note) (document) (query) - (custom) (pushtag) (poptag) (pushmeta) - (popmeta) (option) (include) (plugin) + (balance) + (open) + (close) + (commodity) + (pad) + (event) + (price) + (note) + (document) + (query) + (custom) + (pushtag) + (poptag) + (pushmeta) + (popmeta) + (option) + (include) + (plugin) ] @keyword diff --git a/queries/bibtex/folds.scm b/queries/bibtex/folds.scm index 3b24d5fea..321a045c9 100644 --- a/queries/bibtex/folds.scm +++ b/queries/bibtex/folds.scm @@ -1,3 +1 @@ -[ - (entry) -] @fold +(entry) @fold diff --git a/queries/bibtex/highlights.scm b/queries/bibtex/highlights.scm index 602ed5d27..a82b371ae 100644 --- a/queries/bibtex/highlights.scm +++ b/queries/bibtex/highlights.scm @@ -1,5 +1,4 @@ ; CREDITS @pfoerster (adapted from https://github.com/latex-lsp/tree-sitter-bibtex) - [ (string_type) (preamble_type) diff --git a/queries/bibtex/indents.scm b/queries/bibtex/indents.scm index 1ba3e6b47..764172a76 100644 --- a/queries/bibtex/indents.scm +++ b/queries/bibtex/indents.scm @@ -1,10 +1,8 @@ -[ - (entry) -] @indent.begin +(entry) @indent.begin [ - "{" - "}" + "{" + "}" ] @indent.branch (comment) @indent.ignore diff --git a/queries/bicep/folds.scm b/queries/bicep/folds.scm index 8ec5ba200..217a86d6a 100644 --- a/queries/bicep/folds.scm +++ b/queries/bicep/folds.scm @@ -6,20 +6,14 @@ (resource_declaration) (type_declaration) (variable_declaration) - (parenthesized_expression) - (decorators) (array) (object) - (if_statement) (for_statement) - (subscript_expression) (ternary_expression) - (string) - (comment) ] @fold diff --git a/queries/bicep/highlights.scm b/queries/bicep/highlights.scm index ae691c76b..0045f8b8c 100644 --- a/queries/bicep/highlights.scm +++ b/queries/bicep/highlights.scm @@ -1,5 +1,4 @@ ; Includes - (import_statement "import" @keyword.import) @@ -8,12 +7,10 @@ "with" @keyword.import) ; Namespaces - (module_declaration (identifier) @module) ; Builtins - (primitive_type) @type.builtin ((member_expression @@ -21,12 +18,10 @@ (#eq? @type.builtin "sys")) ; Functions - (call_expression function: (identifier) @function.call) ; Properties - (object_property (identifier) @property ":" @punctuation.delimiter @@ -40,21 +35,20 @@ (property_identifier) @property ; Attributes - (decorator "@" @attribute) (decorator - (call_expression (identifier) @attribute)) + (call_expression + (identifier) @attribute)) (decorator (call_expression (member_expression - object: (identifier) @attribute - property: (property_identifier) @attribute))) + object: (identifier) @attribute + property: (property_identifier) @attribute))) ; Types - (type_declaration (identifier) @type) @@ -66,7 +60,8 @@ (type_declaration (identifier) "=" - (array_type (identifier) @type)) + (array_type + (identifier) @type)) (type (identifier) @type) @@ -78,21 +73,22 @@ (identifier) @type) ; Parameters - (parameter_declaration (identifier) @variable.parameter (_)) (call_expression - function: (_) - (arguments (identifier) @variable.parameter)) + function: (_) + (arguments + (identifier) @variable.parameter)) (call_expression - function: (_) - (arguments (member_expression object: (identifier) @variable.parameter))) + function: (_) + (arguments + (member_expression + object: (identifier) @variable.parameter))) ; Variables - (variable_declaration (identifier) @variable (_)) @@ -117,7 +113,6 @@ (loop_enumerator) @variable)) ; Conditionals - "if" @keyword.conditional (ternary_expression @@ -125,14 +120,12 @@ ":" @keyword.conditional.ternary) ; Loops - (for_statement "for" @keyword.repeat "in" ":" @punctuation.delimiter) ; Keywords - [ "module" "metadata" @@ -146,7 +139,6 @@ ] @keyword ; Operators - [ "+" "-" @@ -169,14 +161,11 @@ "!" ] @operator -[ - "in" -] @keyword.operator - +"in" @keyword.operator ; Literals - (string) @string + (import_string "'" @string (import_name) @module @@ -192,17 +181,25 @@ (null) @constant.builtin ; Misc - (compatible_identifier "?" @punctuation.special) (nullable_return_type) @punctuation.special -["{" "}"] @punctuation.bracket +[ + "{" + "}" +] @punctuation.bracket -["[" "]"] @punctuation.bracket +[ + "[" + "]" +] @punctuation.bracket -["(" ")"] @punctuation.bracket +[ + "(" + ")" +] @punctuation.bracket [ "." @@ -210,9 +207,7 @@ "=>" ] @punctuation.delimiter - ; Interpolation - (interpolation) @none (interpolation @@ -223,7 +218,6 @@ (identifier) @variable) ; Comments - [ (comment) (diagnostic_comment) diff --git a/queries/bicep/indents.scm b/queries/bicep/indents.scm index cf2e6e1c2..055e51b23 100644 --- a/queries/bicep/indents.scm +++ b/queries/bicep/indents.scm @@ -5,11 +5,20 @@ "}" @indent.end -[ "{" "}" ] @indent.branch +[ + "{" + "}" +] @indent.branch -[ "[" "]" ] @indent.branch +[ + "[" + "]" +] @indent.branch -[ "(" ")" ] @indent.branch +[ + "(" + ")" +] @indent.branch [ (ERROR) diff --git a/queries/bicep/injections.scm b/queries/bicep/injections.scm index d3ff30b60..5c2d4a57b 100644 --- a/queries/bicep/injections.scm +++ b/queries/bicep/injections.scm @@ -1,5 +1,5 @@ ([ (comment) (diagnostic_comment) - ] @injection.content - (#set! injection.language "comment")) +] @injection.content + (#set! injection.language "comment")) diff --git a/queries/bicep/locals.scm b/queries/bicep/locals.scm index c28987051..137753ae2 100644 --- a/queries/bicep/locals.scm +++ b/queries/bicep/locals.scm @@ -1,22 +1,17 @@ ; Scopes - [ (infrastructure) (call_expression) - (lambda_expression) (subscript_expression) - (if_statement) (for_statement) - (array) (object) (interpolation) ] @local.scope ; References - (property_identifier) @local.reference (call_expression @@ -31,7 +26,6 @@ (identifier) @local.reference) ; Definitions - (type) @local.definition.associated (object_property diff --git a/queries/bitbake/folds.scm b/queries/bitbake/folds.scm index 9fc865e84..85d226348 100644 --- a/queries/bitbake/folds.scm +++ b/queries/bitbake/folds.scm @@ -2,28 +2,23 @@ (function_definition) (anonymous_python_function) (python_function_definition) - (while_statement) (for_statement) (if_statement) (with_statement) (try_statement) - (import_from_statement) (parameters) (argument_list) - (parenthesized_expression) (generator_expression) (list_comprehension) (set_comprehension) (dictionary_comprehension) - (tuple) (list) (set) (dictionary) - (string) (python_string) ] @fold diff --git a/queries/bitbake/highlights.scm b/queries/bitbake/highlights.scm index eafe60b4d..e555e40d7 100644 --- a/queries/bitbake/highlights.scm +++ b/queries/bitbake/highlights.scm @@ -1,5 +1,4 @@ ; Includes - [ "inherit" "include" @@ -9,12 +8,10 @@ ] @keyword.import ; Keywords - [ "unset" "EXPORT_FUNCTIONS" "python" - "assert" "exec" "global" @@ -34,19 +31,34 @@ "return" "yield" ] @keyword.return -(yield "from" @keyword.return) + +(yield + "from" @keyword.return) (future_import_statement "from" @keyword.import "__future__" @constant.builtin) -(import_from_statement "from" @keyword.import) + +(import_from_statement + "from" @keyword.import) + "import" @keyword.import -(aliased_import "as" @keyword.import) +(aliased_import + "as" @keyword.import) -["if" "elif" "else"] @keyword.conditional +[ + "if" + "elif" + "else" +] @keyword.conditional -["for" "while" "break" "continue"] @keyword.repeat +[ + "for" + "while" + "break" + "continue" +] @keyword.repeat [ "try" @@ -56,7 +68,8 @@ "finally" ] @keyword.exception -(raise_statement "from" @keyword.exception) +(raise_statement + "from" @keyword.exception) (try_statement (else_clause @@ -82,7 +95,6 @@ ] @type.qualifier ; Variables - [ (identifier) (python_identifier) @@ -99,14 +111,18 @@ ; Reset highlighting in f-string interpolations (interpolation) @none -;; Identifier naming conventions +; Identifier naming conventions ((python_identifier) @type - (#lua-match? @type "^[A-Z].*[a-z]")) -([(identifier) (python_identifier)] @constant - (#lua-match? @constant "^[A-Z][A-Z_0-9]*$")) + (#lua-match? @type "^[A-Z].*[a-z]")) + +([ + (identifier) + (python_identifier) +] @constant + (#lua-match? @constant "^[A-Z][A-Z_0-9]*$")) ((python_identifier) @constant.builtin - (#lua-match? @constant.builtin "^__[a-zA-Z0-9_]*__$")) + (#lua-match? @constant.builtin "^__[a-zA-Z0-9_]*__$")) ((python_identifier) @constant.builtin ; format-ignore @@ -117,128 +133,149 @@ ((assignment left: (python_identifier) @type.definition - (type (python_identifier) @_annotation)) - (#eq? @_annotation "TypeAlias")) + (type + (python_identifier) @_annotation)) + (#eq? @_annotation "TypeAlias")) ((assignment left: (python_identifier) @type.definition - right: (call - function: (python_identifier) @_func)) - (#any-of? @_func "TypeVar" "NewType")) + right: + (call + function: (python_identifier) @_func)) + (#any-of? @_func "TypeVar" "NewType")) ; Fields - (flag) @variable.member ((attribute - attribute: (python_identifier) @variable.member) - (#lua-match? @variable.member "^[%l_].*$")) + attribute: (python_identifier) @variable.member) + (#lua-match? @variable.member "^[%l_].*$")) ; Functions - (call function: (python_identifier) @function.call) (call - function: (attribute - attribute: (python_identifier) @function.method.call)) + function: + (attribute + attribute: (python_identifier) @function.method.call)) ((call - function: (python_identifier) @constructor) - (#lua-match? @constructor "^%u")) + function: (python_identifier) @constructor) + (#lua-match? @constructor "^%u")) ((call - function: (attribute - attribute: (python_identifier) @constructor)) - (#lua-match? @constructor "^%u")) + function: + (attribute + attribute: (python_identifier) @constructor)) + (#lua-match? @constructor "^%u")) ((call function: (python_identifier) @function.builtin) - (#any-of? @function.builtin - "abs" "all" "any" "ascii" "bin" "bool" "breakpoint" "bytearray" "bytes" "callable" "chr" "classmethod" - "compile" "complex" "delattr" "dict" "dir" "divmod" "enumerate" "eval" "exec" "filter" "float" "format" - "frozenset" "getattr" "globals" "hasattr" "hash" "help" "hex" "id" "input" "int" "isinstance" "issubclass" - "iter" "len" "list" "locals" "map" "max" "memoryview" "min" "next" "object" "oct" "open" "ord" "pow" - "print" "property" "range" "repr" "reversed" "round" "set" "setattr" "slice" "sorted" "staticmethod" "str" - "sum" "super" "tuple" "type" "vars" "zip" "__import__")) + (#any-of? @function.builtin "abs" "all" "any" "ascii" "bin" "bool" "breakpoint" "bytearray" "bytes" "callable" "chr" "classmethod" "compile" "complex" "delattr" "dict" "dir" "divmod" "enumerate" "eval" "exec" "filter" "float" "format" "frozenset" "getattr" "globals" "hasattr" "hash" "help" "hex" "id" "input" "int" "isinstance" "issubclass" "iter" "len" "list" "locals" "map" "max" "memoryview" "min" "next" "object" "oct" "open" "ord" "pow" "print" "property" "range" "repr" "reversed" "round" "set" "setattr" "slice" "sorted" "staticmethod" "str" "sum" "super" "tuple" "type" "vars" "zip" "__import__")) (python_function_definition name: (python_identifier) @function) -(type (python_identifier) @type) +(type + (python_identifier) @type) + (type (subscript (python_identifier) @type)) ; type subscript: Tuple[int] ((call function: (python_identifier) @_isinstance - arguments: (argument_list - (_) - (python_identifier) @type)) - (#eq? @_isinstance "isinstance")) + arguments: + (argument_list + (_) + (python_identifier) @type)) + (#eq? @_isinstance "isinstance")) -(anonymous_python_function (identifier) @function) +(anonymous_python_function + (identifier) @function) -(function_definition (identifier) @function) +(function_definition + (identifier) @function) -(addtask_statement (identifier) @function) +(addtask_statement + (identifier) @function) -(deltask_statement (identifier) @function) +(deltask_statement + (identifier) @function) -(export_functions_statement (identifier) @function) +(export_functions_statement + (identifier) @function) -(addhandler_statement (identifier) @function) +(addhandler_statement + (identifier) @function) (python_function_definition body: (block - . (expression_statement (python_string) @string.documentation @spell))) + . + (expression_statement + (python_string) @string.documentation @spell))) ; Namespace - (inherit_path) @module -;; Normal parameters +; Normal parameters (parameters (python_identifier) @variable.parameter) -;; Lambda parameters + +; Lambda parameters (lambda_parameters (python_identifier) @variable.parameter) + (lambda_parameters (tuple_pattern (python_identifier) @variable.parameter)) + ; Default parameters (keyword_argument name: (python_identifier) @variable.parameter) + ; Naming parameters on call-site (default_parameter name: (python_identifier) @variable.parameter) + (typed_parameter (python_identifier) @variable.parameter) + (typed_default_parameter (python_identifier) @variable.parameter) + ; Variadic parameters *args, **kwargs (parameters - (list_splat_pattern ; *args + (list_splat_pattern + ; *args (python_identifier) @variable.parameter)) + (parameters - (dictionary_splat_pattern ; **kwargs + (dictionary_splat_pattern + ; **kwargs (python_identifier) @variable.parameter)) -;; Literals - +; Literals (none) @constant.builtin -[(true) (false)] @boolean + +[ + (true) + (false) +] @boolean + ((python_identifier) @variable.builtin - (#eq? @variable.builtin "self")) + (#eq? @variable.builtin "self")) + ((python_identifier) @variable.builtin - (#eq? @variable.builtin "cls")) + (#eq? @variable.builtin "cls")) (integer) @number + (float) @number.float ; Operators - [ "?=" "??=" @@ -293,12 +330,10 @@ "or" "is not" "not in" - "del" ] @keyword.operator ; Literals - [ (string) (python_string) @@ -313,8 +348,14 @@ ] @string.escape ; Punctuation - -[ "(" ")" "{" "}" "[" "]" ] @punctuation.bracket +[ + "(" + ")" + "{" + "}" + "[" + "]" +] @punctuation.bracket [ ":" @@ -325,15 +366,28 @@ (ellipsis) ] @punctuation.delimiter -(variable_expansion [ "${" "}" ] @punctuation.special) -(inline_python [ "${@" "}" ] @punctuation.special) +(variable_expansion + [ + "${" + "}" + ] @punctuation.special) + +(inline_python + [ + "${@" + "}" + ] @punctuation.special) + (interpolation "{" @punctuation.special "}" @punctuation.special) (type_conversion) @function.macro -([(identifier) (python_identifier)] @type.builtin +([ + (identifier) + (python_identifier) +] @type.builtin ; format-ignore (#any-of? @type.builtin ; https://docs.python.org/3/library/exceptions.html diff --git a/queries/bitbake/indents.scm b/queries/bitbake/indents.scm index 01d8aeb3c..ee60d0fda 100644 --- a/queries/bitbake/indents.scm +++ b/queries/bitbake/indents.scm @@ -1,76 +1,101 @@ [ (import_from_statement) - (parenthesized_expression) (generator_expression) (list_comprehension) (set_comprehension) (dictionary_comprehension) - (tuple_pattern) (list_pattern) (binary_operator) - (lambda) - (concatenated_string) ] @indent.begin ((list) @indent.align - (#set! indent.open_delimiter "[") - (#set! indent.close_delimiter "]") -) + (#set! indent.open_delimiter "[") + (#set! indent.close_delimiter "]")) + ((dictionary) @indent.align - (#set! indent.open_delimiter "{") - (#set! indent.close_delimiter "}") -) + (#set! indent.open_delimiter "{") + (#set! indent.close_delimiter "}")) + ((set) @indent.align - (#set! indent.open_delimiter "{") - (#set! indent.close_delimiter "}") -) + (#set! indent.open_delimiter "{") + (#set! indent.close_delimiter "}")) ((for_statement) @indent.begin - (#set! indent.immediate 1)) + (#set! indent.immediate 1)) + ((if_statement) @indent.begin - (#set! indent.immediate 1)) + (#set! indent.immediate 1)) + ((while_statement) @indent.begin - (#set! indent.immediate 1)) + (#set! indent.immediate 1)) + ((try_statement) @indent.begin - (#set! indent.immediate 1)) -(ERROR "try" ":" @indent.begin (#set! indent.immediate 1)) + (#set! indent.immediate 1)) + +(ERROR + "try" + ":" @indent.begin + (#set! indent.immediate 1)) + ((python_function_definition) @indent.begin - (#set! indent.immediate 1)) + (#set! indent.immediate 1)) + (function_definition) @indent.begin + (anonymous_python_function) @indent.begin + ((with_statement) @indent.begin - (#set! indent.immediate 1)) + (#set! indent.immediate 1)) (if_statement condition: (parenthesized_expression) @indent.align (#set! indent.open_delimiter "(") (#set! indent.close_delimiter ")") (#set! indent.avoid_last_matching_next 1)) + (while_statement condition: (parenthesized_expression) @indent.align (#set! indent.open_delimiter "(") (#set! indent.close_delimiter ")") (#set! indent.avoid_last_matching_next 1)) -(ERROR "(" @indent.align (#set! indent.open_delimiter "(") (#set! indent.close_delimiter ")") . (_)) +(ERROR + "(" @indent.align + (#set! indent.open_delimiter "(") + (#set! indent.close_delimiter ")") + . + (_)) + ((argument_list) @indent.align - (#set! indent.open_delimiter "(") - (#set! indent.close_delimiter ")")) + (#set! indent.open_delimiter "(") + (#set! indent.close_delimiter ")")) + ((parameters) @indent.align - (#set! indent.open_delimiter "(") - (#set! indent.close_delimiter ")") - (#set! indent.avoid_last_matching_next 1)) + (#set! indent.open_delimiter "(") + (#set! indent.close_delimiter ")") + (#set! indent.avoid_last_matching_next 1)) + ((tuple) @indent.align - (#set! indent.open_delimiter "(") - (#set! indent.close_delimiter ")")) + (#set! indent.open_delimiter "(") + (#set! indent.close_delimiter ")")) -(ERROR "[" @indent.align (#set! indent.open_delimiter "[") (#set! indent.close_delimiter "]") . (_)) +(ERROR + "[" @indent.align + (#set! indent.open_delimiter "[") + (#set! indent.close_delimiter "]") + . + (_)) -(ERROR "{" @indent.align (#set! indent.open_delimiter "{") (#set! indent.close_delimiter "}") . (_)) +(ERROR + "{" @indent.align + (#set! indent.open_delimiter "{") + (#set! indent.close_delimiter "}") + . + (_)) [ (break_statement) @@ -78,24 +103,43 @@ ] @indent.dedent (ERROR - (_) @indent.branch ":" . + (_) @indent.branch + ":" + . (#lua-match? @indent.branch "^else")) (ERROR - (_) @indent.branch @indent.dedent ":" . + (_) @indent.branch @indent.dedent + ":" + . (#lua-match? @indent.branch "^elif")) -(parenthesized_expression ")" @indent.end) -(generator_expression ")" @indent.end) -(list_comprehension "]" @indent.end) -(set_comprehension "}" @indent.end) -(dictionary_comprehension "}" @indent.end) +(parenthesized_expression + ")" @indent.end) -(tuple_pattern ")" @indent.end) -(list_pattern "]" @indent.end) +(generator_expression + ")" @indent.end) -(function_definition "}" @indent.end) -(anonymous_python_function "}" @indent.end) +(list_comprehension + "]" @indent.end) + +(set_comprehension + "}" @indent.end) + +(dictionary_comprehension + "}" @indent.end) + +(tuple_pattern + ")" @indent.end) + +(list_pattern + "]" @indent.end) + +(function_definition + "}" @indent.end) + +(anonymous_python_function + "}" @indent.end) (return_statement [ @@ -107,10 +151,12 @@ "}" "]" ] @indent.end .) - (attribute + (attribute attribute: (_) @indent.end) (call - arguments: (_ ")" @indent.end)) + arguments: + (_ + ")" @indent.end)) "return" @indent.end ] .) diff --git a/queries/bitbake/injections.scm b/queries/bitbake/injections.scm index 819487bc5..39182e838 100644 --- a/queries/bitbake/injections.scm +++ b/queries/bitbake/injections.scm @@ -1,8 +1,11 @@ (call - function: (attribute - object: (python_identifier) @_re) - arguments: (argument_list (python_string - (string_content) @injection.content) @_string) + function: + (attribute + object: (python_identifier) @_re) + arguments: + (argument_list + (python_string + (string_content) @injection.content) @_string) (#eq? @_re "re") (#lua-match? @_string "^r.*") (#set! injection.language "regex")) @@ -11,4 +14,4 @@ (#set! injection.language "bash")) ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/bitbake/locals.scm b/queries/bitbake/locals.scm index 27e85f02a..0f572584b 100644 --- a/queries/bitbake/locals.scm +++ b/queries/bitbake/locals.scm @@ -7,10 +7,16 @@ ; Imports (aliased_import alias: (python_identifier) @local.definition.import) + (import_statement - name: (dotted_name ((python_identifier) @local.definition.import))) + name: + (dotted_name + ((python_identifier) @local.definition.import))) + (import_from_statement - name: (dotted_name ((python_identifier) @local.definition.import))) + name: + (dotted_name + ((python_identifier) @local.definition.import))) ; Function with parameters, defines parameters (parameters @@ -38,58 +44,80 @@ ; Function defines function and scope ((python_function_definition name: (python_identifier) @local.definition.function) @local.scope - (#set! definition.function.scope "parent")) + (#set! definition.function.scope "parent")) -(function_definition (identifier) @local.definition.function) +(function_definition + (identifier) @local.definition.function) -(anonymous_python_function (identifier) @local.definition.function) +(anonymous_python_function + (identifier) @local.definition.function) -;;; Loops +; Loops ; not a scope! (for_statement - left: (pattern_list - (python_identifier) @local.definition.var)) + left: + (pattern_list + (python_identifier) @local.definition.var)) + (for_statement - left: (tuple_pattern - (python_identifier) @local.definition.var)) + left: + (tuple_pattern + (python_identifier) @local.definition.var)) + (for_statement left: (python_identifier) @local.definition.var) ; not a scope! ;(while_statement) @local.scope - ; for in list comprehension (for_in_clause left: (python_identifier) @local.definition.var) + (for_in_clause - left: (tuple_pattern - (python_identifier) @local.definition.var)) + left: + (tuple_pattern + (python_identifier) @local.definition.var)) + (for_in_clause - left: (pattern_list - (python_identifier) @local.definition.var)) + left: + (pattern_list + (python_identifier) @local.definition.var)) (dictionary_comprehension) @local.scope + (list_comprehension) @local.scope + (set_comprehension) @local.scope -;;; Assignments +; Assignments +(assignment + left: (python_identifier) @local.definition.var) (assignment - left: (python_identifier) @local.definition.var) + left: + (pattern_list + (python_identifier) @local.definition.var)) (assignment - left: (pattern_list - (python_identifier) @local.definition.var)) -(assignment - left: (tuple_pattern - (python_identifier) @local.definition.var)) + left: + (tuple_pattern + (python_identifier) @local.definition.var)) (assignment - left: (attribute - (python_identifier) - (python_identifier) @local.definition.field)) + left: + (attribute + (python_identifier) + (python_identifier) @local.definition.field)) -(variable_assignment (identifier) operator: [ "=" "?=" "??=" ":=" ] @local.definition.var) +(variable_assignment + (identifier) + operator: + [ + "=" + "?=" + "??=" + ":=" + ] @local.definition.var) ; Walrus operator x := 1 (named_expression diff --git a/queries/blueprint/highlights.scm b/queries/blueprint/highlights.scm index 3e3a8e4a8..faefd319d 100644 --- a/queries/blueprint/highlights.scm +++ b/queries/blueprint/highlights.scm @@ -1,6 +1,7 @@ (object_id) @variable (string) @string + (escape_sequence) @string.escape (comment) @comment @spell @@ -15,30 +16,50 @@ (decorator) @attribute -(property_definition (property_name) @property) +(property_definition + (property_name) @property) (object) @type -(signal_binding (signal_name) @function.builtin) -(signal_binding (function (identifier)) @function) -(signal_binding "swapped" @keyword) +(signal_binding + (signal_name) @function.builtin) -(styles_list "styles" @function.macro) -(layout_definition "layout" @function.macro) +(signal_binding + (function + (identifier)) @function) -(gettext_string "_" @function.builtin) +(signal_binding + "swapped" @keyword) -(menu_definition "menu" @keyword) -(menu_section "section" @keyword) -(menu_item "item" @function.macro) +(styles_list + "styles" @function.macro) -(template_definition (template_name_qualifier) @type.qualifier) +(layout_definition + "layout" @function.macro) -(import_statement (gobject_library) @module) +(gettext_string + "_" @function.builtin) -(import_statement (version_number) @number.float) +(menu_definition + "menu" @keyword) + +(menu_section + "section" @keyword) + +(menu_item + "item" @function.macro) + +(template_definition + (template_name_qualifier) @type.qualifier) + +(import_statement + (gobject_library) @module) + +(import_statement + (version_number) @number.float) (float) @number.float + (number) @number [ diff --git a/queries/c/folds.scm b/queries/c/folds.scm index 42ca3fb63..2e2a6b4d0 100644 --- a/queries/c/folds.scm +++ b/queries/c/folds.scm @@ -1,21 +1,21 @@ [ - (for_statement) - (if_statement) - (while_statement) - (do_statement) - (switch_statement) - (case_statement) - (function_definition) - (struct_specifier) - (enum_specifier) - (comment) - (preproc_if) - (preproc_elif) - (preproc_else) - (preproc_ifdef) - (preproc_function_def) - (initializer_list) - (gnu_asm_expression) + (for_statement) + (if_statement) + (while_statement) + (do_statement) + (switch_statement) + (case_statement) + (function_definition) + (struct_specifier) + (enum_specifier) + (comment) + (preproc_if) + (preproc_elif) + (preproc_else) + (preproc_ifdef) + (preproc_function_def) + (initializer_list) + (gnu_asm_expression) ] @fold (compound_statement diff --git a/queries/c/highlights.scm b/queries/c/highlights.scm index 0a6145e3e..c848f68dc 100644 --- a/queries/c/highlights.scm +++ b/queries/c/highlights.scm @@ -1,6 +1,9 @@ ; Lower priority to prefer @variable.parameter when identifier appears in parameter_declaration. -((identifier) @variable (#set! "priority" 95)) -(preproc_def (preproc_arg) @variable) +((identifier) @variable + (#set! "priority" 95)) + +(preproc_def + (preproc_arg) @variable) [ "default" @@ -17,7 +20,10 @@ "sizeof" "offsetof" ] @keyword.operator -(alignof_expression . _ @keyword.operator) + +(alignof_expression + . + _ @keyword.operator) "return" @keyword.return @@ -30,10 +36,10 @@ ] @keyword.repeat [ - "if" - "else" - "case" - "switch" + "if" + "else" + "case" + "switch" ] @keyword.conditional [ @@ -52,42 +58,48 @@ "#include" @keyword.import -[ ";" ":" "," "::" ] @punctuation.delimiter +[ + ";" + ":" + "," + "::" +] @punctuation.delimiter "..." @punctuation.special -[ "(" ")" "[" "]" "{" "}"] @punctuation.bracket +[ + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket [ "=" - "-" "*" "/" "+" "%" - "~" "|" "&" "^" "<<" ">>" - "->" "." - "<" "<=" ">=" ">" "==" "!=" - "!" "&&" "||" - "-=" "+=" "*=" @@ -102,42 +114,54 @@ "++" ] @operator -;; Make sure the comma operator is given a highlight group after the comma -;; punctuator so the operator is highlighted properly. -(comma_expression [ "," ] @operator) +; Make sure the comma operator is given a highlight group after the comma +; punctuator so the operator is highlighted properly. +(comma_expression + "," @operator) [ (true) (false) ] @boolean -(conditional_expression [ "?" ":" ] @keyword.conditional.ternary) +(conditional_expression + [ + "?" + ":" + ] @keyword.conditional.ternary) (string_literal) @string + (system_lib_string) @string + (escape_sequence) @string.escape (null) @constant.builtin + (number_literal) @number + (char_literal) @character -((preproc_arg) @function.macro (#set! "priority" 90)) +((preproc_arg) @function.macro + (#set! "priority" 90)) + (preproc_defined) @function.macro ((field_expression - (field_identifier) @property) @_parent - (#not-has-parent? @_parent template_method function_declarator call_expression)) + (field_identifier) @property) @_parent + (#not-has-parent? @_parent template_method function_declarator call_expression)) (field_designator) @property + ((field_identifier) @property - (#has-ancestor? @property field_declaration) - (#not-has-ancestor? @property function_declarator)) + (#has-ancestor? @property field_declaration) + (#not-has-ancestor? @property function_declarator)) (statement_identifier) @label [ - (type_identifier) - (type_descriptor) + (type_identifier) + (type_descriptor) ] @type (storage_class_specifier) @keyword.storage @@ -156,14 +180,20 @@ (primitive_type) @type.builtin -(sized_type_specifier _ @type.builtin type: _?) +(sized_type_specifier + _ @type.builtin + type: _?) ((identifier) @constant - (#lua-match? @constant "^[A-Z][A-Z0-9_]+$")) -(preproc_def (preproc_arg) @constant (#lua-match? @constant "^[A-Z][A-Z0-9_]+$")) + +(preproc_def + (preproc_arg) @constant + (#lua-match? @constant "^[A-Z][A-Z0-9_]+$")) + (enumerator name: (identifier) @constant) + (case_statement value: (identifier) @constant) @@ -181,7 +211,9 @@ "__clang_wide_literal_encoding__" "__FUNCTION__" "__func__" "__PRETTY_FUNCTION__" "__VA_ARGS__" "__VA_OPT__")) -(preproc_def (preproc_arg) @constant.builtin + +(preproc_def + (preproc_arg) @constant.builtin ; format-ignore (#any-of? @constant.builtin "stderr" "stdin" "stdout" @@ -197,21 +229,26 @@ "__VA_ARGS__" "__VA_OPT__")) (attribute_specifier - (argument_list (identifier) @variable.builtin)) + (argument_list + (identifier) @variable.builtin)) + ((attribute_specifier - (argument_list (call_expression - function: (identifier) @variable.builtin)))) + (argument_list + (call_expression + function: (identifier) @variable.builtin)))) ((call_expression function: (identifier) @function.builtin) (#lua-match? @function.builtin "^__builtin_")) + ((call_expression - function: (identifier) @function.builtin) + function: (identifier) @function.builtin) (#has-ancestor? @function.builtin attribute_specifier)) -;; Preproc def / undef +; Preproc def / undef (preproc_def name: (_) @constant) + (preproc_call directive: (preproc_directive) @_u argument: (_) @constant @@ -219,15 +256,21 @@ (call_expression function: (identifier) @function.call) + (call_expression - function: (field_expression - field: (field_identifier) @function.call)) + function: + (field_expression + field: (field_identifier) @function.call)) + (function_declarator declarator: (identifier) @function) + (function_declarator - declarator: (parenthesized_declarator - (pointer_declarator - declarator: (field_identifier) @function))) + declarator: + (parenthesized_declarator + (pointer_declarator + declarator: (field_identifier) @function))) + (preproc_function_def name: (identifier) @function.macro) @@ -236,7 +279,7 @@ ((comment) @comment.documentation (#lua-match? @comment.documentation "^/[*][*][^*].*[*]/$")) -;; Parameters +; Parameters (parameter_declaration declarator: (identifier) @variable.parameter) @@ -268,8 +311,8 @@ ; declarator: _ ; (declaration ; declarator: (pointer_declarator) @variable.parameter)) - -(preproc_params (identifier) @variable.parameter) +(preproc_params + (identifier) @variable.parameter) [ "__attribute__" diff --git a/queries/c/indents.scm b/queries/c/indents.scm index cf4c8fa62..95d25fe1d 100644 --- a/queries/c/indents.scm +++ b/queries/c/indents.scm @@ -1,5 +1,5 @@ [ - (compound_statement) + (compound_statement) (field_declaration_list) (case_statement) (enumerator_list) @@ -7,56 +7,62 @@ (initializer_list) (init_declarator) ] @indent.begin - ; With current indent logic, if we capture expression_statement with @indent.begin ; It will be affected by _parent_ node with error subnodes deep down the tree -; So narrow indent capture to check for error inside expression statement only, +; So narrow indent capture to check for error inside expression statement only, (expression_statement (_) @indent.begin ";" @indent.end) (ERROR - "for" "(" @indent.begin ";" ";" ")" @indent.end) + "for" + "(" @indent.begin + ";" + ";" + ")" @indent.end) ((for_statement - body: (_) @_body) @indent.begin + body: (_) @_body) @indent.begin (#not-has-type? @_body compound_statement)) (while_statement condition: (_) @indent.begin) ((while_statement - body: (_) @_body) @indent.begin + body: (_) @_body) @indent.begin (#not-has-type? @_body compound_statement)) -( - (if_statement) +((if_statement) . - (ERROR "else" @indent.begin)) + (ERROR + "else" @indent.begin)) (if_statement condition: (_) @indent.begin) -;; Supports if without braces (but not both if-else without braces) +; Supports if without braces (but not both if-else without braces) ((if_statement - consequence: - (_ ";" @indent.end) @_consequence - (#not-has-type? @_consequence compound_statement) + consequence: + (_ + ";" @indent.end) @_consequence + (#not-has-type? @_consequence compound_statement) alternative: - (else_clause + (else_clause "else" @indent.branch - [ - (if_statement (compound_statement) @indent.dedent)? @indent.dedent + [ + (if_statement + (compound_statement) @indent.dedent)? @indent.dedent (compound_statement)? @indent.dedent (_)? @indent.dedent - ] - )? - ) @indent.begin) + ])?) @indent.begin) -(else_clause (_ . "{" @indent.branch)) +(else_clause + (_ + . + "{" @indent.branch)) - -(compound_statement "}" @indent.end) +(compound_statement + "}" @indent.end) [ ")" @@ -79,12 +85,16 @@ (string_literal) ] @indent.ignore -((ERROR (parameter_declaration)) @indent.align - (#set! indent.open_delimiter "(") - (#set! indent.close_delimiter ")")) -([(argument_list) (parameter_list)] @indent.align +((ERROR + (parameter_declaration)) @indent.align + (#set! indent.open_delimiter "(") + (#set! indent.close_delimiter ")")) + +([ + (argument_list) + (parameter_list) +] @indent.align (#set! indent.open_delimiter "(") (#set! indent.close_delimiter ")")) (comment) @indent.auto - diff --git a/queries/c/injections.scm b/queries/c/injections.scm index c025b0f07..6349fe2d1 100644 --- a/queries/c/injections.scm +++ b/queries/c/injections.scm @@ -1,8 +1,8 @@ ((preproc_arg) @injection.content - (#set! injection.language "c")) + (#set! injection.language "c")) ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) ((comment) @injection.content (#match? @injection.content "/\\*!([a-zA-Z]+:)?re2c") @@ -14,8 +14,11 @@ ((call_expression function: (identifier) @_function - arguments: (argument_list - . (string_literal (string_content) @injection.content))) + arguments: + (argument_list + . + (string_literal + (string_content) @injection.content))) ; format-ignore (#any-of? @_function "printf" "printf_s" @@ -29,12 +32,16 @@ "cscanf" "_cscanf" "printw" "scanw") - (#set! injection.language "printf")) + (#set! injection.language "printf")) ((call_expression function: (identifier) @_function - arguments: (argument_list - (_) . (string_literal (string_content) @injection.content))) + arguments: + (argument_list + (_) + . + (string_literal + (string_content) @injection.content))) ; format-ignore (#any-of? @_function "fprintf" "fprintf_s" @@ -57,12 +64,18 @@ "vw_printw" "vwprintw" "wscanw" "vw_scanw" "vwscanw") - (#set! injection.language "printf")) + (#set! injection.language "printf")) ((call_expression function: (identifier) @_function - arguments: (argument_list - (_) . (_) . (string_literal (string_content) @injection.content))) + arguments: + (argument_list + (_) + . + (_) + . + (string_literal + (string_content) @injection.content))) ; format-ignore (#any-of? @_function "sprintf_s" @@ -75,15 +88,22 @@ "vsnwprintf_s" "mvprintw" "mvscanw") - (#set! injection.language "printf")) + (#set! injection.language "printf")) ((call_expression function: (identifier) @_function - arguments: (argument_list - (_) . (_) . (_) . (string_literal (string_content) @injection.content))) - (#any-of? @_function "mvwprintw" - "mvwscanw") - (#set! injection.language "printf")) + arguments: + (argument_list + (_) + . + (_) + . + (_) + . + (string_literal + (string_content) @injection.content))) + (#any-of? @_function "mvwprintw" "mvwscanw") + (#set! injection.language "printf")) ; TODO: add when asm is added ; (gnu_asm_expression assembly_code: (string_literal) @injection.content diff --git a/queries/c/locals.scm b/queries/c/locals.scm index 3756bc4a5..13a122790 100644 --- a/queries/c/locals.scm +++ b/queries/c/locals.scm @@ -1,53 +1,67 @@ -;; Functions definitions +; Functions definitions (function_declarator declarator: (identifier) @local.definition.function) + (preproc_function_def name: (identifier) @local.definition.macro) @local.scope (preproc_def name: (identifier) @local.definition.macro) + (pointer_declarator declarator: (identifier) @local.definition.var) + (parameter_declaration declarator: (identifier) @local.definition.parameter) + (init_declarator declarator: (identifier) @local.definition.var) + (array_declarator declarator: (identifier) @local.definition.var) + (declaration declarator: (identifier) @local.definition.var) + (enum_specifier name: (_) @local.definition.type (enumerator_list - (enumerator name: (identifier) @local.definition.var))) + (enumerator + name: (identifier) @local.definition.var))) -;; Type / Struct / Enum +; Type / Struct / Enum (field_declaration declarator: (field_identifier) @local.definition.field) + (type_definition declarator: (type_identifier) @local.definition.type) + (struct_specifier name: (type_identifier) @local.definition.type) -;; goto -(labeled_statement (statement_identifier) @local.definition) +; goto +(labeled_statement + (statement_identifier) @local.definition) -;; References +; References (identifier) @local.reference + ((field_identifier) @local.reference - (#set! reference.kind "field")) + (#set! reference.kind "field")) + ((type_identifier) @local.reference - (#set! reference.kind "type")) + (#set! reference.kind "type")) -(goto_statement (statement_identifier) @local.reference) +(goto_statement + (statement_identifier) @local.reference) -;; Scope +; Scope [ - (for_statement) - (if_statement) - (while_statement) - (translation_unit) - (function_definition) - (compound_statement) ; a block in curly braces - (struct_specifier) + (for_statement) + (if_statement) + (while_statement) + (translation_unit) + (function_definition) + (compound_statement) ; a block in curly braces + (struct_specifier) ] @local.scope diff --git a/queries/c_sharp/folds.scm b/queries/c_sharp/folds.scm index 4b5d94270..2b7c9773d 100644 --- a/queries/c_sharp/folds.scm +++ b/queries/c_sharp/folds.scm @@ -1,15 +1,10 @@ -body: [ - (declaration_list) - (switch_body) - (enum_member_declaration_list) -] @fold - -accessors: [ - (accessor_list) -] @fold - -initializer: [ - (initializer_expression) -] @fold +body: + [ + (declaration_list) + (switch_body) + (enum_member_declaration_list) + ] @fold +accessors: (accessor_list) @fold +initializer: (initializer_expression) @fold (block) @fold diff --git a/queries/c_sharp/highlights.scm b/queries/c_sharp/highlights.scm index 1cd566728..3671dc258 100644 --- a/queries/c_sharp/highlights.scm +++ b/queries/c_sharp/highlights.scm @@ -26,18 +26,23 @@ name: (identifier) @function.method.call)) (invocation_expression - function: (conditional_access_expression - (member_binding_expression - name: (identifier) @function.method.call))) + function: + (conditional_access_expression + (member_binding_expression + name: (identifier) @function.method.call))) (namespace_declaration - name: [(qualified_name) (identifier)] @module) + name: + [ + (qualified_name) + (identifier) + ] @module) (qualified_name (identifier) @type) (invocation_expression - (identifier) @function.method.call) + (identifier) @function.method.call) (field_declaration (variable_declaration @@ -50,29 +55,29 @@ (parameter_list (parameter - name: (identifier) @variable.parameter)) + name: (identifier) @variable.parameter)) (parameter_list (parameter - type: (identifier) @type)) + type: (identifier) @type)) (integer_literal) @number + (real_literal) @number.float (null_literal) @constant.builtin + (character_literal) @character [ - (string_literal) - (verbatim_string_literal) - (interpolated_string_expression) + (string_literal) + (verbatim_string_literal) + (interpolated_string_expression) ] @string (boolean_literal) @boolean -[ - (predefined_type) -] @type.builtin +(predefined_type) @type.builtin (implicit_type) @keyword @@ -83,6 +88,7 @@ ((comment) @comment.documentation (#lua-match? @comment.documentation "^///[^/]")) + ((comment) @comment.documentation (#lua-match? @comment.documentation "^///$")) @@ -90,7 +96,8 @@ (identifier) @type) (using_directive - (name_equals (identifier) @type.definition)) + (name_equals + (identifier) @type.definition)) (property_declaration name: (identifier) @property) @@ -106,20 +113,25 @@ (interface_declaration name: (identifier) @type) + (class_declaration name: (identifier) @type) + (record_declaration name: (identifier) @type) + (enum_declaration name: (identifier) @type) + (constructor_declaration name: (identifier) @constructor) -(constructor_initializer [ - "base" @constructor -]) + +(constructor_initializer + "base" @constructor) (variable_declaration (identifier) @type) + (object_creation_expression (identifier) @type) @@ -142,19 +154,23 @@ (object_creation_expression (generic_name - (identifier) @type)) + (identifier) @type)) (property_declaration (generic_name (identifier) @type)) (_ - type: (generic_name - (identifier) @type)) + type: + (generic_name + (identifier) @type)) + ; Generic Method invocation with generic type (invocation_expression - function: (generic_name - . (identifier) @function.method.call)) + function: + (generic_name + . + (identifier) @function.method.call)) (invocation_expression (member_access_expression @@ -165,7 +181,7 @@ (identifier) @type) (type_argument_list - (identifier) @type) + (identifier) @type) (type_parameter_list (type_parameter) @type) @@ -174,7 +190,7 @@ target: (identifier) @type) (attribute - name: (identifier) @attribute) + name: (identifier) @attribute) (for_each_statement type: (identifier) @type) @@ -197,180 +213,194 @@ (identifier) @variable.parameter) (warning_directive) @comment.warning + (error_directive) @keyword.exception (define_directive (identifier) @constant) @constant.macro + (undef_directive (identifier) @constant) @constant.macro (line_directive) @constant.macro + (line_directive (preproc_integer_literal) @constant (preproc_string_literal)? @string) (pragma_directive (identifier) @constant) @constant.macro + (pragma_directive (preproc_string_literal) @string) @constant.macro [ - (nullable_directive) - (region_directive) - (endregion_directive) + (nullable_directive) + (region_directive) + (endregion_directive) ] @constant.macro [ - "if" - "else" - "switch" - "break" - "case" - "when" - (if_directive) - (elif_directive) - (else_directive) - (endif_directive) + "if" + "else" + "switch" + "break" + "case" + "when" + (if_directive) + (elif_directive) + (else_directive) + (endif_directive) ] @keyword.conditional (if_directive (identifier) @constant) + (elif_directive (identifier) @constant) [ - "while" - "for" - "do" - "continue" - "goto" - "foreach" + "while" + "for" + "do" + "continue" + "goto" + "foreach" ] @keyword.repeat [ - "try" - "catch" - "throw" - "finally" + "try" + "catch" + "throw" + "finally" ] @keyword.exception [ - "+" - "?" - ":" - "++" - "-" - "--" - "&" - "&&" - "|" - "||" - "!" - "!=" - "==" - "*" - "/" - "%" - "<" - "<=" - ">" - ">=" - "=" - "-=" - "+=" - "*=" - "/=" - "%=" - "^" - "^=" - "&=" - "|=" - "~" - ">>" - ">>>" - "<<" - "<<=" - ">>=" - ">>>=" - "=>" - "??" - "??=" + "+" + "?" + ":" + "++" + "-" + "--" + "&" + "&&" + "|" + "||" + "!" + "!=" + "==" + "*" + "/" + "%" + "<" + "<=" + ">" + ">=" + "=" + "-=" + "+=" + "*=" + "/=" + "%=" + "^" + "^=" + "&=" + "|=" + "~" + ">>" + ">>>" + "<<" + "<<=" + ">>=" + ">>>=" + "=>" + "??" + "??=" ] @operator [ - ";" - "." - "," - ":" + ";" + "." + "," + ":" ] @punctuation.delimiter -(conditional_expression ["?" ":"] @keyword.conditional.ternary) +(conditional_expression + [ + "?" + ":" + ] @keyword.conditional.ternary) [ - "[" - "]" - "{" - "}" - "(" - ")" + "[" + "]" + "{" + "}" + "(" + ")" ] @punctuation.bracket -(type_argument_list ["<" ">"] @punctuation.bracket) +(type_argument_list + [ + "<" + ">" + ] @punctuation.bracket) [ - (this_expression) - (base_expression) + (this_expression) + (base_expression) ] @variable.builtin [ - "using" - "as" + "using" + "as" ] @keyword.import (alias_qualified_name - (identifier "global") @keyword.import) + (identifier + "global") @keyword.import) [ - "with" - "new" - "typeof" - "sizeof" - "is" - "and" - "or" - "not" - "stackalloc" - "in" - "out" - "ref" + "with" + "new" + "typeof" + "sizeof" + "is" + "and" + "or" + "not" + "stackalloc" + "in" + "out" + "ref" ] @keyword.operator [ - "lock" - "params" - "operator" - "default" - "implicit" - "explicit" - "override" - "class" - "delegate" - "enum" - "interface" - "namespace" - "struct" - "get" - "set" - "init" - "where" - "record" - "event" - "add" - "remove" - "checked" - "unchecked" - "fixed" - "alias" + "lock" + "params" + "operator" + "default" + "implicit" + "explicit" + "override" + "class" + "delegate" + "enum" + "interface" + "namespace" + "struct" + "get" + "set" + "init" + "where" + "record" + "event" + "add" + "remove" + "checked" + "unchecked" + "fixed" + "alias" ] @keyword [ @@ -379,39 +409,40 @@ ] @keyword.coroutine [ - "const" - "extern" - "readonly" - "static" - "volatile" - "required" + "const" + "extern" + "readonly" + "static" + "volatile" + "required" ] @keyword.storage [ - "abstract" - "private" - "protected" - "internal" - "public" - "partial" - "sealed" - "virtual" + "abstract" + "private" + "protected" + "internal" + "public" + "partial" + "sealed" + "virtual" ] @type.qualifier (parameter_modifier) @operator (query_expression - (_ [ - "from" - "orderby" - "select" - "group" - "by" - "ascending" - "descending" - "equals" - "let" - ] @keyword)) + (_ + [ + "from" + "orderby" + "select" + "group" + "by" + "ascending" + "descending" + "equals" + "let" + ] @keyword)) [ "return" diff --git a/queries/c_sharp/injections.scm b/queries/c_sharp/injections.scm index 6adae45a2..2f0e58eb6 100644 --- a/queries/c_sharp/injections.scm +++ b/queries/c_sharp/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/c_sharp/locals.scm b/queries/c_sharp/locals.scm index 1d1665d9d..0476a1695 100644 --- a/queries/c_sharp/locals.scm +++ b/queries/c_sharp/locals.scm @@ -1,6 +1,7 @@ -;; Definitions +; Definitions (variable_declarator - . (identifier) @local.definition.var) + . + (identifier) @local.definition.var) (variable_declarator (tuple_pattern @@ -13,8 +14,9 @@ left: (identifier) @local.definition.var) (for_each_statement - left: (tuple_pattern - (identifier) @local.definition.var)) + left: + (tuple_pattern + (identifier) @local.definition.var)) (parameter (identifier) @local.definition.parameter) @@ -34,8 +36,8 @@ (class_declaration name: (identifier) @local.definition) -;; References +; References (identifier) @local.reference -;; Scope +; Scope (block) @local.scope diff --git a/queries/cairo/folds.scm b/queries/cairo/folds.scm index 1c7af9fcf..9937da6f1 100644 --- a/queries/cairo/folds.scm +++ b/queries/cairo/folds.scm @@ -5,20 +5,16 @@ (enum_item) (impl_item) (type_item) - (use_declaration) (let_declaration) (namespace_definition) - (arguments) (implicit_arguments) (tuple_type) - (import_statement) (attribute_statement) (with_statement) (if_statement) - (function_definition) (struct_definition) (loop_expression) @@ -26,6 +22,5 @@ (match_expression) (call_expression) (tuple_expression) - (attribute_item) ] @fold diff --git a/queries/cairo/highlights.scm b/queries/cairo/highlights.scm index f8bacede9..aa25847c9 100644 --- a/queries/cairo/highlights.scm +++ b/queries/cairo/highlights.scm @@ -1,13 +1,18 @@ ; Preproc - [ "%builtins" "%lang" ] @keyword.directive ; Includes - -(import_statement [ "from" "import" ] @keyword.import module_name: (dotted_name (identifier) @module . )) +(import_statement + [ + "from" + "import" + ] @keyword.import + module_name: + (dotted_name + (identifier) @module .)) [ "as" @@ -16,41 +21,42 @@ ] @keyword.import ; Variables - (identifier) @variable ; Namespaces - -(namespace_definition (identifier) @module) +(namespace_definition + (identifier) @module) (mod_item name: (identifier) @module) -(use_list (self) @module) +(use_list + (self) @module) -(scoped_use_list (self) @module) +(scoped_use_list + (self) @module) (scoped_identifier path: (identifier) @module) (scoped_identifier - (scoped_identifier - name: (identifier) @module)) + (scoped_identifier + name: (identifier) @module)) (scoped_type_identifier path: (identifier) @module) ((scoped_identifier path: (identifier) @type) - (#lua-match? @type "^[A-Z]")) + (#lua-match? @type "^[A-Z]")) ((scoped_identifier - name: (identifier) @type) - (#lua-match? @type "^[A-Z]")) + name: (identifier) @type) + (#lua-match? @type "^[A-Z]")) ((scoped_identifier - name: (identifier) @constant) - (#lua-match? @constant "^[A-Z][A-Z%d_]*$")) + name: (identifier) @constant) + (#lua-match? @constant "^[A-Z][A-Z%d_]*$")) ((scoped_identifier path: (identifier) @type @@ -68,17 +74,25 @@ path: (identifier) @module) (scoped_use_list - path: (scoped_identifier - (identifier) @module)) + path: + (scoped_identifier + (identifier) @module)) -(use_list (scoped_identifier (identifier) @module . (_))) +(use_list + (scoped_identifier + (identifier) @module + . + (_))) -(use_list (identifier) @type (#lua-match? @type "^[A-Z]")) +(use_list + (identifier) @type + (#lua-match? @type "^[A-Z]")) -(use_as_clause alias: (identifier) @type (#lua-match? @type "^[A-Z]")) +(use_as_clause + alias: (identifier) @type + (#lua-match? @type "^[A-Z]")) ; Keywords - [ ; 0.x "using" @@ -96,7 +110,6 @@ "with" "call" "nondet" - ; 1.0 "type" "impl" @@ -133,9 +146,7 @@ "match" ] @keyword.conditional -[ - "loop" -] @keyword.repeat +"loop" @keyword.repeat [ "assert" @@ -144,33 +155,52 @@ ] @keyword.exception ; Fields +(implicit_arguments + (typed_identifier + (identifier) @variable.member)) -(implicit_arguments (typed_identifier (identifier) @variable.member)) +(member_expression + "." + (identifier) @variable.member) -(member_expression "." (identifier) @variable.member) +(call_expression + (assignment_expression + left: (identifier) @variable.member)) -(call_expression (assignment_expression left: (identifier) @variable.member)) - -(tuple_expression (assignment_expression left: (identifier) @variable.member)) +(tuple_expression + (assignment_expression + left: (identifier) @variable.member)) (field_identifier) @variable.member -(shorthand_field_initializer (identifier) @variable.member) +(shorthand_field_initializer + (identifier) @variable.member) ; Parameters +(arguments + (typed_identifier + (identifier) @variable.parameter)) -(arguments (typed_identifier (identifier) @variable.parameter)) +(call_expression + (tuple_expression + (assignment_expression + left: (identifier) @variable.parameter))) -(call_expression (tuple_expression (assignment_expression left: (identifier) @variable.parameter))) +(return_type + (tuple_type + (named_type + . + (identifier) @variable.parameter))) -(return_type (tuple_type (named_type . (identifier) @variable.parameter))) - -(parameter (identifier) @variable.parameter) +(parameter + (identifier) @variable.parameter) ; Builtins +(builtin_directive + (identifier) @variable.builtin) -(builtin_directive (identifier) @variable.builtin) -(lang_directive (identifier) @variable.builtin) +(lang_directive + (identifier) @variable.builtin) [ "ap" @@ -179,32 +209,45 @@ ] @variable.builtin ; Functions +(function_definition + "func" + (identifier) @function) -(function_definition "func" (identifier) @function) -(function_definition "fn" (identifier) @function) -(function_signature "fn" (identifier) @function) -(extern_function_statement (identifier) @function) +(function_definition + "fn" + (identifier) @function) + +(function_signature + "fn" + (identifier) @function) + +(extern_function_statement + (identifier) @function) (call_expression function: (identifier) @function.call) (call_expression - function: (scoped_identifier - (identifier) @function.call .)) + function: + (scoped_identifier + (identifier) @function.call .)) (call_expression - function: (field_expression - field: (field_identifier) @function.call)) + function: + (field_expression + field: (field_identifier) @function.call)) -[ - "jmp" -] @function.builtin +"jmp" @function.builtin ; Types +(struct_definition + . + (identifier) @type + (typed_identifier + (identifier) @variable.member)?) -(struct_definition . (identifier) @type (typed_identifier (identifier) @variable.member)?) - -(named_type (identifier) @type .) +(named_type + (identifier) @type .) [ (builtin_type) @@ -217,7 +260,6 @@ (type_identifier) @type ; Constants - ((identifier) @constant (#lua-match? @constant "^[A-Z_][A-Z0-9_]*$")) @@ -225,49 +267,68 @@ name: (identifier) @constant) (call_expression - function: (scoped_identifier - "::" - name: (identifier) @constant) + function: + (scoped_identifier + "::" + name: (identifier) @constant) (#lua-match? @constant "^[A-Z]")) ((match_arm - pattern: (match_pattern (identifier) @constant)) - (#lua-match? @constant "^[A-Z]")) + pattern: + (match_pattern + (identifier) @constant)) + (#lua-match? @constant "^[A-Z]")) ((match_arm - pattern: (match_pattern - (scoped_identifier - name: (identifier) @constant))) - (#lua-match? @constant "^[A-Z]")) + pattern: + (match_pattern + (scoped_identifier + name: (identifier) @constant))) + (#lua-match? @constant "^[A-Z]")) ((identifier) @constant.builtin - (#any-of? @constant.builtin "Some" "None" "Ok" "Err")) + (#any-of? @constant.builtin "Some" "None" "Ok" "Err")) ; Constructors +(unary_expression + "new" + (call_expression + . + (identifier) @constructor)) -(unary_expression "new" (call_expression . (identifier) @constructor)) - -((call_expression . (identifier) @constructor) +((call_expression + . + (identifier) @constructor) (#lua-match? @constructor "^%u")) ; Attributes +(decorator + "@" @attribute + (identifier) @attribute) -(decorator "@" @attribute (identifier) @attribute) +(attribute_item + (identifier) @function.macro) -(attribute_item (identifier) @function.macro) - -(attribute_item (scoped_identifier (identifier) @function.macro .)) +(attribute_item + (scoped_identifier + (identifier) @function.macro .)) ; Labels +(label + . + (identifier) @label) -(label . (identifier) @label) +(inst_jmp_to_label + "jmp" + . + (identifier) @label) -(inst_jmp_to_label "jmp" . (identifier) @label) - -(inst_jnz_to_label "jmp" . (identifier) @label) +(inst_jnz_to_label + "jmp" + . + (identifier) @label) ; Operators - [ "+" "-" @@ -307,7 +368,6 @@ ] @operator ; Literals - (number) @number (boolean) @boolean @@ -318,17 +378,41 @@ ] @string ; Punctuation +(attribute_item + "#" @punctuation.special) -(attribute_item "#" @punctuation.special) +[ + "." + "," + ":" + ";" + "->" + "=>" + "::" +] @punctuation.delimiter -[ "." "," ":" ";" "->" "=>" "::" ] @punctuation.delimiter +[ + "{" + "}" + "(" + ")" + "[" + "]" + "%{" + "%}" +] @punctuation.bracket -[ "{" "}" "(" ")" "[" "]" "%{" "%}" ] @punctuation.bracket +(type_parameters + [ + "<" + ">" + ] @punctuation.bracket) -(type_parameters [ "<" ">" ] @punctuation.bracket) - -(type_arguments [ "<" ">" ] @punctuation.bracket) +(type_arguments + [ + "<" + ">" + ] @punctuation.bracket) ; Comment - (comment) @comment @spell diff --git a/queries/cairo/indents.scm b/queries/cairo/indents.scm index 76a22e705..a97bd24a4 100644 --- a/queries/cairo/indents.scm +++ b/queries/cairo/indents.scm @@ -18,19 +18,36 @@ (tuple_pattern) ] @indent.begin -(import_statement "(") @indent.begin +(import_statement + "(") @indent.begin + +(block + "}" @indent.end) -(block "}" @indent.end) (enum_item - body: (enum_variant_list "}" @indent.end)) + body: + (enum_variant_list + "}" @indent.end)) + (match_expression - body: (match_block "}" @indent.end)) + body: + (match_block + "}" @indent.end)) + (mod_item - body: (declaration_list "}" @indent.end)) + body: + (declaration_list + "}" @indent.end)) + (struct_item - body: (field_declaration_list "}" @indent.end)) + body: + (field_declaration_list + "}" @indent.end)) + (trait_item - body: (declaration_list "}" @indent.end)) + body: + (declaration_list + "}" @indent.end)) [ ")" diff --git a/queries/cairo/injections.scm b/queries/cairo/injections.scm index 675a81a76..fbb66be38 100644 --- a/queries/cairo/injections.scm +++ b/queries/cairo/injections.scm @@ -1,3 +1,5 @@ -(python_code) @python +((python_code) @injection.content + (#set! injection.language "python")) -(comment) @comment +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/cairo/locals.scm b/queries/cairo/locals.scm index a92991f26..27ec73542 100644 --- a/queries/cairo/locals.scm +++ b/queries/cairo/locals.scm @@ -1,13 +1,13 @@ ; References - (identifier) @local.reference + ((type_identifier) @local.reference (#set! reference.kind "type")) + ((field_identifier) @local.reference (#set! reference.kind "field")) ; Scopes - [ (program) (block) @@ -16,53 +16,52 @@ (if_expression) (match_expression) (match_arm) - (struct_item) (enum_item) (impl_item) ] @local.scope -(use_declaration - argument: (scoped_identifier - name: (identifier) @local.definition.import)) +(use_declaration + argument: + (scoped_identifier + name: (identifier) @local.definition.import)) -(use_as_clause +(use_as_clause alias: (identifier) @local.definition.import) (use_list - (identifier) @local.definition.import) ; use std::process::{Child, Command, Stdio}; + (identifier) @local.definition.import) ; use std::process::{Child, Command, Stdio}; ; Functions - (function_definition - (identifier) @local.definition.function) + (identifier) @local.definition.function) (function_definition (identifier) @local.definition.method - (parameter (self))) + (parameter + (self))) ; Function with parameters, defines parameters - (parameter - [ (identifier) (self) ] @local.definition.parameter) + [ + (identifier) + (self) + ] @local.definition.parameter) ; Types - (struct_item name: (type_identifier) @local.definition.type) -(constrained_type_parameter +(constrained_type_parameter left: (type_identifier) @local.definition.type) ; the P in remove_file>(path: P) (enum_item name: (type_identifier) @local.definition.type) ; Module - -(mod_item +(mod_item name: (identifier) @local.definition.namespace) ; Variables - (assignment_expression - left: (identifier) @local.definition.var) + left: (identifier) @local.definition.var) diff --git a/queries/capnp/highlights.scm b/queries/capnp/highlights.scm index 80c8262e7..4ce923ce4 100644 --- a/queries/capnp/highlights.scm +++ b/queries/capnp/highlights.scm @@ -1,12 +1,10 @@ ; Preproc - [ (unique_id) (top_level_annotation_body) ] @keyword.directive ; Includes - [ "import" "$import" @@ -17,7 +15,6 @@ (import_path) @string.special.path ; Keywords - [ "annotation" "enum" @@ -30,10 +27,7 @@ ] @keyword ; Builtins - -[ - "const" -] @type.qualifier +"const" @type.qualifier [ (primitive_type) @@ -41,30 +35,24 @@ ] @type.builtin ; Typedefs - (type_definition) @type.definition ; Labels (@number, @number!) - (field_version) @label ; Methods - [ (annotation_definition_identifier) (method_identifier) ] @function.method ; Fields - (field_identifier) @variable.member ; Properties - (property) @property ; Parameters - [ (param_identifier) (return_identifier) @@ -73,7 +61,6 @@ (annotation_target) @variable.parameter.builtin ; Constants - [ (const_identifier) (local_const) @@ -83,7 +70,6 @@ (void) @constant.builtin ; Types - [ (enum_identifier) (extend_type) @@ -91,18 +77,15 @@ ] @type ; Attributes - [ (annotation_identifier) (attribute) ] @attribute ; Operators - "=" @operator ; Literals - [ (string) (concatenated_string) @@ -125,18 +108,26 @@ (data_hex) @string.special.symbol ; Punctuation - [ "*" "$" ":" ] @punctuation.special -["{" "}"] @punctuation.bracket +[ + "{" + "}" +] @punctuation.bracket -["(" ")"] @punctuation.bracket +[ + "(" + ")" +] @punctuation.bracket -["[" "]"] @punctuation.bracket +[ + "[" + "]" +] @punctuation.bracket [ "." @@ -146,5 +137,4 @@ ] @punctuation.delimiter ; Comments - (comment) @comment @spell diff --git a/queries/capnp/indents.scm b/queries/capnp/indents.scm index bc7979aea..cc2f4d756 100644 --- a/queries/capnp/indents.scm +++ b/queries/capnp/indents.scm @@ -13,14 +13,17 @@ (field) ] @indent.begin -((struct_shorthand (property)) @indent.align +((struct_shorthand + (property)) @indent.align (#set! indent.open_delimiter "(") (#set! indent.close_delimiter ")")) -((method (field_version)) @indent.align +((method + (field_version)) @indent.align (#set! indent.open_delimiter field_version)) -((const_list (const_value)) @indent.align +((const_list + (const_value)) @indent.align (#set! indent.open_delimiter "[") (#set! indent.close_delimiter "]")) @@ -31,7 +34,6 @@ ")" ] @indent.end @indent.branch - [ (ERROR) (comment) diff --git a/queries/capnp/injections.scm b/queries/capnp/injections.scm index 6adae45a2..2f0e58eb6 100644 --- a/queries/capnp/injections.scm +++ b/queries/capnp/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/capnp/locals.scm b/queries/capnp/locals.scm index d0025100e..d1f0ccacc 100644 --- a/queries/capnp/locals.scm +++ b/queries/capnp/locals.scm @@ -18,17 +18,21 @@ (extend_type) (field_type) ] @local.reference -(custom_type (type_identifier) @local.reference) + +(custom_type + (type_identifier) @local.reference) + (custom_type (generics - (generic_parameters + (generic_parameters (generic_identifier) @local.reference))) (annotation_definition_identifier) @local.definition (const_identifier) @local.definition.constant -(enum (enum_identifier) @local.definition.enum) +(enum + (enum_identifier) @local.definition.enum) [ (enum_member) @@ -44,16 +48,19 @@ (return_identifier) ] @local.definition.parameter -(group (type_identifier) @local.definition.type) +(group + (type_identifier) @local.definition.type) -(struct (type_identifier) @local.definition.type) +(struct + (type_identifier) @local.definition.type) -(union (type_identifier) @local.definition.type) +(union + (type_identifier) @local.definition.type) -(interface (type_identifier) @local.definition.type) +(interface + (type_identifier) @local.definition.type) ; Generics Related (don't know how to combine these) - (struct (generics (generic_parameters diff --git a/queries/chatito/folds.scm b/queries/chatito/folds.scm index 20cb51941..052dd2064 100644 --- a/queries/chatito/folds.scm +++ b/queries/chatito/folds.scm @@ -1,5 +1,5 @@ [ - (intent_def) - (slot_def) - (alias_def) + (intent_def) + (slot_def) + (alias_def) ] @fold diff --git a/queries/chatito/highlights.scm b/queries/chatito/highlights.scm index 913787012..0c2dd795a 100644 --- a/queries/chatito/highlights.scm +++ b/queries/chatito/highlights.scm @@ -1,24 +1,32 @@ -;; Punctuation - +; Punctuation [ - "%[" - "@[" - "~[" - "*[" - "]" - "(" - ")" + "%[" + "@[" + "~[" + "*[" + "]" + "(" + ")" ] @punctuation.bracket -[":" ","] @punctuation.delimiter +[ + ":" + "," +] @punctuation.delimiter -(["\"" "'"] @punctuation.special - (#set! conceal "")) +([ + "\"" + "'" +] @punctuation.special + (#set! conceal "")) -["%" "?" "#"] @character.special - -;; Entities +[ + "%" + "?" + "#" +] @character.special +; Entities (intent) @module (slot) @type @@ -35,16 +43,13 @@ (escape) @string.escape -;; Import - +; Import "import" @keyword.import (file) @string.special.path -;; Text - +; Text (word) @spell -;; Comment - +; Comment (comment) @comment @spell diff --git a/queries/chatito/indents.scm b/queries/chatito/indents.scm index 64b4674b7..dc9e13d78 100644 --- a/queries/chatito/indents.scm +++ b/queries/chatito/indents.scm @@ -1,7 +1,8 @@ [ - (intent_def) - (slot_def) - (alias_def) + (intent_def) + (slot_def) + (alias_def) ] @indent.begin -(ERROR "]") @indent.begin +(ERROR + "]") @indent.begin diff --git a/queries/chatito/injections.scm b/queries/chatito/injections.scm index 6adae45a2..2f0e58eb6 100644 --- a/queries/chatito/injections.scm +++ b/queries/chatito/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/chatito/locals.scm b/queries/chatito/locals.scm index fd8bb9da0..827447f57 100644 --- a/queries/chatito/locals.scm +++ b/queries/chatito/locals.scm @@ -1,10 +1,16 @@ -;; Definitions +; Definitions +(intent_def + (intent) @local.definition) -(intent_def (intent) @local.definition) -(slot_def (slot) @local.definition) -(alias_def (alias) @local.definition) +(slot_def + (slot) @local.definition) -;; References +(alias_def + (alias) @local.definition) -(slot_ref (slot) @local.reference) -(alias_ref (alias) @local.reference) +; References +(slot_ref + (slot) @local.reference) + +(alias_ref + (alias) @local.reference) diff --git a/queries/clojure/folds.scm b/queries/clojure/folds.scm index d54daade6..eceb69712 100644 --- a/queries/clojure/folds.scm +++ b/queries/clojure/folds.scm @@ -1 +1,2 @@ -(source (list_lit) @fold) +(source + (list_lit) @fold) diff --git a/queries/clojure/highlights.scm b/queries/clojure/highlights.scm index 974a17c0a..60bc4365b 100644 --- a/queries/clojure/highlights.scm +++ b/queries/clojure/highlights.scm @@ -1,69 +1,87 @@ -;; >> Explanation -;; Parsers for lisps are a bit weird in that they just return the raw forms. -;; This means we have to do a bit of extra work in the queries to get things -;; highlighted as they should be. -;; -;; For the most part this means that some things have to be assigned multiple -;; groups. -;; By doing this we can add a basic capture and then later refine it with more -;; specialized captures. -;; This can mean that sometimes things are highlighted weirdly because they -;; have multiple highlight groups applied to them. +; >> Explanation +; Parsers for lisps are a bit weird in that they just return the raw forms. +; This means we have to do a bit of extra work in the queries to get things +; highlighted as they should be. +; +; For the most part this means that some things have to be assigned multiple +; groups. +; By doing this we can add a basic capture and then later refine it with more +; specialized captures. +; This can mean that sometimes things are highlighted weirdly because they +; have multiple highlight groups applied to them. +; >> Literals +((dis_expr) @comment + (#set! "priority" 105) + ; Higher priority to mark the whole sexpr as a comment + ) - -;; >> Literals - -( - (dis_expr) @comment - (#set! "priority" 105) ; Higher priority to mark the whole sexpr as a comment -) (kwd_lit) @string.special.symbol + (str_lit) @string + (num_lit) @number + (char_lit) @character + (bool_lit) @boolean + (nil_lit) @constant.builtin + (comment) @comment @spell + (regex_lit) @string.regexp -["'" "`"] @string.escape +[ + "'" + "`" +] @string.escape -["~" "~@" "#"] @punctuation.special +[ + "~" + "~@" + "#" +] @punctuation.special -["{" "}" "[" "]" "(" ")"] @punctuation.bracket - - - -;; >> Symbols +[ + "{" + "}" + "[" + "]" + "(" + ")" +] @punctuation.bracket +; >> Symbols ; General symbol highlighting (sym_lit) @variable ; General function calls (list_lit - . - (sym_lit) @function.call) + . + (sym_lit) @function.call) + (anon_fn_lit - . - (sym_lit) @function.call) + . + (sym_lit) @function.call) ; Quoted symbols (quoting_lit - (sym_lit) @string.special.symbol) + (sym_lit) @string.special.symbol) + (syn_quoting_lit - (sym_lit) @string.special.symbol) + (sym_lit) @string.special.symbol) ; Used in destructure pattern ((sym_lit) @variable.parameter - (#lua-match? @variable.parameter "^[&]")) + (#lua-match? @variable.parameter "^[&]")) ; Inline function variables ((sym_lit) @variable.builtin - (#lua-match? @variable.builtin "^%%")) + (#lua-match? @variable.builtin "^%%")) ; Constructor ((sym_lit) @constructor - (#lua-match? @constructor "^-%>[^>].*")) + (#lua-match? @constructor "^-%>[^>].*")) ; Builtin dynamic variables ((sym_lit) @variable.builtin @@ -84,94 +102,91 @@ ; Builtin repl variables ((sym_lit) @variable.builtin - (#any-of? @variable.builtin - "*1" "*2" "*3" "*e")) + (#any-of? @variable.builtin "*1" "*2" "*3" "*e")) ; Gensym -;; Might not be needed +; Might not be needed ((sym_lit) @variable - (#lua-match? @variable "^.*#$")) + (#lua-match? @variable "^.*#$")) ; Types -;; TODO: improve? +; TODO: improve? ((sym_lit) @type - (#lua-match? @type "^[%u][^/]*$")) -;; Symbols with `.` but not `/` + (#lua-match? @type "^[%u][^/]*$")) + +; Symbols with `.` but not `/` ((sym_lit) @type - (#lua-match? @type "^[^/]+[.][^/]*$")) + (#lua-match? @type "^[^/]+[.][^/]*$")) ; Interop ; (.instanceMember instance args*) ; (.instanceMember Classname args*) ((sym_lit) @function.method - (#lua-match? @function.method "^%.[^-]")) + (#lua-match? @function.method "^%.[^-]")) + ; (.-instanceField instance) ((sym_lit) @variable.member - (#lua-match? @variable.member "^%.%-.*")) + (#lua-match? @variable.member "^%.%-.*")) + ; Classname/staticField ((sym_lit) @variable.member - (#lua-match? @variable.member "^[%u].*/.+")) + (#lua-match? @variable.member "^[%u].*/.+")) + ; (Classname/staticMethod args*) (list_lit - . - (sym_lit) @function.method - (#lua-match? @function.method "^[%u].*/.+")) -;; TODO: Special casing for the `.` macro + . + (sym_lit) @function.method + (#lua-match? @function.method "^[%u].*/.+")) +; TODO: Special casing for the `.` macro ; Operators ((sym_lit) @operator - (#any-of? @operator - "*" "*'" "+" "+'" "-" "-'" "/" - "<" "<=" ">" ">=" "=" "==")) + (#any-of? @operator "*" "*'" "+" "+'" "-" "-'" "/" "<" "<=" ">" ">=" "=" "==")) + ((sym_lit) @keyword.operator - (#any-of? @keyword.operator - "not" "not=" "and" "or")) + (#any-of? @keyword.operator "not" "not=" "and" "or")) ; Definition functions ((sym_lit) @keyword - (#any-of? @keyword - "def" "defonce" "defrecord" "defmacro" "definline" "definterface" - "defmulti" "defmethod" "defstruct" "defprotocol" - "deftype")) + (#any-of? @keyword "def" "defonce" "defrecord" "defmacro" "definline" "definterface" "defmulti" "defmethod" "defstruct" "defprotocol" "deftype")) + ((sym_lit) @keyword - (#eq? @keyword "declare")) + (#eq? @keyword "declare")) + ((sym_name) @keyword.coroutine - (#any-of? @keyword.coroutine - "alts!" "alts!!" "await" "await-for" "await1" "chan" "close!" "future" "go" "sync" "thread" "timeout" "!" ">!!")) + (#any-of? @keyword.coroutine "alts!" "alts!!" "await" "await-for" "await1" "chan" "close!" "future" "go" "sync" "thread" "timeout" "!" ">!!")) + ((sym_lit) @keyword.function - (#any-of? @keyword.function "defn" "defn-" "fn" "fn*")) + (#any-of? @keyword.function "defn" "defn-" "fn" "fn*")) ; Comment ((sym_lit) @comment - (#any-of? @comment "comment")) + (#any-of? @comment "comment")) ; Conditionals ((sym_lit) @keyword.conditional - (#any-of? @keyword.conditional - "case" "cond" "cond->" "cond->>" "condp")) + (#any-of? @keyword.conditional "case" "cond" "cond->" "cond->>" "condp")) + ((sym_lit) @keyword.conditional - (#any-of? @keyword.conditional - "if" "if-let" "if-not" "if-some")) + (#any-of? @keyword.conditional "if" "if-let" "if-not" "if-some")) + ((sym_lit) @keyword.conditional - (#any-of? @keyword.conditional - "when" "when-first" "when-let" "when-not" "when-some")) + (#any-of? @keyword.conditional "when" "when-first" "when-let" "when-not" "when-some")) ; Repeats ((sym_lit) @keyword.repeat - (#any-of? @keyword.repeat - "doseq" "dotimes" "for" "loop" "recur" "while")) + (#any-of? @keyword.repeat "doseq" "dotimes" "for" "loop" "recur" "while")) ; Exception ((sym_lit) @keyword.exception - (#any-of? @keyword.exception - "throw" "try" "catch" "finally")) + (#any-of? @keyword.exception "throw" "try" "catch" "finally")) ; Includes ((sym_lit) @keyword.import - (#any-of? @keyword.import "ns" "import" "require" "use")) + (#any-of? @keyword.import "ns" "import" "require" "use")) ; Builtin macros -;; TODO: Do all these items belong here? +; TODO: Do all these items belong here? ((sym_lit) @function.macro ; format-ignore (#any-of? @function.macro @@ -191,7 +206,7 @@ ; (keep (fn [[s v]] (when-not (:macro (meta v)) s))) ; sort ; clojure.pprint/pprint)) -;; ...and then lots of manual filtering... +; ...and then lots of manual filtering... ((sym_lit) @function.builtin ; format-ignore (#any-of? @function.builtin @@ -316,48 +331,43 @@ "seq-to-map-for-destructuring" "update-keys" "update-vals" ;; 1.12 "partitionv" "partitionv-all" "splitv-at")) - - - -;; >> Context based highlighting - -;; def-likes -;; Correctly highlight docstrings +; >> Context based highlighting +; def-likes +; Correctly highlight docstrings ;(list_lit - ;. - ;(sym_lit) @_keyword ; Don't really want to highlight twice - ;(#any-of? @_keyword - ;"def" "defonce" "defrecord" "defmacro" "definline" - ;"defmulti" "defmethod" "defstruct" "defprotocol" - ;"deftype") - ;. - ;(sym_lit) - ;. - ;;; TODO: Add @comment highlight - ;(str_lit)? - ;. - ;(_)) - +;. +;(sym_lit) @_keyword ; Don't really want to highlight twice +;(#any-of? @_keyword +;"def" "defonce" "defrecord" "defmacro" "definline" +;"defmulti" "defmethod" "defstruct" "defprotocol" +;"deftype") +;. +;(sym_lit) +;. +; TODO: Add @comment highlight +;(str_lit)? +;. +;(_)) ; Function definitions (list_lit - . - (sym_lit) @_keyword.function - (#any-of? @_keyword.function "fn" "fn*" "defn" "defn-") - . - (sym_lit)? @function - . - ;; TODO: Add @comment highlight - (str_lit)?) -;; TODO: Fix parameter highlighting -;; I think there's a bug here in nvim-treesitter -;; TODO: Reproduce bug and file ticket - ;. - ;[(vec_lit - ; (sym_lit)* @variable.parameter) - ; (list_lit - ; (vec_lit - ; (sym_lit)* @variable.parameter))]) - + . + (sym_lit) @_keyword.function + (#any-of? @_keyword.function "fn" "fn*" "defn" "defn-") + . + (sym_lit)? @function + . + ; TODO: Add @comment highlight + (str_lit)?) + +; TODO: Fix parameter highlighting +; I think there's a bug here in nvim-treesitter +; TODO: Reproduce bug and file ticket +;. +;[(vec_lit +; (sym_lit)* @variable.parameter) +; (list_lit +; (vec_lit +; (sym_lit)* @variable.parameter))]) ;[((list_lit ; (vec_lit ; (sym_lit) @variable.parameter) @@ -366,19 +376,17 @@ ; ((vec_lit ; (sym_lit) @variable.parameter) ; (_))) - - ; Meta punctuation -;; NOTE: When the above `Function definitions` query captures the -;; the @function it also captures the child meta_lit -;; We capture the meta_lit symbol (^) after so that the later -;; highlighting overrides the former +; NOTE: When the above `Function definitions` query captures the +; the @function it also captures the child meta_lit +; We capture the meta_lit symbol (^) after so that the later +; highlighting overrides the former "^" @punctuation.special -;; namespaces +; namespaces (list_lit - . - (sym_lit) @_include - (#eq? @_include "ns") - . - (sym_lit) @module) + . + (sym_lit) @_include + (#eq? @_include "ns") + . + (sym_lit) @module) diff --git a/queries/clojure/injections.scm b/queries/clojure/injections.scm index 6adae45a2..2f0e58eb6 100644 --- a/queries/clojure/injections.scm +++ b/queries/clojure/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/cmake/folds.scm b/queries/cmake/folds.scm index 9ac59ad4c..ef153b911 100644 --- a/queries/cmake/folds.scm +++ b/queries/cmake/folds.scm @@ -1,8 +1,8 @@ [ - (if_condition) - (foreach_loop) - (while_loop) - (function_def) - (macro_def) - (block_def) + (if_condition) + (foreach_loop) + (while_loop) + (function_def) + (macro_def) + (block_def) ] @fold diff --git a/queries/cmake/highlights.scm b/queries/cmake/highlights.scm index 13544661f..714893cb1 100644 --- a/queries/cmake/highlights.scm +++ b/queries/cmake/highlights.scm @@ -1,96 +1,107 @@ (normal_command (identifier) (argument_list - (argument (unquoted_argument)) @constant - ) - (#lua-match? @constant "^[%u@][%u%d_]+$") -) + (argument + (unquoted_argument)) @constant) + (#lua-match? @constant "^[%u@][%u%d_]+$")) [ - (quoted_argument) - (bracket_argument) + (quoted_argument) + (bracket_argument) ] @string (variable_ref) @none + (variable) @variable [ - (bracket_comment) - (line_comment) + (bracket_comment) + (line_comment) ] @comment @spell -(normal_command (identifier) @function) - -["ENV" "CACHE"] @keyword.storage -["$" "{" "}" "<" ">"] @punctuation.special -["(" ")"] @punctuation.bracket +(normal_command + (identifier) @function) [ - (function) - (endfunction) - (macro) - (endmacro) + "ENV" + "CACHE" +] @keyword.storage + +[ + "$" + "{" + "}" + "<" + ">" +] @punctuation.special + +[ + "(" + ")" +] @punctuation.bracket + +[ + (function) + (endfunction) + (macro) + (endmacro) ] @keyword.function [ - (if) - (elseif) - (else) - (endif) + (if) + (elseif) + (else) + (endif) ] @keyword.conditional [ - (foreach) - (endforeach) - (while) - (endwhile) + (foreach) + (endforeach) + (while) + (endwhile) ] @keyword.repeat (normal_command (identifier) @keyword.repeat - (#match? @keyword.repeat "\\c^(continue|break)$") -) + (#match? @keyword.repeat "\\c^(continue|break)$")) + (normal_command (identifier) @keyword.return - (#match? @keyword.return "\\c^return$") -) + (#match? @keyword.return "\\c^return$")) (function_command (function) (argument_list - . (argument) @function - (argument)* @variable.parameter - ) -) + . + (argument) @function + (argument)* @variable.parameter)) (macro_command (macro) (argument_list - . (argument) @function.macro - (argument)* @variable.parameter - ) -) + . + (argument) @function.macro + (argument)* @variable.parameter)) (block_def (block_command (block) @function.builtin (argument_list - (argument (unquoted_argument) @constant) - ) - (#any-of? @constant "SCOPE_FOR" "POLICIES" "VARIABLES" "PROPAGATE") - ) - (endblock_command (endblock) @function.builtin) -) + (argument + (unquoted_argument) @constant)) + (#any-of? @constant "SCOPE_FOR" "POLICIES" "VARIABLES" "PROPAGATE")) + (endblock_command + (endblock) @function.builtin)) + ; ((argument) @boolean - (#match? @boolean "\\c^(1|on|yes|true|y|0|off|no|false|n|ignore|notfound|.*-notfound)$") -) + (#match? @boolean "\\c^(1|on|yes|true|y|0|off|no|false|n|ignore|notfound|.*-notfound)$")) + ; (if_command (if) (argument_list - (argument) @keyword.operator - ) + (argument) @keyword.operator) ; format-ignore (#any-of? @keyword.operator "NOT" "AND" "OR" @@ -100,13 +111,12 @@ "LESS" "GREATER" "EQUAL" "LESS_EQUAL" "GREATER_EQUAL" "STRLESS" "STRGREATER" "STREQUAL" "STRLESS_EQUAL" "STRGREATER_EQUAL" "VERSION_LESS" "VERSION_GREATER" "VERSION_EQUAL" "VERSION_LESS_EQUAL" "VERSION_GREATER_EQUAL" - ) -) + )) + (elseif_command (elseif) (argument_list - (argument) @keyword.operator - ) + (argument) @keyword.operator) ; format-ignore (#any-of? @keyword.operator "NOT" "AND" "OR" @@ -116,106 +126,105 @@ "LESS" "GREATER" "EQUAL" "LESS_EQUAL" "GREATER_EQUAL" "STRLESS" "STRGREATER" "STREQUAL" "STRLESS_EQUAL" "STRGREATER_EQUAL" "VERSION_LESS" "VERSION_GREATER" "VERSION_EQUAL" "VERSION_LESS_EQUAL" "VERSION_GREATER_EQUAL" - ) -) + )) (normal_command (identifier) @function.builtin - (#match? @function.builtin "\\c^(cmake_host_system_information|cmake_language|cmake_minimum_required|cmake_parse_arguments|cmake_path|cmake_policy|configure_file|execute_process|file|find_file|find_library|find_package|find_path|find_program|foreach|get_cmake_property|get_directory_property|get_filename_component|get_property|include|include_guard|list|macro|mark_as_advanced|math|message|option|separate_arguments|set|set_directory_properties|set_property|site_name|string|unset|variable_watch|add_compile_definitions|add_compile_options|add_custom_command|add_custom_target|add_definitions|add_dependencies|add_executable|add_library|add_link_options|add_subdirectory|add_test|aux_source_directory|build_command|create_test_sourcelist|define_property|enable_language|enable_testing|export|fltk_wrap_ui|get_source_file_property|get_target_property|get_test_property|include_directories|include_external_msproject|include_regular_expression|install|link_directories|link_libraries|load_cache|project|remove_definitions|set_source_files_properties|set_target_properties|set_tests_properties|source_group|target_compile_definitions|target_compile_features|target_compile_options|target_include_directories|target_link_directories|target_link_libraries|target_link_options|target_precompile_headers|target_sources|try_compile|try_run|ctest_build|ctest_configure|ctest_coverage|ctest_empty_binary_directory|ctest_memcheck|ctest_read_custom_files|ctest_run_script|ctest_sleep|ctest_start|ctest_submit|ctest_test|ctest_update|ctest_upload)$") -) + (#match? @function.builtin "\\c^(cmake_host_system_information|cmake_language|cmake_minimum_required|cmake_parse_arguments|cmake_path|cmake_policy|configure_file|execute_process|file|find_file|find_library|find_package|find_path|find_program|foreach|get_cmake_property|get_directory_property|get_filename_component|get_property|include|include_guard|list|macro|mark_as_advanced|math|message|option|separate_arguments|set|set_directory_properties|set_property|site_name|string|unset|variable_watch|add_compile_definitions|add_compile_options|add_custom_command|add_custom_target|add_definitions|add_dependencies|add_executable|add_library|add_link_options|add_subdirectory|add_test|aux_source_directory|build_command|create_test_sourcelist|define_property|enable_language|enable_testing|export|fltk_wrap_ui|get_source_file_property|get_target_property|get_test_property|include_directories|include_external_msproject|include_regular_expression|install|link_directories|link_libraries|load_cache|project|remove_definitions|set_source_files_properties|set_target_properties|set_tests_properties|source_group|target_compile_definitions|target_compile_features|target_compile_options|target_include_directories|target_link_directories|target_link_libraries|target_link_options|target_precompile_headers|target_sources|try_compile|try_run|ctest_build|ctest_configure|ctest_coverage|ctest_empty_binary_directory|ctest_memcheck|ctest_read_custom_files|ctest_run_script|ctest_sleep|ctest_start|ctest_submit|ctest_test|ctest_update|ctest_upload)$")) (normal_command (identifier) @_function (argument_list - . (argument) @variable - ) - (#match? @_function "\\c^set$") -) - -(normal_command - (identifier) @_function - (#match? @_function "\\c^set$") - (argument_list - . (argument) - ( - (argument) @_cache @keyword.storage . - (argument) @_type @type - (#any-of? @_cache "CACHE") - (#any-of? @_type "BOOL" "FILEPATH" "PATH" "STRING" "INTERNAL") - ) - ) -) + (argument) @variable) + (#match? @_function "\\c^set$")) + +(normal_command + (identifier) @_function + (#match? @_function "\\c^set$") + (argument_list + . + (argument) + ((argument) @_cache @keyword.storage + . + (argument) @_type @type + (#any-of? @_cache "CACHE") + (#any-of? @_type "BOOL" "FILEPATH" "PATH" "STRING" "INTERNAL")))) (normal_command (identifier) @_function (#match? @_function "\\c^unset$") (argument_list - . (argument) + . + (argument) (argument) @keyword.storage - (#any-of? @keyword.storage "CACHE" "PARENT_SCOPE") - ) -) + (#any-of? @keyword.storage "CACHE" "PARENT_SCOPE"))) (normal_command (identifier) @_function (#match? @_function "\\c^list$") (argument_list - . (argument) @constant + . + (argument) @constant (#any-of? @constant "LENGTH" "GET" "JOIN" "SUBLIST" "FIND") - . (argument) @variable - (argument) @variable . - ) -) + . + (argument) @variable + (argument) @variable .)) + (normal_command (identifier) @_function (#match? @_function "\\c^list$") (argument_list - . (argument) @constant - . (argument) @variable - (#any-of? @constant "APPEND" "FILTER" "INSERT" - "POP_BACK" "POP_FRONT" "PREPEND" - "REMOVE_ITEM" "REMOVE_AT" "REMOVE_DUPLICATES" - "REVERSE" "SORT") - ) -) + . + (argument) @constant + . + (argument) @variable + (#any-of? @constant "APPEND" "FILTER" "INSERT" "POP_BACK" "POP_FRONT" "PREPEND" "REMOVE_ITEM" "REMOVE_AT" "REMOVE_DUPLICATES" "REVERSE" "SORT"))) + (normal_command (identifier) @_function (#match? @_function "\\c^list$") (argument_list - . (argument) @_transform @constant - . (argument) @variable - . (argument) @_action @constant + . + (argument) @_transform @constant + . + (argument) @variable + . + (argument) @_action @constant + (#eq? @_transform "TRANSFORM") + (#any-of? @_action "APPEND" "PREPEND" "TOUPPER" "TOLOWER" "STRIP" "GENEX_STRIP" "REPLACE"))) + +(normal_command + (identifier) @_function + (#match? @_function "\\c^list$") + (argument_list + . + (argument) @_transform @constant + . + (argument) @variable + . + (argument) @_action @constant + . + (argument)? @_selector @constant (#eq? @_transform "TRANSFORM") (#any-of? @_action "APPEND" "PREPEND" "TOUPPER" "TOLOWER" "STRIP" "GENEX_STRIP" "REPLACE") - ) -) + (#any-of? @_selector "AT" "FOR" "REGEX"))) + (normal_command (identifier) @_function (#match? @_function "\\c^list$") (argument_list - . (argument) @_transform @constant - . (argument) @variable - . (argument) @_action @constant - . (argument)? @_selector @constant - (#eq? @_transform "TRANSFORM") - (#any-of? @_action "APPEND" "PREPEND" "TOUPPER" "TOLOWER" "STRIP" "GENEX_STRIP" "REPLACE") - (#any-of? @_selector "AT" "FOR" "REGEX") - ) -) -(normal_command - (identifier) @_function - (#match? @_function "\\c^list$") - (argument_list - . (argument) @_transform @constant - (argument) @constant . + . + (argument) @_transform @constant + (argument) @constant + . (argument) @variable (#eq? @_transform "TRANSFORM") - (#eq? @constant "OUTPUT_VARIABLE") - ) -) + (#eq? @constant "OUTPUT_VARIABLE"))) (escape_sequence) @string.escape -((source_file . (line_comment) @keyword.directive) +((source_file + . + (line_comment) @keyword.directive) (#lua-match? @keyword.directive "^#!/")) diff --git a/queries/cmake/indents.scm b/queries/cmake/indents.scm index 787cc2c98..e7f326b00 100644 --- a/queries/cmake/indents.scm +++ b/queries/cmake/indents.scm @@ -9,17 +9,18 @@ ] @indent.begin [ - (elseif_command) - (else_command) - (endif_command) - (endforeach_command) - (endwhile_command) - (endfunction_command) - (endmacro_command) - (endblock_command) + (elseif_command) + (else_command) + (endif_command) + (endforeach_command) + (endwhile_command) + (endfunction_command) + (endmacro_command) + (endblock_command) ] @indent.branch (")" @indent.branch) + (")" @indent.end) (argument_list) @indent.auto diff --git a/queries/comment/highlights.scm b/queries/comment/highlights.scm index 41b653e93..6556ec557 100644 --- a/queries/comment/highlights.scm +++ b/queries/comment/highlights.scm @@ -11,33 +11,39 @@ ((tag (name) @comment.note @nospell - ("(" @punctuation.bracket (user) @constant ")" @punctuation.bracket)? + ("(" @punctuation.bracket + (user) @constant + ")" @punctuation.bracket)? ":" @punctuation.delimiter) (#any-of? @comment.note "NOTE" "XXX" "INFO" "DOCS" "PERF" "TEST")) ("text" @comment.note @nospell - (#any-of? @comment.note "NOTE" "XXX" "INFO" "DOCS" "PERF" "TEST")) + (#any-of? @comment.note "NOTE" "XXX" "INFO" "DOCS" "PERF" "TEST")) ((tag (name) @comment.warning @nospell - ("(" @punctuation.bracket (user) @constant ")" @punctuation.bracket)? + ("(" @punctuation.bracket + (user) @constant + ")" @punctuation.bracket)? ":" @punctuation.delimiter) (#any-of? @comment.warning "HACK" "WARNING" "WARN" "FIX")) ("text" @comment.warning @nospell - (#any-of? @comment.warning "HACK" "WARNING" "WARN" "FIX")) + (#any-of? @comment.warning "HACK" "WARNING" "WARN" "FIX")) ((tag (name) @comment.error @nospell - ("(" @punctuation.bracket (user) @constant ")" @punctuation.bracket)? + ("(" @punctuation.bracket + (user) @constant + ")" @punctuation.bracket)? ":" @punctuation.delimiter) (#any-of? @comment.error "FIXME" "BUG" "ERROR")) ("text" @comment.error @nospell - (#any-of? @comment.error "FIXME" "BUG" "ERROR")) + (#any-of? @comment.error "FIXME" "BUG" "ERROR")) ; Issue number (#123) ("text" @number - (#lua-match? @number "^#[0-9]+$")) + (#lua-match? @number "^#[0-9]+$")) ((uri) @string.special.url @nospell) diff --git a/queries/commonlisp/folds.scm b/queries/commonlisp/folds.scm index d54daade6..eceb69712 100644 --- a/queries/commonlisp/folds.scm +++ b/queries/commonlisp/folds.scm @@ -1 +1,2 @@ -(source (list_lit) @fold) +(source + (list_lit) @fold) diff --git a/queries/commonlisp/highlights.scm b/queries/commonlisp/highlights.scm index 42da34d0e..57775019b 100644 --- a/queries/commonlisp/highlights.scm +++ b/queries/commonlisp/highlights.scm @@ -1,25 +1,48 @@ (sym_lit) @variable - -;; A highlighting for functions/macros in th cl namespace is available in theHamsta/nvim-treesitter-commonlisp +; A highlighting for functions/macros in th cl namespace is available in theHamsta/nvim-treesitter-commonlisp ;(list_lit . (sym_lit) @function.builtin (#cl-standard-function? @function.builtin)) ;(list_lit . (sym_lit) @function.builtin (#cl-standard-macro? @function.macro)) - (dis_expr) @comment (defun_keyword) @function.macro + (defun_header function_name: (_) @function) + (defun_header - lambda_list: (list_lit (sym_lit) @variable.parameter)) + lambda_list: + (list_lit + (sym_lit) @variable.parameter)) + (defun_header - keyword: (defun_keyword "defmethod") - lambda_list: (list_lit (list_lit . (sym_lit) . (sym_lit) @string.special.symbol))) + keyword: + (defun_keyword + "defmethod") + lambda_list: + (list_lit + (list_lit + . + (sym_lit) + . + (sym_lit) @string.special.symbol))) + (defun_header - lambda_list: (list_lit (list_lit . (sym_lit) @variable.parameter . (_)))) + lambda_list: + (list_lit + (list_lit + . + (sym_lit) @variable.parameter + . + (_)))) + (defun_header specifier: (sym_lit) @string.special.symbol) -[":" "::" "."] @punctuation.special +[ + ":" + "::" + "." +] @punctuation.special [ (accumulation_verb) @@ -49,99 +72,126 @@ "return" "initially" ] @function.macro + "=" @operator (include_reader_macro) @string.special.symbol -["#C" "#c"] @number -[(kwd_lit) (self_referential_reader_macro)] @string.special.symbol +[ + "#C" + "#c" +] @number + +[ + (kwd_lit) + (self_referential_reader_macro) +] @string.special.symbol (package_lit package: (_) @module) + "cl" @module (str_lit) @string (num_lit) @number -((sym_lit) @boolean (#any-of? @boolean "t" "T")) +((sym_lit) @boolean + (#any-of? @boolean "t" "T")) (nil_lit) @constant.builtin (comment) @comment @spell -;; dynamic variables +; dynamic variables ((sym_lit) @variable.builtin - (#lua-match? @variable.builtin "^[*].+[*]$")) + (#lua-match? @variable.builtin "^[*].+[*]$")) -;; quote +; quote "'" @string.escape + (format_specifier) @string.escape + (quoting_lit) @string.escape -;; syntax quote +; syntax quote "`" @string.escape + "," @string.escape + ",@" @string.escape + (syn_quoting_lit) @string.escape + (unquoting_lit) @none + (unquote_splicing_lit) @none - -["(" ")"] @punctuation.bracket +[ + "(" + ")" +] @punctuation.bracket (block_comment) @comment @spell - (with_clause type: (_) @type) + (for_clause type: (_) @type) -;; defun-like things +; defun-like things (list_lit - . - (sym_lit) @function.macro - . - (sym_lit) @function - (#eq? @function.macro "deftest")) + . + (sym_lit) @function.macro + . + (sym_lit) @function + (#eq? @function.macro "deftest")) -;;; Macros and Special Operators +; Macros and Special Operators (list_lit - . - (sym_lit) @function.macro - ;; Generated via https://github.com/theHamsta/nvim-treesitter-commonlisp/blob/22fdc9fd6ed594176cc7299cc6f68dd21c94c63b/scripts/generate-symbols.lisp#L1-L21 + . + (sym_lit) @function.macro + ; Generated via https://github.com/theHamsta/nvim-treesitter-commonlisp/blob/22fdc9fd6ed594176cc7299cc6f68dd21c94c63b/scripts/generate-symbols.lisp#L1-L21 ; format-ignore (#any-of? @function.macro "do*" "step" "handler-bind" "decf" "prog1" "destructuring-bind" "defconstant" "do" "lambda" "with-standard-io-syntax" "case" "restart-bind" "ignore-errors" "with-slots" "prog2" "defclass" "define-condition" "print-unreadable-object" "defvar" "when" "with-open-file" "prog" "incf" "declaim" "and" "loop-finish" "multiple-value-bind" "pop" "psetf" "defmacro" "with-open-stream" "define-modify-macro" "defsetf" "formatter" "call-method" "handler-case" "pushnew" "or" "with-hash-table-iterator" "ecase" "cond" "defun" "remf" "ccase" "define-compiler-macro" "dotimes" "multiple-value-list" "assert" "deftype" "with-accessors" "trace" "with-simple-restart" "do-symbols" "nth-value" "define-symbol-macro" "psetq" "rotatef" "dolist" "check-type" "multiple-value-setq" "push" "pprint-pop" "loop" "define-setf-expander" "pprint-exit-if-list-exhausted" "with-condition-restarts" "defstruct" "with-input-from-string" "with-compilation-unit" "defgeneric" "with-output-to-string" "untrace" "defparameter" "ctypecase" "do-external-symbols" "etypecase" "do-all-symbols" "with-package-iterator" "unless" "defmethod" "in-package" "defpackage" "return" "typecase" "shiftf" "setf" "pprint-logical-block" "time" "restart-case" "prog*" "define-method-combination" "optimize")) -;; constant +; constant ((sym_lit) @constant - (#lua-match? @constant "^[+].+[+]$")) + (#lua-match? @constant "^[+].+[+]$")) (var_quoting_lit marker: "#'" @string.special.symbol value: (_) @string.special.symbol) -["#" "#p" "#P"] @string.special.symbol +[ + "#" + "#p" + "#P" +] @string.special.symbol (list_lit . (sym_lit) @function.builtin - ;; Generated via https://github.com/theHamsta/nvim-treesitter-commonlisp/blob/22fdc9fd6ed594176cc7299cc6f68dd21c94c63b/scripts/generate-symbols.lisp#L1-L21 + ; Generated via https://github.com/theHamsta/nvim-treesitter-commonlisp/blob/22fdc9fd6ed594176cc7299cc6f68dd21c94c63b/scripts/generate-symbols.lisp#L1-L21 ; format-ignore (#any-of? @function.builtin - "apropos-list" "subst" "substitute" "pprint-linear" "file-namestring" "write-char" "do*" "slot-exists-p" "file-author" "macro-function" "rassoc" "make-echo-stream" "arithmetic-error-operation" "position-if-not" "list" "cdadr" "lisp-implementation-type" "vector-push" "let" "length" "string-upcase" "adjoin" "digit-char" "step" "member-if" "handler-bind" "lognot" "apply" "gcd" "slot-unbound" "stringp" "values-list" "stable-sort" "decode-float" "make-list" "rplaca" "isqrt" "export" "synonym-stream-symbol" "function-keywords" "replace" "tanh" "maphash" "code-char" "decf" "array-displacement" "string-not-lessp" "slot-value" "remove-if" "cell-error-name" "vectorp" "cdddar" "two-way-stream-output-stream" "parse-integer" "get-internal-real-time" "fourth" "make-string" "slot-missing" "byte-size" "string-trim" "nstring-downcase" "cdaddr" "<" "labels" "interactive-stream-p" "fifth" "max" "logxor" "pathname-name" "function" "realp" "eql" "logand" "short-site-name" "prog1" "user-homedir-pathname" "list-all-packages" "exp" "cadar" "read-char-no-hang" "package-error-package" "stream-external-format" "bit-andc2" "nsubstitute-if" "mapcar" "complement" "load-logical-pathname-translations" "pprint-newline" "oddp" "caaar" "destructuring-bind" "copy-alist" "acos" "go" "bit-nor" "defconstant" "fceiling" "tenth" "nreverse" "=" "nunion" "slot-boundp" "string>" "count-if" "atom" "char=" "random-state-p" "row-major-aref" "bit-andc1" "translate-pathname" "simple-vector-p" "coerce" "substitute-if-not" "zerop" "invalid-method-error" "compile" "realpart" "remove-if-not" "pprint-tab" "hash-table-rehash-threshold" "invoke-restart" "if" "count" "/=" "do" "initialize-instance" "abs" "schar" "simple-condition-format-control" "delete-package" "subst-if" "lambda" "hash-table-count" "array-has-fill-pointer-p" "bit" "with-standard-io-syntax" "parse-namestring" "proclaim" "array-in-bounds-p" "multiple-value-call" "rplacd" "some" "graphic-char-p" "read-from-string" "consp" "cadaar" "acons" "every" "make-pathname" "mask-field" "case" "set-macro-character" "bit-and" "restart-bind" "echo-stream-input-stream" "compile-file" "fill-pointer" "numberp" "acosh" "array-dimensions" "documentation" "minusp" "inspect" "copy-structure" "integer-length" "ensure-generic-function" "char>=" "quote" "lognor" "make-two-way-stream" "ignore-errors" "tailp" "with-slots" "fboundp" "logical-pathname-translations" "equal" "float-sign" "shadow" "sleep" "numerator" "prog2" "getf" "ldb-test" "round" "locally" "echo-stream-output-stream" "log" "get-macro-character" "alphanumericp" "find-method" "nintersection" "defclass" "define-condition" "print-unreadable-object" "defvar" "broadcast-stream-streams" "floatp" "subst-if-not" "integerp" "translate-logical-pathname" "subsetp" "when" "write-string" "with-open-file" "clrhash" "apropos" "intern" "min" "string-greaterp" "import" "nset-difference" "prog" "incf" "both-case-p" "multiple-value-prog1" "characterp" "streamp" "digit-char-p" "random" "string-lessp" "make-string-input-stream" "copy-symbol" "read-sequence" "logcount" "bit-not" "boundp" "encode-universal-time" "third" "declaim" "map" "cons" "set-syntax-from-char" "and" "cis" "symbol-plist" "loop-finish" "standard-char-p" "multiple-value-bind" "asin" "string" "pop" "complex" "fdefinition" "psetf" "type-error-datum" "output-stream-p" "floor" "write-line" "<=" "defmacro" "rational" "hash-table-test" "with-open-stream" "read-char" "string-capitalize" "get-properties" "y-or-n-p" "use-package" "remove" "compiler-macro-function" "read" "package-nicknames" "remove-duplicates" "make-load-form-saving-slots" "dribble" "define-modify-macro" "make-dispatch-macro-character" "close" "cosh" "open" "finish-output" "string-downcase" "car" "nstring-capitalize" "software-type" "read-preserving-whitespace" "cadr" "fround" "nsublis" "defsetf" "find-all-symbols" "char>" "no-applicable-method" "compute-restarts" "pathname" "bit-orc2" "write-sequence" "pprint-tabular" "symbol-value" "char-name" "get-decoded-time" "formatter" "bit-vector-p" "intersection" "pathname-type" "clear-input" "call-method" "princ-to-string" "symbolp" "make-load-form" "nsubst" "pprint-dispatch" "handler-case" "method-combination-error" "probe-file" "atan" "string<" "type-error-expected-type" "pushnew" "unread-char" "print" "or" "with-hash-table-iterator" "make-sequence" "ecase" "unwind-protect" "require" "sixth" "get-dispatch-macro-character" "char-not-lessp" "read-byte" "tagbody" "file-error-pathname" "catch" "rationalp" "char-downcase" "char-int" "array-rank" "cond" "last" "make-string-output-stream" "array-dimension" "host-namestring" "input-stream-p" "decode-universal-time" "defun" "eval-when" "char-code" "pathname-directory" "evenp" "subseq" "pprint" "ftruncate" "make-instance" "pathname-host" "logbitp" "remf" "1+" "copy-pprint-dispatch" "char-upcase" "error" "read-line" "second" "make-package" "directory" "special-operator-p" "open-stream-p" "rassoc-if-not" "ccase" "equalp" "substitute-if" "*" "char/=" "cdr" "sqrt" "lcm" "logical-pathname" "eval" "define-compiler-macro" "nsubstitute-if-not" "mapcon" "imagpart" "set-exclusive-or" "simple-condition-format-arguments" "expt" "concatenate" "file-position" "macrolet" "keywordp" "hash-table-rehash-size" "+" "eighth" "use-value" "char-equal" "bit-xor" "format" "byte" "dotimes" "namestring" "char-not-equal" "multiple-value-list" "assert" "append" "notany" "typep" "delete-file" "makunbound" "cdaar" "file-write-date" ">" "cdddr" "write-to-string" "funcall" "member-if-not" "deftype" "readtable-case" "with-accessors" "truename" "constantp" "rassoc-if" "caaadr" "tree-equal" "nset-exclusive-or" "nsubstitute" "make-instances-obsolete" "package-use-list" "invoke-debugger" "provide" "count-if-not" "trace" "logandc1" "nthcdr" "char<=" "functionp" "with-simple-restart" "set-dispatch-macro-character" "logorc2" "unexport" "rest" "unbound-slot-instance" "make-hash-table" "hash-table-p" "reinitialize-instance" "nth" "do-symbols" "nreconc" "macroexpand" "store-value" "float-precision" "remprop" "nth-value" "define-symbol-macro" "update-instance-for-redefined-class" "identity" "progv" "progn" "return-from" "readtablep" "rem" "symbol-name" "psetq" "wild-pathname-p" "char" "list*" "char<" "plusp" "pairlis" "cddar" "pprint-indent" "union" "compiled-function-p" "rotatef" "abort" "machine-type" "concatenated-stream-streams" "string-right-trim" "enough-namestring" "arithmetic-error-operands" "ceiling" "dolist" "delete" "make-condition" "string-left-trim" "integer-decode-float" "check-type" "notevery" "function-lambda-expression" "-" "multiple-value-setq" "name-char" "push" "pprint-pop" "compile-file-pathname" "list-length" "nstring-upcase" "eq" "find-if" "method-qualifiers" "caadr" "cddr" "string=" "let*" "remove-method" "pathname-match-p" "find-package" "truncate" "caaddr" "get-setf-expansion" "loop" "define-setf-expander" "caddr" "package-shadowing-symbols" "force-output" "slot-makunbound" "string-not-greaterp" "cdadar" "cdaadr" "logandc2" "make-array" "merge-pathnames" "sin" "1-" "machine-version" "ffloor" "packagep" "set-pprint-dispatch" "flet" "gensym" "pprint-exit-if-list-exhausted" "cos" "get" "mapl" "delete-if" "with-condition-restarts" "atanh" "copy-list" "fill" "char-not-greaterp" "bit-orc1" "mod" "package-used-by-list" "warn" "add-method" "simple-string-p" "find-restart" "describe" "pathname-version" "peek-char" "yes-or-no-p" "complexp" "aref" "not" "position-if" "string>=" "defstruct" "float-radix" "ninth" "caadar" "subtypep" "set" "butlast" "allocate-instance" "with-input-from-string" "assoc" "write" "make-random-state" "bit-eqv" "float-digits" "long-site-name" "with-compilation-unit" "delete-duplicates" "make-symbol" "room" "cdar" "pprint-fill" "defgeneric" "macroexpand-1" "scale-float" "cdaaar" "update-instance-for-different-class" "array-row-major-index" "ed" "file-string-length" "ensure-directories-exist" "copy-readtable" "string<=" "seventh" "with-output-to-string" "signum" "elt" "untrace" "null" "defparameter" "block" "prin1" "revappend" "gentemp" "ctypecase" "ash" "sxhash" "listp" "do-external-symbols" "bit-ior" "etypecase" "sort" "change-class" "find-class" "alpha-char-p" "map-into" "terpri" "do-all-symbols" "ldb" "logorc1" "search" "fmakunbound" "load" "character" "string-not-equal" "pathnamep" "make-broadcast-stream" "arrayp" "mapcan" "cerror" "invoke-restart-interactively" "assoc-if-not" "with-package-iterator" "get-internal-run-time" "read-delimited-list" "unless" "lower-case-p" "restart-name" "/" "boole" "defmethod" "float" "software-version" "vector-pop" "vector-push-extend" "caar" "ldiff" "member" "find-symbol" "reduce" "svref" "describe-object" "logior" "string-equal" "type-of" "position" "cddadr" "pathname-device" "get-output-stream-string" "symbol-package" "tan" "compute-applicable-methods" "cddddr" "nsubst-if-not" "sublis" "set-difference" "two-way-stream-input-stream" "adjustable-array-p" "machine-instance" "signal" "conjugate" "caaaar" "endp" "lisp-implementation-version" "cddaar" "package-name" "adjust-array" "bit-nand" "gethash" "in-package" "symbol-function" "make-concatenated-stream" "defpackage" "class-of" "no-next-method" "logeqv" "deposit-field" "disassemble" "unuse-package" "copy-tree" "find" "asinh" "class-name" "rename-file" "values" "print-not-readable-object" "mismatch" "cadadr" "shadowing-import" "delete-if-not" "maplist" "listen" "return" "stream-element-type" "unintern" "merge" "make-synonym-stream" "prin1-to-string" "nsubst-if" "byte-position" "phase" "muffle-warning" "remhash" "continue" "load-time-value" "hash-table-size" "upgraded-complex-part-type" "char-lessp" "sbit" "upgraded-array-element-type" "file-length" "typecase" "cadddr" "first" "rationalize" "logtest" "find-if-not" "dpb" "mapc" "sinh" "char-greaterp" "shiftf" "denominator" "get-universal-time" "nconc" "setf" "lognand" "rename-package" "pprint-logical-block" "break" "symbol-macrolet" "the" "fresh-line" "clear-output" "assoc-if" "string/=" "princ" "directory-namestring" "stream-error-stream" "array-element-type" "setq" "copy-seq" "time" "restart-case" "prog*" "shared-initialize" "array-total-size" "simple-bit-vector-p" "define-method-combination" "write-byte" "constantly" "caddar" "print-object" "vector" "throw" "reverse" ">=" "upper-case-p" "nbutlast")) + "apropos-list" "subst" "substitute" "pprint-linear" "file-namestring" "write-char" "do*" "slot-exists-p" "file-author" "macro-function" "rassoc" "make-echo-stream" "arithmetic-error-operation" "position-if-not" "list" "cdadr" "lisp-implementation-type" "vector-push" "let" "length" "string-upcase" "adjoin" "digit-char" "step" "member-if" "handler-bind" "lognot" "apply" "gcd" "slot-unbound" "stringp" "values-list" "stable-sort" "decode-float" "make-list" "rplaca" "isqrt" "export" "synonym-stream-symbol" "function-keywords" "replace" "tanh" "maphash" "code-char" "decf" "array-displacement" "string-not-lessp" "slot-value" "remove-if" "cell-error-name" "vectorp" "cdddar" "two-way-stream-output-stream" "parse-integer" "get-internal-real-time" "fourth" "make-string" "slot-missing" "byte-size" "string-trim" "nstring-downcase" "cdaddr" "<" "labels" "interactive-stream-p" "fifth" "max" "logxor" "pathname-name" "function" "realp" "eql" "logand" "short-site-name" "prog1" "user-homedir-pathname" "list-all-packages" "exp" "cadar" "read-char-no-hang" "package-error-package" "stream-external-format" "bit-andc2" "nsubstitute-if" "mapcar" "complement" "load-logical-pathname-translations" "pprint-newline" "oddp" "caaar" "destructuring-bind" "copy-alist" "acos" "go" "bit-nor" "defconstant" "fceiling" "tenth" "nreverse" "=" "nunion" "slot-boundp" "string>" "count-if" "atom" "char=" "random-state-p" "row-major-aref" "bit-andc1" "translate-pathname" "simple-vector-p" "coerce" "substitute-if-not" "zerop" "invalid-method-error" "compile" "realpart" "remove-if-not" "pprint-tab" "hash-table-rehash-threshold" "invoke-restart" "if" "count" "/=" "do" "initialize-instance" "abs" "schar" "simple-condition-format-control" "delete-package" "subst-if" "lambda" "hash-table-count" "array-has-fill-pointer-p" "bit" "with-standard-io-syntax" "parse-namestring" "proclaim" "array-in-bounds-p" "multiple-value-call" "rplacd" "some" "graphic-char-p" "read-from-string" "consp" "cadaar" "acons" "every" "make-pathname" "mask-field" "case" "set-macro-character" "bit-and" "restart-bind" "echo-stream-input-stream" "compile-file" "fill-pointer" "numberp" "acosh" "array-dimensions" "documentation" "minusp" "inspect" "copy-structure" "integer-length" "ensure-generic-function" "char>=" "quote" "lognor" "make-two-way-stream" "ignore-errors" "tailp" "with-slots" "fboundp" "logical-pathname-translations" "equal" "float-sign" "shadow" "sleep" "numerator" "prog2" "getf" "ldb-test" "round" "locally" "echo-stream-output-stream" "log" "get-macro-character" "alphanumericp" "find-method" "nintersection" "defclass" "define-condition" "print-unreadable-object" "defvar" "broadcast-stream-streams" "floatp" "subst-if-not" "integerp" "translate-logical-pathname" "subsetp" "when" "write-string" "with-open-file" "clrhash" "apropos" "intern" "min" "string-greaterp" "import" "nset-difference" "prog" "incf" "both-case-p" "multiple-value-prog1" "characterp" "streamp" "digit-char-p" "random" "string-lessp" "make-string-input-stream" "copy-symbol" "read-sequence" "logcount" "bit-not" "boundp" "encode-universal-time" "third" "declaim" "map" "cons" "set-syntax-from-char" "and" "cis" "symbol-plist" "loop-finish" "standard-char-p" "multiple-value-bind" "asin" "string" "pop" "complex" "fdefinition" "psetf" "type-error-datum" "output-stream-p" "floor" "write-line" "<=" "defmacro" "rational" "hash-table-test" "with-open-stream" "read-char" "string-capitalize" "get-properties" "y-or-n-p" "use-package" "remove" "compiler-macro-function" "read" "package-nicknames" "remove-duplicates" "make-load-form-saving-slots" "dribble" "define-modify-macro" "make-dispatch-macro-character" "close" "cosh" "open" "finish-output" "string-downcase" "car" "nstring-capitalize" "software-type" "read-preserving-whitespace" "cadr" "fround" "nsublis" "defsetf" "find-all-symbols" "char>" "no-applicable-method" "compute-restarts" "pathname" "bit-orc2" "write-sequence" "pprint-tabular" "symbol-value" "char-name" "get-decoded-time" "formatter" "bit-vector-p" "intersection" "pathname-type" "clear-input" "call-method" "princ-to-string" "symbolp" "make-load-form" "nsubst" "pprint-dispatch" "handler-case" "method-combination-error" "probe-file" "atan" "string<" "type-error-expected-type" "pushnew" "unread-char" "print" "or" "with-hash-table-iterator" "make-sequence" "ecase" "unwind-protect" "require" "sixth" "get-dispatch-macro-character" "char-not-lessp" "read-byte" "tagbody" "file-error-pathname" "catch" "rationalp" "char-downcase" "char-int" "array-rank" "cond" "last" "make-string-output-stream" "array-dimension" "host-namestring" "input-stream-p" "decode-universal-time" "defun" "eval-when" "char-code" "pathname-directory" "evenp" "subseq" "pprint" "ftruncate" "make-instance" "pathname-host" "logbitp" "remf" "1+" "copy-pprint-dispatch" "char-upcase" "error" "read-line" "second" "make-package" "directory" "special-operator-p" "open-stream-p" "rassoc-if-not" "ccase" "equalp" "substitute-if" "*" "char/=" "cdr" "sqrt" "lcm" "logical-pathname" "eval" "define-compiler-macro" "nsubstitute-if-not" "mapcon" "imagpart" "set-exclusive-or" "simple-condition-format-arguments" "expt" "concatenate" "file-position" "macrolet" "keywordp" "hash-table-rehash-size" "+" "eighth" "use-value" "char-equal" "bit-xor" "format" "byte" "dotimes" "namestring" "char-not-equal" "multiple-value-list" "assert" "append" "notany" "typep" "delete-file" "makunbound" "cdaar" "file-write-date" ">" "cdddr" "write-to-string" "funcall" "member-if-not" "deftype" "readtable-case" "with-accessors" "truename" "constantp" "rassoc-if" "caaadr" "tree-equal" "nset-exclusive-or" "nsubstitute" "make-instances-obsolete" "package-use-list" "invoke-debugger" "provide" "count-if-not" "trace" "logandc1" "nthcdr" "char<=" "functionp" "with-simple-restart" "set-dispatch-macro-character" "logorc2" "unexport" "rest" "unbound-slot-instance" "make-hash-table" "hash-table-p" "reinitialize-instance" "nth" "do-symbols" "nreconc" "macroexpand" "store-value" "float-precision" "remprop" "nth-value" "define-symbol-macro" "update-instance-for-redefined-class" "identity" "progv" "progn" "return-from" "readtablep" "rem" "symbol-name" "psetq" "wild-pathname-p" "char" "list*" "char<" "plusp" "pairlis" "cddar" "pprint-indent" "union" "compiled-function-p" "rotatef" "abort" "machine-type" "concatenated-stream-streams" "string-right-trim" "enough-namestring" "arithmetic-error-operands" "ceiling" "dolist" "delete" "make-condition" "string-left-trim" "integer-decode-float" "check-type" "notevery" "function-lambda-expression" "-" "multiple-value-setq" "name-char" "push" "pprint-pop" "compile-file-pathname" "list-length" "nstring-upcase" "eq" "find-if" "method-qualifiers" "caadr" "cddr" "string=" "let*" "remove-method" "pathname-match-p" "find-package" "truncate" "caaddr" "get-setf-expansion" "loop" "define-setf-expander" "caddr" "package-shadowing-symbols" "force-output" "slot-makunbound" "string-not-greaterp" "cdadar" "cdaadr" "logandc2" "make-array" "merge-pathnames" "sin" "1-" "machine-version" "ffloor" "packagep" "set-pprint-dispatch" "flet" "gensym" "pprint-exit-if-list-exhausted" "cos" "get" "mapl" "delete-if" "with-condition-restarts" "atanh" "copy-list" "fill" "char-not-greaterp" "bit-orc1" "mod" "package-used-by-list" "warn" "add-method" "simple-string-p" "find-restart" "describe" "pathname-version" "peek-char" "yes-or-no-p" "complexp" "aref" "not" "position-if" "string>=" "defstruct" "float-radix" "ninth" "caadar" "subtypep" "set" "butlast" "allocate-instance" "with-input-from-string" "assoc" "write" "make-random-state" "bit-eqv" "float-digits" "long-site-name" "with-compilation-unit" "delete-duplicates" "make-symbol" "room" "cdar" "pprint-fill" "defgeneric" "macroexpand-1" "scale-float" "cdaaar" "update-instance-for-different-class" "array-row-major-index" "ed" "file-string-length" "ensure-directories-exist" "copy-readtable" "string<=" "seventh" "with-output-to-string" "signum" "elt" "untrace" "null" "defparameter" "block" "prin1" "revappend" "gentemp" "ctypecase" "ash" "sxhash" "listp" "do-external-symbols" "bit-ior" "etypecase" "sort" "change-class" "find-class" "alpha-char-p" "map-into" "terpri" "do-all-symbols" "ldb" "logorc1" "search" "fmakunbound" "load" "character" "string-not-equal" "pathnamep" "make-broadcast-stream" "arrayp" "mapcan" "cerror" "invoke-restart-interactively" "assoc-if-not" "with-package-iterator" "get-internal-run-time" "read-delimited-list" "unless" "lower-case-p" "restart-name" "/" "boole" "defmethod" "float" "software-version" "vector-pop" "vector-push-extend" "caar" "ldiff" "member" "find-symbol" "reduce" "svref" "describe-object" "logior" "string-equal" "type-of" "position" "cddadr" "pathname-device" "get-output-stream-string" "symbol-package" "tan" "compute-applicable-methods" "cddddr" "nsubst-if-not" "sublis" "set-difference" "two-way-stream-input-stream" "adjustable-array-p" "machine-instance" "signal" "conjugate" "caaaar" "endp" "lisp-implementation-version" "cddaar" "package-name" "adjust-array" "bit-nand" "gethash" "in-package" "symbol-function" "make-concatenated-stream" "defpackage" "class-of" "no-next-method" "logeqv" "deposit-field" "disassemble" "unuse-package" "copy-tree" "find" "asinh" "class-name" "rename-file" "values" "print-not-readable-object" "mismatch" "cadadr" "shadowing-import" "delete-if-not" "maplist" "listen" "return" "stream-element-type" "unintern" "merge" "make-synonym-stream" "prin1-to-string" "nsubst-if" "byte-position" "phase" "muffle-warning" "remhash" "continue" "load-time-value" "hash-table-size" "upgraded-complex-part-type" "char-lessp" "sbit" "upgraded-array-element-type" "file-length" "typecase" "cadddr" "first" "rationalize" "logtest" "find-if-not" "dpb" "mapc" "sinh" "char-greaterp" "shiftf" "denominator" "get-universal-time" "nconc" "setf" "lognand" "rename-package" "pprint-logical-block" "break" "symbol-macrolet" "the" "fresh-line" "clear-output" "assoc-if" "string/=" "princ" "directory-namestring" "stream-error-stream" "array-element-type" "setq" "copy-seq" "time" "restart-case" "prog*" "shared-initialize" "array-total-size" "simple-bit-vector-p" "define-method-combination" "write-byte" "constantly" "caddar" "print-object" "vector" "throw" "reverse" ">=" "upper-case-p" "nbutlast") + ) (list_lit - . - (sym_lit) @operator - (#match? @operator "^([+*-+=<>]|<=|>=|/=)$")) - + . + (sym_lit) @operator + (#match? @operator "^([+*-+=<>]|<=|>=|/=)$")) ((sym_lit) @string.special.symbol -(#lua-match? @string.special.symbol "^[&]")) + (#lua-match? @string.special.symbol "^[&]")) -[(array_dimension) "#0A" "#0a"] @number +[ + (array_dimension) + "#0A" + "#0a" +] @number (char_lit) @character diff --git a/queries/commonlisp/locals.scm b/queries/commonlisp/locals.scm index 647d1007f..2865c1f0f 100644 --- a/queries/commonlisp/locals.scm +++ b/queries/commonlisp/locals.scm @@ -1,72 +1,113 @@ +(defun_header + function_name: (sym_lit) @local.definition.function + (#set! definition.function.scope "parent")) (defun_header - function_name: (sym_lit) @local.definition.function (#set! definition.function.scope "parent")) -(defun_header - lambda_list: (list_lit (sym_lit) @local.definition.parameter)) + lambda_list: + (list_lit + (sym_lit) @local.definition.parameter)) (defun_header - keyword: (defun_keyword "defmethod") - lambda_list: (list_lit (list_lit . (sym_lit) . (sym_lit) @local.definition.type))) + keyword: + (defun_keyword + "defmethod") + lambda_list: + (list_lit + (list_lit + . + (sym_lit) + . + (sym_lit) @local.definition.type))) + (defun_header - lambda_list: (list_lit (list_lit . (sym_lit) @local.definition.parameter . (_)))) + lambda_list: + (list_lit + (list_lit + . + (sym_lit) @local.definition.parameter + . + (_)))) (sym_lit) @local.reference (defun) @local.scope -((list_lit . (sym_lit) @_defvar . (sym_lit) @local.definition.var) -(#match? @_defvar "^(cl:)?(defvar|defparameter)$")) +((list_lit + . + (sym_lit) @_defvar + . + (sym_lit) @local.definition.var) + (#match? @_defvar "^(cl:)?(defvar|defparameter)$")) (list_lit - . - (sym_lit) @_deftest - . - (sym_lit) @local.definition.function - (#eq? @_deftest "deftest")) @local.scope + . + (sym_lit) @_deftest + . + (sym_lit) @local.definition.function + (#eq? @_deftest "deftest")) @local.scope (list_lit - . - (sym_lit) @_deftest - . - (sym_lit) @local.definition.function - (#eq? @_deftest "deftest")) @local.scope + . + (sym_lit) @_deftest + . + (sym_lit) @local.definition.function + (#eq? @_deftest "deftest")) @local.scope + +(for_clause + . + (sym_lit) @local.definition.var) + +(with_clause + . + (sym_lit) @local.definition.var) -(for_clause . (sym_lit) @local.definition.var) -(with_clause . (sym_lit) @local.definition.var) (loop_macro) @local.scope (list_lit - . - (sym_lit) @_let (#match? @_let "(cl:|cffi:)?(with-accessors|with-foreign-objects|let[*]?)") - . - (list_lit (list_lit . (sym_lit) @local.definition.var))) @local.scope + . + (sym_lit) @_let + (#match? @_let "(cl:|cffi:)?(with-accessors|with-foreign-objects|let[*]?)") + . + (list_lit + (list_lit + . + (sym_lit) @local.definition.var))) @local.scope (list_lit - . - (sym_lit) @_let (#match? @_let "(cl:|alexandria:)?(with-gensyms|dotimes|with-foreign-object)") - . - (list_lit . (sym_lit) @local.definition.var)) @local.scope + . + (sym_lit) @_let + (#match? @_let "(cl:|alexandria:)?(with-gensyms|dotimes|with-foreign-object)") + . + (list_lit + . + (sym_lit) @local.definition.var)) @local.scope (list_lit - . - (kwd_lit) @_import_from (#eq? @_import_from ":import-from") - . - (_) - (kwd_lit (kwd_symbol) @local.definition.import)) + . + (kwd_lit) @_import_from + (#eq? @_import_from ":import-from") + . + (_) + (kwd_lit + (kwd_symbol) @local.definition.import)) (list_lit - . - (kwd_lit) @_import_from (#eq? @_import_from ":import-from") - . - (_) - (sym_lit) @local.definition.import) + . + (kwd_lit) @_import_from + (#eq? @_import_from ":import-from") + . + (_) + (sym_lit) @local.definition.import) (list_lit - . - (kwd_lit) @_use (#eq? @_use ":use") - (kwd_lit (kwd_symbol) @local.definition.import)) + . + (kwd_lit) @_use + (#eq? @_use ":use") + (kwd_lit + (kwd_symbol) @local.definition.import)) (list_lit - . - (kwd_lit) @_use (#eq? @_use ":use") - (sym_lit) @local.definition.import) + . + (kwd_lit) @_use + (#eq? @_use ":use") + (sym_lit) @local.definition.import) diff --git a/queries/cooklang/highlights.scm b/queries/cooklang/highlights.scm index 2ed9f2049..cd4eedade 100644 --- a/queries/cooklang/highlights.scm +++ b/queries/cooklang/highlights.scm @@ -3,20 +3,20 @@ (ingredient "@" @tag (name)? @markup.heading - (amount - (quantity)? @number - (units)? @tag.attribute)?) + (amount + (quantity)? @number + (units)? @tag.attribute)?) (timer "~" @tag (name)? @markup.heading - (amount - (quantity)? @number - (units)? @tag.attribute)?) + (amount + (quantity)? @number + (units)? @tag.attribute)?) (cookware "#" @tag (name)? @markup.heading - (amount - (quantity)? @number - (units)? @tag.attribute)?) + (amount + (quantity)? @number + (units)? @tag.attribute)?) diff --git a/queries/corn/folds.scm b/queries/corn/folds.scm index c081ecb47..2ce5ddb31 100644 --- a/queries/corn/folds.scm +++ b/queries/corn/folds.scm @@ -1,5 +1,5 @@ [ - (object) - (array) - (assign_block) + (object) + (array) + (assign_block) ] @fold diff --git a/queries/corn/highlights.scm b/queries/corn/highlights.scm index 18672fd04..029291462 100644 --- a/queries/corn/highlights.scm +++ b/queries/corn/highlights.scm @@ -1,4 +1,5 @@ "let" @keyword + "in" @keyword [ @@ -11,10 +12,15 @@ "." @punctuation.delimiter (input) @constant + (comment) @comment @spell (string) @string + (integer) @number + (float) @number.float + (boolean) @boolean + (null) @keyword diff --git a/queries/corn/indents.scm b/queries/corn/indents.scm index 1f5a2c402..f1f5e04da 100644 --- a/queries/corn/indents.scm +++ b/queries/corn/indents.scm @@ -1,14 +1,24 @@ [ - (assign_block "{") - (object) - (array) + (assign_block + "{") + (object) + (array) ] @indent.begin -(assign_block "}" @indent.branch) -(assign_block "}" @indent.end) +(assign_block + "}" @indent.branch) -(object "}" @indent.branch) -(object "}" @indent.end) +(assign_block + "}" @indent.end) -(array "]" @indent.branch) -(array "]" @indent.end) +(object + "}" @indent.branch) + +(object + "}" @indent.end) + +(array + "]" @indent.branch) + +(array + "]" @indent.end) diff --git a/queries/corn/locals.scm b/queries/corn/locals.scm index 009d29202..7e78c4d23 100644 --- a/queries/corn/locals.scm +++ b/queries/corn/locals.scm @@ -1,16 +1,13 @@ ; scopes - [ (object) (array) ] @local.scope ; definitions - -(assign_block +(assign_block (assignment - (input) - @local.definition.constant)) - -(value (input) @local.reference) + (input) @local.definition.constant)) +(value + (input) @local.reference) diff --git a/queries/cpon/highlights.scm b/queries/cpon/highlights.scm index 370c48b1b..531b3961f 100644 --- a/queries/cpon/highlights.scm +++ b/queries/cpon/highlights.scm @@ -1,6 +1,6 @@ ; Literals - (string) @string + (escape_sequence) @string.escape (hex_blob @@ -15,7 +15,8 @@ "d" @character.special (_) @string.special) -(_ key: (_) @label) +(_ + key: (_) @label) (number) @number @@ -26,21 +27,28 @@ (null) @constant.builtin ; Punctuation - [ "," ":" ] @punctuation.delimiter -[ "{" "}" ] @punctuation.bracket +[ + "{" + "}" +] @punctuation.bracket -[ "[" "]" ] @punctuation.bracket +[ + "[" + "]" +] @punctuation.bracket -[ "<" ">" ] @punctuation.bracket +[ + "<" + ">" +] @punctuation.bracket (("\"" @string) - (#set! conceal "")) + (#set! conceal "")) ; Comments - (comment) @comment @spell diff --git a/queries/cpon/injections.scm b/queries/cpon/injections.scm index 6adae45a2..2f0e58eb6 100644 --- a/queries/cpon/injections.scm +++ b/queries/cpon/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/cpon/locals.scm b/queries/cpon/locals.scm index 8341b9725..2a4ba4712 100644 --- a/queries/cpon/locals.scm +++ b/queries/cpon/locals.scm @@ -1,6 +1,5 @@ [ - (document) - + (document) (meta_map) (map) (array) diff --git a/queries/cpp/folds.scm b/queries/cpp/folds.scm index 23d623b04..26a068a55 100644 --- a/queries/cpp/folds.scm +++ b/queries/cpp/folds.scm @@ -1,14 +1,13 @@ ; inherits: c - [ - (for_range_loop) - (class_specifier) - (field_declaration - type: (enum_specifier) - default_value: (initializer_list)) - (template_declaration) - (namespace_definition) - (try_statement) - (catch_clause) - (lambda_expression) + (for_range_loop) + (class_specifier) + (field_declaration + type: (enum_specifier) + default_value: (initializer_list)) + (template_declaration) + (namespace_definition) + (try_statement) + (catch_clause) + (lambda_expression) ] @fold diff --git a/queries/cpp/highlights.scm b/queries/cpp/highlights.scm index 4919a1b3f..cb8f9c3f3 100644 --- a/queries/cpp/highlights.scm +++ b/queries/cpp/highlights.scm @@ -1,5 +1,4 @@ ; inherits: c - ((identifier) @variable.member (#lua-match? @variable.member "^m_.*$")) @@ -8,23 +7,24 @@ ; function(Foo ...foo) (variadic_parameter_declaration - declarator: (variadic_declarator - (_) @variable.parameter)) + declarator: + (variadic_declarator + (_) @variable.parameter)) + ; int foo = 0 (optional_parameter_declaration - declarator: (_) @variable.parameter) + declarator: (_) @variable.parameter) ;(field_expression) @variable.parameter ;; How to highlight this? - (((field_expression - (field_identifier) @function.method)) @_parent - (#has-parent? @_parent template_method function_declarator)) + (field_identifier) @function.method)) @_parent + (#has-parent? @_parent template_method function_declarator)) (field_declaration (field_identifier) @variable.member) (field_initializer - (field_identifier) @property) + (field_identifier) @property) (function_declarator declarator: (field_identifier) @function.method) @@ -38,13 +38,25 @@ (auto) @type.builtin (namespace_identifier) @module + ((namespace_identifier) @type (#lua-match? @type "^[%u]")) (case_statement - value: (qualified_identifier (identifier) @constant)) + value: + (qualified_identifier + (identifier) @constant)) -(using_declaration . "using" . "namespace" . [(qualified_identifier) (identifier)] @module) +(using_declaration + . + "using" + . + "namespace" + . + [ + (qualified_identifier) + (identifier) + ] @module) (destructor_name (identifier) @function.method) @@ -53,15 +65,18 @@ (function_declarator (qualified_identifier (identifier) @function)) + (function_declarator (qualified_identifier (qualified_identifier (identifier) @function))) + (function_declarator (qualified_identifier (qualified_identifier (qualified_identifier (identifier) @function)))) + ((qualified_identifier (qualified_identifier (qualified_identifier @@ -74,21 +89,26 @@ (identifier) @function)) (operator_name) @function + "operator" @function + "static_assert" @function.builtin (call_expression (qualified_identifier (identifier) @function.call)) + (call_expression (qualified_identifier (qualified_identifier (identifier) @function.call))) + (call_expression (qualified_identifier (qualified_identifier (qualified_identifier (identifier) @function.call)))) + ((qualified_identifier (qualified_identifier (qualified_identifier @@ -99,21 +119,25 @@ (call_expression (template_function (identifier) @function.call)) + (call_expression (qualified_identifier (template_function (identifier) @function.call))) + (call_expression (qualified_identifier (qualified_identifier (template_function (identifier) @function.call)))) + (call_expression (qualified_identifier (qualified_identifier (qualified_identifier (template_function (identifier) @function.call))))) + ((qualified_identifier (qualified_identifier (qualified_identifier @@ -126,12 +150,12 @@ (function_declarator (template_method (field_identifier) @function.method)) + (call_expression (field_expression (field_identifier) @function.method.call)) ; constructors - ((function_declarator (qualified_identifier (identifier) @constructor)) @@ -139,93 +163,91 @@ ((call_expression function: (identifier) @constructor) -(#lua-match? @constructor "^%u")) -((call_expression - function: (qualified_identifier - name: (identifier) @constructor)) -(#lua-match? @constructor "^%u")) + (#lua-match? @constructor "^%u")) ((call_expression - function: (field_expression - field: (field_identifier) @constructor)) -(#lua-match? @constructor "^%u")) + function: + (qualified_identifier + name: (identifier) @constructor)) + (#lua-match? @constructor "^%u")) -;; constructing a type in an initializer list: Constructor (): **SuperType (1)** +((call_expression + function: + (field_expression + field: (field_identifier) @constructor)) + (#lua-match? @constructor "^%u")) + +; constructing a type in an initializer list: Constructor (): **SuperType (1)** ((field_initializer (field_identifier) @constructor (argument_list)) - (#lua-match? @constructor "^%u")) - + (#lua-match? @constructor "^%u")) ; Constants - (this) @variable.builtin -(null "nullptr" @constant.builtin) + +(null + "nullptr" @constant.builtin) (true) @boolean + (false) @boolean ; Literals - -(raw_string_literal) @string +(raw_string_literal) @string ; Keywords - [ - "try" - "catch" - "noexcept" - "throw" + "try" + "catch" + "noexcept" + "throw" ] @keyword.exception - [ - "class" - "decltype" - "explicit" - "friend" - "namespace" - "override" - "template" - "typename" - "using" - "concept" - "requires" - "constexpr" + "class" + "decltype" + "explicit" + "friend" + "namespace" + "override" + "template" + "typename" + "using" + "concept" + "requires" + "constexpr" ] @keyword -[ - "co_await" -] @keyword.coroutine +"co_await" @keyword.coroutine [ - "co_yield" - "co_return" + "co_yield" + "co_return" ] @keyword.coroutine.return [ - "public" - "private" - "protected" - "virtual" - "final" + "public" + "private" + "protected" + "virtual" + "final" ] @type.qualifier [ - "new" - "delete" - - "xor" - "bitand" - "bitor" - "compl" - "not" - "xor_eq" - "and_eq" - "or_eq" - "not_eq" - "and" - "or" + "new" + "delete" + "xor" + "bitand" + "bitor" + "compl" + "not" + "xor_eq" + "and_eq" + "or_eq" + "not_eq" + "and" + "or" ] @keyword.operator "<=>" @operator @@ -233,9 +255,15 @@ "::" @punctuation.delimiter (template_argument_list - ["<" ">"] @punctuation.bracket) + [ + "<" + ">" + ] @punctuation.bracket) (template_parameter_list - ["<" ">"] @punctuation.bracket) + [ + "<" + ">" + ] @punctuation.bracket) (literal_suffix) @operator diff --git a/queries/cpp/indents.scm b/queries/cpp/indents.scm index 6faa6f144..be6826d6e 100644 --- a/queries/cpp/indents.scm +++ b/queries/cpp/indents.scm @@ -1,9 +1,7 @@ ; inherits: c - -[ - (condition_clause) -] @indent.begin +(condition_clause) @indent.begin ((field_initializer_list) @indent.begin (#set! indent.start_at_same_line 1)) + (access_specifier) @indent.branch diff --git a/queries/cpp/injections.scm b/queries/cpp/injections.scm index 75f851367..2038347a2 100644 --- a/queries/cpp/injections.scm +++ b/queries/cpp/injections.scm @@ -1,8 +1,5 @@ ((preproc_arg) @injection.content - (#set! injection.language "cpp")) - -((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "cpp")) ((comment) @injection.content (#lua-match? @injection.content "/[*][!<*][^a-zA-Z]") diff --git a/queries/cpp/locals.scm b/queries/cpp/locals.scm index d8bb18c05..863f9de7d 100644 --- a/queries/cpp/locals.scm +++ b/queries/cpp/locals.scm @@ -1,12 +1,14 @@ ; inherits: c - -;; Parameters +; Parameters (variadic_parameter_declaration - declarator: (variadic_declarator - (identifier) @local.definition.parameter)) + declarator: + (variadic_declarator + (identifier) @local.definition.parameter)) + (optional_parameter_declaration declarator: (identifier) @local.definition.parameter) -;; Class / struct definitions + +; Class / struct definitions (class_specifier) @local.scope (reference_declarator @@ -16,8 +18,9 @@ (identifier) @local.definition.var) (struct_specifier - name: (qualified_identifier - name: (type_identifier) @local.definition.type)) + name: + (qualified_identifier + name: (type_identifier) @local.definition.type)) (class_specifier name: (type_identifier) @local.definition.type) @@ -26,8 +29,9 @@ name: (identifier) @local.definition.type) (class_specifier - name: (qualified_identifier - name: (type_identifier) @local.definition.type)) + name: + (qualified_identifier + name: (type_identifier) @local.definition.type)) (alias_declaration name: (type_identifier) @local.definition.type) @@ -35,9 +39,10 @@ ;template (type_parameter_declaration (type_identifier) @local.definition.type) + (template_declaration) @local.scope -;; Namespaces +; Namespaces (namespace_definition name: (namespace_identifier) @local.definition.namespace body: (_) @local.scope) @@ -47,9 +52,9 @@ body: (_) @local.scope) ((namespace_identifier) @local.reference - (#set! reference.kind "namespace")) + (#set! reference.kind "namespace")) -;; Function definitions +; Function definitions (template_function name: (identifier) @local.definition.function) @local.scope @@ -57,16 +62,18 @@ name: (field_identifier) @local.definition.method) @local.scope (function_declarator - declarator: (qualified_identifier - name: (identifier) @local.definition.function)) @local.scope + declarator: + (qualified_identifier + name: (identifier) @local.definition.function)) @local.scope (field_declaration - declarator: (function_declarator - (field_identifier) @local.definition.method)) + declarator: + (function_declarator + (field_identifier) @local.definition.method)) (lambda_expression) @local.scope -;; Control structures +; Control structures (try_statement body: (_) @local.scope) diff --git a/queries/css/folds.scm b/queries/css/folds.scm index 9d2995c48..2c244d63f 100644 --- a/queries/css/folds.scm +++ b/queries/css/folds.scm @@ -1,3 +1 @@ -[ - (rule_set) -] @fold +(rule_set) @fold diff --git a/queries/css/highlights.scm b/queries/css/highlights.scm index 8beba125f..506f78251 100644 --- a/queries/css/highlights.scm +++ b/queries/css/highlights.scm @@ -1,92 +1,99 @@ [ - "@media" - "@charset" - "@namespace" - "@supports" - "@keyframes" - (at_keyword) - (to) - (from) - ] @keyword + "@media" + "@charset" + "@namespace" + "@supports" + "@keyframes" + (at_keyword) + (to) + (from) +] @keyword "@import" @keyword.import (comment) @comment @spell [ - (tag_name) - (nesting_selector) - (universal_selector) - ] @type + (tag_name) + (nesting_selector) + (universal_selector) +] @type (function_name) @function [ - "~" - ">" - "+" - "-" - "*" - "/" - "=" - "^=" - "|=" - "~=" - "$=" - "*=" - ] @operator + "~" + ">" + "+" + "-" + "*" + "/" + "=" + "^=" + "|=" + "~=" + "$=" + "*=" +] @operator [ - "and" - "or" - "not" - "only" - ] @keyword.operator + "and" + "or" + "not" + "only" +] @keyword.operator (important) @type.qualifier -(attribute_selector (plain_value) @string) -(pseudo_element_selector "::" (tag_name) @property) -(pseudo_class_selector (class_name) @property) +(attribute_selector + (plain_value) @string) + +(pseudo_element_selector + "::" + (tag_name) @property) + +(pseudo_class_selector + (class_name) @property) [ - (class_name) - (id_name) - (property_name) - (feature_name) - (attribute_name) - ] @property + (class_name) + (id_name) + (property_name) + (feature_name) + (attribute_name) +] @property (namespace_name) @module ((property_name) @type.definition (#lua-match? @type.definition "^[-][-]")) + ((plain_value) @type (#lua-match? @type "^[-][-]")) [ - (string_value) - (color_value) - (unit) - ] @string + (string_value) + (color_value) + (unit) +] @string [ - (integer_value) - (float_value) - ] @number + (integer_value) + (float_value) +] @number [ - "#" - "," - "." - ":" - "::" - ";" - ] @punctuation.delimiter + "#" + "," + "." + ":" + "::" + ";" +] @punctuation.delimiter [ - "{" - ")" - "(" - "}" - ] @punctuation.bracket + "{" + ")" + "(" + "}" +] @punctuation.bracket diff --git a/queries/css/indents.scm b/queries/css/indents.scm index cd22ed66c..8385bfc82 100644 --- a/queries/css/indents.scm +++ b/queries/css/indents.scm @@ -3,7 +3,9 @@ (declaration) ] @indent.begin -(block ("}") @indent.branch) +(block + ("}") @indent.branch) + ("}") @indent.dedent (comment) @indent.ignore diff --git a/queries/css/injections.scm b/queries/css/injections.scm index 6adae45a2..2f0e58eb6 100644 --- a/queries/css/injections.scm +++ b/queries/css/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/csv/highlights.scm b/queries/csv/highlights.scm index de2213aa1..94abe21cc 100644 --- a/queries/csv/highlights.scm +++ b/queries/csv/highlights.scm @@ -1,3 +1,2 @@ ; inherits: tsv - "," @punctuation.delimiter diff --git a/queries/cuda/highlights.scm b/queries/cuda/highlights.scm index 0a90dbf67..0b2a13e49 100644 --- a/queries/cuda/highlights.scm +++ b/queries/cuda/highlights.scm @@ -1,6 +1,8 @@ ; inherits: cpp - -[ "<<<" ">>>" ] @punctuation.bracket +[ + "<<<" + ">>>" +] @punctuation.bracket [ "__host__" diff --git a/queries/cuda/injections.scm b/queries/cuda/injections.scm index 82aac968e..0259958c5 100644 --- a/queries/cuda/injections.scm +++ b/queries/cuda/injections.scm @@ -1,5 +1,5 @@ ((preproc_arg) @injection.content - (#set! injection.language "cuda")) + (#set! injection.language "cuda")) -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/cue/highlights.scm b/queries/cue/highlights.scm index 47fd36311..3371bc33e 100644 --- a/queries/cue/highlights.scm +++ b/queries/cue/highlights.scm @@ -1,49 +1,41 @@ ; Includes - [ "package" "import" ] @keyword.import ; Namespaces - (package_identifier) @module -(import_spec ["." "_"] @punctuation.special) +(import_spec + [ + "." + "_" + ] @punctuation.special) [ (attr_path) (package_path) -] @string.special.url ;; In attributes +] @string.special.url ; In attributes ; Attributes - (attribute) @attribute ; Conditionals - "if" @keyword.conditional ; Repeats +"for" @keyword.repeat -[ - "for" -] @keyword.repeat - -(for_clause "_" @punctuation.special) +(for_clause + "_" @punctuation.special) ; Keywords +"let" @keyword -[ - "let" -] @keyword - -[ - "in" -] @keyword.operator +"in" @keyword.operator ; Operators - [ "+" "-" @@ -66,34 +58,33 @@ ] @operator ; Fields & Properties - -(field - (label - (identifier) @variable.member)) +(field + (label + (identifier) @variable.member)) (selector_expression (_) (identifier) @property) ; Functions - (call_expression function: (identifier) @function.call) + (call_expression - function: (selector_expression - (_) - (identifier) @function.call)) + function: + (selector_expression + (_) + (identifier) @function.call)) + (call_expression function: (builtin_function) @function.call) (builtin_function) @function.builtin ; Variables - (identifier) @variable ; Types - (primitive_type) @type.builtin ((identifier) @type @@ -102,22 +93,33 @@ [ (slice_type) (pointer_type) -] @type ;; In attributes +] @type ; In attributes ; Punctuation - [ "," ":" ] @punctuation.delimiter -[ "{" "}" ] @punctuation.bracket +[ + "{" + "}" +] @punctuation.bracket -[ "[" "]" ] @punctuation.bracket +[ + "[" + "]" +] @punctuation.bracket -[ "(" ")" ] @punctuation.bracket +[ + "(" + ")" +] @punctuation.bracket -[ "<" ">" ] @punctuation.bracket +[ + "<" + ">" +] @punctuation.bracket [ (ellipsis) @@ -125,7 +127,6 @@ ] @punctuation.special ; Literals - (string) @string [ @@ -150,11 +151,15 @@ ] @constant.builtin ; Interpolations +(interpolation + "\\(" @punctuation.special + (_) + ")" @punctuation.special) @none -(interpolation "\\(" @punctuation.special (_) ")" @punctuation.special) @none - -(interpolation "\\(" (identifier) @variable ")") +(interpolation + "\\(" + (identifier) @variable + ")") ; Comments - (comment) @comment @spell diff --git a/queries/cue/indents.scm b/queries/cue/indents.scm index 71a03a778..cef2345cc 100644 --- a/queries/cue/indents.scm +++ b/queries/cue/indents.scm @@ -9,11 +9,20 @@ ")" ] @indent.end -[ "{" "}" ] @indent.branch +[ + "{" + "}" +] @indent.branch -[ "[" "]" ] @indent.branch +[ + "[" + "]" +] @indent.branch -[ "(" ")" ] @indent.branch +[ + "(" + ")" +] @indent.branch [ (ERROR) diff --git a/queries/cue/injections.scm b/queries/cue/injections.scm index 6adae45a2..2f0e58eb6 100644 --- a/queries/cue/injections.scm +++ b/queries/cue/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/cue/locals.scm b/queries/cue/locals.scm index bdc4a56a2..9c5a7378e 100644 --- a/queries/cue/locals.scm +++ b/queries/cue/locals.scm @@ -1,5 +1,4 @@ ; Scopes - [ (source_file) (field) @@ -7,17 +6,15 @@ ] @local.scope ; References - (identifier) @local.reference ; Definitions - (import_spec path: (string) @local.definition.import) (field (label - (identifier) @local.definition.field)) + (identifier) @local.definition.field)) (package_identifier) @local.definition.namespace diff --git a/queries/d/highlights.scm b/queries/d/highlights.scm index 18ced7246..2b63dd48c 100644 --- a/queries/d/highlights.scm +++ b/queries/d/highlights.scm @@ -1,5 +1,4 @@ -;; Misc - +; Misc [ (line_comment) (block_comment) @@ -8,6 +7,7 @@ ((line_comment) @comment.documentation (#lua-match? @comment.documentation "^///[^/]")) + ((line_comment) @comment.documentation (#lua-match? @comment.documentation "^///$")) @@ -18,9 +18,12 @@ (#lua-match? @comment.documentation "^/[+][+][^+].*[+]/$")) [ - "(" ")" - "[" "]" - "{" "}" + "(" + ")" + "[" + "]" + "{" + "}" ] @punctuation.bracket [ @@ -35,8 +38,7 @@ "$" ] @punctuation.special -;; Constants - +; Constants [ "__FILE_FULL_PATH__" "__FILE__" @@ -66,11 +68,9 @@ "false" ] @boolean -;; Functions - +; Functions (func_declarator - (identifier) @function -) + (identifier) @function) [ "__traits" @@ -83,29 +83,22 @@ ] @function.builtin (import_expression - "import" @function.builtin -) + "import" @function.builtin) (parameter (var_declarator - (identifier) @variable.parameter - ) -) + (identifier) @variable.parameter)) (function_literal - (identifier) @variable.parameter -) + (identifier) @variable.parameter) (constructor - "this" @constructor -) + "this" @constructor) (destructor - "this" @constructor -) - -;; Keywords + "this" @constructor) +; Keywords [ "case" "default" @@ -238,51 +231,45 @@ ] @type.qualifier (alias_assignment - . (identifier) @type.definition) + . + (identifier) @type.definition) (module_declaration - "module" @keyword.import -) + "module" @keyword.import) (import_declaration - "import" @keyword.import -) + "import" @keyword.import) (type) @type (catch_parameter - (qualified_identifier) @type -) + (qualified_identifier) @type) (var_declarations - (qualified_identifier) @type -) + (qualified_identifier) @type) (func_declaration - (qualified_identifier) @type -) + (qualified_identifier) @type) (parameter - (qualified_identifier) @type -) + (qualified_identifier) @type) (class_declaration - (identifier) @type -) + (identifier) @type) (fundamental_type) @type.builtin -(module_fully_qualified_name (packages (package_name) @module)) +(module_fully_qualified_name + (packages + (package_name) @module)) + (module_name) @module (at_attribute) @attribute (user_defined_attribute - "@" @attribute -) - -;; Variables + "@" @attribute) +; Variables (primary_expression - "this" @variable.builtin -) + "this" @variable.builtin) diff --git a/queries/d/indents.scm b/queries/d/indents.scm index 9ced7527d..81624cabd 100644 --- a/queries/d/indents.scm +++ b/queries/d/indents.scm @@ -5,9 +5,12 @@ ] @indent.begin [ - "(" ")" - "{" "}" - "[" "]" + "(" + ")" + "{" + "}" + "[" + "]" ] @indent.branch [ diff --git a/queries/d/injections.scm b/queries/d/injections.scm index 6dd8aeacf..7437b932b 100644 --- a/queries/d/injections.scm +++ b/queries/d/injections.scm @@ -2,8 +2,8 @@ (line_comment) (block_comment) (nesting_block_comment) - ] @injection.content - (#set! injection.language "comment")) +] @injection.content + (#set! injection.language "comment")) ((token_string_tokens) @injection.content - (#set! injection.language "d")) + (#set! injection.language "d")) diff --git a/queries/dart/folds.scm b/queries/dart/folds.scm index ea398a4b3..8dc4e7815 100644 --- a/queries/dart/folds.scm +++ b/queries/dart/folds.scm @@ -2,13 +2,10 @@ (class_definition) (enum_declaration) (extension_declaration) - (arguments) (function_body) - (block) (switch_block) - (list_literal) (set_or_map_literal) (string_literal) diff --git a/queries/dart/highlights.scm b/queries/dart/highlights.scm index be2824da5..de81cbc0b 100644 --- a/queries/dart/highlights.scm +++ b/queries/dart/highlights.scm @@ -1,18 +1,21 @@ (dotted_identifier_list) @string - ; Methods ; -------------------- (super) @function ; TODO: add method/call_expression to grammar and ; distinguish method call from variable access -(function_expression_body (identifier) @function) -; ((identifier)(selector (argument_part)) @function) +(function_expression_body + (identifier) @function) +; ((identifier)(selector (argument_part)) @function) ; NOTE: This query is a bit of a work around for the fact that the dart grammar doesn't ; specifically identify a node as a function call -(((identifier) @function (#lua-match? @function "^_?[%l]")) - . (selector . (argument_part))) @function +(((identifier) @function + (#lua-match? @function "^_?[%l]")). +(selector + . + (argument_part))) @function ; Annotations ; -------------------- @@ -24,38 +27,36 @@ (template_substitution "$" @punctuation.special "{" @punctuation.special - "}" @punctuation.special -) @none + "}" @punctuation.special) @none (template_substitution "$" @punctuation.special - (identifier_dollar_escaped) @variable -) @none + (identifier_dollar_escaped) @variable) @none (escape_sequence) @string.escape [ - "@" - "=>" - ".." - "??" - "==" - "?" - ":" - "&&" - "%" - "<" - ">" - "=" - ">=" - "<=" - "||" - (multiplicative_operator) - (increment_operator) - (is_operator) - (prefix_operator) - (equality_operator) - (additive_operator) + "@" + "=>" + ".." + "??" + "==" + "?" + ":" + "&&" + "%" + "<" + ">" + "=" + ">=" + "<=" + "||" + (multiplicative_operator) + (increment_operator) + (is_operator) + (prefix_operator) + (equality_operator) + (additive_operator) ] @operator [ @@ -65,7 +66,7 @@ "]" "{" "}" -] @punctuation.bracket +] @punctuation.bracket ; Delimiters ; -------------------- @@ -79,26 +80,34 @@ ; -------------------- (class_definition name: (identifier) @type) + (constructor_signature name: (identifier) @type) + (scoped_identifier scope: (identifier) @type) + (function_signature name: (identifier) @function.method) + (getter_signature (identifier) @function.method) + (setter_signature name: (identifier) @function.method) + (enum_declaration name: (identifier) @type) + (enum_constant name: (identifier) @type) + (void_type) @type ((scoped_identifier scope: (identifier) @type name: (identifier) @type) - (#lua-match? @type "^[%u%l]")) + (#lua-match? @type "^[%u%l]")) (type_identifier) @type @@ -111,7 +120,7 @@ (inferred_type) @keyword ((identifier) @type - (#lua-match? @type "^_?[%u].*[%l]")) ; catch Classes or IClasses not CLASSES + (#lua-match? @type "^_?[%u].*[%l]")) ; catch Classes or IClasses not CLASSES ("Function" @type) @@ -131,29 +140,35 @@ ; Parameters ; -------------------- (formal_parameter - name: (identifier) @variable.parameter) + name: (identifier) @variable.parameter) (named_argument - (label (identifier) @variable.parameter)) + (label + (identifier) @variable.parameter)) ; Literals ; -------------------- [ - (hex_integer_literal) - (decimal_integer_literal) - (decimal_floating_point_literal) - ; TODO: inaccessible nodes - ; (octal_integer_literal) - ; (hex_floating_point_literal) + (hex_integer_literal) + (decimal_integer_literal) + (decimal_floating_point_literal) + ; TODO: inaccessible nodes + ; (octal_integer_literal) + ; (hex_floating_point_literal) ] @number (symbol_literal) @string.special.symbol + (string_literal) @string + (true) @boolean + (false) @boolean + (null_literal) @constant.builtin (comment) @comment @spell + (documentation_comment) @comment.documentation @spell ; Keywords @@ -169,47 +184,44 @@ ; Reserved words (cannot be used as identifiers) [ - ; TODO: - ; "rethrow" cannot be targeted at all and seems to be an invisible node - ; TODO: - ; the assert keyword cannot be specifically targeted - ; because the grammar selects the whole node or the content - ; of the assertion not just the keyword - ; assert - (case_builtin) - "late" - "required" - "extension" - "on" - "class" - "enum" - "extends" - "in" - "is" - "new" - "super" - "with" + ; TODO: + ; "rethrow" cannot be targeted at all and seems to be an invisible node + ; TODO: + ; the assert keyword cannot be specifically targeted + ; because the grammar selects the whole node or the content + ; of the assertion not just the keyword + ; assert + (case_builtin) + "late" + "required" + "extension" + "on" + "class" + "enum" + "extends" + "in" + "is" + "new" + "super" + "with" ] @keyword -[ - "return" -] @keyword.return - +"return" @keyword.return ; Built in identifiers: ; alone these are marked as keywords [ - "deferred" - "factory" - "get" - "implements" - "interface" - "library" - "operator" - "mixin" - "part" - "set" - "typedef" + "deferred" + "factory" + "get" + "implements" + "interface" + "library" + "operator" + "mixin" + "part" + "set" + "typedef" ] @keyword [ @@ -221,43 +233,28 @@ ] @keyword.coroutine [ - (const_builtin) - (final_builtin) - "abstract" - "covariant" - "dynamic" - "external" - "static" - "final" - "base" - "sealed" + (const_builtin) + (final_builtin) + "abstract" + "covariant" + "dynamic" + "external" + "static" + "final" + "base" + "sealed" ] @type.qualifier ; when used as an identifier: ((identifier) @variable.builtin - (#any-of? @variable.builtin - "abstract" - "as" - "covariant" - "deferred" - "dynamic" - "export" - "external" - "factory" - "Function" - "get" - "implements" - "import" - "interface" - "library" - "operator" - "mixin" - "part" - "set" - "static" - "typedef")) + (#any-of? @variable.builtin "abstract" "as" "covariant" "deferred" "dynamic" "export" "external" "factory" "Function" "get" "implements" "import" "interface" "library" "operator" "mixin" "part" "set" "static" "typedef")) -["if" "else" "switch" "default"] @keyword.conditional +[ + "if" + "else" + "switch" + "default" +] @keyword.conditional [ "try" @@ -267,4 +264,9 @@ (break_statement) ] @keyword.exception -["do" "while" "continue" "for"] @keyword.repeat +[ + "do" + "while" + "continue" + "for" +] @keyword.repeat diff --git a/queries/dart/indents.scm b/queries/dart/indents.scm index 87befcf6c..8da3ebb14 100644 --- a/queries/dart/indents.scm +++ b/queries/dart/indents.scm @@ -2,7 +2,8 @@ (class_body) (function_body) (function_expression_body) - (declaration (initializers)) + (declaration + (initializers)) (switch_block) (if_statement) (formal_parameter_list) @@ -32,14 +33,16 @@ "]" ] @indent.branch -[ - "}" -] @indent.end +"}" @indent.end -(return_statement ";" @indent.end) -(break_statement ";" @indent.end) +(return_statement + ";" @indent.end) + +(break_statement + ";" @indent.end) ; this one is for dedenting the else block -(if_statement (block) @indent.branch) +(if_statement + (block) @indent.branch) (comment) @indent.ignore diff --git a/queries/dart/injections.scm b/queries/dart/injections.scm index 6adae45a2..2f0e58eb6 100644 --- a/queries/dart/injections.scm +++ b/queries/dart/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/dart/locals.scm b/queries/dart/locals.scm index f7faa26ac..3e3beb58e 100644 --- a/queries/dart/locals.scm +++ b/queries/dart/locals.scm @@ -1,5 +1,4 @@ -;; Definitions - +; Definitions (function_signature name: (identifier) @local.definition.function) @@ -15,20 +14,19 @@ (static_final_declaration (identifier) @local.definition.var) -;; References - +; References (identifier) @local.reference -;; Scopes - +; Scopes (class_definition body: (_) @local.scope) + [ - (block) - (if_statement) - (for_statement) - (while_statement) - (try_statement) - (catch_clause) - (finally_clause) + (block) + (if_statement) + (for_statement) + (while_statement) + (try_statement) + (catch_clause) + (finally_clause) ] @local.scope diff --git a/queries/devicetree/highlights.scm b/queries/devicetree/highlights.scm index 6236189bf..a81cf2c89 100644 --- a/queries/devicetree/highlights.scm +++ b/queries/devicetree/highlights.scm @@ -6,6 +6,7 @@ ] @keyword.import (preproc_def) @constant.macro + (preproc_function_def) @function.macro [ @@ -22,14 +23,39 @@ (integer_literal) @number (identifier) @variable -(node (identifier) @module) -(property (identifier) @property) -(labeled_item (identifier) @label) -(call_expression (identifier) @function.macro) + +(node + (identifier) @module) + +(property + (identifier) @property) + +(labeled_item + (identifier) @label) + +(call_expression + (identifier) @function.macro) (reference) @label ; referencing labeled_item.identifier + (unit_address) @constant -[ "=" ] @operator -[ "(" ")" "[" "]" "{" "}" "<" ">" ] @punctuation.bracket -[ ";" ":" "," "@" ] @punctuation.delimiter +"=" @operator + +[ + "(" + ")" + "[" + "]" + "{" + "}" + "<" + ">" +] @punctuation.bracket + +[ + ";" + ":" + "," + "@" +] @punctuation.delimiter diff --git a/queries/devicetree/indents.scm b/queries/devicetree/indents.scm index 6cfc81cf2..9740060ca 100644 --- a/queries/devicetree/indents.scm +++ b/queries/devicetree/indents.scm @@ -9,6 +9,4 @@ ">" ] @indent.branch -[ - (comment) -] @indent.ignore +(comment) @indent.ignore diff --git a/queries/devicetree/injections.scm b/queries/devicetree/injections.scm index 6adae45a2..2f0e58eb6 100644 --- a/queries/devicetree/injections.scm +++ b/queries/devicetree/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/devicetree/locals.scm b/queries/devicetree/locals.scm index 88b266ec2..e33a81dfd 100644 --- a/queries/devicetree/locals.scm +++ b/queries/devicetree/locals.scm @@ -1,4 +1,4 @@ [ (node) (integer_cells) -]@local.scope +] @local.scope diff --git a/queries/dhall/folds.scm b/queries/dhall/folds.scm index 305079aa8..bc92797b4 100644 --- a/queries/dhall/folds.scm +++ b/queries/dhall/folds.scm @@ -1,14 +1,10 @@ [ (let_binding) - (application_expression) (lambda_expression) - (record_type) (union_type) - (list_literal) (record_literal) - (block_comment) ] @fold diff --git a/queries/dhall/highlights.scm b/queries/dhall/highlights.scm index 5e2a77848..efd7fedf2 100644 --- a/queries/dhall/highlights.scm +++ b/queries/dhall/highlights.scm @@ -1,7 +1,5 @@ -;; Text - -;; Imports - +; Text +; Imports (missing_import) @keyword.import (local_import) @string.special.path @@ -13,47 +11,55 @@ (import_hash) ] @string.special -[ (import_as_location) (import_as_text) ] @type - -;; Types +[ + (import_as_location) + (import_as_text) +] @type +; Types ([ - (let_binding (label) @type) - (union_type_entry (label) @type) -] (#lua-match? @type "^%u")) + (let_binding + (label) @type) + (union_type_entry + (label) @type) +] + (#lua-match? @type "^%u")) ((primitive_expression - (identifier (label) @type) - (selector (label) @type)) @variable + (identifier + (label) @type) + (selector + (label) @type)) @variable (#lua-match? @variable "^[A-Z][^.]*$")) -;; Parameters - -(lambda_expression label: (label) @variable.parameter) - -;; Variables +; Parameters +(lambda_expression + label: (label) @variable.parameter) +; Variables (label) @variable -(identifier [ - (label) @variable - (de_bruijn_index) @operator -]) +(identifier + [ + (label) @variable + (de_bruijn_index) @operator + ]) -(let_binding label: (label) @variable) +(let_binding + label: (label) @variable) ; Fields +(record_literal_entry + (label) @variable.member) -(record_literal_entry (label) @variable.member) - -(record_type_entry (label) @variable.member) +(record_type_entry + (label) @variable.member) (selector (selector_dot) (_) @variable.member) -;; Keywords - +; Keywords (env_import) @keyword [ @@ -68,8 +74,7 @@ "with" ] @keyword.operator -;; Operators - +; Operators [ (type_operator) (assign_operator) @@ -82,71 +87,88 @@ (empty_record_literal) ] @operator -;; Builtins - +; Builtins (builtin_function) @function.builtin -(builtin [ - "Natural" - "Natural/build" - "Natural/fold" - "Natural/isZero" - "Natural/even" - "Natural/odd" - "Natural/subtract" - "Natural/toInteger" - "Natural/show" - "Integer" - "Integer/toDouble" - "Integer/show" - "Integer/negate" - "Integer/clamp" - "Double" - "Double/show" - "List" - "List/build" - "List/fold" - "List/length" - "List/head" - "List/last" - "List/indexed" - "List/reverse" - "Text" - "Text/show" - "Text/replace" - "Optional" - "Date" - "Time" - "TimeZone" - "Type" - "Kind" - "Sort" -] @type.builtin) -;; Punctuation +(builtin + [ + "Natural" + "Natural/build" + "Natural/fold" + "Natural/isZero" + "Natural/even" + "Natural/odd" + "Natural/subtract" + "Natural/toInteger" + "Natural/show" + "Integer" + "Integer/toDouble" + "Integer/show" + "Integer/negate" + "Integer/clamp" + "Double" + "Double/show" + "List" + "List/build" + "List/fold" + "List/length" + "List/head" + "List/last" + "List/indexed" + "List/reverse" + "Text" + "Text/show" + "Text/replace" + "Optional" + "Date" + "Time" + "TimeZone" + "Type" + "Kind" + "Sort" + ] @type.builtin) + +; Punctuation +[ + "," + "|" +] @punctuation.delimiter -[ "," "|" ] @punctuation.delimiter (selector_dot) @punctuation.delimiter -[ "{" "}" ] @punctuation.bracket +[ + "{" + "}" +] @punctuation.bracket -[ "[" "]" ] @punctuation.bracket +[ + "[" + "]" +] @punctuation.bracket -[ "(" ")" ] @punctuation.bracket +[ + "(" + ")" +] @punctuation.bracket -[ "<" ">" ] @punctuation.bracket - -;; Conditionals +[ + "<" + ">" +] @punctuation.bracket +; Conditionals [ "if" "then" "else" ] @keyword.conditional -;; Literals - +; Literals (text_literal) @string -(interpolation "}" @string) + +(interpolation + "}" @string) + [ (double_quote_escaped) (single_quote_escaped) @@ -161,10 +183,10 @@ (boolean_literal) @boolean -(builtin "None") @constant.builtin - -;; Comments +(builtin + "None") @constant.builtin +; Comments [ (line_comment) (block_comment) diff --git a/queries/dhall/injections.scm b/queries/dhall/injections.scm index 43ae7287b..3cd6aac8e 100644 --- a/queries/dhall/injections.scm +++ b/queries/dhall/injections.scm @@ -1,5 +1,5 @@ ([ (line_comment) (block_comment) - ] @injection.content - (#set! injection.language "comment")) +] @injection.content + (#set! injection.language "comment")) diff --git a/queries/diff/highlights.scm b/queries/diff/highlights.scm index 4288913d9..d8e600882 100644 --- a/queries/diff/highlights.scm +++ b/queries/diff/highlights.scm @@ -1,6 +1,15 @@ -[(addition) (new_file)] @diff.plus -[(deletion) (old_file)] @diff.minus +[ + (addition) + (new_file) +] @diff.plus + +[ + (deletion) + (old_file) +] @diff.minus (commit) @constant + (location) @attribute + (command) @function diff --git a/queries/dockerfile/highlights.scm b/queries/dockerfile/highlights.scm index 592e70423..762e34426 100644 --- a/queries/dockerfile/highlights.scm +++ b/queries/dockerfile/highlights.scm @@ -41,17 +41,19 @@ "$" "{" "}" - ] @punctuation.special -) + ] @punctuation.special) ((variable) @constant (#lua-match? @constant "^[A-Z][A-Z_0-9]*$")) (arg_instruction - . (unquoted_string) @property) + . + (unquoted_string) @property) (env_instruction - (env_pair . (unquoted_string) @property)) + (env_pair + . + (unquoted_string) @property)) (expose_instruction (expose_port) @number) diff --git a/queries/dockerfile/injections.scm b/queries/dockerfile/injections.scm index 0eb9ffdf2..0304f982e 100644 --- a/queries/dockerfile/injections.scm +++ b/queries/dockerfile/injections.scm @@ -1,6 +1,6 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) -((shell_command) @injection.content - (#set! injection.language "bash") - (#set! injection.include-children)) +((shell_command) @injection.content + (#set! injection.language "bash") + (#set! injection.include-children)) diff --git a/queries/dot/highlights.scm b/queries/dot/highlights.scm index f204ce44c..7919e87f5 100644 --- a/queries/dot/highlights.scm +++ b/queries/dot/highlights.scm @@ -10,6 +10,7 @@ ] @keyword (string_literal) @string + (number_literal) @number [ @@ -32,19 +33,19 @@ ] @punctuation.bracket (subgraph - id: (id - (identifier) @module) -) + id: + (id + (identifier) @module)) (attribute - name: (id - (identifier) @variable.member) -) + name: + (id + (identifier) @variable.member)) (attribute - value: (id - (identifier) @constant) -) + value: + (id + (identifier) @constant)) (comment) @comment diff --git a/queries/dot/injections.scm b/queries/dot/injections.scm index ac41393ab..4fe39a8ba 100644 --- a/queries/dot/injections.scm +++ b/queries/dot/injections.scm @@ -1,5 +1,5 @@ -((html_internal) @injection.content - (#set! injection.language "html")) +((html_internal) @injection.content + (#set! injection.language "html")) ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/doxygen/highlights.scm b/queries/doxygen/highlights.scm index fadcdfa80..e3e26881e 100644 --- a/queries/doxygen/highlights.scm +++ b/queries/doxygen/highlights.scm @@ -9,11 +9,12 @@ (identifier) @variable ((tag - (tag_name) @_param + (tag_name) @_param (identifier) @variable.parameter) (#any-of? @_param "@param" "\\param")) -(function (identifier) @function) +(function + (identifier) @function) (function_link) @function @@ -48,6 +49,13 @@ (code_block_end) ] @punctuation.delimiter -[ "(" ")" "{" "}" "[" "]" ] @punctuation.bracket +[ + "(" + ")" + "{" + "}" + "[" + "]" +] @punctuation.bracket (code_block_content) @none diff --git a/queries/doxygen/injections.scm b/queries/doxygen/injections.scm index 8353dfd7a..e0eff433a 100644 --- a/queries/doxygen/injections.scm +++ b/queries/doxygen/injections.scm @@ -1,7 +1,10 @@ ((type) @injection.content (#set! injection.parent)) -([ (function_link) (code) ] @injection.content +([ + (function_link) + (code) +] @injection.content (#set! injection.parent)) ((link) @injection.content diff --git a/queries/dtd/folds.scm b/queries/dtd/folds.scm index ba7ea121b..b1bce4ffb 100644 --- a/queries/dtd/folds.scm +++ b/queries/dtd/folds.scm @@ -1,4 +1,4 @@ [ - (conditionalSect) - (Comment) + (conditionalSect) + (Comment) ] @fold diff --git a/queries/dtd/highlights.scm b/queries/dtd/highlights.scm index fac7d923c..12a2093d1 100644 --- a/queries/dtd/highlights.scm +++ b/queries/dtd/highlights.scm @@ -1,80 +1,95 @@ -;; XML declaration +; XML declaration +(XMLDecl + "xml" @keyword.directive) -(XMLDecl "xml" @keyword.directive) +(XMLDecl + [ + "version" + "encoding" + ] @tag.attribute) -(XMLDecl [ "version" "encoding" ] @tag.attribute) +(XMLDecl + (EncName) @string.special) -(XMLDecl (EncName) @string.special) - -(XMLDecl (VersionNum) @number) - -;; Processing instructions +(XMLDecl + (VersionNum) @number) +; Processing instructions (PI) @keyword.directive -;; Element declaration - +; Element declaration (elementdecl "ELEMENT" @keyword.directive.define (Name) @tag) (contentspec - (_ (Name) @tag.attribute)) + (_ + (Name) @tag.attribute)) "#PCDATA" @type.builtin -[ "EMPTY" "ANY" ] @type.qualifier +[ + "EMPTY" + "ANY" +] @type.qualifier -[ "*" "?" "+" ] @character.special - -;; Entity declaration +[ + "*" + "?" + "+" +] @character.special +; Entity declaration (GEDecl "ENTITY" @keyword.directive.define (Name) @constant) -(GEDecl (EntityValue) @string) +(GEDecl + (EntityValue) @string) (NDataDecl "NDATA" @keyword (Name) @label) -;; Parsed entity declaration - +; Parsed entity declaration (PEDecl "ENTITY" @keyword.directive.define "%" @operator (Name) @function.macro) -(PEDecl (EntityValue) @string) - -;; Notation declaration +(PEDecl + (EntityValue) @string) +; Notation declaration (NotationDecl "NOTATION" @keyword.directive (Name) @label) ((NotationDecl (ExternalID - (SystemLiteral (URI) @string.special.url)) - (#set! "priority" 105))) - -;; Attlist declaration + (SystemLiteral + (URI) @string.special.url)) + (#set! "priority" 105))) +; Attlist declaration (AttlistDecl "ATTLIST" @keyword.directive.define (Name) @tag) -(AttDef (Name) @tag.attribute) +(AttDef + (Name) @tag.attribute) -(AttDef (Enumeration (Nmtoken) @string)) +(AttDef + (Enumeration + (Nmtoken) @string)) [ (StringType) (TokenizedType) ] @type.builtin -(NotationType "NOTATION" @type.builtin) +(NotationType + "NOTATION" @type.builtin) [ "#REQUIRED" @@ -82,38 +97,57 @@ "#FIXED" ] @attribute -;; Entities - +; Entities (EntityRef) @constant ((EntityRef) @constant.builtin - (#any-of? @constant.builtin - "&" "<" ">" """ "'")) + (#any-of? @constant.builtin "&" "<" ">" """ "'")) (CharRef) @character (PEReference) @function.macro -;; External references - -[ "PUBLIC" "SYSTEM" ] @keyword +; External references +[ + "PUBLIC" + "SYSTEM" +] @keyword (PubidLiteral) @string.special -(SystemLiteral (URI) @string.special.url) +(SystemLiteral + (URI) @string.special.url) -;; Delimiters & punctuation +; Delimiters & punctuation +[ + "" + "" + "]]>" +] @tag.delimiter -[ "" "" "]]>" ] @tag.delimiter +[ + "(" + ")" + "[" +] @punctuation.bracket -[ "(" ")" "[" ] @punctuation.bracket +[ + "\"" + "'" +] @punctuation.delimiter -[ "\"" "'" ] @punctuation.delimiter +[ + "," + "|" + "=" +] @operator -[ "," "|" "=" ] @operator - -;; Misc - -[ "INCLUDE" "IGNORE" ] @keyword.import +; Misc +[ + "INCLUDE" + "IGNORE" +] @keyword.import (Comment) @comment @spell diff --git a/queries/dtd/locals.scm b/queries/dtd/locals.scm index 6f64c6791..88246c04a 100644 --- a/queries/dtd/locals.scm +++ b/queries/dtd/locals.scm @@ -1,7 +1,11 @@ -(elementdecl (Name) @local.definition.type) +(elementdecl + (Name) @local.definition.type) (elementdecl (contentspec - (children (Name) @local.reference))) + (children + (Name) @local.reference))) -(AttlistDecl . (Name) @local.reference) +(AttlistDecl + . + (Name) @local.reference) diff --git a/queries/ebnf/highlights.scm b/queries/ebnf/highlights.scm index b0dfa2737..8715091b1 100644 --- a/queries/ebnf/highlights.scm +++ b/queries/ebnf/highlights.scm @@ -1,4 +1,4 @@ -;;;; Simple tokens ;;;; +; Simple tokens ;;;; (terminal) @string.grammar (special_sequence) @string.special.grammar @@ -7,37 +7,36 @@ (comment) @comment @spell -;;;; Identifiers ;;;; - +; Identifiers ;;;; ; Allow different highlighting for specific casings ((identifier) @type - (#lua-match? @type "^%u")) + (#lua-match? @type "^%u")) ((identifier) @string.special.symbol - (#lua-match? @string.special.symbol "^%l")) + (#lua-match? @string.special.symbol "^%l")) ((identifier) @constant - (#lua-match? @constant "^%u[%u%d_]+$")) + (#lua-match? @constant "^%u[%u%d_]+$")) -;;; Punctuation ;;;; +; Punctuation ;;;; [ - ";" - "," + ";" + "," ] @punctuation.delimiter [ - "|" - "*" - "-" + "|" + "*" + "-" ] @operator "=" @keyword.operator [ - "(" - ")" - "[" - "]" - "{" - "}" + "(" + ")" + "[" + "]" + "{" + "}" ] @punctuation.bracket diff --git a/queries/ecma/highlights.scm b/queries/ecma/highlights.scm index b6fd64668..223198410 100644 --- a/queries/ecma/highlights.scm +++ b/queries/ecma/highlights.scm @@ -1,92 +1,60 @@ ; Types - ; Javascript - ; Variables ;----------- (identifier) @variable ; Properties ;----------- - (property_identifier) @property + (shorthand_property_identifier) @property + (private_property_identifier) @property (variable_declarator - name: (object_pattern - (shorthand_property_identifier_pattern))) @variable + name: + (object_pattern + (shorthand_property_identifier_pattern))) @variable ; Special identifiers ;-------------------- - ((identifier) @type - (#lua-match? @type "^[A-Z]")) + (#lua-match? @type "^[A-Z]")) ((identifier) @constant - (#lua-match? @constant "^_*[A-Z][A-Z%d_]*$")) + (#lua-match? @constant "^_*[A-Z][A-Z%d_]*$")) ((shorthand_property_identifier) @constant - (#lua-match? @constant "^_*[A-Z][A-Z%d_]*$")) + (#lua-match? @constant "^_*[A-Z][A-Z%d_]*$")) ((identifier) @variable.builtin - (#any-of? @variable.builtin - "arguments" - "module" - "console" - "window" - "document")) + (#any-of? @variable.builtin "arguments" "module" "console" "window" "document")) ((identifier) @type.builtin - (#any-of? @type.builtin - "Object" - "Function" - "Boolean" - "Symbol" - "Number" - "Math" - "Date" - "String" - "RegExp" - "Map" - "Set" - "WeakMap" - "WeakSet" - "Promise" - "Array" - "Int8Array" - "Uint8Array" - "Uint8ClampedArray" - "Int16Array" - "Uint16Array" - "Int32Array" - "Uint32Array" - "Float32Array" - "Float64Array" - "ArrayBuffer" - "DataView" - "Error" - "EvalError" - "InternalError" - "RangeError" - "ReferenceError" - "SyntaxError" - "TypeError" - "URIError")) + (#any-of? @type.builtin "Object" "Function" "Boolean" "Symbol" "Number" "Math" "Date" "String" "RegExp" "Map" "Set" "WeakMap" "WeakSet" "Promise" "Array" "Int8Array" "Uint8Array" "Uint8ClampedArray" "Int16Array" "Uint16Array" "Int32Array" "Uint32Array" "Float32Array" "Float64Array" "ArrayBuffer" "DataView" "Error" "EvalError" "InternalError" "RangeError" "ReferenceError" "SyntaxError" "TypeError" "URIError")) ; Function and method definitions ;-------------------------------- - (function name: (identifier) @function) + (function_declaration name: (identifier) @function) + (generator_function name: (identifier) @function) + (generator_function_declaration name: (identifier) @function) + (method_definition - name: [(property_identifier) (private_property_identifier)] @function.method) + name: + [ + (property_identifier) + (private_property_identifier) + ] @function.method) + (method_definition name: (property_identifier) @constructor (#eq? @constructor "constructor")) @@ -94,22 +62,27 @@ (pair key: (property_identifier) @function.method value: (function)) + (pair key: (property_identifier) @function.method value: (arrow_function)) (assignment_expression - left: (member_expression - property: (property_identifier) @function.method) + left: + (member_expression + property: (property_identifier) @function.method) right: (arrow_function)) + (assignment_expression - left: (member_expression - property: (property_identifier) @function.method) + left: + (member_expression + property: (property_identifier) @function.method) right: (function)) (variable_declarator name: (identifier) @function value: (arrow_function)) + (variable_declarator name: (identifier) @function value: (function)) @@ -117,42 +90,35 @@ (assignment_expression left: (identifier) @function right: (arrow_function)) + (assignment_expression left: (identifier) @function right: (function)) ; Function and method calls ;-------------------------- - (call_expression function: (identifier) @function.call) (call_expression - function: (member_expression - property: [(property_identifier) (private_property_identifier)] @function.method.call)) + function: + (member_expression + property: + [ + (property_identifier) + (private_property_identifier) + ] @function.method.call)) ; Builtins ;--------- - ((identifier) @module.builtin - (#eq? @module.builtin "Intl")) + (#eq? @module.builtin "Intl")) ((identifier) @function.builtin - (#any-of? @function.builtin - "eval" - "isFinite" - "isNaN" - "parseFloat" - "parseInt" - "decodeURI" - "decodeURIComponent" - "encodeURI" - "encodeURIComponent" - "require")) + (#any-of? @function.builtin "eval" "isFinite" "isNaN" "parseFloat" "parseInt" "decodeURI" "decodeURIComponent" "encodeURI" "encodeURIComponent" "require")) ; Constructor ;------------ - (new_expression constructor: (identifier) @constructor) @@ -163,19 +129,24 @@ ; Decorators ;---------- -(decorator "@" @attribute (identifier) @attribute) -(decorator "@" @attribute (call_expression (identifier) @attribute)) +(decorator + "@" @attribute + (identifier) @attribute) + +(decorator + "@" @attribute + (call_expression + (identifier) @attribute)) ; Literals ;--------- - [ (this) (super) ] @variable.builtin ((identifier) @variable.builtin - (#eq? @variable.builtin "self")) + (#eq? @variable.builtin "self")) [ (true) @@ -195,30 +166,45 @@ (hash_bang_line) @keyword.directive ((string_fragment) @keyword.directive - (#eq? @keyword.directive "use strict")) + (#eq? @keyword.directive "use strict")) (string) @string + (template_string) @string + (escape_sequence) @string.escape + (regex_pattern) @string.regexp + (regex_flags) @character.special -(regex "/" @punctuation.bracket) ; Regex delimiters + +(regex + "/" @punctuation.bracket) ; Regex delimiters (number) @number + ((identifier) @number (#any-of? @number "NaN" "Infinity")) ; Punctuation ;------------ - ";" @punctuation.delimiter + "." @punctuation.delimiter + "," @punctuation.delimiter -(pair ":" @punctuation.delimiter) -(pair_pattern ":" @punctuation.delimiter) -(switch_case ":" @punctuation.delimiter) -(switch_default ":" @punctuation.delimiter) +(pair + ":" @punctuation.delimiter) + +(pair_pattern + ":" @punctuation.delimiter) + +(switch_case + ":" @punctuation.delimiter) + +(switch_default + ":" @punctuation.delimiter) [ "--" @@ -265,10 +251,28 @@ "..." ] @operator -(binary_expression "/" @operator) -(ternary_expression ["?" ":"] @keyword.conditional.ternary) -(unary_expression ["!" "~" "-" "+"] @operator) -(unary_expression ["delete" "void"] @keyword.operator) +(binary_expression + "/" @operator) + +(ternary_expression + [ + "?" + ":" + ] @keyword.conditional.ternary) + +(unary_expression + [ + "!" + "~" + "-" + "+" + ] @operator) + +(unary_expression + [ + "delete" + "void" + ] @keyword.operator) [ "(" @@ -279,11 +283,14 @@ "}" ] @punctuation.bracket -((template_substitution ["${" "}"] @punctuation.special) @none) +((template_substitution + [ + "${" + "}" + ] @punctuation.special) @none) ; Keywords ;---------- - [ "if" "else" @@ -296,10 +303,17 @@ "from" ] @keyword.import -(export_specifier "as" @keyword.import) -(import_specifier "as" @keyword.import) -(namespace_export "as" @keyword.import) -(namespace_import "as" @keyword.import) +(export_specifier + "as" @keyword.import) + +(import_specifier + "as" @keyword.import) + +(namespace_export + "as" @keyword.import) + +(namespace_import + "as" @keyword.import) [ "for" @@ -335,9 +349,7 @@ "yield" ] @keyword.return -[ - "function" -] @keyword.function +"function" @keyword.function [ "new" @@ -356,5 +368,6 @@ (export_statement "default" @keyword) + (switch_default "default" @keyword.conditional) diff --git a/queries/ecma/indents.scm b/queries/ecma/indents.scm index 538c5bdc7..03b10c605 100644 --- a/queries/ecma/indents.scm +++ b/queries/ecma/indents.scm @@ -18,36 +18,56 @@ (ternary_expression) ] @indent.begin -(arguments (call_expression) @indent.begin) -(binary_expression (call_expression) @indent.begin) -(expression_statement (call_expression) @indent.begin) +(arguments + (call_expression) @indent.begin) + +(binary_expression + (call_expression) @indent.begin) + +(expression_statement + (call_expression) @indent.begin) + (arrow_function body: (_) @_body - (#not-has-type? @_body statement_block) -) @indent.begin + (#not-has-type? @_body statement_block)) @indent.begin + (assignment_expression right: (_) @_right - (#not-has-type? @_right arrow_function function) -) @indent.begin + (#not-has-type? @_right arrow_function function)) @indent.begin + (variable_declarator value: (_) @_value - (#not-has-type? @_value arrow_function call_expression function) -) @indent.begin + (#not-has-type? @_value arrow_function call_expression function)) @indent.begin -(arguments ")" @indent.end) -(object "}" @indent.end) -(statement_block "}" @indent.end) +(arguments + ")" @indent.end) + +(object + "}" @indent.end) + +(statement_block + "}" @indent.end) [ - (arguments (object)) + (arguments + (object)) ")" "}" "]" ] @indent.branch -(statement_block "{" @indent.branch) -(parenthesized_expression ("(" (_) ")" @indent.end)) -["}" "]"] @indent.end +(statement_block + "{" @indent.branch) + +(parenthesized_expression + ("(" + (_) + ")" @indent.end)) + +[ + "}" + "]" +] @indent.end (template_string) @indent.ignore diff --git a/queries/ecma/injections.scm b/queries/ecma/injections.scm index 97dbbb628..9421d8113 100644 --- a/queries/ecma/injections.scm +++ b/queries/ecma/injections.scm @@ -3,98 +3,116 @@ (#set! injection.language "jsdoc")) ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) ; html(`...`), html`...`, sql(...) etc (call_expression - function: ((identifier) @injection.language) - arguments: [ - (arguments - (template_string) @injection.content) - (template_string) @injection.content - ] - (#lua-match? @injection.language "^[a-zA-Z][a-zA-Z0-9]*$") - (#offset! @injection.content 0 1 0 -1) - (#not-eq? @injection.language "svg")) + function: + ((identifier) @injection.language) + arguments: + [ + (arguments + (template_string) @injection.content) + (template_string) @injection.content + ] + (#lua-match? @injection.language "^[a-zA-Z][a-zA-Z0-9]*$") + (#offset! @injection.content 0 1 0 -1) + (#not-eq? @injection.language "svg")) ; svg`...` or svg(`...`), which uses the html parser, so is not included in the previous query (call_expression - function: ((identifier) @_name (#eq? @_name "svg")) - arguments: [ - (arguments - (template_string) @injection.content) - (template_string) @injection.content - ] - (#offset! @injection.content 0 1 0 -1) - (#set! injection.language "html")) - + function: + ((identifier) @_name + (#eq? @_name "svg")) + arguments: + [ + (arguments + (template_string) @injection.content) + (template_string) @injection.content + ] + (#offset! @injection.content 0 1 0 -1) + (#set! injection.language "html")) (call_expression - function: ((identifier) @_name - (#eq? @_name "gql")) - arguments: ((template_string) @injection.content - (#offset! @injection.content 0 1 0 -1) - (#set! injection.language "graphql"))) + function: + ((identifier) @_name + (#eq? @_name "gql")) + arguments: + ((template_string) @injection.content + (#offset! @injection.content 0 1 0 -1) + (#set! injection.language "graphql"))) (call_expression - function: ((identifier) @_name - (#eq? @_name "hbs")) - arguments: ((template_string) @injection.content - (#offset! @injection.content 0 1 0 -1) - (#set! injection.language "glimmer"))) + function: + ((identifier) @_name + (#eq? @_name "hbs")) + arguments: + ((template_string) @injection.content + (#offset! @injection.content 0 1 0 -1) + (#set! injection.language "glimmer"))) ((glimmer_template) @injection.content - (#set! injection.language "glimmer")) + (#set! injection.language "glimmer")) ; styled.div`` (call_expression - function: (member_expression - object: (identifier) @_name - (#eq? @_name "styled")) - arguments: ((template_string) @injection.content - (#offset! @injection.content 0 1 0 -1) - (#set! injection.language "styled"))) + function: + (member_expression + object: (identifier) @_name + (#eq? @_name "styled")) + arguments: + ((template_string) @injection.content + (#offset! @injection.content 0 1 0 -1) + (#set! injection.language "styled"))) ; styled(Component)`` (call_expression - function: (call_expression - function: (identifier) @_name - (#eq? @_name "styled")) - arguments: ((template_string) @injection.content - (#offset! @injection.content 0 1 0 -1) - (#set! injection.language "styled"))) + function: + (call_expression + function: (identifier) @_name + (#eq? @_name "styled")) + arguments: + ((template_string) @injection.content + (#offset! @injection.content 0 1 0 -1) + (#set! injection.language "styled"))) ; styled.div.attrs({ prop: "foo" })`` (call_expression - function: (call_expression - function: (member_expression - object: (member_expression - object: (identifier) @_name - (#eq? @_name "styled")))) - arguments: ((template_string) @injection.content - (#offset! @injection.content 0 1 0 -1) - (#set! injection.language "styled"))) - + function: + (call_expression + function: + (member_expression + object: + (member_expression + object: (identifier) @_name + (#eq? @_name "styled")))) + arguments: + ((template_string) @injection.content + (#offset! @injection.content 0 1 0 -1) + (#set! injection.language "styled"))) ; styled(Component).attrs({ prop: "foo" })`` (call_expression - function: (call_expression - function: (member_expression - object: (call_expression - function: (identifier) @_name - (#eq? @_name "styled")))) - arguments: ((template_string) @injection.content - (#offset! @injection.content 0 1 0 -1) - (#set! injection.language "styled"))) + function: + (call_expression + function: + (member_expression + object: + (call_expression + function: (identifier) @_name + (#eq? @_name "styled")))) + arguments: + ((template_string) @injection.content + (#offset! @injection.content 0 1 0 -1) + (#set! injection.language "styled"))) ((regex_pattern) @injection.content - (#set! injection.language "regex")) + (#set! injection.language "regex")) ; ((comment) @_gql_comment ; (#eq? @_gql_comment "/* GraphQL */") ; (template_string) @injection.content ; (#set! injection.language "graphql")) - ((template_string) @injection.content (#lua-match? @injection.content "^`#graphql") (#offset! @injection.content 0 1 0 -1) @@ -102,20 +120,21 @@ ; el.innerHTML = `` (assignment_expression - left: + left: (member_expression property: (property_identifier) @_prop (#any-of? @_prop "outerHTML" "innerHTML")) right: (template_string) @injection.content - (#offset! @injection.content 0 1 0 -1) - (#set! injection.language "html")) + (#offset! @injection.content 0 1 0 -1) + (#set! injection.language "html")) ; el.innerHTML = '' (assignment_expression - left: + left: (member_expression property: (property_identifier) @_prop (#any-of? @_prop "outerHTML" "innerHTML")) - right: - (string (string_fragment) @injection.content) - (#set! injection.language "html")) + right: + (string + (string_fragment) @injection.content) + (#set! injection.language "html")) diff --git a/queries/ecma/locals.scm b/queries/ecma/locals.scm index 86e565490..54da79335 100644 --- a/queries/ecma/locals.scm +++ b/queries/ecma/locals.scm @@ -1,18 +1,23 @@ ; Scopes ;------- - (statement_block) @local.scope + (function) @local.scope + (arrow_function) @local.scope + (function_declaration) @local.scope + (method_definition) @local.scope + (for_statement) @local.scope + (for_in_statement) @local.scope + (catch_clause) @local.scope ; Definitions ;------------ - (variable_declarator name: (identifier) @local.definition.var) @@ -24,14 +29,14 @@ (function_declaration ((identifier) @local.definition.function) - (#set! definition.var.scope parent)) + (#set! definition.var.scope parent)) (method_definition ((property_identifier) @local.definition.function) - (#set! definition.var.scope parent)) + (#set! definition.var.scope parent)) ; References ;------------ - (identifier) @local.reference + (shorthand_property_identifier) @local.reference diff --git a/queries/eds/highlights.scm b/queries/eds/highlights.scm index 42f408754..2ce79c048 100644 --- a/queries/eds/highlights.scm +++ b/queries/eds/highlights.scm @@ -1,49 +1,58 @@ "=" @punctuation.delimiter -[ "[" "]" ] @punctuation.bracket +[ + "[" + "]" +] @punctuation.bracket ((section_name) @variable.builtin - (#match? @variable.builtin "\\c^(FileInfo|DeviceInfo|DummyUsage|MandatoryObjects|OptionalObjects)$")) + (#match? @variable.builtin "\\c^(FileInfo|DeviceInfo|DummyUsage|MandatoryObjects|OptionalObjects)$")) ((section_name) @variable.builtin - (#lua-match? @variable.builtin "^1")) + (#lua-match? @variable.builtin "^1")) (section - (section_name) @_name - (#match? @_name "\\c^Comments$")) @comment + (section_name) @_name + (#match? @_name "\\c^Comments$")) @comment (section - (section_name) @_name - (statement (key) @_key) @string - (#match? @_key "\\c^ParameterName$") - (#not-match? @_name "\\c^Comments$")) + (section_name) @_name + (statement + (key) @_key) @string + (#match? @_key "\\c^ParameterName$") + (#not-match? @_name "\\c^Comments$")) (section - (section_name) @_name - (statement (key) @_key) @type - (#match? @_key "\\c^ObjectType$") - (#not-match? @_name "\\c^Comments$")) + (section_name) @_name + (statement + (key) @_key) @type + (#match? @_key "\\c^ObjectType$") + (#not-match? @_name "\\c^Comments$")) (section - (section_name) @_name - (statement (key) @_key) @type - (#match? @_key "\\c^DataType$") - (#not-match? @_name "\\c^Comments$")) + (section_name) @_name + (statement + (key) @_key) @type + (#match? @_key "\\c^DataType$") + (#not-match? @_name "\\c^Comments$")) (section - (section_name) @_name - (statement (key) @_key) @type.qualifier - (#match? @_key "\\c^AccessType$") - (#not-match? @_name "\\c^Comments$")) + (section_name) @_name + (statement + (key) @_key) @type.qualifier + (#match? @_key "\\c^AccessType$") + (#not-match? @_name "\\c^Comments$")) (section - (section_name) @_name - (statement (key) @_key) @attribute - (#match? @_key "\\c^PDOMapping$") - (#not-match? @_name "\\c^Comments$")) + (section_name) @_name + (statement + (key) @_key) @attribute + (#match? @_key "\\c^PDOMapping$") + (#not-match? @_name "\\c^Comments$")) (section - (section_name) @_name - (statement (key) @_key) @number - (#match? @_key "\\c^(DefaultValue|LowLimit|HighLimit|SubNumber)$") - (#not-match? @_name "\\c^Comments$")) + (section_name) @_name + (statement + (key) @_key) @number + (#match? @_key "\\c^(DefaultValue|LowLimit|HighLimit|SubNumber)$") + (#not-match? @_name "\\c^Comments$")) diff --git a/queries/eex/highlights.scm b/queries/eex/highlights.scm index d032a7486..ae91a2774 100644 --- a/queries/eex/highlights.scm +++ b/queries/eex/highlights.scm @@ -7,6 +7,5 @@ "<%%=" "<%=" ] @tag.delimiter - ; EEx comments are highlighted as such (comment) @comment @spell diff --git a/queries/eex/injections.scm b/queries/eex/injections.scm index 9331f5925..f13d3c14e 100644 --- a/queries/eex/injections.scm +++ b/queries/eex/injections.scm @@ -1,8 +1,8 @@ ; EEx expressions are Elixir -((expression) @injection.content - (#set! injection.language "elixir")) +((expression) @injection.content + (#set! injection.language "elixir")) ; EEx expressions can span multiple interpolated lines ((partial_expression) @injection.content - (#set! injection.language "elixir") - (#set! injection.combined)) + (#set! injection.language "elixir") + (#set! injection.combined)) diff --git a/queries/elixir/highlights.scm b/queries/elixir/highlights.scm index 5a9297fc7..57e299b17 100644 --- a/queries/elixir/highlights.scm +++ b/queries/elixir/highlights.scm @@ -15,15 +15,14 @@ "}" ] @punctuation.bracket -[ - "%" -] @punctuation.special +"%" @punctuation.special ; Identifiers (identifier) @variable ; Unused Identifiers -((identifier) @comment (#lua-match? @comment "^_")) +((identifier) @comment + (#lua-match? @comment "^_")) ; Comments (comment) @comment @spell @@ -43,7 +42,11 @@ ] @string.special.symbol ; Interpolation -(interpolation ["#{" "}"] @string.special) +(interpolation + [ + "#{" + "}" + ] @string.special) ; Escape sequences (escape_sequence) @string.escape @@ -69,82 +72,65 @@ ; Operators (operator_identifier) @operator -(unary_operator operator: _ @operator) +(unary_operator + operator: _ @operator) -(binary_operator operator: _ @operator) +(binary_operator + operator: _ @operator) ; Pipe Operator -(binary_operator operator: "|>" right: (identifier) @function) +(binary_operator + operator: "|>" + right: (identifier) @function) -(dot operator: _ @operator) +(dot + operator: _ @operator) -(stab_clause operator: _ @operator) +(stab_clause + operator: _ @operator) ; Local Function Calls -(call target: (identifier) @function.call) +(call + target: (identifier) @function.call) ; Remote Function Calls -(call target: (dot left: [ - (atom) @type - (_) -] right: (identifier) @function.call) (arguments)) +(call + target: + (dot + left: + [ + (atom) @type + (_) + ] + right: (identifier) @function.call) + (arguments)) ; Definition Function Calls -(call target: ((identifier) @keyword.function (#any-of? @keyword.function - "def" - "defdelegate" - "defexception" - "defguard" - "defguardp" - "defimpl" - "defmacro" - "defmacrop" - "defmodule" - "defn" - "defnp" - "defoverridable" - "defp" - "defprotocol" - "defstruct" - )) - (arguments [ - (call (identifier) @function) - (identifier) @function - (binary_operator left: (call target: (identifier) @function) operator: "when")])?) +(call + target: + ((identifier) @keyword.function + (#any-of? @keyword.function "def" "defdelegate" "defexception" "defguard" "defguardp" "defimpl" "defmacro" "defmacrop" "defmodule" "defn" "defnp" "defoverridable" "defp" "defprotocol" "defstruct")) + (arguments + [ + (call + (identifier) @function) + (identifier) @function + (binary_operator + left: + (call + target: (identifier) @function) + operator: "when") + ])?) ; Kernel Keywords & Special Forms -(call target: ((identifier) @keyword (#any-of? @keyword - "alias" - "case" - "catch" - "cond" - "else" - "for" - "if" - "import" - "quote" - "raise" - "receive" - "require" - "reraise" - "super" - "throw" - "try" - "unless" - "unquote" - "unquote_splicing" - "use" - "with" -))) +(call + target: + ((identifier) @keyword + (#any-of? @keyword "alias" "case" "catch" "cond" "else" "for" "if" "import" "quote" "raise" "receive" "require" "reraise" "super" "throw" "try" "unless" "unquote" "unquote_splicing" "use" "with"))) ; Special Constants -((identifier) @constant.builtin (#any-of? @constant.builtin - "__CALLER__" - "__DIR__" - "__ENV__" - "__MODULE__" - "__STACKTRACE__" -)) +((identifier) @constant.builtin + (#any-of? @constant.builtin "__CALLER__" "__DIR__" "__ENV__" "__MODULE__" "__STACKTRACE__")) ; Reserved Keywords [ @@ -170,14 +156,22 @@ ; Capture Operator (unary_operator operator: "&" - operand: [ - (integer) @operator - (binary_operator - left: [ - (call target: (dot left: (_) right: (identifier) @function)) - (identifier) @function - ] operator: "/" right: (integer) @operator) - ]) + operand: + [ + (integer) @operator + (binary_operator + left: + [ + (call + target: + (dot + left: (_) + right: (identifier) @function)) + (identifier) @function + ] + operator: "/" + right: (integer) @operator) + ]) ; Non-String Sigils (sigil @@ -201,24 +195,30 @@ ; Module attributes (unary_operator operator: "@" - operand: [ - (identifier) - (call target: (identifier)) - ] @constant) @constant + operand: + [ + (identifier) + (call + target: (identifier)) + ] @constant) @constant ; Documentation (unary_operator operator: "@" - operand: (call - target: ((identifier) @_identifier (#any-of? @_identifier "moduledoc" "typedoc" "shortdoc" "doc")) @comment.documentation - (arguments [ - (string) - (boolean) - (charlist) - (sigil - "~" @comment.documentation - ((sigil_name) @comment.documentation) - quoted_start: _ @comment.documentation - (quoted_content) @comment.documentation - quoted_end: _ @comment.documentation) - ] @comment.documentation))) @comment.documentation + operand: + (call + target: + ((identifier) @_identifier + (#any-of? @_identifier "moduledoc" "typedoc" "shortdoc" "doc")) @comment.documentation + (arguments + [ + (string) + (boolean) + (charlist) + (sigil + "~" @comment.documentation + ((sigil_name) @comment.documentation) + quoted_start: _ @comment.documentation + (quoted_content) @comment.documentation + quoted_end: _ @comment.documentation) + ] @comment.documentation))) @comment.documentation diff --git a/queries/elixir/indents.scm b/queries/elixir/indents.scm index 0ba8fd442..5470b6422 100644 --- a/queries/elixir/indents.scm +++ b/queries/elixir/indents.scm @@ -20,4 +20,6 @@ ] @indent.end @indent.branch ; Elixir pipelines are not indented, but other binary operator chains are -((binary_operator operator: _ @_operator) @indent.begin (#not-eq? @_operator "|>")) +((binary_operator + operator: _ @_operator) @indent.begin + (#not-eq? @_operator "|>")) diff --git a/queries/elixir/injections.scm b/queries/elixir/injections.scm index 1f0b31f07..b580f2ea6 100644 --- a/queries/elixir/injections.scm +++ b/queries/elixir/injections.scm @@ -1,56 +1,61 @@ ; Comments -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) ; Documentation (unary_operator operator: "@" - operand: (call - target: ((identifier) @_identifier (#any-of? @_identifier "moduledoc" "typedoc" "shortdoc" "doc")) - (arguments [ - (string (quoted_content) @injection.content) - (sigil (quoted_content) @injection.content) - ]) - (#set! injection.language "markdown"))) + operand: + (call + target: + ((identifier) @_identifier + (#any-of? @_identifier "moduledoc" "typedoc" "shortdoc" "doc")) + (arguments + [ + (string + (quoted_content) @injection.content) + (sigil + (quoted_content) @injection.content) + ]) + (#set! injection.language "markdown"))) ; HEEx (sigil (sigil_name) @_sigil_name (quoted_content) @injection.content - (#eq? @_sigil_name "H") - (#set! injection.language "heex")) + (#eq? @_sigil_name "H") + (#set! injection.language "heex")) ; Surface (sigil (sigil_name) @_sigil_name (quoted_content) @injection.content - (#eq? @_sigil_name "F") - (#set! injection.language "surface")) + (#eq? @_sigil_name "F") + (#set! injection.language "surface")) ; Zigler (sigil (sigil_name) @_sigil_name (quoted_content) @injection.content - (#any-of? @_sigil_name "E" "L") - (#set! injection.language "eex")) + (#any-of? @_sigil_name "E" "L") + (#set! injection.language "eex")) (sigil (sigil_name) @_sigil_name (quoted_content) @injection.content - (#any-of? @_sigil_name "z" "Z") - (#set! injection.language "zig")) + (#any-of? @_sigil_name "z" "Z") + (#set! injection.language "zig")) ; Regex (sigil (sigil_name) @_sigil_name (quoted_content) @injection.content - (#any-of? @_sigil_name "r" "R") - (#set! injection.language "regex")) + (#any-of? @_sigil_name "r" "R") + (#set! injection.language "regex")) ; Json (sigil (sigil_name) @_sigil_name (quoted_content) @injection.content - (#any-of? @_sigil_name "j" "J") - (#set! injection.language "json")) - + (#any-of? @_sigil_name "j" "J") + (#set! injection.language "json")) diff --git a/queries/elixir/locals.scm b/queries/elixir/locals.scm index 59e55eae0..003ec4b1b 100644 --- a/queries/elixir/locals.scm +++ b/queries/elixir/locals.scm @@ -5,7 +5,7 @@ ; Module Definitions (call - target: + target: ((identifier) @_identifier (#eq? @_identifier "defmodule")) (arguments diff --git a/queries/elm/highlights.scm b/queries/elm/highlights.scm index 11bc0a00d..86351fe60 100644 --- a/queries/elm/highlights.scm +++ b/queries/elm/highlights.scm @@ -6,10 +6,8 @@ ((block_comment) @comment.documentation (#lua-match? @comment.documentation "^{[-]|[^|]")) - ; Keywords ;--------- - [ "if" "then" @@ -34,13 +32,9 @@ (exposing) ] @keyword.import - ; Punctuation ;------------ - -[ - (double_dot) -] @punctuation.special +(double_dot) @punctuation.special [ "," @@ -57,71 +51,89 @@ "]" ] @punctuation.bracket - ; Variables ;---------- - (value_qid (lower_case_identifier) @variable) + (value_declaration - (function_declaration_left (lower_case_identifier) @variable)) + (function_declaration_left + (lower_case_identifier) @variable)) + (type_annotation (lower_case_identifier) @variable) + (port_annotation (lower_case_identifier) @variable) + (anything_pattern (underscore) @variable) + (record_base_identifier (lower_case_identifier) @variable) + (lower_pattern (lower_case_identifier) @variable) + (exposed_value (lower_case_identifier) @variable) (value_qid - ((dot) (lower_case_identifier) @variable.member)) + ((dot) + (lower_case_identifier) @variable.member)) + (field_access_expr - ((dot) (lower_case_identifier) @variable.member)) + ((dot) + (lower_case_identifier) @variable.member)) (function_declaration_left - (anything_pattern (underscore) @variable.parameter)) -(function_declaration_left - (lower_pattern (lower_case_identifier) @variable.parameter)) + (anything_pattern + (underscore) @variable.parameter)) +(function_declaration_left + (lower_pattern + (lower_case_identifier) @variable.parameter)) ; Functions ;---------- - (value_declaration functionDeclarationLeft: (function_declaration_left (lower_case_identifier) @function (pattern))) + (value_declaration functionDeclarationLeft: (function_declaration_left (lower_case_identifier) @function pattern: (_))) + (value_declaration functionDeclarationLeft: (function_declaration_left (lower_case_identifier) @function) body: (anonymous_function_expr)) + (type_annotation name: (lower_case_identifier) @function - typeExpression: (type_expression (arrow))) + typeExpression: + (type_expression + (arrow))) + (port_annotation name: (lower_case_identifier) @function - typeExpression: (type_expression (arrow))) + typeExpression: + (type_expression + (arrow))) (function_call_expr - target: (value_expr - (value_qid (lower_case_identifier) @function.call))) - + target: + (value_expr + (value_qid + (lower_case_identifier) @function.call))) ; Operators ;---------- - [ (operator_identifier) (eq) @@ -131,31 +143,38 @@ "::" ] @operator - ; Modules ;-------- - (module_declaration - (upper_case_qid (upper_case_identifier) @module)) + (upper_case_qid + (upper_case_identifier) @module)) + (import_clause - (upper_case_qid (upper_case_identifier) @module)) + (upper_case_qid + (upper_case_identifier) @module)) + (as_clause (upper_case_identifier) @module) -(value_expr - (value_qid (upper_case_identifier) @module)) +(value_expr + (value_qid + (upper_case_identifier) @module)) ; Types ;------ - (type_declaration (upper_case_identifier) @type) + (type_ref - (upper_case_qid (upper_case_identifier) @type)) + (upper_case_qid + (upper_case_identifier) @type)) + (type_variable (lower_case_identifier) @type) + (lower_type_name (lower_case_identifier) @type) + (exposed_type (upper_case_identifier) @type) @@ -164,34 +183,43 @@ (field_type name: (lower_case_identifier) @property) + (field name: (lower_case_identifier) @property) (type_declaration - (union_variant (upper_case_identifier) @constructor)) -(nullary_constructor_argument_pattern - (upper_case_qid (upper_case_identifier) @constructor)) -(union_pattern - (upper_case_qid (upper_case_identifier) @constructor)) -(value_expr - (upper_case_qid (upper_case_identifier)) @constructor) + (union_variant + (upper_case_identifier) @constructor)) +(nullary_constructor_argument_pattern + (upper_case_qid + (upper_case_identifier) @constructor)) + +(union_pattern + (upper_case_qid + (upper_case_identifier) @constructor)) + +(value_expr + (upper_case_qid + (upper_case_identifier)) @constructor) ; Literals ;--------- - (number_constant_expr (number_literal) @number) (upper_case_qid - ((upper_case_identifier) @boolean (#any-of? @boolean "True" "False"))) + ((upper_case_identifier) @boolean + (#any-of? @boolean "True" "False"))) [ (open_quote) (close_quote) ] @string + (string_constant_expr (string_escape) @string) + (string_constant_expr (regular_string_part) @string) @@ -199,7 +227,9 @@ (open_char) (close_char) ] @character + (char_constant_expr (string_escape) @character) + (char_constant_expr (regular_string_part) @character) diff --git a/queries/elm/injections.scm b/queries/elm/injections.scm index b8b3e9943..7ee6c7f03 100644 --- a/queries/elm/injections.scm +++ b/queries/elm/injections.scm @@ -1,8 +1,8 @@ ([ - (line_comment) + (line_comment) (block_comment) - ] @injection.content - (#set! injection.language "comment")) +] @injection.content + (#set! injection.language "comment")) ((glsl_content) @injection.content - (#set! injection.language "glsl")) + (#set! injection.language "glsl")) diff --git a/queries/elsa/highlights.scm b/queries/elsa/highlights.scm index 8e52b6f5b..1a974bda6 100644 --- a/queries/elsa/highlights.scm +++ b/queries/elsa/highlights.scm @@ -1,28 +1,22 @@ ; Keywords - [ "eval" "let" ] @keyword ; Function - (function) @function ; Method - (method) @function.method ; Parameter - (parameter) @variable.parameter ; Variables - (identifier) @variable ; Operators - [ "\\" "->" @@ -31,11 +25,12 @@ ] @operator ; Punctuation - -["(" ")"] @punctuation.bracket +[ + "(" + ")" +] @punctuation.bracket ":" @punctuation.delimiter ; Comments - (comment) @comment @spell diff --git a/queries/elsa/injections.scm b/queries/elsa/injections.scm index 6adae45a2..2f0e58eb6 100644 --- a/queries/elsa/injections.scm +++ b/queries/elsa/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/elvish/highlights.scm b/queries/elvish/highlights.scm index d6243549f..a2fd9302c 100644 --- a/queries/elvish/highlights.scm +++ b/queries/elvish/highlights.scm @@ -1,32 +1,90 @@ (comment) @comment @spell -["if" "elif"] @keyword.conditional -(if (else "else" @keyword.conditional)) +[ + "if" + "elif" +] @keyword.conditional -["while" "for"] @keyword.repeat -(while (else "else" @keyword.repeat)) -(for (else "else" @keyword.repeat)) +(if + (else + "else" @keyword.conditional)) -["try" "catch" "finally"] @keyword.exception -(try (else "else" @keyword.exception)) +[ + "while" + "for" +] @keyword.repeat + +(while + (else + "else" @keyword.repeat)) + +(for + (else + "else" @keyword.repeat)) + +[ + "try" + "catch" + "finally" +] @keyword.exception + +(try + (else + "else" @keyword.exception)) "use" @keyword.import -(import (bareword) @string.special.path) -(wildcard ["*" "**" "?"] @character.special) +(import + (bareword) @string.special.path) + +(wildcard + [ + "*" + "**" + "?" + ] @character.special) + +(command + argument: (bareword) @variable.parameter) + +(command + head: (identifier) @function.call) + +((command + head: (identifier) @keyword.return) + (#eq? @keyword.return "return")) + +((command + (identifier) @keyword.operator) + (#any-of? @keyword.operator "and" "or" "coalesce")) -(command argument: (bareword) @variable.parameter) -(command head: (identifier) @function.call) -((command head: (identifier) @keyword.return) - (#eq? @keyword.return "return")) -((command (identifier) @keyword.operator) - (#any-of? @keyword.operator "and" "or" "coalesce")) [ - "+" "-" "*" "/" "%" "<" "<=""==" "!=" ">" - ">=" "s" ">=s" + "+" + "-" + "*" + "/" + "%" + "<" + "<=" + "==" + "!=" + ">" + ">=" + "s" + ">=s" ] @function.builtin -[">" "<" ">>" "<>" "|"] @operator +[ + ">" + "<" + ">>" + "<>" + "|" +] @operator (io_port) @number @@ -35,36 +93,63 @@ (identifier) @function) (parameter_list) @variable.parameter -(parameter_list "|" @punctuation.bracket) -["var" "set" "tmp" "del"] @keyword +(parameter_list + "|" @punctuation.bracket) + +[ + "var" + "set" + "tmp" + "del" +] @keyword + (variable_declaration - (lhs (identifier) @variable)) + (lhs + (identifier) @variable)) (variable_assignment - (lhs (identifier) @variable)) + (lhs + (identifier) @variable)) (temporary_assignment - (lhs (identifier) @variable)) + (lhs + (identifier) @variable)) (variable_deletion (identifier) @variable) - (number) @number + (string) @string -(variable (identifier) @variable) -((variable (identifier) @function) - (#match? @function ".+\\~$")) -((variable (identifier) @boolean) - (#any-of? @boolean "true" "false")) -((variable (identifier) @constant.builtin) - (#any-of? @constant.builtin - "_" "after-chdir" "args" "before-chdir" "buildinfo" "nil" - "notify-bg-job-success" "num-bg-jobs" "ok" "paths" "pid" - "pwd" "value-out-indicator" "version")) +(variable + (identifier) @variable) + +((variable + (identifier) @function) + (#match? @function ".+\\~$")) + +((variable + (identifier) @boolean) + (#any-of? @boolean "true" "false")) + +((variable + (identifier) @constant.builtin) + (#any-of? @constant.builtin "_" "after-chdir" "args" "before-chdir" "buildinfo" "nil" "notify-bg-job-success" "num-bg-jobs" "ok" "paths" "pid" "pwd" "value-out-indicator" "version")) + +[ + "$" + "@" +] @punctuation.special + +[ + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket -["$" "@"] @punctuation.special -["(" ")" "[" "]" "{" "}"] @punctuation.bracket ";" @punctuation.delimiter diff --git a/queries/elvish/injections.scm b/queries/elvish/injections.scm index 6adae45a2..2f0e58eb6 100644 --- a/queries/elvish/injections.scm +++ b/queries/elvish/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/embedded_template/injections.scm b/queries/embedded_template/injections.scm index 2824f7a00..cdeb2cd4f 100644 --- a/queries/embedded_template/injections.scm +++ b/queries/embedded_template/injections.scm @@ -1,7 +1,7 @@ ((content) @injection.content - (#set! injection.language "html") - (#set! injection.combined)) + (#set! injection.language "html") + (#set! injection.combined)) ((code) @injection.content - (#set! injection.language "ruby") - (#set! injection.combined)) + (#set! injection.language "ruby") + (#set! injection.combined)) diff --git a/queries/erlang/highlights.scm b/queries/erlang/highlights.scm index da0d1e600..1b9aeaf4e 100644 --- a/queries/erlang/highlights.scm +++ b/queries/erlang/highlights.scm @@ -1,8 +1,12 @@ -((atom) @constant (#set! "priority" "90")) +((atom) @constant + (#set! "priority" "90")) + (var) @variable (char) @character + (integer) @number + (float) @number.float (comment) @comment @spell @@ -10,13 +14,13 @@ ((comment) @comment.documentation (#lua-match? @comment.documentation "^[%%][%%]")) -;; keyword +; keyword [ "fun" "div" ] @keyword -;; bracket +; bracket [ "(" ")" @@ -27,7 +31,7 @@ "#" ] @punctuation.bracket -;;; Comparisons +; Comparisons [ "==" "=:=" @@ -36,14 +40,14 @@ ">=" "<" ">" -] @operator ;; .comparison +] @operator ; .comparison -;;; operator +; operator [ ":" ":=" "!" - ;; "-" + ; "-" "+" "=" "->" @@ -58,7 +62,7 @@ ";" ] @punctuation.delimiter -;; conditional +; conditional [ "receive" "if" @@ -77,54 +81,108 @@ "try" ] @keyword.exception -((atom) @boolean (#any-of? @boolean "true" "false")) +((atom) @boolean + (#any-of? @boolean "true" "false")) -;; Macros -((macro_call_expr) @constant.macro (#set! "priority" 101)) +; Macros +((macro_call_expr) @constant.macro + (#set! "priority" 101)) -;; Preprocessor +; Preprocessor (pp_define - lhs: _ @constant.macro (#set! "priority" 101) -) -(_preprocessor_directive) @keyword.directive (#set! "priority" 99) + lhs: _ @constant.macro + (#set! "priority" 101)) -;; Attributes +(_preprocessor_directive) @keyword.directive +(#set! "priority" 99) + +; Attributes (pp_include) @keyword.import + (pp_include_lib) @keyword.import + (export_attribute) @keyword.import + (export_type_attribute) @type.definition -(export_type_attribute types: (fa fun: _ @type (#set! "priority" 101))) + +(export_type_attribute + types: + (fa + fun: _ @type + (#set! "priority" 101))) + (behaviour_attribute) @keyword.import -(module_attribute (atom) @module) @keyword.import -(wild_attribute name: (attr_name name: _ @attribute)) @attribute -;; Records +(module_attribute + (atom) @module) @keyword.import + +(wild_attribute + name: + (attr_name + name: _ @attribute)) @attribute + +; Records (record_expr) @type -(record_field_expr _ @variable.member) @type -(record_field_name _ @variable.member) @type -(record_name "#" @type name: _ @type) @type -(record_decl name: _ @type) @type.definition -(record_field name: _ @variable.member) -(record_field name: _ @variable.member ty: _ @type) -;; Type alias -(type_alias name: _ @type) @type.definition +(record_field_expr + _ @variable.member) @type + +(record_field_name + _ @variable.member) @type + +(record_name + "#" @type + name: _ @type) @type + +(record_decl + name: _ @type) @type.definition + +(record_field + name: _ @variable.member) + +(record_field + name: _ @variable.member + ty: _ @type) + +; Type alias +(type_alias + name: _ @type) @type.definition + (spec) @type.definition -[(string) (binary)] @string +[ + (string) + (binary) +] @string -;;; expr_function_call -(call expr: [(atom) (remote) (var)] @function) -(call (atom) @keyword.exception (#any-of? @keyword.exception "error" "throw" "exit")) - -;;; Parenthesized expression: (SomeFunc)(), only highlight the parens +; expr_function_call (call - expr: (paren_expr "(" @function.call ")" @function.call) -) + expr: + [ + (atom) + (remote) + (var) + ] @function) -;;; function +(call + (atom) @keyword.exception + (#any-of? @keyword.exception "error" "throw" "exit")) + +; Parenthesized expression: (SomeFunc)(), only highlight the parens +(call + expr: + (paren_expr + "(" @function.call + ")" @function.call)) + +; function (external_fun) @function.call -(internal_fun fun: (atom) @function.call) -(function_clause name: (atom) @function) -(fa fun: (atom) @function) +(internal_fun + fun: (atom) @function.call) + +(function_clause + name: (atom) @function) + +(fa + fun: (atom) @function) diff --git a/queries/facility/highlights.scm b/queries/facility/highlights.scm index 060ccd05c..01f1bab19 100644 --- a/queries/facility/highlights.scm +++ b/queries/facility/highlights.scm @@ -11,9 +11,10 @@ "]" "{" "}" -] @punctuation.bracket +] @punctuation.bracket (comment) @comment @spell + (doc_comment) @comment.documentation @spell "method" @keyword.function @@ -78,4 +79,5 @@ name: (identifier) @function.method) (number_literal) @number + (string_literal) @string diff --git a/queries/facility/indents.scm b/queries/facility/indents.scm index 96a24f202..247949ba1 100644 --- a/queries/facility/indents.scm +++ b/queries/facility/indents.scm @@ -1,8 +1,7 @@ [ - (service_block) - (values_block) - (field_list) + (service_block) + (values_block) + (field_list) ] @indent.begin "}" @indent.branch - diff --git a/queries/facility/injections.scm b/queries/facility/injections.scm index 572849ab4..5d9b7836f 100644 --- a/queries/facility/injections.scm +++ b/queries/facility/injections.scm @@ -1,5 +1,8 @@ ((remarks) @injection.content (#set! injection.language "markdown")) -([(comment) (doc_comment)] @injection.content +([ + (comment) + (doc_comment) +] @injection.content (#set! injection.language "comment")) diff --git a/queries/fennel/folds.scm b/queries/fennel/folds.scm index c8427b188..619300c4f 100644 --- a/queries/fennel/folds.scm +++ b/queries/fennel/folds.scm @@ -1 +1,11 @@ -[(list) (table) (sequential_table) (let) (fn) (let_clause) (quoted_list) (local) (global)] @fold +[ + (list) + (table) + (sequential_table) + (let) + (fn) + (let_clause) + (quoted_list) + (local) + (global) +] @fold diff --git a/queries/fennel/highlights.scm b/queries/fennel/highlights.scm index 620c42ef3..ec2a82759 100644 --- a/queries/fennel/highlights.scm +++ b/queries/fennel/highlights.scm @@ -18,29 +18,38 @@ ] @punctuation.special (nil) @constant.builtin + (vararg) @punctuation.special (boolean) @boolean + (number) @number (string) @string + (escape_sequence) @string.escape (symbol) @variable (multi_symbol - "." @punctuation.delimiter - (symbol) @variable.member) + "." @punctuation.delimiter + (symbol) @variable.member) (multi_symbol_method - ":" @punctuation.delimiter - (symbol) @function.method.call .) + ":" @punctuation.delimiter + (symbol) @function.method.call .) -(list . (symbol) @function.call) -(list . (multi_symbol (symbol) @function.call .)) +(list + . + (symbol) @function.call) + +(list + . + (multi_symbol + (symbol) @function.call .)) ((symbol) @variable.builtin - (#lua-match? @variable.builtin "^[$]")) + (#lua-match? @variable.builtin "^[$]")) (binding) @string.special.symbol @@ -51,30 +60,34 @@ "#" ] @keyword.function -(fn name: [ - (symbol) @function - (multi_symbol (symbol) @function .) -]) +(fn + name: + [ + (symbol) @function + (multi_symbol + (symbol) @function .) + ]) -(lambda name: [ - (symbol) @function - (multi_symbol (symbol) @function .) -]) +(lambda + name: + [ + (symbol) @function + (multi_symbol + (symbol) @function .) + ]) [ "for" "each" ] @keyword.repeat -((symbol) @keyword.repeat - (#any-of? @keyword.repeat - "while")) -[ - "match" -] @keyword.conditional +((symbol) @keyword.repeat + (#any-of? @keyword.repeat "while")) + +"match" @keyword.conditional + ((symbol) @keyword.conditional - (#any-of? @keyword.conditional - "if" "when")) + (#any-of? @keyword.conditional "if" "when")) [ "global" @@ -85,13 +98,12 @@ "where" "or" ] @keyword + ((symbol) @keyword - (#any-of? @keyword - "comment" "do" "doc" "eval-compiler" "lua" "macros" "quote" "tset" "values")) + (#any-of? @keyword "comment" "do" "doc" "eval-compiler" "lua" "macros" "quote" "tset" "values")) ((symbol) @keyword.import - (#any-of? @keyword.import - "require" "require-macros" "import-macros" "include")) + (#any-of? @keyword.import "require" "require-macros" "import-macros" "include")) [ "collect" @@ -100,22 +112,14 @@ ] @function.macro ((symbol) @function.macro - (#any-of? @function.macro - "->" "->>" "-?>" "-?>>" "?." "doto" "macro" "macrodebug" "partial" "pick-args" - "pick-values" "with-open")) + (#any-of? @function.macro "->" "->>" "-?>" "-?>>" "?." "doto" "macro" "macrodebug" "partial" "pick-args" "pick-values" "with-open")) ; Lua builtins ((symbol) @constant.builtin - (#any-of? @constant.builtin - "arg" "_ENV" "_G" "_VERSION")) + (#any-of? @constant.builtin "arg" "_ENV" "_G" "_VERSION")) ((symbol) @function.builtin - (#any-of? @function.builtin - "assert" "collectgarbage" "dofile" "error" "getmetatable" "ipairs" - "load" "loadfile" "next" "pairs" "pcall" "print" "rawequal" "rawget" - "rawlen" "rawset" "require" "select" "setmetatable" "tonumber" "tostring" - "type" "warn" "xpcall")) + (#any-of? @function.builtin "assert" "collectgarbage" "dofile" "error" "getmetatable" "ipairs" "load" "loadfile" "next" "pairs" "pcall" "print" "rawequal" "rawget" "rawlen" "rawset" "require" "select" "setmetatable" "tonumber" "tostring" "type" "warn" "xpcall")) ((symbol) @function.builtin - (#any-of? @function.builtin - "loadstring" "module" "setfenv" "unpack")) + (#any-of? @function.builtin "loadstring" "module" "setfenv" "unpack")) diff --git a/queries/fennel/injections.scm b/queries/fennel/injections.scm index 6adae45a2..2f0e58eb6 100644 --- a/queries/fennel/injections.scm +++ b/queries/fennel/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/fennel/locals.scm b/queries/fennel/locals.scm index 38e54bf6d..bf3701a50 100644 --- a/queries/fennel/locals.scm +++ b/queries/fennel/locals.scm @@ -1,26 +1,32 @@ [ - (program) - (fn) - (lambda) - (let) - (each) - (for) - (match) + (program) + (fn) + (lambda) + (let) + (each) + (for) + (match) ] @local.scope -( - (list . (symbol) @_special) @local.scope - (#any-of? @_special - "while" "if" "when" "do" "collect" "icollect" "accumulate") -) +((list + . + (symbol) @_special) @local.scope + (#any-of? @_special "while" "if" "when" "do" "collect" "icollect" "accumulate")) -(fn name: (symbol) @local.definition.function +(fn + name: (symbol) @local.definition.function (#set! definition.function.scope "parent")) -(lambda name: (symbol) @local.definition.function + +(lambda + name: (symbol) @local.definition.function (#set! definition.function.scope "parent")) ; TODO: use @local.definition.parameter for parameters -(binding (symbol) @local.definition.var) -(for_clause . (symbol) @local.definition.var) +(binding + (symbol) @local.definition.var) + +(for_clause + . + (symbol) @local.definition.var) (symbol) @local.reference diff --git a/queries/firrtl/folds.scm b/queries/firrtl/folds.scm index 437b2c81c..4c64e644f 100644 --- a/queries/firrtl/folds.scm +++ b/queries/firrtl/folds.scm @@ -1,6 +1,6 @@ [ - (circuit) - (module) - (when) - (else) + (circuit) + (module) + (when) + (else) ] @fold diff --git a/queries/firrtl/highlights.scm b/queries/firrtl/highlights.scm index 5f165eb32..8e078fad2 100644 --- a/queries/firrtl/highlights.scm +++ b/queries/firrtl/highlights.scm @@ -1,30 +1,26 @@ ; Namespaces +(circuit + (identifier) @module) -(circuit (identifier) @module) - -(module (identifier) @module) +(module + (identifier) @module) ; Types - ((identifier) @type (#lua-match? @type "^[A-Z][A-Za-z0-9_$]*$")) ; Keywords - [ "circuit" "module" "extmodule" - "flip" "parameter" "reset" "wire" - "cmem" "smem" "mem" - "reg" "with" "mport" @@ -34,39 +30,32 @@ "is" "invalid" "skip" - "infer" "read" "write" "rdwr" - "defname" ] @keyword ; Qualifiers - (qualifier) @type.qualifier ; Storageclasses - [ "input" "output" ] @keyword.storage ; Conditionals - [ "when" "else" ] @keyword.conditional ; Annotations - (info) @attribute ; Builtins - [ "stop" "printf" @@ -89,7 +78,6 @@ ] @type.builtin ; Fields - [ "data-type" "depth" @@ -104,33 +92,44 @@ ((field_id) @variable.member (#set! "priority" 105)) -(port (identifier) @variable.member) +(port + (identifier) @variable.member) -(wire (identifier) @variable.member) +(wire + (identifier) @variable.member) -(cmem (identifier) @variable.member) +(cmem + (identifier) @variable.member) -(smem (identifier) @variable.member) +(smem + (identifier) @variable.member) -(memory (identifier) @variable.member) +(memory + (identifier) @variable.member) -(register (identifier) @variable.member) +(register + (identifier) @variable.member) ; Parameters +(primitive_operation + (identifier) @variable.parameter) -(primitive_operation (identifier) @variable.parameter) +(mux + (identifier) @variable.parameter) -(mux (identifier) @variable.parameter) -(printf (identifier) @variable.parameter) -(reset (identifier) @variable.parameter) -(stop (identifier) @variable.parameter) +(printf + (identifier) @variable.parameter) + +(reset + (identifier) @variable.parameter) + +(stop + (identifier) @variable.parameter) ; Variables - (identifier) @variable ; Operators - (primop) @keyword.operator [ @@ -143,7 +142,6 @@ ] @operator ; Literals - [ (uint) (number) @@ -164,14 +162,25 @@ ] @constant.builtin ; Punctuation +[ + "{" + "}" +] @punctuation.bracket -[ "{" "}" ] @punctuation.bracket +[ + "[" + "]" +] @punctuation.bracket -[ "[" "]" ] @punctuation.bracket +[ + "<" + ">" +] @punctuation.bracket -[ "<" ">" ] @punctuation.bracket - -[ "(" ")" ] @punctuation.bracket +[ + "(" + ")" +] @punctuation.bracket [ "," @@ -180,7 +189,10 @@ ] @punctuation.delimiter ; Comments - (comment) @comment @spell -["=>" "<=" "="] @operator +[ + "=>" + "<=" + "=" +] @operator diff --git a/queries/firrtl/indents.scm b/queries/firrtl/indents.scm index 8bc1e2019..e172e1e81 100644 --- a/queries/firrtl/indents.scm +++ b/queries/firrtl/indents.scm @@ -1,9 +1,9 @@ [ - (circuit) - (module) - (memory) - (when) - (else) + (circuit) + (module) + (memory) + (when) + (else) ] @indent.begin [ diff --git a/queries/firrtl/injections.scm b/queries/firrtl/injections.scm index 6adae45a2..2f0e58eb6 100644 --- a/queries/firrtl/injections.scm +++ b/queries/firrtl/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/firrtl/locals.scm b/queries/firrtl/locals.scm index aa0e294cd..97b7931bf 100644 --- a/queries/firrtl/locals.scm +++ b/queries/firrtl/locals.scm @@ -1,38 +1,45 @@ ; Scopes - [ (source_file) (circuit) (module) - (else) (when) ] @local.scope ; References - (identifier) @local.reference ; Definitions +(port + (identifier) @local.definition.field) -(port (identifier) @local.definition.field) +(wire + (identifier) @local.definition.field) -(wire (identifier) @local.definition.field) +(cmem + (identifier) @local.definition.field) -(cmem (identifier) @local.definition.field) +(smem + (identifier) @local.definition.field) -(smem (identifier) @local.definition.field) +(memory + (identifier) @local.definition.field) -(memory (identifier) @local.definition.field) +(register + (identifier) @local.definition.field) -(register (identifier) @local.definition.field) +(circuit + (identifier) @local.definition.namespace) -(circuit (identifier) @local.definition.namespace) +(module + (identifier) @local.definition.namespace) -(module (identifier) @local.definition.namespace) +(parameter + (identifier) @local.definition.parameter) -(parameter (identifier) @local.definition.parameter) +(rdwr + (identifier) @local.definition.var) -(rdwr (identifier) @local.definition.var) - -(node (identifier) @local.definition.var) +(node + (identifier) @local.definition.var) diff --git a/queries/fish/folds.scm b/queries/fish/folds.scm index 6075e2e04..06363e15e 100644 --- a/queries/fish/folds.scm +++ b/queries/fish/folds.scm @@ -1,8 +1,8 @@ [ - (function_definition) - (if_statement) - (switch_statement) - (for_statement) - (while_statement) - (begin_statement) + (function_definition) + (if_statement) + (switch_statement) + (for_statement) + (while_statement) + (begin_statement) ] @fold diff --git a/queries/fish/highlights.scm b/queries/fish/highlights.scm index 28ddf0b98..77dccbf89 100644 --- a/queries/fish/highlights.scm +++ b/queries/fish/highlights.scm @@ -1,163 +1,174 @@ -;; Fish highlighting - -;; Operators - +; Fish highlighting +; Operators [ - "&&" - "||" - "|" - "&" - ".." - "!" - (direction) - (stream_redirect) + "&&" + "||" + "|" + "&" + ".." + "!" + (direction) + (stream_redirect) ] @operator -;; match operators of test command +; match operators of test command (command - name: (word) @function.builtin (#eq? @function.builtin "test") - argument: (word) @operator (#match? @operator "^(!?\\=|-[a-zA-Z]+)$")) + name: (word) @function.builtin + (#eq? @function.builtin "test") + argument: (word) @operator + (#match? @operator "^(!?\\=|-[a-zA-Z]+)$")) -;; match operators of [ command +; match operators of [ command (command - name: (word) @punctuation.bracket (#eq? @punctuation.bracket "[") - argument: (word) @operator (#match? @operator "^(!?\\=|-[a-zA-Z]+)$")) + name: (word) @punctuation.bracket + (#eq? @punctuation.bracket "[") + argument: (word) @operator + (#match? @operator "^(!?\\=|-[a-zA-Z]+)$")) [ - "not" - "and" - "or" + "not" + "and" + "or" ] @keyword.operator -;; Conditionals - +; Conditionals (if_statement -[ - "if" - "end" -] @keyword.conditional) + [ + "if" + "end" + ] @keyword.conditional) (switch_statement -[ - "switch" - "end" -] @keyword.conditional) + [ + "switch" + "end" + ] @keyword.conditional) (case_clause -[ - "case" -] @keyword.conditional) + "case" @keyword.conditional) -(else_clause -[ - "else" -] @keyword.conditional) +(else_clause + "else" @keyword.conditional) -(else_if_clause -[ - "else" - "if" -] @keyword.conditional) - -;; Loops/Blocks +(else_if_clause + [ + "else" + "if" + ] @keyword.conditional) +; Loops/Blocks (while_statement -[ - "while" - "end" -] @keyword.repeat) + [ + "while" + "end" + ] @keyword.repeat) (for_statement -[ - "for" - "end" -] @keyword.repeat) + [ + "for" + "end" + ] @keyword.repeat) (begin_statement -[ - "begin" - "end" -] @keyword.repeat) - -;; Keywords + [ + "begin" + "end" + ] @keyword.repeat) +; Keywords [ - "in" - (break) - (continue) + "in" + (break) + (continue) ] @keyword "return" @keyword.return -;; Punctuation - +; Punctuation [ - "[" - "]" - "{" - "}" - "(" - ")" + "[" + "]" + "{" + "}" + "(" + ")" ] @punctuation.bracket "," @punctuation.delimiter -;; Commands - +; Commands (command - argument: [ - (word) @variable.parameter (#lua-match? @variable.parameter "^[-]") - ] -) + argument: + [ + (word) @variable.parameter + (#lua-match? @variable.parameter "^[-]") + ]) -(command_substitution "$" @punctuation.bracket) +(command_substitution + "$" @punctuation.bracket) ; non-builtin command names -(command name: (word) @function.call) +(command + name: (word) @function.call) ; derived from builtin -n (fish 3.2.2) (command - name: [ - (word) @function.builtin - (#any-of? @function.builtin "." ":" "_" "alias" "argparse" "bg" "bind" "block" "breakpoint" "builtin" "cd" "command" "commandline" "complete" "contains" "count" "disown" "echo" "emit" "eval" "exec" "exit" "fg" "functions" "history" "isatty" "jobs" "math" "printf" "pwd" "random" "read" "realpath" "set" "set_color" "source" "status" "string" "test" "time" "type" "ulimit" "wait") - ] -) + name: + [ + (word) @function.builtin + (#any-of? @function.builtin "." ":" "_" "alias" "argparse" "bg" "bind" "block" "breakpoint" "builtin" "cd" "command" "commandline" "complete" "contains" "count" "disown" "echo" "emit" "eval" "exec" "exit" "fg" "functions" "history" "isatty" "jobs" "math" "printf" "pwd" "random" "read" "realpath" "set" "set_color" "source" "status" "string" "test" "time" "type" "ulimit" "wait") + ]) -;; Functions - -(function_definition ["function" "end"] @keyword.function) +; Functions +(function_definition + [ + "function" + "end" + ] @keyword.function) (function_definition - name: [ - (word) (concatenation) - ] -@function) + name: + [ + (word) + (concatenation) + ] @function) (function_definition - option: [ - (word) - (concatenation (word)) - ] @variable.parameter (#lua-match? @variable.parameter "^[-]") -) + option: + [ + (word) + (concatenation + (word)) + ] @variable.parameter + (#lua-match? @variable.parameter "^[-]")) -;; Strings +; Strings +[ + (double_quote_string) + (single_quote_string) +] @string -[(double_quote_string) (single_quote_string)] @string (escape_sequence) @string.escape -;; Variables - +; Variables (variable_name) @variable + (variable_expansion) @constant -;; Nodes +; Nodes +[ + (integer) + (float) +] @number -[(integer) (float)] @number (comment) @comment + (comment) @spell ((word) @boolean -(#any-of? @boolean "true" "false")) + (#any-of? @boolean "true" "false")) -((program . (comment) @keyword.directive) +((program + . + (comment) @keyword.directive) (#lua-match? @keyword.directive "^#!/")) diff --git a/queries/fish/indents.scm b/queries/fish/indents.scm index 526c56e69..4984c4cb2 100644 --- a/queries/fish/indents.scm +++ b/queries/fish/indents.scm @@ -1,16 +1,16 @@ [ - (function_definition) - (while_statement) - (for_statement) - (if_statement) - (begin_statement) - (switch_statement) + (function_definition) + (while_statement) + (for_statement) + (if_statement) + (begin_statement) + (switch_statement) ] @indent.begin [ - "else" ; else and else if must both start the line with "else", so tag the string directly - "case" - "end" + "else" ; else and else if must both start the line with "else", so tag the string directly + "case" + "end" ] @indent.branch "end" @indent.end diff --git a/queries/fish/injections.scm b/queries/fish/injections.scm index 6adae45a2..2f0e58eb6 100644 --- a/queries/fish/injections.scm +++ b/queries/fish/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/fish/locals.scm b/queries/fish/locals.scm index 15c3aac1d..904d568f9 100644 --- a/queries/fish/locals.scm +++ b/queries/fish/locals.scm @@ -1,4 +1,4 @@ -;; Scopes +; Scopes [ (command) (function_definition) @@ -9,10 +9,11 @@ (switch_statement) ] @local.scope -;; Definitions +; Definitions (function_definition name: (word) @local.definition.function) -;; References +; References (variable_name) @local.reference + (word) @local.reference diff --git a/queries/foam/folds.scm b/queries/foam/folds.scm index 2e499c2e2..e05d0dbaa 100644 --- a/queries/foam/folds.scm +++ b/queries/foam/folds.scm @@ -1,7 +1,8 @@ [ - (comment) - (list) - (dict_core) + (comment) + (list) + (dict_core) ] @fold -(code (code_body)* @fold) +(code + (code_body)* @fold) diff --git a/queries/foam/highlights.scm b/queries/foam/highlights.scm index 33370df66..9c96f196e 100644 --- a/queries/foam/highlights.scm +++ b/queries/foam/highlights.scm @@ -1,44 +1,47 @@ -;; Comments +; Comments (comment) @comment @spell -;; Generic Key-value pairs and dictionary keywords +; Generic Key-value pairs and dictionary keywords (key_value - keyword: (identifier) @function -) + keyword: (identifier) @function) + (dict - key: (identifier) @type -) + key: (identifier) @type) -;; Macros +; Macros (macro - "$" @keyword.conditional - (prev_scope)* @keyword.conditional - (identifier)* @module -) + "$" @keyword.conditional + (prev_scope)* @keyword.conditional + (identifier)* @module) - -;; Directives +; Directives "#" @keyword.conditional + (preproc_call - directive: (identifier)* @keyword.conditional - argument: (identifier)* @module -) + directive: (identifier)* @keyword.conditional + argument: (identifier)* @module) + ((preproc_call argument: (identifier)* @module) @keyword.conditional (#eq? @keyword.conditional "ifeq")) + ((preproc_call) @keyword.conditional (#any-of? @keyword.conditional "else" "endif")) -;; Literals +; Literals (number_literal) @number.float + (string_literal) @string + (escape_sequence) @string.escape + (boolean) @boolean -;; Treat [m^2 s^-2] the same as if it was put in numbers format -(dimensions dimension: (identifier) @number.float) +; Treat [m^2 s^-2] the same as if it was put in numbers format +(dimensions + dimension: (identifier) @number.float) -;; Punctuation +; Punctuation [ "(" ")" diff --git a/queries/foam/indents.scm b/queries/foam/indents.scm index a52cafea6..be02b80ed 100644 --- a/queries/foam/indents.scm +++ b/queries/foam/indents.scm @@ -3,9 +3,9 @@ "}" ] @indent.branch -[(dict) (key_value)] @indent.begin - - [ - (comment) -] @indent.ignore + (dict) + (key_value) +] @indent.begin + +(comment) @indent.ignore diff --git a/queries/foam/injections.scm b/queries/foam/injections.scm index 2d744f6af..e1c223bd2 100644 --- a/queries/foam/injections.scm +++ b/queries/foam/injections.scm @@ -1,20 +1,20 @@ -;; Pass code blocks to Cpp highlighter -(code - (code_body) @injection.content +; Pass code blocks to Cpp highlighter +(code + (code_body) @injection.content (#set! injection.language "cpp")) -;; Pass identifiers to Go highlighter (Cheating I know) -;; ((identifier) @injection.content -;; (#set! injection.language "lua") +; Pass identifiers to Go highlighter (Cheating I know) +; ((identifier) @injection.content +; (#set! injection.language "lua") +; Highlight regex syntax inside literal strings +((string_literal) @injection.content + (#set! injection.language "regex")) -;; Highlight regex syntax inside literal strings -((string_literal) @injection.content - (#set! injection.language "regex")) - -;; Highlight PyFoam syntax as Python statements +; Highlight PyFoam syntax as Python statements (pyfoam_variable code_body: (_) @injection.content (#set! injection.language "python")) + (pyfoam_expression code_body: (_) @injection.content (#set! injection.language "python")) diff --git a/queries/foam/locals.scm b/queries/foam/locals.scm index c1f635036..508643672 100644 --- a/queries/foam/locals.scm +++ b/queries/foam/locals.scm @@ -1,6 +1,12 @@ (dict) @local.scope -(dict key: (_) @local.definition.type) +(dict + key: (_) @local.definition.type) -(key_value keyword: (_) @local.definition.parameter) -(key_value value: (macro (identifier)*)* @local.reference) +(key_value + keyword: (_) @local.definition.parameter) + +(key_value + value: + (macro + (identifier)*)* @local.reference) diff --git a/queries/fortran/folds.scm b/queries/fortran/folds.scm index a2edc64d3..cedbdb635 100644 --- a/queries/fortran/folds.scm +++ b/queries/fortran/folds.scm @@ -1,11 +1,11 @@ -;; by @oponkork +; by @oponkork [ - (if_statement) - (where_statement) - (enum_statement) - (do_loop_statement) - (derived_type_definition) - (function) - (subroutine) - (interface) + (if_statement) + (where_statement) + (enum_statement) + (do_loop_statement) + (derived_type_definition) + (function) + (subroutine) + (interface) ] @fold diff --git a/queries/fortran/highlights.scm b/queries/fortran/highlights.scm index c2eaa6a7e..c88ad9cec 100644 --- a/queries/fortran/highlights.scm +++ b/queries/fortran/highlights.scm @@ -1,9 +1,7 @@ ; Preprocs - (preproc_file_line) @keyword.directive ; Namespaces - (program_statement (name) @module) @@ -23,7 +21,6 @@ (name) @module) ; Includes - [ "import" "include" @@ -32,10 +29,12 @@ (import_statement "," - ["all" "none"] @keyword) + [ + "all" + "none" + ] @keyword) ; Attributes - [ (none) "implicit" @@ -46,7 +45,6 @@ "type" @attribute) ; Keywords - [ "attributes" "associate" @@ -88,22 +86,14 @@ "typeis" ] @keyword -[ - (default) -] @keyword +(default) @keyword ; Types +(type_name) @type -[ - (type_name) -] @type - -[ - (intrinsic_type) -] @type.builtin +(intrinsic_type) @type.builtin ; Qualifiers - [ "abstract" "allocatable" @@ -150,7 +140,6 @@ ] @keyword.storage ; Labels - [ (statement_label) (statement_label_reference) @@ -174,7 +163,6 @@ ] @keyword.return ; Functions - (function_statement (name) @function) @@ -208,13 +196,9 @@ ] @function.builtin ; Exceptions - -[ - "error" -] @keyword.exception +"error" @keyword.exception ; Conditionals - [ "else" "elseif" @@ -227,7 +211,6 @@ ] @keyword.conditional ; Repeats - [ "do" "concurrent" @@ -241,11 +224,9 @@ ] @keyword.repeat ; Variables - (identifier) @variable ; Parameters - (keyword_argument name: (identifier) @variable.parameter) @@ -253,12 +234,10 @@ (identifier) @variable.parameter) ; Properties - (derived_type_member_expression (type_member) @property) ; Operators - [ "+" "-" @@ -291,15 +270,26 @@ ] @keyword.operator ; Punctuation +[ + "[" + "]" +] @punctuation.bracket -[ "[" "]" ] @punctuation.bracket +[ + "(" + ")" +] @punctuation.bracket -[ "(" ")" ] @punctuation.bracket - -[ "<<<" ">>>" ] @punctuation.bracket +[ + "<<<" + ">>>" +] @punctuation.bracket (array_literal - ["(/" "/)"] @punctuation.bracket) + [ + "(/" + "/)" + ] @punctuation.bracket) [ ":" @@ -311,7 +301,6 @@ ] @punctuation.delimiter ; Literals - (string_literal) @string (number_literal) @number @@ -321,7 +310,6 @@ (null_literal) @constant.builtin ; Comments - (comment) @comment @spell ((comment) @comment.documentation diff --git a/queries/fsh/highlights.scm b/queries/fsh/highlights.scm index 9a11e279f..3404fa7c6 100644 --- a/queries/fsh/highlights.scm +++ b/queries/fsh/highlights.scm @@ -71,17 +71,23 @@ "Canonical" ] @type.builtin +(sd_metadata + (parent + (name))) @type -(sd_metadata (parent (name))) @type -(target_type (name)) @type +(target_type + (name)) @type ; Strings (string) @string + (multiline_string) @string ; Constants (strength_value) @constant + (bool) @constant.boolean + (flag) @constant ; Special Params diff --git a/queries/func/highlights.scm b/queries/func/highlights.scm index b5b6dde35..a6fb6bd0b 100644 --- a/queries/func/highlights.scm +++ b/queries/func/highlights.scm @@ -1,13 +1,10 @@ ; Include - "#include" @keyword.import + (include_path) @string ; Preproc - -[ - "#pragma" -] @keyword.directive +"#pragma" @keyword.directive (pragma_directive [ @@ -17,7 +14,6 @@ ] @keyword.directive) ; Keywords - [ "asm" "impure" @@ -27,12 +23,9 @@ "type" ] @keyword -[ - "return" -] @keyword.return +"return" @keyword.return ; Conditionals - [ "if" "ifnot" @@ -43,14 +36,12 @@ ] @keyword.conditional ; Exceptions - [ "try" "catch" ] @keyword.exception ; Repeats - [ "do" "forall" @@ -66,16 +57,13 @@ ] @type.qualifier ; Variables - (identifier) @variable ; Constants - (const_var_declarations name: (identifier) @constant) ; Functions/Methods - (function_definition name: (function_name) @function) @@ -86,17 +74,14 @@ method_name: (identifier) @function.method.call) ; Parameters - (parameter) @variable.parameter ; Types - (type_identifier) @type (primitive_type) @type.builtin ; Operators - [ "=" "+=" @@ -143,7 +128,6 @@ ] @operator ; Literals - [ (string) (asm_instruction) @@ -157,12 +141,21 @@ (number) @number ; Punctuation +[ + "{" + "}" +] @punctuation.bracket -["{" "}"] @punctuation.bracket +[ + "(" + ")" + "()" +] @punctuation.bracket -["(" ")" "()"] @punctuation.bracket - -["[" "]"] @punctuation.bracket +[ + "[" + "]" +] @punctuation.bracket [ ";" @@ -171,5 +164,4 @@ ] @punctuation.delimiter ; Comments - (comment) @comment @spell diff --git a/queries/fusion/highlights.scm b/queries/fusion/highlights.scm index e8c217e67..dca576f84 100644 --- a/queries/fusion/highlights.scm +++ b/queries/fusion/highlights.scm @@ -1,11 +1,14 @@ (comment) @comment @spell + (afx_comment) @comment @spell ; identifiers afx (afx_opening_element (afx_identifier) @tag) + (afx_closing_element (afx_identifier) @tag) + (afx_element_self_closing (afx_identifier) @tag) @@ -15,11 +18,9 @@ (afx_text) @spell ; identifiers eel - (eel_object_path (eel_path_identifier) @variable.builtin - (#any-of? @variable.builtin "this" "props") -) + (#any-of? @variable.builtin "this" "props")) (eel_object_path (eel_path_identifier) @variable) @@ -33,19 +34,16 @@ ; identifiers fusion ; ----------- - (path_part) @property -(meta_property) @attribute -(prototype_signature - "prototype" @keyword -) +(meta_property) @attribute + +(prototype_signature + "prototype" @keyword) + (include_statement - [ - "include" - ] @keyword.import - (source_file) @string.special.url -) + "include" @keyword.import + (source_file) @string.special.url) (namespace_declaration "namespace" @keyword @@ -58,21 +56,21 @@ ; ------ (afx_opening_element [ - "<" - ">" - ] @punctuation.bracket) + "<" + ">" + ] @punctuation.bracket) - (afx_closing_element +(afx_closing_element [ - "<" - ">" - "/" - ] @punctuation.bracket) + "<" + ">" + "/" + ] @punctuation.bracket) (afx_element_self_closing [ - "<" - "/>" + "<" + "/>" ] @punctuation.bracket) [ @@ -80,41 +78,55 @@ (alias_namespace) ] @module -(namespace_declaration "=" @operator) -(assignment "=" @operator) -(copy "<" @operator) +(namespace_declaration + "=" @operator) + +(assignment + "=" @operator) + +(copy + "<" @operator) + (deletion) @operator + (eel_binary_expression operator: _ @operator) + (eel_not_expression [ - "!" - "not" + "!" + "not" ] @operator) (string) @string + (number) @number + (boolean) @boolean + (null) @constant.builtin (value_expression start: _ @punctuation.special - end: _ @punctuation.special -) + end: _ @punctuation.special) + [ - "(" - ")" - "{" - "}" - "[" - "]" + "(" + ")" + "{" + "}" + "[" + "]" ] @punctuation.bracket [ - ":" - "." - "?" + ":" + "." + "?" ] @punctuation.delimiter (eel_ternary_expression - ["?" ":"] @keyword.conditional.ternary) + [ + "?" + ":" + ] @keyword.conditional.ternary) diff --git a/queries/fusion/indents.scm b/queries/fusion/indents.scm index 73133191b..0ba6cf758 100644 --- a/queries/fusion/indents.scm +++ b/queries/fusion/indents.scm @@ -7,13 +7,18 @@ (eel_object) ] @indent.begin +(block + end: _ @indent.branch) -(block end: _ @indent.branch) -(value_dsl end: _ @indent.branch) -(eel_array end: _ @indent.branch) -(eel_object end: _ @indent.branch) -[ - (afx_closing_element) -] @indent.branch +(value_dsl + end: _ @indent.branch) + +(eel_array + end: _ @indent.branch) + +(eel_object + end: _ @indent.branch) + +(afx_closing_element) @indent.branch (comment) @indent.ignore diff --git a/queries/fusion/locals.scm b/queries/fusion/locals.scm index 19afce078..d23e0ab46 100644 --- a/queries/fusion/locals.scm +++ b/queries/fusion/locals.scm @@ -1,21 +1,23 @@ -;; Fusion base +; Fusion base (block) @local.scope (namespace_declaration (alias_namespace) @local.definition.namespace) (property - (path (path_part) @local.definition.field)) + (path + (path_part) @local.definition.field)) (type namespace: (package_name)? @local.definition.namespace - name: (type_name) @local.definition.type -) + name: (type_name) @local.definition.type) -;; Eel Expressions +; Eel Expressions (eel_arrow_function) @local.scope + (eel_object) @local.scope (eel_parameter) @local.definition.parameter + (eel_object_pair key: (eel_property_name) @local.definition.field) diff --git a/queries/gdscript/folds.scm b/queries/gdscript/folds.scm index 946b0fea3..828ef807f 100644 --- a/queries/gdscript/folds.scm +++ b/queries/gdscript/folds.scm @@ -2,7 +2,6 @@ ; Body fold will "join" the next adjacent fold into a SUPER fold. ; This is an issue with the grammar. ; (body) - (if_statement) (elif_clause) (else_clause) @@ -16,10 +15,11 @@ (lambda) (constructor_definition) ] @fold - ; It's nice to be able to fold the if/elif/else clauses and the entire ; if_statement. -(if_statement (body) @fold) +(if_statement + (body) @fold) ; Fold strings that are probably doc strings. -(expression_statement (string) @fold) +(expression_statement + (string) @fold) diff --git a/queries/gdscript/highlights.scm b/queries/gdscript/highlights.scm index 21e0b8e0b..212bc67e3 100644 --- a/queries/gdscript/highlights.scm +++ b/queries/gdscript/highlights.scm @@ -1,23 +1,44 @@ -;; Basic - +; Basic (identifier) @variable + (name) @variable + (type) @type + (comment) @comment @spell + (string_name) @string + (string) @string + (float) @number.float + (integer) @number + (null) @constant + (setter) @function + (getter) @function -(set_body "set" @keyword.function) -(get_body "get" @keyword.function) + +(set_body + "set" @keyword.function) + +(get_body + "get" @keyword.function) + (static_keyword) @type.qualifier + (tool_statement) @keyword + (breakpoint_statement) @keyword.debug + (inferred_type) @operator -[(true) (false)] @boolean + +[ + (true) + (false) +] @boolean [ (get_node) @@ -31,68 +52,105 @@ "const" @type.qualifier (name) @constant) -(expression_statement (string) @comment @spell) +(expression_statement + (string) @comment @spell) -;; Identifier naming conventions +; Identifier naming conventions ((identifier) @type (#lua-match? @type "^[A-Z]")) + ((identifier) @constant (#lua-match? @constant "^[A-Z][A-Z_0-9]*$")) -;; Functions +; Functions (constructor_definition) @constructor (function_definition - (name) @function (parameters + (name) @function + (parameters (identifier) @variable.parameter)*) -(typed_parameter (identifier) @variable.parameter) -(default_parameter (identifier) @variable.parameter) +(typed_parameter + (identifier) @variable.parameter) -(call (identifier) @function.call) -(call (identifier) @keyword.import - (#any-of? @keyword.import "preload" "load")) +(default_parameter + (identifier) @variable.parameter) -;; Properties and Methods +(call + (identifier) @function.call) +(call + (identifier) @keyword.import + (#any-of? @keyword.import "preload" "load")) + +; Properties and Methods ; We'll use @property since that's the term Godot uses. ; But, should (source (variable_statement (name))) be @property, too? Since a ; script file is a class in gdscript. (class_definition - (body (variable_statement (name) @property))) + (body + (variable_statement + (name) @property))) ; Same question but for methods? (class_definition - (body (function_definition (name) @function.method))) + (body + (function_definition + (name) @function.method))) -(attribute_call (identifier) @function.method.call) -(attribute (_) (identifier) @property) +(attribute_call + (identifier) @function.method.call) -;; Enums +(attribute + (_) + (identifier) @property) -(enumerator left: (identifier) @constant) - -;; Special Builtins +; Enums +(enumerator + left: (identifier) @constant) +; Special Builtins ((identifier) @variable.builtin (#any-of? @variable.builtin "self" "super")) -(attribute_call (identifier) @keyword.operator - (#eq? @keyword.operator "new")) +(attribute_call + (identifier) @keyword.operator + (#eq? @keyword.operator "new")) -;; Match Pattern +; Match Pattern +(underscore) @constant ; The "_" pattern. -(underscore) @constant ; The "_" pattern. (pattern_open_ending) @operator ; The ".." pattern. -;; Alternations -["(" ")" "[" "]" "{" "}"] @punctuation.bracket +; Alternations +[ + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket -["," "." ":"] @punctuation.delimiter +[ + "," + "." + ":" +] @punctuation.delimiter -["if" "elif" "else" "match"] @keyword.conditional +[ + "if" + "elif" + "else" + "match" +] @keyword.conditional -["for" "while" "break" "continue"] @keyword.repeat +[ + "for" + "while" + "break" + "continue" +] @keyword.repeat [ "~" @@ -157,28 +215,24 @@ "func" @keyword.function -[ - "return" -] @keyword.return +"return" @keyword.return -[ - "await" -] @keyword.coroutine +"await" @keyword.coroutine -(call (identifier) @keyword.coroutine - (#eq? @keyword.coroutine "yield")) +(call + (identifier) @keyword.coroutine + (#eq? @keyword.coroutine "yield")) - -;; Builtins +; Builtins ; generated from ; - https://github.com/godotengine/godot/blob/491ded18983a4ae963ce9c29e8df5d5680873ccb/doc/classes/@GlobalScope.xml ; - https://github.com/godotengine/godot/blob/491ded18983a4ae963ce9c29e8df5d5680873ccb/modules/gdscript/doc_classes/@GDScript.xml ; some from: ; - https://github.com/godotengine/godot-vscode-plugin/blob/0636797c22bf1e23a41fd24d55cdb9be62e0c992/syntaxes/GDScript.tmLanguage.json - -;; Built-in Annotations - -((annotation "@" @attribute (identifier) @attribute) +; Built-in Annotations +((annotation + "@" @attribute + (identifier) @attribute) ; format-ignore (#any-of? @attribute ; @GDScript @@ -191,9 +245,11 @@ "export_placeholder" "export_range" "export_subgroup" "icon" "onready" "rpc" "tool" "warning_ignore")) -;; Builtin Types - -([(identifier) (type)] @type.builtin +; Builtin Types +([ + (identifier) + (type) +] @type.builtin ; format-ignore (#any-of? @type.builtin ; from godot-vscode-plugin @@ -220,9 +276,9 @@ "TranslationServer" "WorkerThreadPool" "XRServer" )) -;; Builtin Funcs - -(call (identifier) @function.builtin +; Builtin Funcs +(call + (identifier) @function.builtin ; format-ignore (#any-of? @function.builtin ; @GlobalScope @@ -248,9 +304,7 @@ "Color8" "assert" "char" "convert" "dict_to_inst" "get_stack" "inst_to_dict" "is_instance_of" "len" "print_debug" "print_stack" "range" "type_exists")) - -;; Builtin Constants - +; Builtin Constants ((identifier) @constant.builtin ; format-ignore (#any-of? @constant.builtin @@ -341,4 +395,3 @@ "OP_EQUAL" "OP_NOT_EQUAL" "OP_LESS" "OP_LESS_EQUAL" "OP_GREATER" "OP_GREATER_EQUAL" "OP_ADD" "OP_SUBTRACT" "OP_MULTIPLY" "OP_DIVIDE" "OP_NEGATE" "OP_POSITIVE" "OP_MODULE" "OP_POWER" "OP_SHIFT_LEFT" "OP_SHIFT_RIGHT" "OP_BIT_AND" "OP_BIT_OR" "OP_BIT_XOR" "OP_BIT_NEGATE" "OP_AND" "OP_OR" "OP_XOR" "OP_NOT" "OP_IN" "OP_MAX")) - diff --git a/queries/gdscript/indents.scm b/queries/gdscript/indents.scm index 4eb579b22..22d155e6f 100644 --- a/queries/gdscript/indents.scm +++ b/queries/gdscript/indents.scm @@ -1,7 +1,6 @@ [ (lambda) (function_definition) - (for_statement) (while_statement) (if_statement) @@ -20,12 +19,12 @@ ] @indent.branch [ - (string) - (comment) - (array) - (dictionary) - (parenthesized_expression) - (ERROR) + (string) + (comment) + (array) + (dictionary) + (parenthesized_expression) + (ERROR) ] @indent.auto [ @@ -36,43 +35,43 @@ ] @indent.dedent [ - (ERROR "[") - (ERROR "(") - (ERROR "{") + (ERROR + "[") + (ERROR + "(") + (ERROR + "{") ] @indent.begin -;; This only works with expanded tabs. +; This only works with expanded tabs. ; ((parameters) @indent.align (#set! indent.open_delimiter "(") (#set! indent.close_delimiter ")")) ; ((arguments) @indent.align (#set! indent.open_delimiter "(") (#set! indent.close_delimiter ")")) - -;; The following queries either do not agree with the current body parsing or are -;; attempted workarounds. Specifically as the last statement of a body. Opening -;; a new line in between statements works well. -;; -;; The overall experience is poor, so I've opted for @indent.auto. -;; -;; The gdscript parser will need to be patched to accommodate more interactive -;; edits. As far as I can tell the parser greedily consumes whitespace -;; as a zero-width token which causes trouble when inserting indents. - -;; This indents correctly with tabs. +; The following queries either do not agree with the current body parsing or are +; attempted workarounds. Specifically as the last statement of a body. Opening +; a new line in between statements works well. +; +; The overall experience is poor, so I've opted for @indent.auto. +; +; The gdscript parser will need to be patched to accommodate more interactive +; edits. As far as I can tell the parser greedily consumes whitespace +; as a zero-width token which causes trouble when inserting indents. +; This indents correctly with tabs. ; (arguments) @indent.begin ; (parameters) @indent.begin ; (array) @indent.begin ; (dictionary) @indent.begin ; (parenthesized_expression) @indent.begin - -;; Partial workaround for when the cursor is on the bracket character and a newline -;; is created with . Without this the newline is opened with extra -;; indentation. +; Partial workaround for when the cursor is on the bracket character and a newline +; is created with . Without this the newline is opened with extra +; indentation. ; (body (_ (array "]" @indent.end) ) _) -;; Problematic behaviors occur at the last statement of a body. -;; with @dedent: -;; - [ | ] i will dedent ] to 0. -;; - [ -;; ]| o will open new line at correct indentation. -;; with @auto: -;; - [ | ] i same -;; - [ -;; ]| o will open new line with extra indent. +; Problematic behaviors occur at the last statement of a body. +; with @dedent: +; - [ | ] i will dedent ] to 0. +; - [ +; ]| o will open new line at correct indentation. +; with @auto: +; - [ | ] i same +; - [ +; ]| o will open new line with extra indent. ;(body (_ (array "]" @indent.auto) ) .) diff --git a/queries/gdscript/injections.scm b/queries/gdscript/injections.scm index 6adae45a2..2f0e58eb6 100644 --- a/queries/gdscript/injections.scm +++ b/queries/gdscript/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/gdscript/locals.scm b/queries/gdscript/locals.scm index ebcda4f7d..83a1b4433 100644 --- a/queries/gdscript/locals.scm +++ b/queries/gdscript/locals.scm @@ -1,5 +1,4 @@ -;; Scopes - +; Scopes [ (if_statement) (elif_clause) @@ -16,77 +15,107 @@ (set_body) ] @local.scope -;; Parameters +; Parameters +(parameters + (identifier) @local.definition.parameter) -(parameters (identifier) @local.definition.parameter) -(default_parameter (identifier) @local.definition.parameter) -(typed_parameter (identifier) @local.definition.parameter) -(typed_default_parameter (identifier) @local.definition.parameter) +(default_parameter + (identifier) @local.definition.parameter) -;; Signals +(typed_parameter + (identifier) @local.definition.parameter) +(typed_default_parameter + (identifier) @local.definition.parameter) + +; Signals ; Can gdscript 2 signals be considered fields? -(signal_statement (name) @local.definition.field) +(signal_statement + (name) @local.definition.field) -;; Variable Definitions +; Variable Definitions +(const_statement + (name) @local.definition.constant) -(const_statement (name) @local.definition.constant) ; onready and export variations are only properties. -(variable_statement (name) @local.definition.var) +(variable_statement + (name) @local.definition.var) (setter) @local.reference + (getter) @local.reference -;; Function Definition - -((function_definition (name) @local.definition.function) - (#set! "definition.function.scope" "parent")) - -;; Lambda +; Function Definition +((function_definition + (name) @local.definition.function) + (#set! "definition.function.scope" "parent")) +; Lambda ; lambda names are not accessible and are only for debugging. -(lambda (name) @local.definition.function) +(lambda + (name) @local.definition.function) -;; Source +; Source +(class_name_statement + (name) @local.definition.type) -(class_name_statement (name) @local.definition.type) +(source + (variable_statement + (name) @local.definition.field)) -(source (variable_statement (name) @local.definition.field)) -(source (onready_variable_statement (name) @local.definition.field)) -(source (export_variable_statement (name) @local.definition.field)) +(source + (onready_variable_statement + (name) @local.definition.field)) -;; Class +(source + (export_variable_statement + (name) @local.definition.field)) -((class_definition (name) @local.definition.type) - (#set! "definition.type.scope" "parent")) +; Class +((class_definition + (name) @local.definition.type) + (#set! "definition.type.scope" "parent")) (class_definition - (body (variable_statement (name) @local.definition.field))) + (body + (variable_statement + (name) @local.definition.field))) + (class_definition - (body (onready_variable_statement (name) @local.definition.field))) + (body + (onready_variable_statement + (name) @local.definition.field))) + (class_definition - (body (export_variable_statement (name) @local.definition.field))) + (body + (export_variable_statement + (name) @local.definition.field))) + (class_definition - (body (signal_statement (name) @local.definition.field))) + (body + (signal_statement + (name) @local.definition.field))) ; Although a script is also a class, let's only define functions in an inner class as ; methods. ((class_definition - (body (function_definition (name) @local.definition.method))) - (#set! "definition.method.scope" "parent")) + (body + (function_definition + (name) @local.definition.method))) + (#set! "definition.method.scope" "parent")) -;; Enum +; Enum +((enum_definition + (name) @local.definition.enum)) -((enum_definition (name) @local.definition.enum)) +; Repeat +(for_statement + . + (identifier) @local.definition.var) -;; Repeat - -(for_statement . (identifier) @local.definition.var) - -;; Match Statement - -(pattern_binding (identifier) @local.definition.var) - -;; References +; Match Statement +(pattern_binding + (identifier) @local.definition.var) +; References (identifier) @local.reference diff --git a/queries/git_config/folds.scm b/queries/git_config/folds.scm index e69de29bb..8b1378917 100644 --- a/queries/git_config/folds.scm +++ b/queries/git_config/folds.scm @@ -0,0 +1 @@ + diff --git a/queries/git_config/highlights.scm b/queries/git_config/highlights.scm index df1dde803..ebae70e51 100644 --- a/queries/git_config/highlights.scm +++ b/queries/git_config/highlights.scm @@ -1,26 +1,23 @@ ; Sections - (section_name) @type ((section_name) @keyword.import - (#eq? @keyword.import "include")) + (#eq? @keyword.import "include")) ((section_header - (section_name) @keyword.import - (subsection_name)) - (#eq? @keyword.import "includeIf")) + (section_name) @keyword.import + (subsection_name)) + (#eq? @keyword.import "includeIf")) -(variable (name) @property) +(variable + (name) @property) ; Operators - -[ - "=" -] @operator +"=" @operator ; Literals - (integer) @number + [ (true) (false) @@ -29,10 +26,10 @@ (string) @string ((string) @string.special.path - (#lua-match? @string.special.path "^[.]?[/]")) + (#lua-match? @string.special.path "^[.]?[/]")) ((string) @string.special.path - (#lua-match? @string.special.path "^[~]")) + (#lua-match? @string.special.path "^[~]")) (section_header [ @@ -41,9 +38,10 @@ ] @string.special) ; Punctuation - -[ "[" "]" ] @punctuation.bracket +[ + "[" + "]" +] @punctuation.bracket ; Comments - (comment) @comment @spell diff --git a/queries/git_rebase/highlights.scm b/queries/git_rebase/highlights.scm index 9ace6be26..248366e24 100644 --- a/queries/git_rebase/highlights.scm +++ b/queries/git_rebase/highlights.scm @@ -5,4 +5,3 @@ (option) @operator (comment) @comment - diff --git a/queries/git_rebase/injections.scm b/queries/git_rebase/injections.scm index 8e6815a68..da2628667 100644 --- a/queries/git_rebase/injections.scm +++ b/queries/git_rebase/injections.scm @@ -1,6 +1,5 @@ ((operation - (command) @_command - (message) @injection.content) -(#set! injection.language "bash") -(#any-of? @_command "exec" "x")) - + (command) @_command + (message) @injection.content) + (#set! injection.language "bash") + (#any-of? @_command "exec" "x")) diff --git a/queries/gitattributes/highlights.scm b/queries/gitattributes/highlights.scm index 9f3c03dfb..bc2e02e88 100644 --- a/queries/gitattributes/highlights.scm +++ b/queries/gitattributes/highlights.scm @@ -6,7 +6,10 @@ (range_notation) @string.special (range_notation - [ "[" "]" ] @punctuation.bracket) + [ + "[" + "]" + ] @punctuation.bracket) (wildcard) @character.special @@ -14,7 +17,8 @@ (character_class) @constant -(class_range ("-" @operator)) +(class_range + ("-" @operator)) [ (ansi_c_escape) @@ -48,5 +52,4 @@ ; (redundant_escape) ; (trailing_slash) ; ] @error - (comment) @comment @spell diff --git a/queries/gitattributes/injections.scm b/queries/gitattributes/injections.scm index 6adae45a2..2f0e58eb6 100644 --- a/queries/gitattributes/injections.scm +++ b/queries/gitattributes/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/gitattributes/locals.scm b/queries/gitattributes/locals.scm index 43082a43d..2471b8bc6 100644 --- a/queries/gitattributes/locals.scm +++ b/queries/gitattributes/locals.scm @@ -1,4 +1,8 @@ -(macro_def (attr_name) @local.definition.macro) +(macro_def + (attr_name) @local.definition.macro) -(attribute (attr_name) @local.reference) -(attribute (builtin_attr) @local.reference) +(attribute + (attr_name) @local.reference) + +(attribute + (builtin_attr) @local.reference) diff --git a/queries/gitcommit/highlights.scm b/queries/gitcommit/highlights.scm index d475021c2..880d05e01 100644 --- a/queries/gitcommit/highlights.scm +++ b/queries/gitcommit/highlights.scm @@ -1,32 +1,52 @@ (comment) @comment + (generated_comment) @comment + (title) @markup.heading + ; (text) @none (branch) @markup.link + (change) @keyword + (filepath) @string.special.url + (arrow) @punctuation.delimiter (subject) @markup.heading @spell -(subject (overflow) @none @spell) -(subject (subject_prefix) @function @nospell) -(prefix (type) @keyword @nospell) -(prefix (scope) @variable.parameter @nospell) -(prefix [ + +(subject + (overflow) @none @spell) + +(subject + (subject_prefix) @function @nospell) + +(prefix + (type) @keyword @nospell) + +(prefix + (scope) @variable.parameter @nospell) + +(prefix + [ "(" ")" ":" -] @punctuation.delimiter) -(prefix [ - "!" -] @punctuation.special) + ] @punctuation.delimiter) + +(prefix + "!" @punctuation.special) (message) @spell -(trailer (token) @label) -; (trailer (value) @none) +(trailer + (token) @label) -(breaking_change (token) @comment.warning) -(breaking_change (value) @none @spell) +; (trailer (value) @none) +(breaking_change + (token) @comment.warning) + +(breaking_change + (value) @none @spell) (scissor) @comment diff --git a/queries/gitcommit/injections.scm b/queries/gitcommit/injections.scm index 5e56dfa5f..5613d7e8e 100644 --- a/queries/gitcommit/injections.scm +++ b/queries/gitcommit/injections.scm @@ -1,5 +1,5 @@ ((diff) @injection.content - (#set! injection.language "diff")) + (#set! injection.language "diff")) -((rebase_command) @injection.content - (#set! injection.language "git_rebase")) +((rebase_command) @injection.content + (#set! injection.language "git_rebase")) diff --git a/queries/gitignore/highlights.scm b/queries/gitignore/highlights.scm index 6e83ea6f2..10ae3f309 100644 --- a/queries/gitignore/highlights.scm +++ b/queries/gitignore/highlights.scm @@ -19,13 +19,15 @@ (bracket_char_escaped) ] @string.escape -;; bracket expressions +; bracket expressions [ "[" "]" ] @punctuation.bracket (bracket_char) @constant -(bracket_range + +(bracket_range "-" @operator) + (bracket_char_class) @constant.builtin diff --git a/queries/gleam/folds.scm b/queries/gleam/folds.scm index 7c3b16741..b4cd225e7 100644 --- a/queries/gleam/folds.scm +++ b/queries/gleam/folds.scm @@ -1,7 +1,7 @@ ; Folds [ (case) - (function) + (function) (anonymous_function) (type_definition) ] @fold diff --git a/queries/gleam/highlights.scm b/queries/gleam/highlights.scm index f74f17ab7..5c34dde7a 100644 --- a/queries/gleam/highlights.scm +++ b/queries/gleam/highlights.scm @@ -9,14 +9,10 @@ ] @keyword ; Function Keywords -[ - "fn" -] @keyword.function +"fn" @keyword.function ; Imports -[ - "import" -] @keyword.import +"import" @keyword.import ; Conditionals [ @@ -25,9 +21,7 @@ ] @keyword.conditional ; Exceptions -[ - "assert" -] @keyword.exception +"assert" @keyword.exception ; Punctuation [ @@ -48,9 +42,7 @@ "->" ] @punctuation.delimiter -[ - "#" -] @punctuation.special +"#" @punctuation.special ; Operators [ @@ -83,9 +75,7 @@ (identifier) @variable ; Comments -[ - (comment) -] @comment @spell +(comment) @comment @spell [ (module_comment) @@ -100,9 +90,16 @@ ; Modules & Imports (module) @module -(import alias: ((identifier) @module)?) -(remote_type_identifier module: (identifier) @module) -(unqualified_import name: (identifier) @function) + +(import + alias: + ((identifier) @module)?) + +(remote_type_identifier + module: (identifier) @module) + +(unqualified_import + name: (identifier) @function) ; Strings (string) @string @@ -116,15 +113,35 @@ (float) @number.float ; Function Parameter Labels -(function_call arguments: (arguments (argument label: (label) @label))) -(function_parameter label: (label)? @label name: (identifier) @variable.parameter) +(function_call + arguments: + (arguments + (argument + label: (label) @label))) + +(function_parameter + label: (label)? @label + name: (identifier) @variable.parameter) ; Records -(record arguments: (arguments (argument label: (label) @property)?)) -(record_pattern_argument label: (label) @property) -(record_update_argument label: (label) @property) -(field_access record: (identifier) @variable field: (label) @property) -(data_constructor_argument (label) @property) +(record + arguments: + (arguments + (argument + label: (label) @property)?)) + +(record_pattern_argument + label: (label) @property) + +(record_update_argument + label: (label) @property) + +(field_access + record: (identifier) @variable + field: (label) @property) + +(data_constructor_argument + (label) @property) ; Types [ @@ -145,25 +162,44 @@ ] @type.qualifier ; Tuples -(tuple_access index: (integer) @operator) +(tuple_access + index: (integer) @operator) ; Functions -(function name: (identifier) @function) -(function_call function: (identifier) @function.call) -(function_call function: (field_access field: (label) @function.call)) +(function + name: (identifier) @function) + +(function_call + function: (identifier) @function.call) + +(function_call + function: + (field_access + field: (label) @function.call)) ; External Functions -(external_function name: (identifier) @function) -(external_function_body (string) @module . (string) @function) +(external_function + name: (identifier) @function) + +(external_function_body + (string) @module + . + (string) @function) ; Constructors (constructor_name) @type @constructor -([(type_identifier) (constructor_name)] @constant.builtin +([ + (type_identifier) + (constructor_name) +] @constant.builtin (#any-of? @constant.builtin "Ok" "Error")) ; Booleans -((constructor_name) @boolean (#any-of? @boolean "True" "False")) +((constructor_name) @boolean + (#any-of? @boolean "True" "False")) ; Pipe Operator -(binary_expression operator: "|>" right: (identifier) @function) +(binary_expression + operator: "|>" + right: (identifier) @function) diff --git a/queries/gleam/indents.scm b/queries/gleam/indents.scm index 37f88df66..c79854508 100644 --- a/queries/gleam/indents.scm +++ b/queries/gleam/indents.scm @@ -25,4 +25,6 @@ ] @indent.end @indent.branch ; Gleam pipelines are not indented, but other binary expression chains are -((binary_expression operator: _ @_operator) @indent.begin (#not-eq? @_operator "|>")) +((binary_expression + operator: _ @_operator) @indent.begin + (#not-eq? @_operator "|>")) diff --git a/queries/gleam/injections.scm b/queries/gleam/injections.scm index 378240e38..11d4f5d55 100644 --- a/queries/gleam/injections.scm +++ b/queries/gleam/injections.scm @@ -1,7 +1,7 @@ ; Comments ([ (module_comment) - (statement_comment) - (comment) - ] @injection.content - (#set! injection.language "comment")) + (statement_comment) + (comment) +] @injection.content + (#set! injection.language "comment")) diff --git a/queries/gleam/locals.scm b/queries/gleam/locals.scm index 43328ce1b..ba0632c0b 100644 --- a/queries/gleam/locals.scm +++ b/queries/gleam/locals.scm @@ -1,18 +1,25 @@ ; Let Binding Definition -(let pattern: (identifier) @local.definition) +(let + pattern: (identifier) @local.definition) ; List Pattern Definitions -(list_pattern (identifier) @local.definition) -(list_pattern assign: (identifier) @local.definition) +(list_pattern + (identifier) @local.definition) + +(list_pattern + assign: (identifier) @local.definition) ; Tuple Pattern Definition -(tuple_pattern (identifier) @local.definition) +(tuple_pattern + (identifier) @local.definition) ; Record Pattern Definition -(record_pattern_argument pattern: (identifier) @local.definition) +(record_pattern_argument + pattern: (identifier) @local.definition) ; Function Parameter Definition -(function_parameter name: (identifier) @local.definition) +(function_parameter + name: (identifier) @local.definition) ; References (identifier) @local.reference diff --git a/queries/glimmer/folds.scm b/queries/glimmer/folds.scm index cfe9d35b0..6502455d8 100644 --- a/queries/glimmer/folds.scm +++ b/queries/glimmer/folds.scm @@ -1,4 +1,5 @@ [ - (element_node (element_node_start)) - (block_statement) + (element_node + (element_node_start)) + (block_statement) ] @fold diff --git a/queries/glimmer/highlights.scm b/queries/glimmer/highlights.scm index 059a1069c..cfb1af15f 100644 --- a/queries/glimmer/highlights.scm +++ b/queries/glimmer/highlights.scm @@ -1,9 +1,9 @@ ; === Tag Names === - ; Tags that start with a lower case letter are HTML tags ; We'll also use this highlighting for named blocks (which start with `:`) ((tag_name) @tag (#lua-match? @tag "^:?[%l]")) + ; Tags that start with a capital letter are Glimmer components ((tag_name) @constructor (#lua-match? @constructor "^%u")) @@ -11,74 +11,106 @@ (attribute_name) @property (string_literal) @string + (number_literal) @number + (boolean_literal) @boolean (concat_statement) @string ; === Block Statements === - ; Highlight the brackets (block_statement_start) @tag.delimiter + (block_statement_end) @tag.delimiter ; Highlight `if`/`each`/`let` -(block_statement_start path: (identifier) @keyword.conditional) -(block_statement_end path: (identifier) @keyword.conditional) -((mustache_statement (identifier) @keyword.conditional) - (#lua-match? @keyword.conditional "else")) +(block_statement_start + path: (identifier) @keyword.conditional) + +(block_statement_end + path: (identifier) @keyword.conditional) + +((mustache_statement + (identifier) @keyword.conditional) + (#lua-match? @keyword.conditional "else")) ; == Mustache Statements === - ; Highlight the whole statement, to color brackets and separators (mustache_statement) @tag.delimiter ; An identifier in a mustache expression is a variable -((mustache_statement [ - (path_expression (identifier) @variable) - (identifier) @variable +((mustache_statement + [ + (path_expression + (identifier) @variable) + (identifier) @variable ]) (#not-any-of? @variable "yield" "outlet" "this" "else")) + ; As are arguments in a block statement -(block_statement_start argument: [ - (path_expression (identifier) @variable) - (identifier) @variable - ]) +(block_statement_start + argument: + [ + (path_expression + (identifier) @variable) + (identifier) @variable + ]) + ; As is an identifier in a block param -(block_params (identifier) @variable) +(block_params + (identifier) @variable) + ; As are helper arguments -((helper_invocation argument: [ - (path_expression (identifier) @variable) - (identifier) @variable - ]) +((helper_invocation + argument: + [ + (path_expression + (identifier) @variable) + (identifier) @variable + ]) (#not-eq? @variable "this")) + ; `this` should be highlighted as a built-in variable ((identifier) @variable.builtin (#eq? @variable.builtin "this")) ; If the identifier is just "yield" or "outlet", it's a keyword -((mustache_statement (identifier) @keyword) +((mustache_statement + (identifier) @keyword) (#any-of? @keyword "yield" "outlet")) ; Helpers are functions -((helper_invocation helper: [ - (path_expression (identifier) @function) - (identifier) @function - ]) +((helper_invocation + helper: + [ + (path_expression + (identifier) @function) + (identifier) @function + ]) (#not-any-of? @function "if" "yield")) -((helper_invocation helper: (identifier) @keyword.conditional) + +((helper_invocation + helper: (identifier) @keyword.conditional) (#eq? @keyword.conditional "if")) -((helper_invocation helper: (identifier) @keyword) + +((helper_invocation + helper: (identifier) @keyword) (#eq? @keyword "yield")) -(hash_pair key: (identifier) @property) +(hash_pair + key: (identifier) @property) (comment_statement) @comment @spell -(attribute_node "=" @operator) +(attribute_node + "=" @operator) -(block_params "as" @keyword) -(block_params "|" @operator) +(block_params + "as" @keyword) + +(block_params + "|" @operator) [ "<" diff --git a/queries/glimmer/indents.scm b/queries/glimmer/indents.scm index 8bccf33fa..c1ef130c0 100644 --- a/queries/glimmer/indents.scm +++ b/queries/glimmer/indents.scm @@ -1,22 +1,34 @@ [ - (element_node (element_node_start)) + (element_node + (element_node_start)) (element_node_void) - (block_statement (block_statement_start)) + (block_statement + (block_statement_start)) (mustache_statement) ] @indent.begin -(element_node (element_node_end [">"] @indent.end)) -(element_node_void "/>" @indent.end) +(element_node + (element_node_end + ">" @indent.end)) + +(element_node_void + "/>" @indent.end) + [ - ">" - "/>" - "" + "/>" + "" @operator (comment) @comment @spell + (module_path) @string.special.url [ -(version) -(go_version) + (version) + (go_version) ] @string diff --git a/queries/gomod/injections.scm b/queries/gomod/injections.scm index 321c90add..2f0e58eb6 100644 --- a/queries/gomod/injections.scm +++ b/queries/gomod/injections.scm @@ -1,2 +1,2 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/gosum/highlights.scm b/queries/gosum/highlights.scm index bd9595b2b..f20c5f176 100644 --- a/queries/gosum/highlights.scm +++ b/queries/gosum/highlights.scm @@ -7,17 +7,18 @@ "+incompatible" ] @keyword - (module_path) @string.special.url + (module_version) @string.special (hash_version) @attribute + (hash) @string.special.symbol [ - (number) - (number_with_decimal) - (hex_number) + (number) + (number_with_decimal) + (hex_number) ] @number (checksum diff --git a/queries/gowork/highlights.scm b/queries/gowork/highlights.scm index 0584f1a68..bca9a5f80 100644 --- a/queries/gowork/highlights.scm +++ b/queries/gowork/highlights.scm @@ -9,6 +9,6 @@ (comment) @comment @spell [ -(version) -(go_version) + (version) + (go_version) ] @string diff --git a/queries/gowork/injections.scm b/queries/gowork/injections.scm index 321c90add..2f0e58eb6 100644 --- a/queries/gowork/injections.scm +++ b/queries/gowork/injections.scm @@ -1,2 +1,2 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/gpg/highlights.scm b/queries/gpg/highlights.scm index 1dac05562..09656b302 100644 --- a/queries/gpg/highlights.scm +++ b/queries/gpg/highlights.scm @@ -1,14 +1,17 @@ -(option . _ @keyword) +(option + . + _ @keyword) (option ("no-" @variable.parameter)? (name) @variable.parameter) -(string (content) @string) +(string + (content) @string) [ - (value) - "clear" + (value) + "clear" ] @string.special (url) @string.special.url @@ -16,9 +19,9 @@ (key) @constant [ - (number) - (expire_time) - (iso_time) + (number) + (expire_time) + (iso_time) ] @number (format) @character.special @@ -34,14 +37,18 @@ (filter_value) @string [ - (filter_op0) - (filter_op1) - (filter_lc) - "=" + (filter_op0) + (filter_op1) + (filter_lc) + "=" ] @operator "!" @punctuation.special -[ "\"" "'" "," ] @punctuation.delimiter +[ + "\"" + "'" + "," +] @punctuation.delimiter (comment) @comment @spell diff --git a/queries/gpg/injections.scm b/queries/gpg/injections.scm index 321c90add..2f0e58eb6 100644 --- a/queries/gpg/injections.scm +++ b/queries/gpg/injections.scm @@ -1,2 +1,2 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/graphql/highlights.scm b/queries/graphql/highlights.scm index 136f287ee..24db06645 100644 --- a/queries/graphql/highlights.scm +++ b/queries/graphql/highlights.scm @@ -1,6 +1,5 @@ ; Types ;------ - (scalar_type_definition (name) @type) @@ -42,7 +41,6 @@ ; Directives ;----------- - (directive_definition "@" @attribute (name) @attribute) @@ -51,7 +49,6 @@ ; Properties ;----------- - (field (name) @property) @@ -69,9 +66,8 @@ (enum_value (name) @property) -; Variable Definitions and Arguments +; Variable Definitions and Arguments ;----------------------------------- - (operation_definition (name) @variable) @@ -98,7 +94,6 @@ ; Constants ;---------- - (string_value) @string (int_value) @number @@ -109,7 +104,6 @@ ; Literals ;--------- - (description (string_value) @string.documentation @spell) @@ -123,7 +117,6 @@ ; Keywords ;---------- - [ "query" "mutation" @@ -145,21 +138,23 @@ ; Punctuation ;------------ - [ - "(" - ")" - "[" - "]" - "{" - "}" + "(" + ")" + "[" + "]" + "{" + "}" ] @punctuation.bracket "=" @operator "|" @punctuation.delimiter + "&" @punctuation.delimiter + ":" @punctuation.delimiter "..." @punctuation.special + "!" @punctuation.special diff --git a/queries/graphql/injections.scm b/queries/graphql/injections.scm index 321c90add..2f0e58eb6 100644 --- a/queries/graphql/injections.scm +++ b/queries/graphql/injections.scm @@ -1,2 +1,2 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/groovy/highlights.scm b/queries/groovy/highlights.scm index 25dcdb8ca..4306f17a3 100644 --- a/queries/groovy/highlights.scm +++ b/queries/groovy/highlights.scm @@ -1,5 +1,6 @@ (unit (identifier) @variable) + (string (identifier) @variable) @@ -24,52 +25,19 @@ (#eq? @constant.builtin "null")) ((identifier) @type - (#any-of? @type - "String" - "Map" - "Object" - "Boolean" - "Integer" - "List")) + (#any-of? @type "String" "Map" "Object" "Boolean" "Integer" "List")) ((identifier) @function.builtin - (#any-of? @function.builtin - "void" - "id" - "version" - "apply" - "implementation" - "testImplementation" - "androidTestImplementation" - "debugImplementation")) + (#any-of? @function.builtin "void" "id" "version" "apply" "implementation" "testImplementation" "androidTestImplementation" "debugImplementation")) ((identifier) @keyword - (#any-of? @keyword - "static" - "class" - "def" - "import" - "package" - "assert" - "extends" - "implements" - "instanceof" - "interface" - "new")) + (#any-of? @keyword "static" "class" "def" "import" "package" "assert" "extends" "implements" "instanceof" "interface" "new")) ((identifier) @type.qualifier - (#any-of? @type.qualifier - "abstract" - "protected" - "private" - "public")) + (#any-of? @type.qualifier "abstract" "protected" "private" "public")) ((identifier) @keyword.exception - (#any-of? @keyword.exception - "throw" - "finally" - "try" - "catch")) + (#any-of? @keyword.exception "throw" "finally" "try" "catch")) (string) @string @@ -92,4 +60,11 @@ (leading_key) ] @operator -["(" ")" "[" "]" "{" "}"] @punctuation.bracket +[ + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket diff --git a/queries/groovy/injections.scm b/queries/groovy/injections.scm index 0f3127b6b..14a5d393e 100644 --- a/queries/groovy/injections.scm +++ b/queries/groovy/injections.scm @@ -1,5 +1,5 @@ -((line_comment) @injection.content - (#set! injection.language "comment")) - ((block_comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) + +((line_comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/gstlaunch/highlights.scm b/queries/gstlaunch/highlights.scm index 36118712e..90729f876 100644 --- a/queries/gstlaunch/highlights.scm +++ b/queries/gstlaunch/highlights.scm @@ -1,30 +1,35 @@ [ - "!" - "=" + "!" + "=" ] @operator [ - "," - "." - ";" - "/" + "," + "." + ";" + "/" ] @punctuation.delimiter [ - "(" - ")" + "(" + ")" ] @punctuation.bracket (property key: (identifier) @variable.member) + (value) @string + (string_literal) @string + (cap . (identifier) @string . (identifier) @string) + (simple_element type: (_) @type) + (bin type: (_) @type) diff --git a/queries/hack/highlights.scm b/queries/hack/highlights.scm index 91efe90b4..22fa7ea50 100644 --- a/queries/hack/highlights.scm +++ b/queries/hack/highlights.scm @@ -1,13 +1,15 @@ (variable) @variable + (identifier) @variable + ((variable) @variable.builtin - (#eq? @variable.builtin "$this")) + (#eq? @variable.builtin "$this")) (braced_expression) @none (scoped_identifier - (qualified_identifier - (identifier) @type)) + (qualified_identifier + (identifier) @type)) [ (comment) @@ -20,16 +22,16 @@ "function" @keyword.function [ - "type" - "interface" - "implements" - "class" - "using" - "namespace" - "attribute" - "const" - "extends" - "insteadof" + "type" + "interface" + "implements" + "class" + "using" + "namespace" + "attribute" + "const" + "extends" + "insteadof" ] @keyword [ @@ -38,11 +40,11 @@ ] @keyword.coroutine [ - "use" - "include" - "include_once" - "require" - "require_once" + "use" + "include" + "include_once" + "require" + "require_once" ] @keyword.import [ @@ -80,9 +82,7 @@ "noreturn" ] @type.builtin -[ - (null) -] @constant.builtin +(null) @constant.builtin [ (true) @@ -90,14 +90,23 @@ ] @boolean (type_specifier) @type + (new_expression (_) @type) -(alias_declaration "newtype" . (_) @type) -(alias_declaration "type" . (_) @type) +(alias_declaration + "newtype" + . + (_) @type) + +(alias_declaration + "type" + . + (_) @type) (class_declaration name: (identifier) @type) + (type_parameter name: (identifier) @type) @@ -106,8 +115,8 @@ (identifier) @type .)) [ - "@required" - "@lateinit" + "@required" + "@lateinit" (attribute_modifier) ] @attribute @@ -126,7 +135,6 @@ "/=" "%=" "**=" - "==>" "|>" "??" @@ -154,13 +162,10 @@ "/" "%" "**" - "++" "--" "!" - "?:" - "=" "??=" ".=" @@ -176,110 +181,156 @@ "%=" "**=" "=>" - - ;; type modifiers + ; type modifiers "@" "?" "~" ] @operator (integer) @number + (float) @number.float (parameter (variable) @variable.parameter) (call_expression - function: (qualified_identifier (identifier) @function.call .)) + function: + (qualified_identifier + (identifier) @function.call .)) (call_expression - function: (scoped_identifier (identifier) @function.call .)) + function: + (scoped_identifier + (identifier) @function.call .)) (call_expression - function: (selection_expression - (qualified_identifier (identifier) @function.method.call .))) + function: + (selection_expression + (qualified_identifier + (identifier) @function.method.call .))) (qualified_identifier - (_) @module . + (_) @module + . (_)) (use_statement (qualified_identifier - (_) @module .) + (_) @module .) (use_clause)) (use_statement - (use_type "namespace") + (use_type + "namespace") (use_clause (qualified_identifier - (identifier) @module .) + (identifier) @module .) alias: (identifier)? @module)) (use_statement - (use_type "const") + (use_type + "const") (use_clause (qualified_identifier - (identifier) @constant .) + (identifier) @constant .) alias: (identifier)? @constant)) (use_statement - (use_type "function") + (use_type + "function") (use_clause (qualified_identifier - (identifier) @function .) + (identifier) @function .) alias: (identifier)? @function)) (use_statement - (use_type "type") + (use_type + "type") (use_clause (qualified_identifier - (identifier) @type .) + (identifier) @type .) alias: (identifier)? @type)) (use_clause - (use_type "namespace") + (use_type + "namespace") (qualified_identifier - (_) @module .) + (_) @module .) alias: (identifier)? @module) (use_clause - (use_type "function") + (use_type + "function") (qualified_identifier - (_) @function .) + (_) @function .) alias: (identifier)? @function) (use_clause - (use_type "const") + (use_type + "const") (qualified_identifier - (_) @constant .) + (_) @constant .) alias: (identifier)? @constant) (use_clause - (use_type "type") + (use_type + "type") (qualified_identifier - (_) @type .) + (_) @type .) alias: (identifier)? @type) (function_declaration name: (identifier) @function) + (method_declaration name: (identifier) @function.method) (type_arguments - [ "<" ">" ] @punctuation.bracket) -[ "(" ")" "[" "]" "{" "}" "<<" ">>"] @punctuation.bracket + [ + "<" + ">" + ] @punctuation.bracket) + +[ + "(" + ")" + "[" + "]" + "{" + "}" + "<<" + ">>" +] @punctuation.bracket (xhp_open - [ "<" ">" ] @tag.delimiter) -(xhp_close - [ "" ] @tag.delimiter) + [ + "<" + ">" + ] @tag.delimiter) + +(xhp_close + [ + "" + ] @tag.delimiter) + +[ + "." + ";" + "::" + ":" + "," +] @punctuation.delimiter -[ "." ";" "::" ":" "," ] @punctuation.delimiter (qualified_identifier "\\" @punctuation.delimiter) (ternary_expression - ["?" ":"] @keyword.conditional.ternary) + [ + "?" + ":" + ] @keyword.conditional.ternary) [ "if" @@ -305,11 +356,11 @@ ] @keyword.repeat [ - (string) - (xhp_string) + (string) + (xhp_string) ] @string [ - (xhp_open) - (xhp_close) + (xhp_open) + (xhp_close) ] @tag diff --git a/queries/hare/folds.scm b/queries/hare/folds.scm index 28f18b175..58b10bfdc 100644 --- a/queries/hare/folds.scm +++ b/queries/hare/folds.scm @@ -1,12 +1,10 @@ [ (imports) - (function_declaration) (enum_type) (struct_type) (tuple_type) (union_type) - (block) (if_statement) (for_statement) @@ -14,7 +12,6 @@ (switch_expression) (match_expression) (case) - (array_literal) (struct_literal) (tuple_literal) diff --git a/queries/hare/highlights.scm b/queries/hare/highlights.scm index fb9f3f158..817084886 100644 --- a/queries/hare/highlights.scm +++ b/queries/hare/highlights.scm @@ -1,44 +1,44 @@ ; Variables - (identifier) @variable ; Types - (type) @type (scoped_type_identifier - (identifier) . (identifier) @type) + (identifier) + . + (identifier) @type) (struct_literal - . (identifier) @type) + . + (identifier) @type) (builtin_type) @type.builtin ; Constants - ((identifier) @constant (#lua-match? @constant "^[A-Z_]+$")) ; Includes - -[ - "use" -] @keyword.import +"use" @keyword.import (use_statement (scoped_type_identifier (identifier) @module)) + (use_statement - (identifier) @module "{") + (identifier) @module + "{") + (use_statement - . (identifier) @module .) + . + (identifier) @module .) ((scoped_type_identifier path: (_) @module) (#set! "priority" 105)) ; Keywords - [ "def" "enum" @@ -49,9 +49,7 @@ "union" ] @keyword -[ - "fn" -] @keyword.function +"fn" @keyword.function [ "defer" @@ -65,12 +63,13 @@ ] @keyword.operator ; Typedefs - (type_declaration - "type" (identifier) @type.definition . "=") + "type" + (identifier) @type.definition + . + "=") ; Qualifiers - [ "const" "static" @@ -78,7 +77,6 @@ ] @type.qualifier ; Attributes - [ "@fini" "@init" @@ -89,62 +87,72 @@ ] @attribute ; Labels - ((label) @label (#set! "priority" 105)) ; Functions - (function_declaration - "fn" . (identifier) @function) + "fn" + . + (identifier) @function) (call_expression - . (identifier) @function.call) + . + (identifier) @function.call) (call_expression - . (scoped_type_identifier - . (identifier) . "::" . (identifier) @function.method.call)) + . + (scoped_type_identifier + . + (identifier) + . + "::" + . + (identifier) @function.method.call)) ((call_expression - . (identifier) @function.builtin) + . + (identifier) @function.builtin) (#any-of? @function.builtin "align" "assert" "free" "len" "offset" "size")) (size_expression "size" @function.builtin) ((function_declaration - "fn" . (identifier) @constructor) + "fn" + . + (identifier) @constructor) (#eq? @constructor "init")) ((call_expression - . (identifier) @constructor) + . + (identifier) @constructor) (#eq? @constructor "init")) ; Parameters - (parameter - (_) @variable.parameter . ":") + (_) @variable.parameter + . + ":") ; Fields - ((member_expression - "." (_) @variable.member) + "." + (_) @variable.member) (#set! "priority" 105)) (field - . (identifier) @variable.member) + . + (identifier) @variable.member) (field_assignment - . (identifier) @variable.member) + . + (identifier) @variable.member) ; Repeats - -[ - "for" -] @keyword.repeat +"for" @keyword.repeat ; Conditionals - [ "if" "else" @@ -155,7 +163,6 @@ ] @keyword.conditional ; Operators - [ "+" "-" @@ -196,12 +203,20 @@ ] @operator ; Punctuation +[ + "{" + "}" +] @punctuation.bracket -[ "{" "}" ] @punctuation.bracket +[ + "[" + "]" +] @punctuation.bracket -[ "[" "]" ] @punctuation.bracket - -[ "(" ")" ] @punctuation.bracket +[ + "(" + ")" +] @punctuation.bracket [ ".." @@ -209,11 +224,14 @@ "_" ] @punctuation.special -(pointer_type "*" @punctuation.special) +(pointer_type + "*" @punctuation.special) -(slice_type "*" @punctuation.special) +(slice_type + "*" @punctuation.special) -(error_type "!" @punctuation.special) +(error_type + "!" @punctuation.special) [ "," @@ -225,7 +243,6 @@ ] @punctuation.delimiter ; Literals - [ (string) (raw_string) @@ -247,5 +264,4 @@ ] @constant.builtin ; Comments - (comment) @comment @spell diff --git a/queries/hare/indents.scm b/queries/hare/indents.scm index b3aadcd6e..d729663e1 100644 --- a/queries/hare/indents.scm +++ b/queries/hare/indents.scm @@ -3,19 +3,18 @@ (struct_type) (tuple_type) (union_type) - (block) (for_statement) (call_expression) (case) - (array_literal) (struct_literal) (tuple_literal) ] @indent.begin (if_statement - ("(" condition: (_) ")") @indent.begin) + ("(" + condition: (_)")") @indent.begin) [ "}" @@ -23,11 +22,20 @@ ")" ] @indent.end -[ "{" "}" ] @indent.branch +[ + "{" + "}" +] @indent.branch -[ "[" "]" ] @indent.branch +[ + "[" + "]" +] @indent.branch -[ "(" ")" ] @indent.branch +[ + "(" + ")" +] @indent.branch [ (ERROR) diff --git a/queries/hare/injections.scm b/queries/hare/injections.scm index d3befb39b..88a3f1cdd 100644 --- a/queries/hare/injections.scm +++ b/queries/hare/injections.scm @@ -1,10 +1,18 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) ((call_expression - . (_) @_fnname - . "(" - . (_ [(string_content) (raw_string_content)] @injection.content) - . ")") + . + (_) @_fnname + . + "(" + . + (_ + [ + (string_content) + (raw_string_content) + ] @injection.content) + . + ")") (#any-of? @_fnname "compile" "regex::compile") (#set! injection.language "regex")) diff --git a/queries/hare/locals.scm b/queries/hare/locals.scm index bf606b9b1..b81ee5135 100644 --- a/queries/hare/locals.scm +++ b/queries/hare/locals.scm @@ -1,5 +1,4 @@ ; Scopes - [ (module) (function_declaration) @@ -10,38 +9,57 @@ ] @local.scope ; References - [ (identifier) (scoped_type_identifier) ] @local.reference ; Definitions - (global_binding - (identifier) @local.definition.constant . ":" (_)) + (identifier) @local.definition.constant + . + ":" + (_)) (const_declaration - "const" (identifier) @local.definition.constant . "=") + "const" + (identifier) @local.definition.constant + . + "=") (field - . (identifier) @local.definition.field) + . + (identifier) @local.definition.field) (field_assignment - . (identifier) @local.definition.field) + . + (identifier) @local.definition.field) (function_declaration - "fn" . (identifier) @local.definition.function) + "fn" + . + (identifier) @local.definition.function) (parameter - (_) @local.definition.parameter . ":") + (_) @local.definition.parameter + . + ":") (type_declaration - "type" (identifier) @local.definition.type . "=") + "type" + (identifier) @local.definition.type + . + "=") (type_declaration - "type" (identifier) @local.definition.enum . "=" (enum_type)) + "type" + (identifier) @local.definition.enum + . + "=" + (enum_type)) (let_declaration - "let" . (identifier) @local.definition.variable ","?) - + "let" + . + (identifier) @local.definition.variable + ","?) diff --git a/queries/haskell/folds.scm b/queries/haskell/folds.scm index 28eadf8f3..a1af2a169 100644 --- a/queries/haskell/folds.scm +++ b/queries/haskell/folds.scm @@ -1,5 +1,5 @@ [ - (exp_apply) - (exp_do) - (function) + (exp_apply) + (exp_do) + (function) ] @fold diff --git a/queries/haskell/highlights.scm b/queries/haskell/highlights.scm index 92b36434d..1a3cfd485 100644 --- a/queries/haskell/highlights.scm +++ b/queries/haskell/highlights.scm @@ -1,34 +1,44 @@ -;; ---------------------------------------------------------------------------- -;; Parameters and variables - -;; NOTE: These are at the top, so that they have low priority, -;; and don't override destructured parameters - +; ---------------------------------------------------------------------------- +; Parameters and variables +; NOTE: These are at the top, so that they have low priority, +; and don't override destructured parameters (variable) @variable + (pat_wildcard) @variable (function - patterns: (patterns (_) @variable.parameter)) + patterns: + (patterns + (_) @variable.parameter)) -(exp_lambda (_)+ @variable.parameter "->") +(exp_lambda + (_)+ @variable.parameter + "->") -(function - infix: (infix - lhs: (_) @variable.parameter)) -(function - infix: (infix - rhs: (_) @variable.parameter)) +(function + infix: + (infix + lhs: (_) @variable.parameter)) -;; ---------------------------------------------------------------------------- -;; Literals and comments +(function + infix: + (infix + rhs: (_) @variable.parameter)) +; ---------------------------------------------------------------------------- +; Literals and comments (integer) @number + (exp_negation) @number -(exp_literal (float)) @number.float + +(exp_literal + (float)) @number.float + (char) @character + (string) @string -(con_unit) @string.special.symbol ; unit, as in () +(con_unit) @string.special.symbol ; unit, as in () (comment) @comment @@ -37,30 +47,28 @@ ; ((comment) @_first . (comment)+ @comment.documentation) ; once https://github.com/neovim/neovim/pull/24738 has been merged. ; -; ((comment) @comment.documentation +; ((comment) @comment.documentation ; (#lua-match? @comment.documentation "^-- |")) ; -; ((comment) @_first @comment.documentation -; (comment) @comment.documentation +; ((comment) @_first @comment.documentation +; (comment) @comment.documentation ; (#lua-match? @_first "^-- |")) ; -; ((comment) @comment.documentation +; ((comment) @comment.documentation ; (#lua-match? @comment.documentation "^-- %^")) ; -; ((comment) @_first @comment.documentation -; (comment) @comment.documentation +; ((comment) @_first @comment.documentation +; (comment) @comment.documentation ; (#lua-match? @_first "^-- %^")) ; -; ((comment) @comment.documentation +; ((comment) @comment.documentation ; (#lua-match? @comment.documentation "^{-")) ; -; ((comment) @_first @comment.documentation -; (comment) @comment.documentation +; ((comment) @_first @comment.documentation +; (comment) @comment.documentation ; (#lua-match? @_first "^{-")) - -;; ---------------------------------------------------------------------------- -;; Punctuation - +; ---------------------------------------------------------------------------- +; Punctuation [ "(" ")" @@ -75,10 +83,8 @@ ";" ] @punctuation.delimiter - -;; ---------------------------------------------------------------------------- -;; Keywords, operators, includes - +; ---------------------------------------------------------------------------- +; Keywords, operators, includes [ "forall" "∀" @@ -105,7 +111,7 @@ (constructor_operator) (type_operator) (tycon_arrow) - (qualified_module) ; grabs the `.` (dot), ex: import System.IO + (qualified_module) ; grabs the `.` (dot), ex: import System.IO (qualified_type) (qualified_variable) (all_names) @@ -123,14 +129,26 @@ "@" ] @operator - (module) @module -((qualified_module (module) @constructor) - . (module)) -(qualified_type (module) @module) -(qualified_variable (module) @module) -(import (module) @module) -(import (module) @constructor . (module)) + +((qualified_module + (module) @constructor) + . + (module)) + +(qualified_type + (module) @module) + +(qualified_variable + (module) @module) + +(import + (module) @module) + +(import + (module) @constructor + . + (module)) [ (where) @@ -157,310 +175,449 @@ "infixr" ] @keyword +; ---------------------------------------------------------------------------- +; Functions and variables +(signature + name: (variable) @function) -;; ---------------------------------------------------------------------------- -;; Functions and variables +(function + name: (variable) @function) -(signature name: (variable) @function) - -(function name: (variable) @function) - -(function +(function name: (variable) @variable - rhs: [ - (exp_literal) - (exp_apply - (exp_name - [(constructor) - (variable) - (qualified_variable) - ])) - (quasiquote) - ((exp_name) . (operator)) - ]) + rhs: + [ + (exp_literal) + (exp_apply + (exp_name + [ + (constructor) + (variable) + (qualified_variable) + ])) + (quasiquote) + ((exp_name) + . + (operator)) + ]) -(function +(function name: (variable) @variable - rhs: (exp_infix [ - (exp_literal) - (exp_apply - (exp_name - [(constructor) - (variable) - (qualified_variable) - ])) - (quasiquote) - ((exp_name) . (operator)) - ])) + rhs: + (exp_infix + [ + (exp_literal) + (exp_apply + (exp_name + [ + (constructor) + (variable) + (qualified_variable) + ])) + (quasiquote) + ((exp_name) + . + (operator)) + ])) -;; Consider signatures (and accompanying functions) -;; with only one value on the rhs as variables -(signature . (variable) @variable . (_) . ) -((signature . (variable) @_name . (_) . ) - . (function name: (variable) @variable) - (#eq? @_name @variable)) -;; but consider a type that involves 'IO' a function -(signature name: (variable) @function - . (type_apply (type_name) @_type) - (#eq? @_type "IO")) -((signature name: (variable) @_name - . (type_apply (type_name) @_type) - (#eq? @_type "IO")) - . (function name: (variable) @function) - (#eq? @_name @function)) +; Consider signatures (and accompanying functions) +; with only one value on the rhs as variables +(signature + . + (variable) @variable + . + (_) .) -;; functions with parameters -;; + accompanying signatures +((signature + . + (variable) @_name + . + (_) .) + . + (function + name: (variable) @variable) + (#eq? @_name @variable)) + +; but consider a type that involves 'IO' a function +(signature + name: (variable) @function + . + (type_apply + (type_name) @_type) + (#eq? @_type "IO")) + +((signature + name: (variable) @_name + . + (type_apply + (type_name) @_type) + (#eq? @_type "IO")) + . + (function + name: (variable) @function) + (#eq? @_name @function)) + +; functions with parameters +; + accompanying signatures (function name: (variable) @function patterns: (patterns)) + ((signature) @function - . (function + . + (function name: (variable) @function patterns: (patterns))) + (function name: (variable) @function rhs: (exp_lambda)) ; view patterns -(pat_view (exp_name [ - ((variable) @function.call) - (qualified_variable (variable) @function.call) -])) +(pat_view + (exp_name + [ + ((variable) @function.call) + (qualified_variable + (variable) @function.call) + ])) ; consider infix functions as operators -(exp_infix [ - (variable) @operator - (qualified_variable (variable) @operator) -]) +(exp_infix + [ + (variable) @operator + (qualified_variable + (variable) @operator) + ]) + ; partially applied infix functions (sections) also get highlighted as operators -(exp_section_right [ - ((variable) @operator) - (qualified_variable (variable) @operator) -]) -(exp_section_left [ - ((variable) @operator) - (qualified_variable (variable) @operator) -]) +(exp_section_right + [ + ((variable) @operator) + (qualified_variable + (variable) @operator) + ]) + +(exp_section_left + [ + ((variable) @operator) + (qualified_variable + (variable) @operator) + ]) ; function calls with an infix operator ; e.g. func <$> a <*> b -(exp_infix - (exp_name +(exp_infix + (exp_name [ ((variable) @function.call) - (qualified_variable ( - (module) @module - (variable) @function.call)) + (qualified_variable + ((module) @module + (variable) @function.call)) ]) - . (operator)) -; infix operators applied to variables -((exp_name (variable) @variable) . (operator)) -((operator) . (exp_name [ - ((variable) @variable) - (qualified_variable (variable) @variable) -])) -; function calls with infix operators -((exp_name [ - ((variable) @function.call) - (qualified_variable (variable) @function.call) - ]) . (operator) @_op - (#any-of? @_op "$" "<$>" ">>=" "=<<")) -; right hand side of infix operator -((exp_infix - [(operator)(variable)] ; infix or `func` - . (exp_name [ - ((variable) @function.call) - (qualified_variable (variable) @function.call) - ])) . (operator) @_op - (#any-of? @_op "$" "<$>" "=<<")) -; function composition, arrows, monadic composition (lhs) -((exp_name [ - ((variable) @function) - (qualified_variable (variable) @function) - ]) . (operator) @_op - (#any-of? @_op "." ">>>" "***" ">=>" "<=<")) -; right hand side of infix operator -((exp_infix - [(operator)(variable)] ; infix or `func` - . (exp_name [ - ((variable) @function) - (qualified_variable (variable) @function) - ])) . (operator) @_op - (#any-of? @_op "." ">>>" "***" ">=>" "<=<")) -; function composition, arrows, monadic composition (rhs) -((operator) @_op . (exp_name [ - ((variable) @function) - (qualified_variable (variable) @function) - ]) - (#any-of? @_op "." ">>>" "***" ">=>" "<=<" )) - -; function defined in terms of a function composition -(function - name: (variable) @function - rhs: (exp_infix (_) . (operator) @_op . (_) - (#any-of? @_op "." ">>>" "***" ">=>" "<=<"))) + . + (operator)) -(exp_apply (exp_name +; infix operators applied to variables +((exp_name + (variable) @variable) + . + (operator)) + +((operator) + . + (exp_name + [ + ((variable) @variable) + (qualified_variable + (variable) @variable) + ])) + +; function calls with infix operators +((exp_name [ ((variable) @function.call) - (qualified_variable (variable) @function.call) - ])) + (qualified_variable + (variable) @function.call) + ]) + . + (operator) @_op + (#any-of? @_op "$" "<$>" ">>=" "=<<")) + +; right hand side of infix operator +((exp_infix + [ + (operator) + (variable) + ] ; infix or `func` + . + (exp_name + [ + ((variable) @function.call) + (qualified_variable + (variable) @function.call) + ])) + . + (operator) @_op + (#any-of? @_op "$" "<$>" "=<<")) + +; function composition, arrows, monadic composition (lhs) +((exp_name + [ + ((variable) @function) + (qualified_variable + (variable) @function) + ]) + . + (operator) @_op + (#any-of? @_op "." ">>>" "***" ">=>" "<=<")) + +; right hand side of infix operator +((exp_infix + [ + (operator) + (variable) + ] ; infix or `func` + . + (exp_name + [ + ((variable) @function) + (qualified_variable + (variable) @function) + ])) + . + (operator) @_op + (#any-of? @_op "." ">>>" "***" ">=>" "<=<")) + +; function composition, arrows, monadic composition (rhs) +((operator) @_op + . + (exp_name + [ + ((variable) @function) + (qualified_variable + (variable) @function) + ]) + (#any-of? @_op "." ">>>" "***" ">=>" "<=<")) + +; function defined in terms of a function composition +(function + name: (variable) @function + rhs: + (exp_infix + (_) + . + (operator) @_op + . + (_) + (#any-of? @_op "." ">>>" "***" ">=>" "<=<"))) + +(exp_apply + (exp_name + [ + ((variable) @function.call) + (qualified_variable + (variable) @function.call) + ])) ; function compositions, in parentheses, applied ; lhs -(exp_apply - . (exp_parens (exp_infix - (exp_name [((variable) @function.call) (qualified_variable (variable) @function.call)]) - . (operator)))) +(exp_apply + . + (exp_parens + (exp_infix + (exp_name + [ + ((variable) @function.call) + (qualified_variable + (variable) @function.call) + ]) + . + (operator)))) + ; rhs -(exp_apply - . (exp_parens (exp_infix - (operator) - . (exp_name [((variable) @function.call) (qualified_variable (variable) @function.call)]))) - ) +(exp_apply + . + (exp_parens + (exp_infix + (operator) + . + (exp_name + [ + ((variable) @function.call) + (qualified_variable + (variable) @function.call) + ])))) -;; variables being passed to a function call -(exp_apply (_)+ - . (exp_name [ - ((variable) @variable) - (qualified_variable (variable) @variable) - ])) +; variables being passed to a function call +(exp_apply + (_)+ + . + (exp_name + [ + ((variable) @variable) + (qualified_variable + (variable) @variable) + ])) -;; Consider functions with only one value on the rhs -;; as variables, e.g. x = Rec {} or x = foo +; Consider functions with only one value on the rhs +; as variables, e.g. x = Rec {} or x = foo (function - . (variable) @variable - . [ - (exp_record) - (exp_name [(variable) (qualified_variable)]) - (exp_list) - (exp_tuple) - (exp_cond) - ] . ) + . + (variable) @variable + . + [ + (exp_record) + (exp_name + [ + (variable) + (qualified_variable) + ]) + (exp_list) + (exp_tuple) + (exp_cond) + ] .) -;; main is always a function -;; (this prevents `main = undefined` from being highlighted as a variable) -(function name: (variable) @function (#eq? @function "main")) +; main is always a function +; (this prevents `main = undefined` from being highlighted as a variable) +(function + name: (variable) @function + (#eq? @function "main")) -;; scoped function types (func :: a -> b) -(pat_typed - pattern: (pat_name (variable) @function) +; scoped function types (func :: a -> b) +(pat_typed + pattern: + (pat_name + (variable) @function) type: (fun)) -;; signatures that have a function type -;; + functions that follow them -((signature (variable) @function (fun))) -((signature (variable) @_type (fun)) . (function (variable) @function) (#eq? @function @_type)) -((signature (variable) @function (context (fun)))) -((signature (variable) @_type (context (fun))) . (function (variable) @function) (#eq? @function @_type)) -((signature (variable) @function (forall (context (fun)))) . (function (variable))) -((signature (variable) @_type (forall (context (fun)))) . (function (variable) @function) (#eq? @function @_type)) +; signatures that have a function type +; + functions that follow them +((signature + (variable) @function + (fun))) -;; ---------------------------------------------------------------------------- -;; Types +((signature + (variable) @_type + (fun)) + . + (function + (variable) @function) + (#eq? @function @_type)) +((signature + (variable) @function + (context + (fun)))) + +((signature + (variable) @_type + (context + (fun))) + . + (function + (variable) @function) + (#eq? @function @_type)) + +((signature + (variable) @function + (forall + (context + (fun)))) + . + (function + (variable))) + +((signature + (variable) @_type + (forall + (context + (fun)))) + . + (function + (variable) @function) + (#eq? @function @_type)) + +; ---------------------------------------------------------------------------- +; Types (type) @type + (type_star) @type + (type_variable) @type (constructor) @constructor ; True or False -((constructor) @boolean (#any-of? @boolean "True" "False")) +((constructor) @boolean + (#any-of? @boolean "True" "False")) + ; otherwise (= True) ((variable) @boolean (#eq? @boolean "otherwise")) -;; ---------------------------------------------------------------------------- -;; Quasi-quotes - +; ---------------------------------------------------------------------------- +; Quasi-quotes (quoter) @function.call -(quasiquote +(quasiquote [ - (quoter) @_name - (_ (variable) @_name) - ](#eq? @_name "qq") + (quoter) @_name + (_ + (variable) @_name) + ] + (#eq? @_name "qq") (quasiquote_body) @string) -(quasiquote - ((_ (variable) @_name)) (#eq? @_name "qq") +(quasiquote + ((_ + (variable) @_name)) + (#eq? @_name "qq") (quasiquote_body) @string) -;; namespaced quasi-quoter +; namespaced quasi-quoter (quasiquote (_ (module) @module - . (variable) @function.call - )) + . + (variable) @function.call)) ; Highlighting of quasiquote_body for other languages is handled by injections.scm - -;; ---------------------------------------------------------------------------- -;; Exceptions/error handling - +; ---------------------------------------------------------------------------- +; Exceptions/error handling ((variable) @keyword.exception - (#any-of? @keyword.exception - "error" - "undefined" - "try" - "tryJust" - "tryAny" - "catch" - "catches" - "catchJust" - "handle" - "handleJust" - "throw" - "throwIO" - "throwTo" - "throwError" - "ioError" - "mask" - "mask_" - "uninterruptibleMask" - "uninterruptibleMask_" - "bracket" - "bracket_" - "bracketOnErrorSource" - "finally" - "fail" - "onException" - "expectationFailure")) + (#any-of? @keyword.exception "error" "undefined" "try" "tryJust" "tryAny" "catch" "catches" "catchJust" "handle" "handleJust" "throw" "throwIO" "throwTo" "throwError" "ioError" "mask" "mask_" "uninterruptibleMask" "uninterruptibleMask_" "bracket" "bracket_" "bracketOnErrorSource" "finally" "fail" "onException" "expectationFailure")) -;; ---------------------------------------------------------------------------- -;; Debugging +; ---------------------------------------------------------------------------- +; Debugging ((variable) @keyword.debug - (#any-of? @keyword.debug - "trace" - "traceId" - "traceShow" - "traceShowId" - "traceWith" - "traceShowWith" - "traceStack" - "traceIO" - "traceM" - "traceShowM" - "traceEvent" - "traceEventWith" - "traceEventIO" - "flushEventLog" - "traceMarker" - "traceMarkerIO")) + (#any-of? @keyword.debug "trace" "traceId" "traceShow" "traceShowId" "traceWith" "traceShowWith" "traceStack" "traceIO" "traceM" "traceShowM" "traceEvent" "traceEventWith" "traceEventIO" "flushEventLog" "traceMarker" "traceMarkerIO")) +; ---------------------------------------------------------------------------- +; Fields +(field + (variable) @variable.member) -;; ---------------------------------------------------------------------------- -;; Fields -(field (variable) @variable.member) -(pat_field (variable) @variable.member) -(exp_projection field: (variable) @variable.member) -(import_item (type) . (import_con_names (variable) @variable.member)) -(exp_field field: [((variable) @variable.member) (qualified_variable (variable) @variable.member)]) +(pat_field + (variable) @variable.member) +(exp_projection + field: (variable) @variable.member) -;; ---------------------------------------------------------------------------- -;; Spell checking +(import_item + (type) + . + (import_con_names + (variable) @variable.member)) +(exp_field + field: + [ + ((variable) @variable.member) + (qualified_variable + (variable) @variable.member) + ]) + +; ---------------------------------------------------------------------------- +; Spell checking (comment) @spell diff --git a/queries/haskell/injections.scm b/queries/haskell/injections.scm index bc70e012f..d1c8fe5fb 100644 --- a/queries/haskell/injections.scm +++ b/queries/haskell/injections.scm @@ -1,18 +1,15 @@ -;; ----------------------------------------------------------------------------- -;; General language injection - +; ----------------------------------------------------------------------------- +; General language injection (quasiquote - ((quoter) @injection.language) - ((quasiquote_body) @injection.content) -) + ((quoter) @injection.language) + ((quasiquote_body) @injection.content)) ((comment) @injection.content - (#set! injection.language "comment")) - -;; ----------------------------------------------------------------------------- -;; shakespeare library -;; NOTE: doesn't support templating + (#set! injection.language "comment")) +; ----------------------------------------------------------------------------- +; shakespeare library +; NOTE: doesn't support templating ; TODO: add once CoffeeScript parser is added ; ; CoffeeScript: Text.Coffee ; (quasiquote @@ -20,58 +17,52 @@ ; (#eq? @_name "coffee") ; ((quasiquote_body) @injection.content ; (#set! injection.language "coffeescript"))) - ; CSS: Text.Cassius, Text.Lucius (quasiquote - (quoter) @_name - (#any-of? @_name "cassius" "lucius") - ((quasiquote_body) @injection.content) - (#set! injection.language "css")) + (quoter) @_name + (#any-of? @_name "cassius" "lucius") + ((quasiquote_body) @injection.content) + (#set! injection.language "css")) ; HTML: Text.Hamlet (quasiquote - (quoter) @_name - (#any-of? @_name "shamlet" "xshamlet" "hamlet" "xhamlet" "ihamlet") - ((quasiquote_body) @injection.content) - (#set! injection.language "html")) + (quoter) @_name + (#any-of? @_name "shamlet" "xshamlet" "hamlet" "xhamlet" "ihamlet") + ((quasiquote_body) @injection.content) + (#set! injection.language "html")) ; JS: Text.Julius (quasiquote - (quoter) @_name - (#any-of? @_name "js" "julius") - ((quasiquote_body) @injection.content) - (#set! injection.language "javascript")) + (quoter) @_name + (#any-of? @_name "js" "julius") + ((quasiquote_body) @injection.content) + (#set! injection.language "javascript")) ; TS: Text.TypeScript (quasiquote - (quoter) @_name - (#any-of? @_name "tsc" "tscJSX") - ((quasiquote_body) @injection.content) - (#set! injection.language "typescript")) - - -;; ----------------------------------------------------------------------------- -;; HSX + (quoter) @_name + (#any-of? @_name "tsc" "tscJSX") + ((quasiquote_body) @injection.content) + (#set! injection.language "typescript")) +; ----------------------------------------------------------------------------- +; HSX (quasiquote - (quoter) @_name - (#eq? @_name "hsx") - ((quasiquote_body) @injection.content) - (#set! injection.language "html")) - -;; ----------------------------------------------------------------------------- -;; Inline JSON from aeson + (quoter) @_name + (#eq? @_name "hsx") + ((quasiquote_body) @injection.content) + (#set! injection.language "html")) +; ----------------------------------------------------------------------------- +; Inline JSON from aeson (quasiquote (quoter) @_name (#eq? @_name "aesonQQ") ((quasiquote_body) @injection.content) (#set! injection.language "json")) - -;; ----------------------------------------------------------------------------- -;; SQL - +; ----------------------------------------------------------------------------- +; SQL ; postgresql-simple (quasiquote (quoter) @injection.language diff --git a/queries/haskell_persistent/folds.scm b/queries/haskell_persistent/folds.scm index 2bdffd177..dd34d9f15 100644 --- a/queries/haskell_persistent/folds.scm +++ b/queries/haskell_persistent/folds.scm @@ -1,3 +1 @@ -[ - (entity_definition) -] @fold +(entity_definition) @fold diff --git a/queries/haskell_persistent/highlights.scm b/queries/haskell_persistent/highlights.scm index e806befcf..22cbf5cb3 100644 --- a/queries/haskell_persistent/highlights.scm +++ b/queries/haskell_persistent/highlights.scm @@ -1,20 +1,23 @@ -;; ---------------------------------------------------------------------------- -;; Literals and comments - +; ---------------------------------------------------------------------------- +; Literals and comments (integer) @number + (float) @number.float + (char) @character + (string) @string + (attribute_name) @attribute + (attribute_exclamation_mark) @attribute -(con_unit) @string.special.symbol ; unit, as in () +(con_unit) @string.special.symbol ; unit, as in () (comment) @comment @spell -;; ---------------------------------------------------------------------------- -;; Keywords, operators, includes - +; ---------------------------------------------------------------------------- +; Keywords, operators, includes [ "Id" "Primary" @@ -24,15 +27,12 @@ "=" @operator - -;; ---------------------------------------------------------------------------- -;; Functions and variables - +; ---------------------------------------------------------------------------- +; Functions and variables (variable) @variable -;; ---------------------------------------------------------------------------- -;; Types - +; ---------------------------------------------------------------------------- +; Types (type) @type (constructor) @constructor diff --git a/queries/hcl/folds.scm b/queries/hcl/folds.scm index cb20b2aa8..e0c5313a2 100644 --- a/queries/hcl/folds.scm +++ b/queries/hcl/folds.scm @@ -1,6 +1,6 @@ [ - (comment) - (block) - (heredoc_template) - (object) + (comment) + (block) + (heredoc_template) + (object) ] @fold diff --git a/queries/hcl/highlights.scm b/queries/hcl/highlights.scm index 7aa8b86fe..45a120dff 100644 --- a/queries/hcl/highlights.scm +++ b/queries/hcl/highlights.scm @@ -1,5 +1,4 @@ ; highlights.scm - [ "!" "\*" @@ -76,22 +75,45 @@ ] @punctuation.special (numeric_lit) @number + (bool_lit) @boolean + (null_lit) @constant + (comment) @comment @spell + (identifier) @variable -(body (block (identifier) @keyword)) -(body (block (body (block (identifier) @type)))) -(function_call (identifier) @function) -(attribute (identifier) @variable.member) +(body + (block + (identifier) @keyword)) + +(body + (block + (body + (block + (identifier) @type)))) + +(function_call + (identifier) @function) + +(attribute + (identifier) @variable.member) ; { key: val } ; ; highlight identifier keys as though they were block attributes -(object_elem key: (expression (variable_expr (identifier) @variable.member))) +(object_elem + key: + (expression + (variable_expr + (identifier) @variable.member))) ; var.foo, data.bar ; ; first element in get_attr is a variable.builtin or a reference to a variable.builtin -(expression (variable_expr (identifier) @variable.builtin) (get_attr (identifier) @variable.member)) +(expression + (variable_expr + (identifier) @variable.builtin) + (get_attr + (identifier) @variable.member)) diff --git a/queries/hcl/indents.scm b/queries/hcl/indents.scm index 93264de9d..1d7dc49d9 100644 --- a/queries/hcl/indents.scm +++ b/queries/hcl/indents.scm @@ -12,4 +12,5 @@ ] @indent.branch @indent.end (comment) @indent.auto + (ERROR) @indent.auto diff --git a/queries/hcl/injections.scm b/queries/hcl/injections.scm index fd881d503..b68f4caea 100644 --- a/queries/hcl/injections.scm +++ b/queries/hcl/injections.scm @@ -1,5 +1,5 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) (heredoc_template (template_literal) @injection.content diff --git a/queries/heex/highlights.scm b/queries/heex/highlights.scm index f13e5d04f..e2fb01880 100644 --- a/queries/heex/highlights.scm +++ b/queries/heex/highlights.scm @@ -31,23 +31,24 @@ ; HEEx text content is treated as markup ; (text) @none - ; HEEx tags and slots are highlighted as HTML [ - (tag_name) - (slot_name) + (tag_name) + (slot_name) ] @tag ; HEEx attributes are highlighted as HTML attributes (attribute_name) @tag.attribute + [ (attribute_value) (quoted_attribute_value) ] @string ; HEEx components are highlighted as modules and function calls -(component_name [ - (module) @type - (function) @function - "." @punctuation.delimiter -]) +(component_name + [ + (module) @type + (function) @function + "." @punctuation.delimiter + ]) diff --git a/queries/heex/injections.scm b/queries/heex/injections.scm index d8ae03caa..4f179ee80 100644 --- a/queries/heex/injections.scm +++ b/queries/heex/injections.scm @@ -27,4 +27,4 @@ ; HEEx comments ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/hjson/highlights.scm b/queries/hjson/highlights.scm index 6e092fa14..8333d8fe5 100644 --- a/queries/hjson/highlights.scm +++ b/queries/hjson/highlights.scm @@ -1,15 +1,28 @@ (true) @boolean + (false) @boolean + (null) @constant.builtin + (number) @number -(pair key: (string) @label) -(pair value: (string) @string) -(array (string) @string) + +(pair + key: (string) @label) + +(pair + value: (string) @string) + +(array + (string) @string) + ; (string_content (escape_sequence) @string.escape) ; "," @punctuation.delimiter "[" @punctuation.bracket + "]" @punctuation.bracket + "{" @punctuation.bracket + "}" @punctuation.bracket (comment) @comment @spell diff --git a/queries/hjson/indents.scm b/queries/hjson/indents.scm index 3b01ca999..350f670a0 100644 --- a/queries/hjson/indents.scm +++ b/queries/hjson/indents.scm @@ -1,3 +1,2 @@ ; inherits: json - (comment) @indent.ignore diff --git a/queries/hjson/injections.scm b/queries/hjson/injections.scm index 321c90add..2f0e58eb6 100644 --- a/queries/hjson/injections.scm +++ b/queries/hjson/injections.scm @@ -1,2 +1,2 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/hlsl/highlights.scm b/queries/hlsl/highlights.scm index 68e9e44bd..b85c1a7fd 100644 --- a/queries/hlsl/highlights.scm +++ b/queries/hlsl/highlights.scm @@ -1,5 +1,4 @@ ; inherits: cpp - [ "in" "out" @@ -26,10 +25,13 @@ "triangle" ] @type.qualifier -( - (identifier) @variable.builtin - (#lua-match? @variable.builtin "^SV_") -) +((identifier) @variable.builtin + (#lua-match? @variable.builtin "^SV_")) (hlsl_attribute) @attribute -(hlsl_attribute ["[" "]"] @attribute) + +(hlsl_attribute + [ + "[" + "]" + ] @attribute) diff --git a/queries/hlsl/injections.scm b/queries/hlsl/injections.scm index 29222ee01..c2fca7121 100644 --- a/queries/hlsl/injections.scm +++ b/queries/hlsl/injections.scm @@ -1,5 +1,5 @@ ((preproc_arg) @injection.content - (#set! injection.language "hlsl")) + (#set! injection.language "hlsl")) ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/hocon/highlights.scm b/queries/hocon/highlights.scm index f0cc498b4..0eb94e6dd 100644 --- a/queries/hocon/highlights.scm +++ b/queries/hocon/highlights.scm @@ -1,37 +1,65 @@ (comment) @comment @spell (null) @constant.builtin -[ (true) (false) ] @boolean + +[ + (true) + (false) +] @boolean + (number) @number + (unit) @keyword + (string) @string + (multiline_string) @string -(string (escape_sequence) @string.escape) + +(string + (escape_sequence) @string.escape) + (unquoted_string) @string -[ "url" +[ + "url" "file" "classpath" "required" ] @keyword -(include "include" @keyword.import) +(include + "include" @keyword.import) -(substitution ["${" "${?" "}"] @punctuation.special) -(substitution (_) @variable.member) +(substitution + [ + "${" + "${?" + "}" + ] @punctuation.special) -(path (_) @variable.member) -(value [":" "=" "+=" ] @operator) +(substitution + (_) @variable.member) + +(path + (_) @variable.member) + +(value + [ + ":" + "=" + "+=" + ] @operator) [ - "(" - ")" - "[" - "]" - "{" - "}" -] @punctuation.bracket + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket -[ "," ] @punctuation.delimiter -(unquoted_path "." @punctuation.delimiter) +"," @punctuation.delimiter +(unquoted_path + "." @punctuation.delimiter) diff --git a/queries/hocon/injections.scm b/queries/hocon/injections.scm index 321c90add..2f0e58eb6 100644 --- a/queries/hocon/injections.scm +++ b/queries/hocon/injections.scm @@ -1,2 +1,2 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/hoon/folds.scm b/queries/hoon/folds.scm index 93d1386e7..cfb4b6d0c 100644 --- a/queries/hoon/folds.scm +++ b/queries/hoon/folds.scm @@ -1,6 +1,6 @@ [ - (bartisTall) - (luslusTall) - (lusbucTall) - (barcenTall) - ] @fold + (bartisTall) + (luslusTall) + (lusbucTall) + (barcenTall) +] @fold diff --git a/queries/hoon/highlights.scm b/queries/hoon/highlights.scm index 029d20c1e..767b0dd22 100644 --- a/queries/hoon/highlights.scm +++ b/queries/hoon/highlights.scm @@ -7,14 +7,13 @@ ")" "[" "]" -] @punctuation.bracket +] @punctuation.bracket [ (coreTerminator) (seriesTerminator) ] @punctuation.delimiter - (rune) @operator (term) @constant @@ -28,6 +27,9 @@ (date) @string.special (mold) @string.special.symbol + (specialIndex) @number.builtin + (lark) @operator + (fullContext) @string.special.symbol diff --git a/queries/hoon/locals.scm b/queries/hoon/locals.scm index f8cb5f857..fd7cc026d 100644 --- a/queries/hoon/locals.scm +++ b/queries/hoon/locals.scm @@ -1,4 +1,4 @@ (tisfasTall name: (name) @local.definition.var) - + (name) @local.reference diff --git a/queries/html/highlights.scm b/queries/html/highlights.scm index 4e2371d64..ae4e396c0 100644 --- a/queries/html/highlights.scm +++ b/queries/html/highlights.scm @@ -1,5 +1,4 @@ ; inherits: html_tags - (doctype) @constant "" - "" + "<" + ">" + "" ] @tag.delimiter "=" @operator diff --git a/queries/html_tags/indents.scm b/queries/html_tags/indents.scm index 2d9fd3864..59448d2fc 100644 --- a/queries/html_tags/indents.scm +++ b/queries/html_tags/indents.scm @@ -1,31 +1,32 @@ [ - ( - (element - (start_tag - (tag_name) @_not_special) - ) - (#not-any-of? @_not_special "meta" "link") - ) - (element (self_closing_tag)) + ((element + (start_tag + (tag_name) @_not_special)) + (#not-any-of? @_not_special "meta" "link")) + (element + (self_closing_tag)) ] @indent.begin - ; These tags are usually written one-lined and doesn't use self-closing tags so special-cased them ; but add indent to the tag to make sure attributes inside them are still indented if written multi-lined -( - (start_tag - (tag_name) @_special) - (#any-of? @_special "meta" "link") -) @indent.begin - +((start_tag + (tag_name) @_special) + (#any-of? @_special "meta" "link")) @indent.begin ; These are the nodes that will be captured when we do `normal o` ; But last element has already been ended, so capturing this ; to mark end of last element -(element (end_tag [">"] @indent.end)) -(element (self_closing_tag "/>" @indent.end)) +(element + (end_tag + ">" @indent.end)) + +(element + (self_closing_tag + "/>" @indent.end)) ; Script/style elements aren't indented, so only branch the end tag of other elements -(element (end_tag) @indent.branch) +(element + (end_tag) @indent.branch) + [ ">" "/>" diff --git a/queries/html_tags/injections.scm b/queries/html_tags/injections.scm index cef63ad8d..8cfcddf29 100644 --- a/queries/html_tags/injections.scm +++ b/queries/html_tags/injections.scm @@ -3,51 +3,57 @@ ; Add "lang" to predicate check so that vue/svelte can inherit this ; without having this element being captured twice ((style_element - (start_tag) @_no_type_lang - (raw_text) @injection.content) + (start_tag) @_no_type_lang + (raw_text) @injection.content) (#not-lua-match? @_no_type_lang "%slang%s*=") (#not-lua-match? @_no_type_lang "%stype%s*=") (#set! injection.language "css")) ((style_element - (start_tag - (attribute - (attribute_name) @_type - (quoted_attribute_value (attribute_value) @_css))) - (raw_text) @injection.content) - (#eq? @_type "type") - (#eq? @_css "text/css") - (#set! injection.language "css")) + (start_tag + (attribute + (attribute_name) @_type + (quoted_attribute_value + (attribute_value) @_css))) + (raw_text) @injection.content) + (#eq? @_type "type") + (#eq? @_css "text/css") + (#set! injection.language "css")) ; ; ((script_element - (start_tag) @_no_type_lang - (raw_text) @injection.content) - (#not-lua-match? @_no_type_lang "%slang%s*=") - (#not-lua-match? @_no_type_lang "%stype%s*=") - (#set! injection.language "javascript")) + (start_tag) @_no_type_lang + (raw_text) @injection.content) + (#not-lua-match? @_no_type_lang "%slang%s*=") + (#not-lua-match? @_no_type_lang "%stype%s*=") + (#set! injection.language "javascript")) ; + + @@ -27,8 +29,6 @@ - - @@ -40,7 +40,7 @@ - +
Test div to test css injections for style attributes From c13511c8842451f4408666ae803b07d030b3782d Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 18 Apr 2025 13:14:31 +0200 Subject: [PATCH 2120/2494] feat(parsers): update nickel, sql, devicetree, dhall, htmldjango, t32, gap, javadoc, templ, jinja, tera, verilog, meson, mlir, typespec, wit, phpdoc, superhtml, git_config, swift, terraform, vim, koto, rasi, rescript, bp, enforce, erlang, jinja_inline, cmake, fennel, comment, slint, elm, rust, hcl --- lua/nvim-treesitter/parsers.lua | 72 ++++++++++++++++----------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 01c78a63f..58456ecfa 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -144,7 +144,7 @@ return { }, bp = { install_info = { - revision = '16c43068ec30828c5aed11e87262c56f36782595', + revision = 'ee641d15390183d7535777947ce0f2f1fbcee69f', url = 'https://github.com/ambroisie/tree-sitter-bp', }, maintainers = { '@ambroisie' }, @@ -225,7 +225,7 @@ return { }, cmake = { install_info = { - revision = 'fe48221d4d9842d916d66b5e71ab3c6307ec28b3', + revision = 'c2fdefaf7ae3b7c5cf11705fe63c516b1c490590', url = 'https://github.com/uyha/tree-sitter-cmake', }, maintainers = { '@uyha' }, @@ -233,7 +233,7 @@ return { }, comment = { install_info = { - revision = '3555706cef8b98d3e4c7379d7260548ff03ad363', + revision = '85eae6644d25bcbdd19f4a35c9946abc71c2d6fe', url = 'https://github.com/stsewd/tree-sitter-comment', }, maintainers = { '@stsewd' }, @@ -352,7 +352,7 @@ return { }, devicetree = { install_info = { - revision = '16f640f3c59117c9e749d581634afdb00e004f4c', + revision = '6557729f4afaf01dec7481d4e5975515ea8f0edd', url = 'https://github.com/joelspadin/tree-sitter-devicetree', }, maintainers = { '@jedrzejboczar' }, @@ -360,7 +360,7 @@ return { }, dhall = { install_info = { - revision = '4a6c08abfb54827db4e722d6cdca81b093898988', + revision = '62013259b26ac210d5de1abf64cf1b047ef88000', url = 'https://github.com/jbellerb/tree-sitter-dhall', }, maintainers = { '@amaanq' }, @@ -479,7 +479,7 @@ return { }, elm = { install_info = { - revision = 'e34bdc5c512918628b05b48e633f711123204e45', + revision = '3b373a3ccb48f31aa4b7ddc9092e2f5e24ab7aed', url = 'https://github.com/elm-tooling/tree-sitter-elm', }, maintainers = { '@zweimach' }, @@ -510,7 +510,7 @@ return { }, enforce = { install_info = { - revision = 'aedd0bbab9dcc9caec9cc4e32bd303e86509522b', + revision = '36064bd71ce22e9a8c73b64b1a3448cc600a4312', url = 'https://github.com/simonvic/tree-sitter-enforce', }, maintainers = { '@simonvic' }, @@ -518,7 +518,7 @@ return { }, erlang = { install_info = { - revision = '416ca60d7d2a824c0d346163541153e230710780', + revision = '067d66937c8eeb6651e349f400c1756c2ea90b2e', url = 'https://github.com/WhatsApp/tree-sitter-erlang', }, maintainers = { '@filmor' }, @@ -543,7 +543,7 @@ return { fennel = { install_info = { generate_from_json = true, - revision = 'cfbfa478dc2dbef267ee94ae4323d9c886f45e94', + revision = 'de06b9ad366f0186080056109a8c3be980129538', url = 'https://github.com/alexmozaidze/tree-sitter-fennel', }, maintainers = { '@alexmozaidze' }, @@ -632,7 +632,7 @@ return { }, gap = { install_info = { - revision = '7db79590d2f8b0e0246008ecfd569b4bfca587a9', + revision = '8dee53cfb962600dd35ca25432f005e7920e89f2', url = 'https://github.com/gap-system/tree-sitter-gap', }, maintainers = { '@reiniscirpons' }, @@ -668,7 +668,7 @@ return { }, git_config = { install_info = { - revision = '9c2a1b7894e6d9eedfe99805b829b4ecd871375e', + revision = 'edc973f498482529ff2a319249d0f43a22860321', url = 'https://github.com/the-mikedavis/tree-sitter-git-config', }, maintainers = { '@amaanq' }, @@ -900,7 +900,7 @@ return { }, hcl = { install_info = { - revision = 'de10d494dbd6b71cdf07a678fecbf404dbfe4398', + revision = '41a2e702413a53f2614533b2aa9c187816116cbc', url = 'https://github.com/tree-sitter-grammars/tree-sitter-hcl', }, maintainers = { '@MichaHoffmann' }, @@ -984,7 +984,7 @@ return { }, htmldjango = { install_info = { - revision = 'ea71012d3fe14dd0b69f36be4f96bdfe9155ebae', + revision = '3a643167ad9afac5d61e092f08ff5b054576fadf', url = 'https://github.com/interdependence/tree-sitter-htmldjango', }, maintainers = { '@ObserverOfTime' }, @@ -1082,7 +1082,7 @@ return { }, javadoc = { install_info = { - revision = '330cc9cb4f33545f7bfce6c3b6aa77fe6db1b537', + revision = 'd162cc3344a9be8196b72d8780478474c4e0fd55', url = 'https://github.com/rmuir/tree-sitter-javadoc', }, maintainers = { '@rmuir' }, @@ -1100,7 +1100,7 @@ return { jinja = { install_info = { location = 'tree-sitter-jinja', - revision = '9af6ce9380fabd3d5b19d0254b8c8936e879c471', + revision = '258d7fb22fa6cd2dc800f201cfdcbe05111a836c', url = 'https://github.com/cathaysia/tree-sitter-jinja', }, maintainers = { '@cathaysia' }, @@ -1111,7 +1111,7 @@ return { jinja_inline = { install_info = { location = 'tree-sitter-jinja_inline', - revision = '9af6ce9380fabd3d5b19d0254b8c8936e879c471', + revision = '258d7fb22fa6cd2dc800f201cfdcbe05111a836c', url = 'https://github.com/cathaysia/tree-sitter-jinja', }, maintainers = { '@cathaysia' }, @@ -1223,7 +1223,7 @@ return { }, koto = { install_info = { - revision = '46770abba021e2ddd2c51d9fa3087fd1ab6b2aea', + revision = 'f4e64231b5a2ddd3ff2731896b3bbcaf1c0b32a1', url = 'https://github.com/koto-lang/tree-sitter-koto', }, maintainers = { '@irh' }, @@ -1399,7 +1399,7 @@ return { }, meson = { install_info = { - revision = 'a56af662e8540412fed5e40cc20435b2b9a20502', + revision = '0e5919d240fd639d81ddc9778152bf487bb9efc7', url = 'https://github.com/tree-sitter-grammars/tree-sitter-meson', }, maintainers = { '@Decodetalkers' }, @@ -1408,7 +1408,7 @@ return { mlir = { install_info = { generate = true, - revision = '922cbb97f3d20044e6b4362b3d7af5e530ed8f34', + revision = '8a9c57fe224cbc9194a08c1d5b734290b354edc2', url = 'https://github.com/artagnon/tree-sitter-mlir', }, maintainers = { '@artagnon' }, @@ -1440,7 +1440,7 @@ return { }, nickel = { install_info = { - revision = '25464b33522c3f609fa512aa9651707c0b66d48b', + revision = 'f77c02df6dd0845594846beeeedf3715d4b68758', url = 'https://github.com/nickel-lang/tree-sitter-nickel', }, tier = 2, @@ -1607,7 +1607,7 @@ return { phpdoc = { install_info = { generate_from_json = true, - revision = 'fe3202e468bc17332bec8969f2b50ff1f1da3a46', + revision = '03bb10330704b0b371b044e937d5cc7cd40b4999', url = 'https://github.com/claytonrcarter/tree-sitter-phpdoc', }, maintainers = { '@mikehaertl' }, @@ -1844,7 +1844,7 @@ return { }, rasi = { install_info = { - revision = '6c9bbcfdf5f0f553d9ebc01750a3aa247a37b8aa', + revision = 'e735c6881d8b475aaa4ef8f0a2bdfd825b438143', url = 'https://github.com/Fymyte/tree-sitter-rasi', }, maintainers = { '@Fymyte' }, @@ -1910,7 +1910,7 @@ return { }, rescript = { install_info = { - revision = '4606cd81c4c31d1d02390fee530858323410a74c', + revision = 'd2df8a285fff95de56a91d2f8152aeceb66f40ef', url = 'https://github.com/rescript-lang/tree-sitter-rescript', }, maintainers = { '@ribru17' }, @@ -1982,7 +1982,7 @@ return { }, rust = { install_info = { - revision = 'e86119bdb4968b9799f6a014ca2401c178d54b5f', + revision = '3691201b01cacb2f96ffca4c632c4e938bfacd88', url = 'https://github.com/tree-sitter/tree-sitter-rust', }, maintainers = { '@amaanq' }, @@ -2051,7 +2051,7 @@ return { }, slint = { install_info = { - revision = 'f11da7e62051ba8b9d4faa299c26de8aeedfc1cd', + revision = '3493309534cd08ae176c7b917ec79068dca2c1c9', url = 'https://github.com/slint-ui/tree-sitter-slint', }, maintainers = { '@hunger' }, @@ -2129,7 +2129,7 @@ return { install_info = { branch = 'gh-pages', generate_from_json = true, - revision = 'b9d109588d5b5ed986c857464830c2f0bef53f18', + revision = 'b1ec2aa5091624e4729f0a771a6d631afebf1ed4', url = 'https://github.com/derekstride/tree-sitter-sql', }, maintainers = { '@derekstride' }, @@ -2188,7 +2188,7 @@ return { superhtml = { install_info = { location = 'tree-sitter-superhtml', - revision = '16887e9fa3122c36a3d4942470e33c1c282fe859', + revision = '13f5a2221cb748bbe50ad702e89362afd5b925a7', url = 'https://github.com/kristoff-it/superhtml', }, maintainers = { '@rockorager' }, @@ -2223,7 +2223,7 @@ return { swift = { install_info = { generate = true, - revision = 'aca5a52aa3cab858944d3c02701ccf5b2d8fd0f9', + revision = '672079db0c0de8d38b018ecc9fe2bb8fa2c722d3', url = 'https://github.com/alex-pinkus/tree-sitter-swift', }, maintainers = { '@alex-pinkus' }, @@ -2247,7 +2247,7 @@ return { }, t32 = { install_info = { - revision = 'e5a12f798f056049642aa03fbb83786e3a5b95d4', + revision = 'dc2a9a3bcc4ad29fff36d3f3bbc62ae117e83028', url = 'https://gitlab.com/xasc/tree-sitter-t32', }, maintainers = { '@xasc' }, @@ -2289,7 +2289,7 @@ return { templ = { install_info = { generate_from_json = true, - revision = 'def9849184de71a797c4e2b2837df85abeccf92c', + revision = '7f7f06b3931ca00e8ddfbeab3fc08ad00d297fad', url = 'https://github.com/vrischmann/tree-sitter-templ', }, maintainers = { '@vrischmann' }, @@ -2297,7 +2297,7 @@ return { }, tera = { install_info = { - revision = '25a7c617192253bddfa65e378975d8c476419010', + revision = 'd006172998fa8b81f96b0f2fc7fa2bf25207c46b', url = 'https://github.com/uncenter/tree-sitter-tera', }, maintainers = { '@uncenter' }, @@ -2306,7 +2306,7 @@ return { terraform = { install_info = { location = 'dialects/terraform', - revision = 'de10d494dbd6b71cdf07a678fecbf404dbfe4398', + revision = '41a2e702413a53f2614533b2aa9c187816116cbc', url = 'https://github.com/MichaHoffmann/tree-sitter-hcl', }, maintainers = { '@MichaHoffmann' }, @@ -2419,7 +2419,7 @@ return { }, typespec = { install_info = { - revision = '42fb163442ef2691b9b720fb4e4e846809415d18', + revision = 'b6b6a66a18e98f44cc2f2cdbfd2e1df845b59852', url = 'https://github.com/happenslol/tree-sitter-typespec', }, maintainers = { '@happenslol' }, @@ -2509,7 +2509,7 @@ return { }, verilog = { install_info = { - revision = '15fbf73dafaffc89050d247857beb27500ea30e8', + revision = 'ba3c1e305caf948f718293c86c6018a82ed5043e', url = 'https://github.com/gmlarumbe/tree-sitter-systemverilog', }, maintainers = { '@zhangwwpeng' }, @@ -2533,7 +2533,7 @@ return { }, vim = { install_info = { - revision = '11b688a1f0e97c0c4e3dbabf4a38016335f4d237', + revision = '0f31cb98e5c0cb3707e097bf95a04c0c2aac573d', url = 'https://github.com/tree-sitter-grammars/tree-sitter-vim', }, maintainers = { '@clason' }, @@ -2593,7 +2593,7 @@ return { }, wit = { install_info = { - revision = '81490b4e74c792369e005f72b0d46fe082d3fed2', + revision = '37bf43c7f11d2b4af7a78d98a19e6d5c2cf04ad2', url = 'https://github.com/liamwh/tree-sitter-wit', }, maintainers = { '@liamwh' }, From 990110336c69f142137992b61b8295c23e5b0387 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 18 Apr 2025 13:16:48 +0200 Subject: [PATCH 2121/2494] feat(julia)!: update parser and queries --- lua/nvim-treesitter/parsers.lua | 2 +- runtime/queries/julia/locals.scm | 8 -------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 58456ecfa..a8e782c1c 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -1175,7 +1175,7 @@ return { }, julia = { install_info = { - revision = '12a3aede757bc7fbdfb1909507c7a6fddd31df37', + revision = '18b739c1563c83fc816170a4241adfa4b69e5c47', url = 'https://github.com/tree-sitter/tree-sitter-julia', }, maintainers = { '@fredrikekre' }, diff --git a/runtime/queries/julia/locals.scm b/runtime/queries/julia/locals.scm index 500b7fe58..218a84ae9 100644 --- a/runtime/queries/julia/locals.scm +++ b/runtime/queries/julia/locals.scm @@ -9,14 +9,6 @@ (tuple_expression (identifier) @local.definition.var)) -; let/const bindings -(let_binding - (identifier) @local.definition.var) - -(let_binding - (tuple_expression - (identifier) @local.definition.var)) - ; For bindings (for_binding (identifier) @local.definition.var) From 308c9b26c7ee1ce0db19650140dcfa5fb71300ee Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 18 Apr 2025 13:22:20 +0200 Subject: [PATCH 2122/2494] feat(tcl)!: update parser and queries --- lua/nvim-treesitter/parsers.lua | 2 +- runtime/queries/tcl/indents.scm | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index a8e782c1c..791f63328 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -2271,7 +2271,7 @@ return { }, tcl = { install_info = { - revision = 'f15e711167661d1ba541d4f62b9dbfc4ce61ec56', + revision = '7b582f8b113bd8a014a44e07d103f70205ac983d', url = 'https://github.com/tree-sitter-grammars/tree-sitter-tcl', }, maintainers = { '@lewis6991' }, diff --git a/runtime/queries/tcl/indents.scm b/runtime/queries/tcl/indents.scm index bc0355372..253cd899e 100644 --- a/runtime/queries/tcl/indents.scm +++ b/runtime/queries/tcl/indents.scm @@ -2,7 +2,9 @@ (braced_word_simple) (namespace) (command) - (conditional) + (if) + (else) + (elseif) (foreach) (while) (try) From ed1f573aaeb9570d200fe16a0d041e335ebb070c Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sat, 19 Apr 2025 10:33:53 +0200 Subject: [PATCH 2123/2494] feat(parsers): update ziggy, ziggy_schema, bibtex, latex --- lua/nvim-treesitter/parsers.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 791f63328..4a5bf1479 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -104,7 +104,7 @@ return { }, bibtex = { install_info = { - revision = 'ccfd77db0ed799b6c22c214fe9d2937f47bc8b34', + revision = '8d04ed27b3bc7929f14b7df9236797dab9f3fa66', url = 'https://github.com/latex-lsp/tree-sitter-bibtex', }, maintainers = { '@theHamsta', '@clason' }, @@ -1248,7 +1248,7 @@ return { latex = { install_info = { generate = true, - revision = '7b06f6ed394308e7407a1703d2724128c45fc9d7', + revision = 'f736d24d89acbd90092d92089e5171e6a449db40', url = 'https://github.com/latex-lsp/tree-sitter-latex', }, maintainers = { '@theHamsta', '@clason' }, @@ -2668,7 +2668,7 @@ return { ziggy = { install_info = { location = 'tree-sitter-ziggy', - revision = '8a29017169f43dc2c3526817e98142eb9a335087', + revision = 'fe3bf9389e7ff213cf3548caaf9c6f3d4bb38647', url = 'https://github.com/kristoff-it/ziggy', }, maintainers = { '@rockorager' }, @@ -2677,7 +2677,7 @@ return { ziggy_schema = { install_info = { location = 'tree-sitter-ziggy-schema', - revision = '8a29017169f43dc2c3526817e98142eb9a335087', + revision = 'fe3bf9389e7ff213cf3548caaf9c6f3d4bb38647', url = 'https://github.com/kristoff-it/ziggy', }, maintainers = { '@rockorager' }, From 037ac775e1bd25577463a4cbdf7991ca3f78fddb Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 22 Apr 2025 10:44:45 +0200 Subject: [PATCH 2124/2494] feat: add .tsqueryrc.json --- .tsqueryrc.json | 375 ++++++++++++++++++++++++++++++++++++++++++++++++ CONTRIBUTING.md | 1 + TODO.md | 1 + 3 files changed, 377 insertions(+) create mode 100644 .tsqueryrc.json diff --git a/.tsqueryrc.json b/.tsqueryrc.json new file mode 100644 index 000000000..129550b46 --- /dev/null +++ b/.tsqueryrc.json @@ -0,0 +1,375 @@ +{ + "$schema": "https://raw.githubusercontent.com/ribru17/ts_query_ls/refs/heads/master/schemas/config.json", + "parser_install_directories": ["${HOME}/.local/share/nvim/site/parser"], + "parser_aliases": { + "html_tags": "html", + "ecma": "javascript", + "jsx": "javascript" + }, + "valid_captures": { + "highlights": { + "variable": "various variable names", + "variable.builtin": "built-in variable names (e.g. `this`)", + "variable.parameter": "parameters of a function", + "variable.parameter.builtin": "special parameters (e.g. `_`, `it`)", + "variable.member": "object and struct fields", + + "constant": "constant identifiers", + "constant.builtin": "built-in constant values", + "constant.macro": "constants defined by the preprocessor", + + "module": "modules or namespaces", + "module.builtin": "built-in modules or namespaces", + "label": "GOTO and other labels (e.g. `label:` in C), including heredoc labels", + + "string": "string literals", + "string.documentation": "string documenting code (e.g. Python docstrings)", + "string.regexp": "regular expressions", + "string.escape": "escape sequences", + "string.special": "other special strings (e.g. dates)", + "string.special.symbol": "symbols or atoms", + "string.special.url": "URIs (e.g. hyperlinks)", + "string.special.path": "filenames", + + "character": "character literals", + "character.special": "special characters (e.g. wildcards)", + + "boolean": "boolean literals", + "number": "numeric literals", + "number.float": "floating-point number literals", + + "type": "type or class definitions and annotations", + "type.builtin": "built-in types", + "type.definition": "identifiers in type definitions (e.g. `typedef ` in C)", + + "attribute": "attribute annotations (e.g. Python decorators, Rust lifetimes)", + "attribute.builtin": "builtin annotations (e.g. `@property` in Python)", + "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 or exporting modules (e.g. `import` / `from` in Python)", + "keyword.type": "keywords describing namespaces and composite types (e.g. `struct`, `enum`)", + "keyword.modifier": "keywords modifying other constructs (e.g. `const`, `static`, `public`)", + "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 & 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`)", + "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.heading.1": "top-level heading", + "markup.heading.2": "section heading", + "markup.heading.3": "subsection heading", + "markup.heading.4": "and so on", + "markup.heading.5": "and so forth", + "markup.heading.6": "six levels ought to be enough for anybody", + "markup.quote": "block quotes", + "markup.math": "math 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 ; (use priority 90 for blocks with injections)", + "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 (and similar)", + "tag.builtin": "builtin tag names (e.g. HTML5 tags)", + "tag.attribute": "XML-style tag attributes", + "tag.delimiter": "XML-style tag delimiters", + + "conceal": "captures that are only meant to be concealed", + "spell": "for defining regions to be spellchecked", + "nospell": "for defining regions that should NOT be spellchecked", + "none": "completely disable the highlight" + }, + "injections": { + "injection.content": "indicates that the captured node should have its contents re-parsed using another language", + "injection.language": "indicates that the captured node’s text may contain the name of a language that should be used to re-parse the `@injection.content`", + "injection.filename": "indicates that the captured node’s text may contain a filename; the corresponding filetype is then looked-up up via `vim.filetype.match()` and treated as the name of a language that should be used to re-parse the `@injection.content`" + }, + "folds": { + "fold": "fold this node" + }, + "indents": { + "indent.begin": "indent children when matching this node", + "indent.end": "marks the end of indented block", + "indent.align": "behaves like python aligned/hanging indent", + "indent.dedent": "dedent children when matching this node", + "indent.branch": "dedent itself when matching this node", + "indent.ignore": "do not indent in this node", + "indent.auto": "behaves like 'autoindent' buffer option", + "indent.zero": "sets this node at position 0 (no indent)" + }, + "locals": { + "local.definition": "various definitions", + "local.definition.constant": "constants", + "local.definition.function": "functions", + "local.definition.method": "methods", + "local.definition.var": "variables", + "local.definition.parameter": "parameters", + "local.definition.macro": "preprocessor macros", + "local.definition.type": "types or classes", + "local.definition.field": "fields or properties", + "local.definition.enum": "enumerations", + "local.definition.namespace": "modules or namespaces", + "local.definition.import": "imported names", + "local.definition.associated": "the associated type of a variable", + "local.scope": "scope block", + "local.reference": "identifier reference" + } + }, + "valid_predicates": { + "eq": { + "any": true, + "parameters": [ + { + "type": "capture", + "arity": "required" + }, + { + "type": "any", + "arity": "required" + } + ], + "description": "checks for equality between two nodes, or a node and a string" + }, + "any-of": { + "parameters": [ + { + "type": "capture", + "arity": "required" + }, + { + "type": "string", + "arity": "required" + }, + { + "type": "string", + "arity": "variadic" + } + ], + "description": "match any of the given strings against the text corresponding to a node" + }, + "contains": { + "any": true, + "parameters": [ + { + "type": "capture", + "arity": "required" + }, + { + "type": "string", + "arity": "required" + }, + { + "type": "string", + "arity": "variadic" + } + ], + "description": "match a string against parts of the text corresponding to a node" + }, + "match": { + "any": true, + "parameters": [ + { + "type": "capture", + "arity": "required" + }, + { + "type": "string", + "arity": "required" + } + ], + "description": "Match a regexp against the text corresponding to a node" + }, + "lua-match": { + "any": true, + "parameters": [ + { + "type": "capture", + "arity": "required" + }, + { + "type": "string", + "arity": "required" + } + ], + "description": "match a Lua pattern against the text corresponding to a node" + }, + "has-ancestor": { + "parameters": [ + { + "type": "capture", + "arity": "required" + }, + { + "type": "string", + "arity": "required" + }, + { + "type": "string", + "arity": "variadic" + } + ], + "description": "match any of the given node types against all ancestors of a node" + }, + "has-parent": { + "parameters": [ + { + "type": "capture", + "arity": "required" + }, + { + "type": "any", + "arity": "required" + }, + { + "type": "any", + "arity": "variadic" + } + ], + "description": "match any of the given node types against the direct ancestor of a node" + }, + "kind-eq": { + "parameters": [ + { + "type": "capture", + "arity": "required" + }, + { + "type": "string", + "arity": "required" + }, + { + "type": "string", + "arity": "variadic" + } + ], + "description": "checks whether a capture corresponds to a given set of nodes" + } + }, + "valid_directives": { + "set": { + "parameters": [ + { + "type": "any", + "arity": "required" + }, + { + "type": "any", + "arity": "optional" + }, + { + "type": "any", + "arity": "optional" + } + ], + "description": "sets key/value metadata for a specific match or capture" + }, + "offset": { + "parameters": [ + { + "type": "capture", + "arity": "required" + }, + { + "type": "string", + "arity": "required" + }, + { + "type": "string", + "arity": "required" + }, + { + "type": "string", + "arity": "required" + }, + { + "type": "string", + "arity": "required" + } + ], + "description": "Takes the range of the captured node and applies an offset. This will set a new range in the form of a list like { {start_row}, {start_col}, {end_row}, {end_col} } for the captured node with `capture_id` as `metadata[capture_id].range`." + }, + "gsub": { + "parameters": [ + { + "type": "capture", + "arity": "required" + }, + { + "type": "string", + "arity": "required" + }, + { + "type": "string", + "arity": "required" + } + ], + "description": "Transforms the content of the node using a Lua pattern. This will set a new `metadata[capture_id].text`." + }, + "trim": { + "parameters": [ + { + "type": "capture", + "arity": "required" + }, + { + "type": "string", + "arity": "optional" + }, + { + "type": "string", + "arity": "optional" + }, + { + "type": "string", + "arity": "optional" + }, + { + "type": "string", + "arity": "optional" + } + ], + "description": "Trims whitespace from the node. Sets a new `metadata[capture_id].range`. Takes a capture ID and, optionally, four integers to customize trimming behavior (`1` meaning trim, `0` meaning don't trim). When only given a capture ID, trims blank lines (lines that contain only whitespace, or are empty) from the end of the node (for backwards compatibility). Can trim all whitespace from both sides of the node if parameters are given." + } + } +} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d82c9cd7b..81cd45dbb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -364,6 +364,7 @@ the node describing the language and `@injection.content` to describe the inject ```query @injection.language ; dynamic detection of the injection language (i.e. the text of the captured node describes the language) @injection.content ; region for the dynamically detected language +@injection.filename ; indicates that the captured node’s text may contain a filename; the corresponding filetype is then looked-up up via vim.filetype.match() and treated as the name of a language that should be used to re-parse the `@injection.content` ``` For example, to inject javascript into HTML's ` -``` - -```query -(script_element - (raw_text) @injection.content - (#set! injection.language "javascript")) ; set the parser language for @injection.content region to javascript -``` - -For regions that don't have a corresponding `@injection.language`, you need to manually set the language -through `(#set injection.language "lang_name")` - -To combine all matches of a pattern as one single block of content, add `(#set! injection.combined)` to such pattern - -### Indents - -```query -@indent.begin ; indent children when matching this node -@indent.end ; marks the end of indented block -@indent.align ; behaves like python aligned/hanging indent -@indent.dedent ; dedent children when matching this node -@indent.branch ; dedent itself when matching this node -@indent.ignore ; do not indent in this node -@indent.auto ; behaves like 'autoindent' buffer option -@indent.zero ; sets this node at position 0 (no indent) -``` - -[Matrix channel]: https://matrix.to/#/#nvim-treesitter:matrix.org +[supported languages]: https://github.com/nvim-treesitter/nvim-treesitter/SUPPORTED_LANGUAGES.md +[tree-sitter queries]: https://tree-sitter.github.io/tree-sitter/using-parsers/queries/index.html +[ts_query_ls]: https://github.com/ribru17/ts_query_ls diff --git a/README.md b/README.md index 5b04cf86c..f55b570ad 100644 --- a/README.md +++ b/README.md @@ -15,14 +15,16 @@

-# WARNING -**This branch is a [full, incompatible, rewrite of `nvim-treesitter`](https://github.com/nvim-treesitter/nvim-treesitter/issues/4767) and [work in progress](TODO.md).** The **stable** branch is [`master`](https://github.com/nvim-treesitter/nvim-treesitter/tree/master). +>[!WARNING] +> This branch is a [full, incompatible, rewrite of `nvim-treesitter`](https://github.com/nvim-treesitter/nvim-treesitter/issues/4767) and [work in progress](TODO.md). The **stable** branch is [`master`](https://github.com/nvim-treesitter/nvim-treesitter/tree/master). The `nvim-treesitter` plugin provides 1. functions for installing, updating, and removing [**tree-sitter parsers**](SUPPORTED_LANGUAGES.md); 2. a collection of **queries** for enabling tree-sitter features built into Neovim for these languages. +For details on these and how to help improving them, see [CONTRIBUTING.md](./CONTRIBUTING.md). + # Quickstart ## Requirements @@ -37,7 +39,7 @@ The `nvim-treesitter` plugin provides You can install `nvim-treesitter` with your favorite package manager (or using the native `package` feature of vim, see `:h packages`). -**NOTE: This plugin is only guaranteed to work with specific versions of language parsers** (as specified in the `parser.lua` table). **When upgrading the plugin, you must make sure that all installed parsers are updated to the latest version** via `:TSUpdate`. +This plugin is only guaranteed to work with specific versions of language parsers** (as specified in the `parser.lua` table). **When upgrading the plugin, you must make sure that all installed parsers are updated to the latest version** via `:TSUpdate`. It is strongly recommended to automate this; e.g., using [lazy.nvim](https://github.com/folke/lazy.nvim) ```lua @@ -46,7 +48,8 @@ require('lazy').setup( ) ``` -**NOTE: This plugin does not support lazy-loading.** +>[!IMPORTANT] +> This plugin does not support lazy-loading. ## Setup @@ -67,7 +70,14 @@ Parsers and queries can then be installed with require'nvim-treesitter'.install { 'rust', 'javascript', 'zig' } ``` -(This is a no-op if the parsers are already installed.) Note that this function runs asynchronously; for synchronous installation in a script context ("bootstrapping"), adapt [this script](scripts/install-parsers.lua) to your needs. +(This is a no-op if the parsers are already installed.) Note that this function runs asynchronously; for synchronous installation in a script context ("bootstrapping"), use something like +```lua +local done = nil +require('nvim-treesitter').install({ 'rust', 'javascript', 'zig' }, function(success) + done = success +end) +vim.wait(3000000, function() return done ~= nil end) +``` Check [`:h nvim-treesitter-commands`](doc/nvim-treesitter.txt) for a list of all available commands. @@ -75,7 +85,7 @@ Check [`:h nvim-treesitter-commands`](doc/nvim-treesitter.txt) for a list of all For `nvim-treesitter` to support a specific feature for a specific language requires both a parser for that language and an appropriate language-specific query file for that feature. -A list of the currently supported languages can be found [on this page](SUPPORTED_LANGUAGES.md). If you wish to add a new language or improve the queries for the an existing one, please see our [contributing guide](CONTRIBUTING.md). +A list of the currently supported languages can be found [on this page](SUPPORTED_LANGUAGES.md). If you wish to add a new language or improve the queries for an existing one, please see our [contributing guide](CONTRIBUTING.md). For related information on the supported languages, including related plugins, see [this wiki page](https://github.com/nvim-treesitter/nvim-treesitter/wiki/Supported-Languages-Information). @@ -134,13 +144,12 @@ callback = function() require('nvim-treesitter.parsers').zimbu = { install_info = { url = 'https://github.com/zimbulang/tree-sitter-zimbu', - files = { 'src/parser.c' }, -- note that some parsers also require src/scanner.c revision = , -- commit hash for revision to check out; HEAD if missing -- optional entries: branch = 'develop', -- only needed if different from default branch location = 'parser', -- only needed if the parser is in subdirectory of a "monorepo" - generate = true, -- only needed if repo does not contain pre-generated src/parser.c - generate_from_json = true, -- only needed if parser has npm dependencies + generate = true, -- only needed if repo does not contain pre-generated `src/parser.c` + generate_from_json = false, -- only needed if repo does not contain `src/grammar.json` }, } end}) @@ -150,11 +159,10 @@ Alternatively, if you have a local checkout, you can instead use ```lua install_info = { path = '~/parsers/tree-sitter-zimbu', - files = { 'src/parser.c' }, -- note that some parsers also require src/scanner.c -- optional entries - location = 'parser', -- only needed if the parser is in subdirectory of a "monorepo" - generate = true, -- only needed if repo does not contain pre-generated src/parser.c - generate_from_json = true, -- only needed if parser has npm dependencies + location = 'parser', + generate = true, + generate_from_json = false, }, ``` This will always use the state of the directory as-is (i.e., `branch` and `revision` will be ignored). @@ -169,7 +177,8 @@ If Neovim does not detect your language's filetype by default, you can use [Neov 3. Start `nvim` and `:TSInstall zimbu`. -**Note:** Parsers using external scanner need to be written in C. C++ scanners are no longer supported. +>[!IMPORTANT] +> Parsers using external scanner need to be written in C. ### Modifying parsers @@ -183,47 +192,9 @@ end}) ## Adding queries -Queries can be placed anywhere in your `runtimepath` under `queries/`, with earlier directories taking precedence unless the queries are marked with `; extends`; see `:h treesitter-query`. +Queries can be placed anywhere in your `runtimepath` under `queries/`, with earlier directories taking precedence unless the queries are marked with `; extends`; see [`:h treesitter-query-modelines`](https://neovim.io/doc/user/treesitter.html#treesitter-query-modeline). E.g., to add queries for `zimbu`, put `highlights.scm` etc. under ```lua vim.fn.stdpath('data') .. 'site/queries/zimbu' ``` - -# Troubleshooting - -Before doing anything, make sure you have the latest version of this plugin and run `:checkhealth nvim-treesitter`. -It can also help to update the parsers via `:TSUpdate`. - -#### I get `Error detected while processing .../plugin/nvim-treesitter.vim` every time I open Neovim - -This is probably due to a change in a parser's grammar or its queries. -Try updating the parser that you suspect has changed (`:TSUpdate {language}`) or all of them (`:TSUpdate`). -If the error persists after updating all parsers, -please [open an issue](https://github.com/nvim-treesitter/nvim-treesitter/issues/new/choose). - -#### I get `query error: invalid node type at position` - -This could be due a query file outside this plugin using outdated nodes, -or due to an outdated parser. - -- Make sure you have the parsers up to date with `:TSUpdate` -- Make sure you don't have more than one `parser` runtime directory. - You can execute this command `:= vim.api.nvim_get_runtime_file('parser', true)` to find all runtime directories. - If you get more than one path, remove the ones that are outside this plugin (`nvim-treesitter` directory), - so the correct version of the parser is used. - -#### I want to use a mirror instead of "https://github.com/" - -In your Lua config: - -```lua -for _, config in pairs(require("nvim-treesitter.parsers")) do - config.install_info.url = config.install_info.url:gsub("https://github.com/", "something else") -end - -require'nvim-treesitter'.setup { - -- - -- -} -``` diff --git a/TODO.md b/TODO.md index 7bf42c9aa..5f12ac997 100644 --- a/TODO.md +++ b/TODO.md @@ -6,8 +6,6 @@ This document lists the planned and finished changes in this rewrite towards [Nv - [ ] **`install.lua`:** migrate to async v2 - [ ] **tests:** remove custom crate, plenary dependency -- [ ] **documentation:** consolidate, autogenerate? -- [ ] **documentation:** migration guide - [ ] **indents:** rewrite (Helix or Zed compatible) - [ ] **textobjects:** include simple(!) `node`, `scope` (using `locals`) objects diff --git a/doc/nvim-treesitter.txt b/doc/nvim-treesitter.txt index f0abcc779..f95872177 100644 --- a/doc/nvim-treesitter.txt +++ b/doc/nvim-treesitter.txt @@ -11,16 +11,14 @@ Authors: Type |gO| to see the table of contents. ============================================================================== -INTRODUCTION *nvim-treesitter-intro* +INTRODUCTION *nvim-treesitter-intro* Nvim-treesitter provides functionalities for managing treesitter parsers and -compatible queries for core features (highlighting, injections, fold, indent). - -WARNING: This is work in progress and requires the latest commit on Neovim -`master`. +compatible queries for core features (highlighting, injections, folds, +indents). ============================================================================== -QUICK START *nvim-treesitter-quickstart* +QUICK START *nvim-treesitter-quickstart* To configure `nvim-treesitter`, put this in your `init.lua` file: >lua @@ -36,156 +34,141 @@ NOTE: You do not need to call `setup` to use this plugin with the default settings! Parsers and queries can then be installed with >lua - require'nvim-treesitter'.install { 'rust', 'javascript', 'zig' } + require'nvim-treesitter'.install { 'rust', 'javascript', 'zig' } < -(This is a no-op if the parsers are already installed.) - To check installed parsers and queries, use `:checkhealth nvim-treesitter`. +Treesitter features for installed languages need to be enabled manually in a +|FileType| autocommand or |ftplugin|, e.g. >lua + vim.api.nvim_create_autocmd('FileType', { + pattern = { 'rust', 'javascript', 'zig' }, + callback = function() + -- syntax highlighting, provided by Neovim + vim.treesitter.start() + -- folds, provided by Neovim + vim.wo.foldexpr = 'v:lua.vim.treesitter.foldexpr()' + -- indentation, provided by nvim-treesitter + vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()" + end, + }) +< ============================================================================== -COMMANDS *nvim-treesitter-commands* +COMMANDS *nvim-treesitter-commands* - *:TSInstall* -:TSInstall {language} ... ~ +:TSInstall {language} *:TSInstall* -Install one or more treesitter parsers. -You can use |:TSInstall| `all` to install all parsers. Use |:TSInstall!| to -force the reinstallation of already installed parsers. +Install one or more treesitter parsers. {language} can be one or multiple +parsers or tiers (`stable`, `unstable`, or `all` (not recommended)). This is a +no-op of the parser(s) are already installed. Installation is performed +asynchronously. Use *:TSInstall!* to force installation even if a parser is +already installed. - *:TSUpdate* -:TSUpdate {language} ... ~ +:TSInstallFromGrammar {language} *:TSInstallFromGrammar* -Update the installed parser for one more {language} or all installed parsers -if {language} is omitted. The specified parser is installed if it is not already -installed. +Like |:TSInstall| but also regenerates the `parser.c` from the original +grammar. Useful for languages where the provided `parser.c` is outdated (e.g., +uses a no longer supported ABI). - *:TSUninstall* -:TSUninstall {language} ... ~ +:TSUpdate [{language}] *:TSUpdate* -Deletes the parser for one or more {language}. You can use 'all' for language -to uninstall all parsers. +Update parsers to the `revision` specified in the manifest if this is newer +than the installed version. If {language} is specified, update the +corresponding parser or tier; otherwise update all installed parsers. This is +a no-op if all (specified) parsers are up to date. + +Note: It is recommended to add this command as a build step in your plugin +manager. + +:TSUninstall {language} *:TSUninstall* + +Deletes the parser for one or more {language}, or all parsers with `all`. + +:TSLog *:TSLog* + +Shows all messages from previous install, update, or uninstall operations. ============================================================================== -INDENTATION *nvim-treesitter-indentation* +API *nvim-treesitter-api* -Indentation based on treesitter for the |=| operator. -NOTE: this is an experimental feature and will be upstreamed to Neovim when -stable. +setup({opts}) *nvim-treesitter.setup()* -To enable it for a supported parser, add the following to a corresponding -`FileType` autocommand or `ftplugin/.lua`: >lua + Configure installation options. Needs to be specified before any + installation operation. - vim.bo.indentexpr = 'v.lua:require'nvim-treesitter'.indentexpr()' + Note: You only need to call `setup` if you want to set non-default + options! + Parameters: ~ + • {opts} `(table?)` Optional parameters: + • {install_dir} (`string?`, default `stdpath('data')/site/`) + directory to install parsers and queries to. Note: will be + appended to |runtimepath|. + • {ignore_install} (`string[]?`) list of languages to never + install even if specified for an installation operation. + (Useful when specifying tiers instead of individual + languages.) + +install({languages}, {opts}, {callback}) *nvim-treesitter.install()* + + Download, compile, and install the specified treesitter parsers and copy + the corresponding queries to a directory on |runtimepath|, enabling their + use in Neovim. + + Note: This operation is performed asynchronously by default. For + synchronous operation (e.g., in a bootstrapping script), you need to + provide a suitable {callback}: >lua + local done = nil + require('nvim-treesitter').install({ 'rust', 'javascript', 'zig' }, + function(success) + done = success + end) + vim.wait(3000000, function() return done ~= nil end) < + Parameters: ~ + • {languages} `(string[]|string)` (List of) languages or tiers (`stable`, + `unstable`) to install. + • {opts} `(table?)` Optional parameters: + • {force} (`boolean?`, default `false`) force installation + of already installed parsers + • {generate} (`boolean?`, default `false`) generate + `parser.c` from `grammar.json` or `grammar.js` before + compiling. + • {max_jobs} (`integer?`) limit parallel tasks (useful in + combination with {generate} on memory-limited systems). + • {callback} `(function?`) Callback for synchronous execution. -Indentation for a language is controlled by `indents.scm` queries. The -following captures are supported: +uninstall({languages}) *nvim-treesitter.uninstall()* + Remove the parser and queries for the specified language(s). -`@indent` *nvim-treesitter-indentation-queries* -Queries can use the following captures: `@indent.begin` and `@indent.dedent`, -`@indent.branch`, `@indent.end` or `@indent.align`. An `@indent.ignore` capture tells -treesitter to ignore indentation and a `@indent.zero` capture sets -the indentation to 0. + Parameters: ~ + • {languages} `(string[]|string)` (List of) languages or tiers (`stable`, + `unstable`) to update. -`@indent.begin` *nvim-treesitter-indentation-indent.begin* -The `@indent.begin` specifies that the next line should be indented. Multiple -indents on the same line get collapsed. Eg. +update({languages}, {callback}) *nvim-treesitter.update()* ->query - ( - (if_statement) - (ERROR "else") @indent.begin - ) + Update the parsers and queries if older than the revision specified in the + manifest. + + Note: This operation is performed asynchronously by default. For + synchronous operation (e.g., in a bootstrapping script), you need to + provide a suitable {callback}: >lua + local done = nil + require('nvim-treesitter').update(), + function(success) + done = success + end) + vim.wait(3000000, function() return done ~= nil end) < -Indent can also have `indent.immediate` set using a `#set!` directive, which -permits the next line to indent even when the block intended to be indented -has no content yet, improving interactive typing. + Parameters: ~ + • {languages} `(string[]|string)` (List of) languages or tiers to + uninstall. + • {callback} `(function?`) Callback for synchronous execution. -eg for python: ->query - ((if_statement) @indent.begin - (#set! indent.immediate 1)) +indentexpr() *nvim-treesitter.indentexpr()* + + Used to enable treesitter indentation for a language via >lua + vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()" < -Will allow: ->python - if True: - # Auto indent to here - -`@indent.end` *nvim-treesitter-indentation-indent.end* -An `@indent.end` capture is used to specify that the indented region ends and -any text subsequent to the capture should be dedented. - -`@indent.branch` *nvim-treesitter-indentation-indent.branch* -An `@indent.branch` capture is used to specify that a dedented region starts -at the line including the captured nodes. - -`@indent.dedent` *nvim-treesitter-indentation-indent.dedent* -A `@indent.dedent` capture specifies dedenting starting on the next line. -> -`@indent.align` *nvim-treesitter-indentation-aligned_indent.align* -Aligned indent blocks may be specified with the `@indent.align` capture. -This permits - -> - foo(a, - b, - c) -< -As well as -> - foo( - a, - b, - c) -< -and finally -> - foo( - a, - b, - c - ) -< -To specify the delimiters to use `indent.open_delimiter` and -`indent.close_delimiter` should be used. Eg. ->query - ((argument_list) @indent.align - (#set! indent.open_delimiter "(") - (#set! indent.close_delimiter ")")) -< - -For some languages the last line of an `indent.align` block must not be -the same indent as the natural next line. - -For example in python: - ->python - if (a > b and - c < d): - pass - -Is not correct, whereas ->python - if (a > b and - c < d): - pass - -Would be correctly indented. This behavior may be chosen using -`indent.avoid_last_matching_next`. Eg. - ->query - (if_statement - condition: (parenthesized_expression) @indent.align - (#set! indent.open_delimiter "(") - (#set! indent.close_delimiter ")") - (#set! indent.avoid_last_matching_next 1) - ) -< -Could be used to specify that the last line of an `@indent.align` capture -should be additionally indented to avoid clashing with the indent of the first -line of the block inside an if. - vim:tw=78:ts=8:expandtab:noet:ft=help:norl: diff --git a/lua/nvim-treesitter/health.lua b/lua/nvim-treesitter/health.lua index 8ca51814e..6904899f6 100644 --- a/lua/nvim-treesitter/health.lua +++ b/lua/nvim-treesitter/health.lua @@ -7,7 +7,7 @@ local health = vim.health local M = {} local NVIM_TREESITTER_MINIMUM_ABI = 13 -local TREE_SITTER_MIN_VER = { 0, 25, 1 } +local TREE_SITTER_MIN_VER = { 0, 25, 4 } ---@param name string ---@return table? From 6b55bc0fab46be886ee81764228ddd8146dcbf9d Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 13 May 2025 14:30:27 +0200 Subject: [PATCH 2143/2494] ci(test): remove parser cache Since installation now installs parsers _and_ queries, caching parsers doesn't allow skipping the installation step (and caching queries does not pay off). --- .github/workflows/test-core.yml | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/.github/workflows/test-core.yml b/.github/workflows/test-core.yml index 05f8078ce..0c0ae594c 100644 --- a/.github/workflows/test-core.yml +++ b/.github/workflows/test-core.yml @@ -31,26 +31,14 @@ jobs: run: | bash ./scripts/ci-install.sh - - if: inputs.type == 'generate' - name: Generate and compile parsers - run: $NVIM -l ./scripts/install-parsers.lua --generate --max-jobs=2 - - - if: inputs.type == 'build' - name: Setup Parsers Cache - id: parsers-cache - uses: actions/cache@v4 - with: - path: | - ~/.local/share/nvim/site/parser/ - ~/AppData/Local/nvim-data/site/parser/ - key: parsers-${{ join(matrix.*, '-') }}-${{ hashFiles( - './lua/nvim-treesitter/install.lua', - './lua/nvim-treesitter/parsers.lua') }} - - if: inputs.type == 'build' name: Compile parsers run: $NVIM -l ./scripts/install-parsers.lua + - if: inputs.type == 'generate' + name: Generate and compile parsers + run: $NVIM -l ./scripts/install-parsers.lua --generate --max-jobs=2 + - name: Check parsers run: $NVIM -l ./scripts/check-parsers.lua From 25f08b82afd3df904ab13b76106975eae370a91a Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 13 May 2025 14:31:03 +0200 Subject: [PATCH 2144/2494] fix(hcl): remove unnecessary escapes --- runtime/queries/hcl/highlights.scm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/runtime/queries/hcl/highlights.scm b/runtime/queries/hcl/highlights.scm index 4fb7d1fca..f2c784f6f 100644 --- a/runtime/queries/hcl/highlights.scm +++ b/runtime/queries/hcl/highlights.scm @@ -1,10 +1,10 @@ ; highlights.scm [ "!" - "\*" + "*" "/" "%" - "\+" + "+" "-" ">" ">=" @@ -34,7 +34,7 @@ [ (ellipsis) - "\?" + "?" "=>" ] @punctuation.special From 864e75a85d4bbe77745929a1ce4d4c63bef11480 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 13 May 2025 14:47:47 +0200 Subject: [PATCH 2145/2494] fix(c,cpp,fsharp,idl,powershell,sql,systemtap): remove unneeded escapes --- runtime/queries/c/injections.scm | 2 +- runtime/queries/cpp/injections.scm | 2 +- runtime/queries/fsharp/highlights.scm | 2 +- runtime/queries/idl/injections.scm | 4 ++-- runtime/queries/powershell/highlights.scm | 2 +- runtime/queries/sql/highlights.scm | 2 +- runtime/queries/systemtap/highlights.scm | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/runtime/queries/c/injections.scm b/runtime/queries/c/injections.scm index 24634864e..ebedc1ec3 100644 --- a/runtime/queries/c/injections.scm +++ b/runtime/queries/c/injections.scm @@ -9,7 +9,7 @@ (#set! injection.language "re2c")) ((comment) @injection.content - (#lua-match? @injection.content "/[*\/][!*\/] Date: Thu, 15 May 2025 09:45:28 +0200 Subject: [PATCH 2146/2494] feat(config)!: remove `ignore_install` This was only useful for no longer supported `auto_install` option. --- README.md | 2 -- doc/nvim-treesitter.txt | 6 ------ lua/nvim-treesitter/config.lua | 15 +-------------- lua/nvim-treesitter/install.lua | 5 ++--- 4 files changed, 3 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index f55b570ad..fb4691bf3 100644 --- a/README.md +++ b/README.md @@ -59,8 +59,6 @@ require('lazy').setup( require'nvim-treesitter'.setup { -- Directory to install parsers and queries to install_dir = vim.fn.stdpath('data') .. '/site' - -- List of parsers to ignore when installing tiers - ignore_install = { }, } ``` diff --git a/doc/nvim-treesitter.txt b/doc/nvim-treesitter.txt index f95872177..c810023f7 100644 --- a/doc/nvim-treesitter.txt +++ b/doc/nvim-treesitter.txt @@ -26,8 +26,6 @@ To configure `nvim-treesitter`, put this in your `init.lua` file: -- A directory to install the parsers and queries to. -- Defaults to the `stdpath('data')/site` dir. install_dir = "/some/path/to/store/parsers", - -- List of parsers to ignore installing (for "stable" etc.) - ignore_install = { "some_parser" }, } NOTE: You do not need to call `setup` to use this plugin with the default @@ -103,10 +101,6 @@ setup({opts}) *nvim-treesitter.setup()* • {install_dir} (`string?`, default `stdpath('data')/site/`) directory to install parsers and queries to. Note: will be appended to |runtimepath|. - • {ignore_install} (`string[]?`) list of languages to never - install even if specified for an installation operation. - (Useful when specifying tiers instead of individual - languages.) install({languages}, {opts}, {callback}) *nvim-treesitter.install()* diff --git a/lua/nvim-treesitter/config.lua b/lua/nvim-treesitter/config.lua index b7ffbf47c..8dcbdb37e 100644 --- a/lua/nvim-treesitter/config.lua +++ b/lua/nvim-treesitter/config.lua @@ -3,12 +3,10 @@ local M = {} M.tiers = { 'stable', 'unstable', 'unmaintained', 'unsupported' } ---@class TSConfig ----@field ignore_install string[] ---@field install_dir string ---@type TSConfig local config = { - ignore_install = {}, install_dir = vim.fs.joinpath(vim.fn.stdpath('data'), 'site'), } @@ -92,7 +90,7 @@ end ---Normalize languages ---@param languages? string[]|string ----@param skip? { ignored: boolean, missing: boolean, unsupported: boolean, installed: boolean, dependencies: boolean } +---@param skip? { missing: boolean, unsupported: boolean, installed: boolean, dependencies: boolean } ---@return string[] function M.norm_languages(languages, skip) if not languages then @@ -110,17 +108,6 @@ function M.norm_languages(languages, skip) languages = expand_tiers(languages) - if skip and skip.ignored then - local ignored = expand_tiers(config.ignore_install) - languages = vim.tbl_filter( - --- @param v string - function(v) - return not vim.list_contains(ignored, v) - end, - languages - ) - end - if skip and skip.installed then local installed = M.installed_parsers() languages = vim.tbl_filter( diff --git a/lua/nvim-treesitter/install.lua b/lua/nvim-treesitter/install.lua index b36a7ddee..68f4c5ea4 100644 --- a/lua/nvim-treesitter/install.lua +++ b/lua/nvim-treesitter/install.lua @@ -439,7 +439,7 @@ end ---@param callback? fun(boolean) M.install = a.sync(function(languages, options, callback) reload_parsers() - languages = config.norm_languages(languages, { ignored = true, unsupported = true }) + languages = config.norm_languages(languages, { unsupported = true }) install(languages, options, callback) end, 3) @@ -451,8 +451,7 @@ M.update = a.sync(function(languages, _options, callback) if not languages or #languages == 0 then languages = 'all' end - languages = - config.norm_languages(languages, { ignored = true, missing = true, unsupported = true }) + languages = config.norm_languages(languages, { missing = true, unsupported = true }) languages = vim.tbl_filter(needs_update, languages) ---@type string[] if #languages > 0 then From 7a4a35de3ebe01e85beba91ebc124b7dd80bd287 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 16 May 2025 14:55:45 +0200 Subject: [PATCH 2147/2494] refactor(indent): use `node:byte_length() --- lua/nvim-treesitter/indent.lua | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/lua/nvim-treesitter/indent.lua b/lua/nvim-treesitter/indent.lua index dda632df3..b0982c6c6 100644 --- a/lua/nvim-treesitter/indent.lua +++ b/lua/nvim-treesitter/indent.lua @@ -39,14 +39,6 @@ local function get_last_node_at_line(root, lnum, col) return root:descendant_for_range(lnum - 1, col, lnum - 1, col + 1) end ----@param node TSNode ----@return number -local function node_length(node) - local _, _, start_byte = node:start() - local _, _, end_byte = node:end_() - return end_byte - start_byte -end - ---@param bufnr integer ---@param node TSNode ---@param delimiter string @@ -133,7 +125,7 @@ function M.get_indent(lnum) end local local_root = tstree:root() if ts.is_in_node_range(local_root, lnum - 1, 0) then - if not root or node_length(root) >= node_length(local_root) then + if not root or root:byte_length() >= local_root:byte_length() then root = local_root lang_tree = tree end From 69371f0148bb96b41047f036a58e7e648e200140 Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Fri, 16 May 2025 15:44:26 +0100 Subject: [PATCH 2148/2494] feat(install)!: migrate to latest async.nvim impl (#7856) Provides significantly simpler blocking installation and update. --- .gitattributes | 7 +- README.md | 8 +- TODO.md | 2 +- doc/nvim-treesitter.txt | 29 +- lua/nvim-treesitter/async.lua | 777 ++++++++++++++++++++++++++++---- lua/nvim-treesitter/install.lua | 117 +++-- scripts/install-parsers.lua | 23 +- 7 files changed, 788 insertions(+), 175 deletions(-) diff --git a/.gitattributes b/.gitattributes index 3375d5ce2..f88a2024f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1,4 @@ -runtime/queries/**/*.scm linguist-language=Tree-sitter-Query -doc/*.txt linguist-documentation -SUPPORTED_LANGUAGES.md linguist-generated +runtime/queries/**/*.scm linguist-language=tsq +doc/*.txt linguist-documentation +SUPPORTED_LANGUAGES.md linguist-generated +lua/nvim-treesitter/async.lua linguist-vendored diff --git a/README.md b/README.md index fb4691bf3..703a41781 100644 --- a/README.md +++ b/README.md @@ -68,13 +68,9 @@ Parsers and queries can then be installed with require'nvim-treesitter'.install { 'rust', 'javascript', 'zig' } ``` -(This is a no-op if the parsers are already installed.) Note that this function runs asynchronously; for synchronous installation in a script context ("bootstrapping"), use something like +(This is a no-op if the parsers are already installed.) Note that this function runs asynchronously; for synchronous installation in a script context ("bootstrapping"), you need to `wait()` for it to finish: ```lua -local done = nil -require('nvim-treesitter').install({ 'rust', 'javascript', 'zig' }, function(success) - done = success -end) -vim.wait(3000000, function() return done ~= nil end) +require('nvim-treesitter').install({ 'rust', 'javascript', 'zig' }):wait(300000) -- wait max. 5 minutes ``` Check [`:h nvim-treesitter-commands`](doc/nvim-treesitter.txt) for a list of all available commands. diff --git a/TODO.md b/TODO.md index 5f12ac997..937a8b63b 100644 --- a/TODO.md +++ b/TODO.md @@ -4,7 +4,6 @@ This document lists the planned and finished changes in this rewrite towards [Nv ## TODO -- [ ] **`install.lua`:** migrate to async v2 - [ ] **tests:** remove custom crate, plenary dependency - [ ] **indents:** rewrite (Helix or Zed compatible) - [ ] **textobjects:** include simple(!) `node`, `scope` (using `locals`) objects @@ -26,3 +25,4 @@ This document lists the planned and finished changes in this rewrite towards [Nv - [X] drop ensure_install (replace with install) - [X] **CI:** switch to ts_query_ls, add update readme as check (remove update job) - [X] **CI:** track versioned releases for tier 1 +- [X] **`install.lua`:** migrate to async v2 diff --git a/doc/nvim-treesitter.txt b/doc/nvim-treesitter.txt index c810023f7..b57687961 100644 --- a/doc/nvim-treesitter.txt +++ b/doc/nvim-treesitter.txt @@ -102,7 +102,7 @@ setup({opts}) *nvim-treesitter.setup()* directory to install parsers and queries to. Note: will be appended to |runtimepath|. -install({languages}, {opts}, {callback}) *nvim-treesitter.install()* +install({languages} [, {opts}]) *nvim-treesitter.install()* Download, compile, and install the specified treesitter parsers and copy the corresponding queries to a directory on |runtimepath|, enabling their @@ -110,13 +110,9 @@ install({languages}, {opts}, {callback}) *nvim-treesitter.install()* Note: This operation is performed asynchronously by default. For synchronous operation (e.g., in a bootstrapping script), you need to - provide a suitable {callback}: >lua - local done = nil - require('nvim-treesitter').install({ 'rust', 'javascript', 'zig' }, - function(success) - done = success - end) - vim.wait(3000000, function() return done ~= nil end) + `wait()` for it: >lua + require('nvim-treesitter').install({ 'rust', 'javascript', 'zig' }) + :wait(300000) -- max. 5 minutes < Parameters: ~ • {languages} `(string[]|string)` (List of) languages or tiers (`stable`, @@ -129,7 +125,6 @@ install({languages}, {opts}, {callback}) *nvim-treesitter.install()* compiling. • {max_jobs} (`integer?`) limit parallel tasks (useful in combination with {generate} on memory-limited systems). - • {callback} `(function?`) Callback for synchronous execution. uninstall({languages}) *nvim-treesitter.uninstall()* @@ -139,25 +134,19 @@ uninstall({languages}) *nvim-treesitter.uninstall() • {languages} `(string[]|string)` (List of) languages or tiers (`stable`, `unstable`) to update. -update({languages}, {callback}) *nvim-treesitter.update()* +update([{languages}]) *nvim-treesitter.update()* Update the parsers and queries if older than the revision specified in the manifest. Note: This operation is performed asynchronously by default. For synchronous operation (e.g., in a bootstrapping script), you need to - provide a suitable {callback}: >lua - local done = nil - require('nvim-treesitter').update(), - function(success) - done = success - end) - vim.wait(3000000, function() return done ~= nil end) + `wait()` for it: >lua + require('nvim-treesitter').update():wait(300000) -- max. 5 minutes < Parameters: ~ - • {languages} `(string[]|string)` (List of) languages or tiers to - uninstall. - • {callback} `(function?`) Callback for synchronous execution. + • {languages} `(string[]|string)?` (List of) languages or tiers to update + (default: all installed). indentexpr() *nvim-treesitter.indentexpr()* diff --git a/lua/nvim-treesitter/async.lua b/lua/nvim-treesitter/async.lua index 8a5e7c8af..e78c0f964 100644 --- a/lua/nvim-treesitter/async.lua +++ b/lua/nvim-treesitter/async.lua @@ -1,112 +1,725 @@ -local co = coroutine +local pcall = copcall or pcall +--- @param ... any +--- @return {[integer]: any, n: integer} +local function pack_len(...) + return { n = select('#', ...), ... } +end + +--- like unpack() but use the length set by F.pack_len if present +--- @param t? { [integer]: any, n?: integer } +--- @param first? integer +--- @return ...any +local function unpack_len(t, first) + if t then + return unpack(t, first or 1, t.n or table.maxn(t)) + end +end + +--- @class async local M = {} ----Executes a future with a callback when it is done ----@param func function ----@param callback function ----@param ... unknown -local function execute(func, callback, ...) - local thread = co.create(func) +--- Weak table to keep track of running tasks +--- @type table +local threads = setmetatable({}, { __mode = 'k' }) - local function step(...) - local ret = { co.resume(thread, ...) } - ---@type boolean, any - local stat, nargs_or_err = unpack(ret) +--- @return async.Task? +local function running() + local task = threads[coroutine.running()] + if task and not (task:_completed() or task._closing) then + return task + end +end - if not stat then - error( - string.format( - 'The coroutine failed with this message: %s\n%s', - nargs_or_err, - debug.traceback(thread) - ) - ) - end +--- Base class for async tasks. Async functions should return a subclass of +--- this. This is designed specifically to be a base class of uv_handle_t +--- @class async.Handle +--- @field close fun(self: async.Handle, callback?: fun()) +--- @field is_closing? fun(self: async.Handle): boolean - if co.status(thread) == 'dead' then - if callback then - callback(unpack(ret, 3, table.maxn(ret))) - end - return - end +--- @alias async.CallbackFn fun(...: any): async.Handle? - ---@type function, any[] - local fn, args = ret[3], { unpack(ret, 4, table.maxn(ret)) } - args[nargs_or_err] = step - fn(unpack(args, 1, nargs_or_err)) +--- @class async.Task : async.Handle +--- @field package _callbacks table +--- @field package _callback_pos integer +--- @field private _thread thread +--- +--- Tasks can call other async functions (task of callback functions) +--- when we are waiting on a child, we store the handle to it here so we can +--- cancel it. +--- @field private _current_child? async.Handle +--- +--- Error result of the task is an error occurs. +--- Must use `await` to get the result. +--- @field private _err? any +--- +--- Result of the task. +--- Must use `await` to get the result. +--- @field private _result? any[] +local Task = {} +Task.__index = Task + +--- @private +--- @param func function +--- @return async.Task +function Task._new(func) + local thread = coroutine.create(func) + + local self = setmetatable({ + _closing = false, + _thread = thread, + _callbacks = {}, + _callback_pos = 1, + }, Task) + + threads[thread] = self + + return self +end + +--- @param callback fun(err?: any, ...: any) +function Task:await(callback) + if self._closing then + callback('closing') + elseif self:_completed() then -- TODO(lewis6991): test + -- Already finished or closed + callback(self._err, unpack_len(self._result)) + else + self._callbacks[self._callback_pos] = callback + self._callback_pos = self._callback_pos + 1 + end +end + +--- @package +function Task:_completed() + return (self._err or self._result) ~= nil +end + +-- Use max 32-bit signed int value to avoid overflow on 32-bit systems. +-- Do not use `math.huge` as it is not interpreted as a positive integer on all +-- platforms. +local MAX_TIMEOUT = 2 ^ 31 - 1 + +--- Synchronously wait (protected) for a task to finish (blocking) +--- +--- If an error is returned, `Task:traceback()` can be used to get the +--- stack trace of the error. +--- +--- Example: +--- ```lua +--- +--- local ok, err_or_result = task:pwait(10) +--- +--- if not ok then +--- error(task:traceback(err_or_result)) +--- end +--- +--- local _, result = assert(task:pwait(10)) +--- ``` +--- +--- Can be called if a task is closing. +--- @param timeout? integer +--- @return boolean status +--- @return any ... result or error +function Task:pwait(timeout) + local done = vim.wait(timeout or MAX_TIMEOUT, function() + -- Note we use self:_completed() instead of self:await() to avoid creating a + -- callback. This avoids having to cleanup/unregister any callback in the + -- case of a timeout. + return self:_completed() + end) + + if not done then + return false, 'timeout' + elseif self._err then + return false, self._err + else + return true, unpack_len(self._result) + end +end + +--- Synchronously wait for a task to finish (blocking) +--- +--- Example: +--- ```lua +--- local result = task:wait(10) -- wait for 10ms or else error +--- +--- local result = task:wait() -- wait indefinitely +--- ``` +--- @param timeout? integer Timeout in milliseconds +--- @return any ... result +function Task:wait(timeout) + local res = pack_len(self:pwait(timeout)) + local stat = res[1] + + if not stat then + error(self:traceback(res[2])) end - step(...) + return unpack_len(res, 2) +end + +--- @private +--- @param msg? string +--- @param _lvl? integer +--- @return string +function Task:_traceback(msg, _lvl) + _lvl = _lvl or 0 + + local thread = ('[%s] '):format(self._thread) + + local child = self._current_child + if getmetatable(child) == Task then + --- @cast child async.Task + msg = child:_traceback(msg, _lvl + 1) + end + + local tblvl = getmetatable(child) == Task and 2 or nil + msg = (msg or '') .. debug.traceback(self._thread, '', tblvl):gsub('\n\t', '\n\t' .. thread) + + if _lvl == 0 then + --- @type string + msg = msg + :gsub('\nstack traceback:\n', '\nSTACK TRACEBACK:\n', 1) + :gsub('\nstack traceback:\n', '\n') + :gsub('\nSTACK TRACEBACK:\n', '\nstack traceback:\n', 1) + end + + return msg +end + +--- Get the traceback of a task when it is not active. +--- Will also get the traceback of nested tasks. +--- +--- @param msg? string +--- @return string +function Task:traceback(msg) + return self:_traceback(msg) +end + +--- If a task completes with an error, raise the error +function Task:raise_on_error() + self:await(function(err) + if err then + error(self:_traceback(err), 0) + end + end) + return self +end + +--- @private +--- @param err? any +--- @param result? {[integer]: any, n: integer} +function Task:_finish(err, result) + self._current_child = nil + self._err = err + self._result = result + threads[self._thread] = nil + + local errs = {} --- @type string[] + for _, cb in pairs(self._callbacks) do + --- @type boolean, string + local ok, cb_err = pcall(cb, err, unpack_len(result)) + if not ok then + errs[#errs + 1] = cb_err + end + end + + if #errs > 0 then + error(table.concat(errs, '\n'), 0) + end +end + +--- @return boolean +function Task:is_closing() + return self._closing +end + +--- Close the task and all its children. +--- If callback is provided it will run asynchronously, +--- else it will run synchronously. +--- +--- @param callback? fun() +function Task:close(callback) + if self:_completed() then + if callback then + callback() + end + return + end + + if self._closing then + return + end + + self._closing = true + + if callback then -- async + if self._current_child then + self._current_child:close(function() + self:_finish('closed') + callback() + end) + else + self:_finish('closed') + callback() + end + else -- sync + if self._current_child then + self._current_child:close(function() + self:_finish('closed') + end) + else + self:_finish('closed') + end + vim.wait(0, function() + return self:_completed() + end) + end +end + +--- @param obj any +--- @return boolean +local function is_async_handle(obj) + local ty = type(obj) + return (ty == 'table' or ty == 'userdata') and vim.is_callable(obj.close) +end + +--- @param ... any +function Task:_resume(...) + --- @type [boolean, string|async.CallbackFn] + local ret = pack_len(coroutine.resume(self._thread, ...)) + local stat = ret[1] + + if not stat then + -- Coroutine had error + self:_finish(ret[2]) + elseif coroutine.status(self._thread) == 'dead' then + -- Coroutine finished + local result = pack_len(unpack_len(ret, 2)) + self:_finish(nil, result) + else + local fn = ret[2] + --- @cast fn -string + + -- TODO(lewis6991): refine error handler to be more specific + local ok, r + ok, r = pcall(fn, function(...) + if is_async_handle(r) then + --- @cast r async.Handle + -- We must close children before we resume to ensure + -- all resources are collected. + local args = pack_len(...) + r:close(function() + self:_resume(unpack_len(args)) + end) + else + self:_resume(...) + end + end) + + if not ok then + self:_finish(r) + elseif is_async_handle(r) then + self._current_child = r + end + end +end + +--- @return 'running'|'suspended'|'normal'|'dead'? +function Task:status() + return coroutine.status(self._thread) +end + +--- Run a function in an async context, asynchronously. +--- +--- Examples: +--- ```lua +--- -- The two below blocks are equivalent: +--- +--- -- Run a uv function and wait for it +--- local stat = async.arun(function() +--- return async.await(2, vim.uv.fs_stat, 'foo.txt') +--- end):wait() +--- +--- -- Since uv functions have sync versions. You can just do: +--- local stat = vim.fs_stat('foo.txt') +--- ``` +--- @param func function +--- @param ... any +--- @return async.Task +function M.arun(func, ...) + local task = Task._new(func) + task:_resume(...) + return task +end + +--- @class async.TaskFun +--- @field package _fun fun(...: any): any +--- @operator call(...): any +local TaskFun = {} +TaskFun.__index = TaskFun + +function TaskFun:__call(...) + return M.arun(self._fun, ...) +end + +--- Create an async function +--- @param fun function +--- @return async.TaskFun +function M.async(fun) + return setmetatable({ _fun = fun }, TaskFun) +end + +--- Returns the status of a task’s thread. +--- +--- @param task? async.Task +--- @return 'running'|'suspended'|'normal'|'dead'? +function M.status(task) + task = task or running() + if task then + assert(getmetatable(task) == Task, 'Expected Task') + return task:status() + end +end + +--- @async +--- @generic R1, R2, R3, R4 +--- @param fun fun(callback: fun(r1: R1, r2: R2, r3: R3, r4: R4)): any? +--- @return R1, R2, R3, R4 +local function yield(fun) + assert(type(fun) == 'function', 'Expected function') + return coroutine.yield(fun) +end + +--- @async +--- @param task async.Task +--- @return any ... +local function await_task(task) + --- @param callback fun(err?: string, ...: any) + --- @return function + local res = pack_len(yield(function(callback) + task:await(callback) + return task + end)) + + local err = res[1] + + if err then + -- TODO(lewis6991): what is the correct level to pass? + error(err, 0) + end + + return unpack_len(res, 2) +end + +--- Asynchronous blocking wait +--- @param argc integer +--- @param fun async.CallbackFn +--- @param ... any func arguments +--- @return any ... +local function await_cbfun(argc, fun, ...) + local args = pack_len(...) + + --- @param callback fun(...:any) + --- @return any? + return yield(function(callback) + args[argc] = callback + args.n = math.max(args.n, argc) + return fun(unpack_len(args)) + end) +end + +--- @param taskfun async.TaskFun +--- @param ... any +--- @return any ... +local function await_taskfun(taskfun, ...) + return taskfun._fun(...) +end + +--- Asynchronous blocking wait +--- +--- Example: +--- ```lua +--- local task = async.arun(function() +--- return 1, 'a' +--- end) +--- +--- local task_fun = async.async(function(arg) +--- return 2, 'b', arg +--- end) +--- +--- async.arun(function() +--- do -- await a callback function +--- async.await(1, vim.schedule) +--- end +--- +--- do -- await a task (new async context) +--- local n, s = async.await(task) +--- assert(n == 1 and s == 'a') +--- end +--- +--- do -- await a started task function (new async context) +--- local n, s, arg = async.await(task_fun('A')) +--- assert(n == 2) +--- assert(s == 'b') +--- assert(args == 'A') +--- end +--- +--- do -- await a task function (re-using the current async context) +--- local n, s, arg = async.await(task_fun, 'B') +--- assert(n == 2) +--- assert(s == 'b') +--- assert(args == 'B') +--- end +--- end) +--- ``` +--- @async +--- @overload fun(argc: integer, func: async.CallbackFn, ...:any): any ... +--- @overload fun(task: async.Task): any ... +--- @overload fun(taskfun: async.TaskFun): any ... +function M.await(...) + assert(running(), 'Not in async context') + + local arg1 = select(1, ...) + + if type(arg1) == 'number' then + return await_cbfun(...) + elseif getmetatable(arg1) == Task then + return await_task(...) + elseif getmetatable(arg1) == TaskFun then + return await_taskfun(...) + end + + error('Invalid arguments, expected Task or (argc, func) got: ' .. type(arg1), 2) end --- Creates an async function with a callback style function. ----@generic F: function ----@param func F ----@param argc integer ----@return F -function M.wrap(func, argc) - vim.validate('func', func, 'function') - vim.validate('argc', argc, 'number') - ---@param ... unknown - ---@return unknown +--- +--- Example: +--- +--- ```lua +--- --- Note the callback argument is not present in the return function +--- --- @type fun(timeout: integer) +--- local sleep = async.awrap(2, function(timeout, callback) +--- local timer = vim.uv.new_timer() +--- timer:start(timeout * 1000, 0, callback) +--- -- uv_timer_t provides a close method so timer will be +--- -- cleaned up when this function finishes +--- return timer +--- end) +--- +--- async.arun(function() +--- print('hello') +--- sleep(2) +--- print('world') +--- end) +--- ``` +--- +--- local atimer = async.awrap( +--- @param argc integer +--- @param func async.CallbackFn +--- @return async function +function M.awrap(argc, func) + assert(type(argc) == 'number') + assert(type(func) == 'function') + --- @async return function(...) - return co.yield(argc, func, ...) + return M.await(argc, func, ...) end end ----Use this to create a function which executes in an async context but ----called from a non-async context. Inherently this cannot return anything ----since it is non-blocking ----@generic F: function ----@param func async F ----@param nargs? integer ----@return F -function M.sync(func, nargs) - nargs = nargs or 0 - return function(...) - local callback = select(nargs + 1, ...) - execute(func, callback, unpack({ ... }, 1, nargs)) - end +if vim.schedule then + --- An async function that when called will yield to the Neovim scheduler to be + --- able to call the API. + M.schedule = M.awrap(1, vim.schedule) end ----@param n integer max number of concurrent jobs ----@param interrupt_check? function ----@param thunks function[] ----@return any -function M.join(n, interrupt_check, thunks) - return co.yield(1, function(finish) - if #thunks == 0 then - return finish() +--- Create a function that runs a function when it is garbage collected. +--- @generic F +--- @param f F +--- @param gc fun() +--- @return F +local function gc_fun(f, gc) + local proxy = newproxy(true) + local proxy_mt = getmetatable(proxy) + proxy_mt.__gc = gc + proxy_mt.__call = function(_, ...) + return f(...) + end + + return proxy +end + +--- @param task_cbs table +local function gc_cbs(task_cbs) + for task, tcb in pairs(task_cbs) do + for j, cb in pairs(task._callbacks) do + if cb == tcb then + task._callbacks[j] = nil + break + end end + end +end - local remaining = { select(n + 1, unpack(thunks)) } - local to_go = #thunks +--- @async +--- Example: +--- ```lua +--- local task1 = async.arun(function() +--- return 1, 'a' +--- end) +--- +--- local task2 = async.arun(function() +--- return 1, 'a' +--- end) +--- +--- local task3 = async.arun(function() +--- error('task3 error') +--- end) +--- +--- async.arun(function() +--- for i, err, r1, r2 in async.iter({task1, task2, task3}) +--- print(i, err, r1, r2) +--- end +--- end) +--- ``` +--- +--- Prints: +--- ``` +--- 1 nil 1 'a' +--- 2 nil 2 'b' +--- 3 'task3 error' nil nil +--- ``` +--- +--- @param tasks async.Task[] +--- @return fun(): (integer?, any?, ...) +function M.iter(tasks) + assert(running(), 'Not in async context') - local ret = {} ---@type any[] + local results = {} --- @type [integer, any, ...][] - local function cb(...) - ret[#ret + 1] = { ... } - to_go = to_go - 1 - if to_go == 0 then - finish(ret) - elseif not interrupt_check or not interrupt_check() then - if #remaining > 0 then - local next_task = table.remove(remaining) - next_task(cb) - end + -- Iter blocks in an async context so only one waiter is needed + local waiter = nil + local task_cbs = {} --- @type table + local remaining = #tasks + + --- If can_gc_cbs is true, then the iterator function has been garbage + --- collected and means any awaiters can also be garbage collected. The + --- only time we can't do this is if with the special case when iter() is + --- called anonymously (`local i = async.iter(tasks)()`), so we should not + --- garbage collect the callbacks until at least one awaiter is called. + local can_gc_cbs = false + + for i, task in ipairs(tasks) do + local function cb(err, ...) + if can_gc_cbs == true then + gc_cbs(task_cbs) + end + + local callback = waiter + + -- Clear waiter before calling it + waiter = nil + + remaining = remaining - 1 + if callback then + -- Iterator is waiting, yield to it + callback(i, err, ...) + else + -- Task finished before Iterator was called. Store results. + table.insert(results, pack_len(i, err, ...)) end end - for i = 1, math.min(n, #thunks) do - thunks[i](cb) + task_cbs[task] = cb + task:await(cb) + end + + return gc_fun( + M.awrap(1, function(callback) + if next(results) then + local res = table.remove(results, 1) + callback(unpack_len(res)) + elseif remaining == 0 then + callback() -- finish + else + assert(not waiter, 'internal error: waiter already set') + waiter = callback + end + end), + function() + -- Don't gc callbacks just yet. Wait until at least one of them is called. + can_gc_cbs = true end - end, 1) + ) end ----An async function that when called will yield to the Neovim scheduler to be ----able to call the API. ----@type fun() -M.main = M.wrap(vim.schedule, 1) +do -- join() + --- @param results table + --- @param i integer + --- @param ... any + --- @return boolean + local function collect(results, i, ...) + if i then + results[i] = pack_len(...) + end + return i ~= nil + end + + --- @param iter fun(): ... + --- @return table + local function drain_iter(iter) + local results = {} --- @type table + while collect(results, iter()) do + end + return results + end + + --- @async + --- Wait for all tasks to finish and return their results. + --- + --- Example: + --- ```lua + --- local task1 = async.arun(function() + --- return 1, 'a' + --- end) + --- + --- local task2 = async.arun(function() + --- return 1, 'a' + --- end) + --- + --- local task3 = async.arun(function() + --- error('task3 error') + --- end) + --- + --- async.arun(function() + --- local results = async.join({task1, task2, task3}) + --- print(vim.inspect(results)) + --- end) + --- ``` + --- + --- Prints: + --- ``` + --- { + --- [1] = { nil, 1, 'a' }, + --- [2] = { nil, 2, 'b' }, + --- [3] = { 'task2 error' }, + --- } + --- ``` + --- @param tasks async.Task[] + --- @return table + function M.join(tasks) + assert(running(), 'Not in async context') + return drain_iter(M.iter(tasks)) + end + + --- @async + --- @param tasks async.Task[] + --- @return integer?, any?, ...? + function M.joinany(tasks) + return M.iter(tasks)() + end +end return M diff --git a/lua/nvim-treesitter/install.lua b/lua/nvim-treesitter/install.lua index 68f4c5ea4..6d60b7921 100644 --- a/lua/nvim-treesitter/install.lua +++ b/lua/nvim-treesitter/install.lua @@ -9,23 +9,53 @@ local parsers = require('nvim-treesitter.parsers') local util = require('nvim-treesitter.util') ---@type fun(path: string, new_path: string, flags?: table): string? -local uv_copyfile = a.wrap(uv.fs_copyfile, 4) +local uv_copyfile = a.awrap(4, uv.fs_copyfile) ---@type fun(path: string, mode: integer): string? -local uv_mkdir = a.wrap(uv.fs_mkdir, 3) +local uv_mkdir = a.awrap(3, uv.fs_mkdir) ---@type fun(path: string, new_path: string): string? -local uv_rename = a.wrap(uv.fs_rename, 3) +local uv_rename = a.awrap(3, uv.fs_rename) ---@type fun(path: string, new_path: string, flags?: table): string? -local uv_symlink = a.wrap(uv.fs_symlink, 4) +local uv_symlink = a.awrap(4, uv.fs_symlink) ---@type fun(path: string): string? -local uv_unlink = a.wrap(uv.fs_unlink, 2) +local uv_unlink = a.awrap(2, uv.fs_unlink) local MAX_JOBS = 100 local INSTALL_TIMEOUT = 60000 +--- @async +--- @param max_jobs integer +--- @param task_funs async.TaskFun[] +local function join(max_jobs, task_funs) + if #task_funs == 0 then + return + end + + max_jobs = math.min(max_jobs, #task_funs) + + local remaining = { select(max_jobs + 1, unpack(task_funs)) } + local to_go = #task_funs + + a.await(1, function(finish) + local function cb() + to_go = to_go - 1 + if to_go == 0 then + finish() + elseif #remaining > 0 then + local next_task = table.remove(remaining) + next_task():await(cb) + end + end + + for i = 1, max_jobs do + task_funs[i]():await(cb) + end + end) +end + ---@async ---@param cmd string[] ---@param opts? vim.SystemOpts @@ -33,8 +63,8 @@ local INSTALL_TIMEOUT = 60000 local function system(cmd, opts) local cwd = opts and opts.cwd or uv.cwd() log.trace('running job: (cwd=%s) %s', cwd, table.concat(cmd, ' ')) - local r = a.wrap(vim.system, 3)(cmd, opts) --[[@as vim.SystemCompleted]] - a.main() + local r = a.await(3, vim.system, cmd, opts) --[[@as vim.SystemCompleted]] + a.schedule() if r.stdout and r.stdout ~= '' then log.trace('stdout -> %s', r.stdout) end @@ -190,7 +220,7 @@ local function do_download(logger, url, project_name, cache_dir, revision, outpu do -- Create tmp dir logger:debug('Creating temporary directory: %s', tmp) local err = mkpath(tmp) - a.main() + a.schedule() if err then return logger:error('Could not create %s-tmp: %s', project_name, err) end @@ -211,7 +241,7 @@ local function do_download(logger, url, project_name, cache_dir, revision, outpu do -- Remove tarball logger:debug('Removing %s...', tarball_path) local err = uv_unlink(tarball_path) - a.main() + a.schedule() if err then return logger:error('Could not remove tarball: %s', err) end @@ -223,7 +253,7 @@ local function do_download(logger, url, project_name, cache_dir, revision, outpu local extracted = fs.joinpath(tmp, repo_project_name .. '-' .. dir_rev) logger:debug('Moving %s to %s/...', extracted, output_dir) local err = uv_rename(extracted, output_dir) - a.main() + a.schedule() if err then return logger:error('Could not rename temp: %s', err) end @@ -265,7 +295,7 @@ local function do_install(logger, compile_location, target_location) end local err = uv_copyfile(compile_location, target_location) - a.main() + a.schedule() if err then return logger:error('Error during parser installation: %s', err) end @@ -343,7 +373,7 @@ local function try_install_lang(lang, cache_dir, install_dir, generate) local queries_src = M.get_package_path('runtime', 'queries', lang) uv_unlink(queries) local err = uv_symlink(queries_src, queries, { dir = true, junction = true }) - a.main() + a.schedule() if err then return logger:error(err) end @@ -403,20 +433,20 @@ end ---@field max_jobs? integer --- Install a parser +---@async ---@param languages string[] ---@param options? InstallOptions ----@param callback? fun(boolean) -local function install(languages, options, callback) +local function install(languages, options) options = options or {} local cache_dir = fs.normalize(fn.stdpath('cache')) local install_dir = config.get_install_dir('parser') - local tasks = {} ---@type fun()[] + local task_funs = {} ---@type async.TaskFun[] local done = 0 for _, lang in ipairs(languages) do - tasks[#tasks + 1] = a.sync(function() - a.main() + task_funs[#task_funs + 1] = a.async(function() + a.schedule() local status = install_lang(lang, cache_dir, install_dir, options.force, options.generate) if status ~= 'failed' then done = done + 1 @@ -424,29 +454,24 @@ local function install(languages, options, callback) end) end - a.join(options and options.max_jobs or MAX_JOBS, nil, tasks) - if #tasks > 1 then - a.main() - log.info('Installed %d/%d languages', done, #tasks) - end - if callback then - callback(done == #tasks) + join(options and options.max_jobs or MAX_JOBS, task_funs) + if #task_funs > 1 then + a.schedule() + log.info('Installed %d/%d languages', done, #task_funs) end + return done == #task_funs end ---@param languages string[]|string ---@param options? InstallOptions ----@param callback? fun(boolean) -M.install = a.sync(function(languages, options, callback) +M.install = a.async(function(languages, options) reload_parsers() languages = config.norm_languages(languages, { unsupported = true }) - install(languages, options, callback) -end, 3) + return install(languages, options) +end) ---@param languages? string[]|string ----@param _options? table ----@param callback? function -M.update = a.sync(function(languages, _options, callback) +M.update = a.async(function(languages) reload_parsers() if not languages or #languages == 0 then languages = 'all' @@ -455,14 +480,12 @@ M.update = a.sync(function(languages, _options, callback) languages = vim.tbl_filter(needs_update, languages) ---@type string[] if #languages > 0 then - install(languages, { force = true }, callback) + return install(languages, { force = true }) else log.info('All parsers are up-to-date') - if callback then - callback(true) - end + return true end -end, 3) +end) ---@async ---@param logger Logger @@ -477,7 +500,7 @@ local function uninstall_lang(logger, lang, parser, queries) if fn.filereadable(parser) == 1 then logger:debug('Unlinking ' .. parser) local perr = uv_unlink(parser) - a.main() + a.schedule() if perr then return logger:error(perr) @@ -487,7 +510,7 @@ local function uninstall_lang(logger, lang, parser, queries) if fn.isdirectory(queries) == 1 then logger:debug('Unlinking ' .. queries) local qerr = uv_unlink(queries) - a.main() + a.schedule() if qerr then return logger:error(qerr) @@ -498,16 +521,14 @@ local function uninstall_lang(logger, lang, parser, queries) end ---@param languages string[]|string ----@param _options? table ----@param _callback? fun() -M.uninstall = a.sync(function(languages, _options, _callback) +M.uninstall = a.async(function(languages) languages = config.norm_languages(languages or 'all', { missing = true, dependencies = true }) local parser_dir = config.get_install_dir('parser') local query_dir = config.get_install_dir('queries') local installed = config.installed_parsers() - local tasks = {} ---@type fun()[] + local task_funs = {} ---@type async.TaskFun[] local done = 0 for _, lang in ipairs(languages) do local logger = log.new('uninstall/' .. lang) @@ -516,7 +537,7 @@ M.uninstall = a.sync(function(languages, _options, _callback) else local parser = fs.joinpath(parser_dir, lang) .. '.so' local queries = fs.joinpath(query_dir, lang) - tasks[#tasks + 1] = a.sync(function() + task_funs[#task_funs + 1] = a.async(function() local err = uninstall_lang(logger, lang, parser, queries) if not err then done = done + 1 @@ -525,11 +546,11 @@ M.uninstall = a.sync(function(languages, _options, _callback) end end - a.join(MAX_JOBS, nil, tasks) - if #tasks > 1 then - a.main() - log.info('Uninstalled %d/%d languages', done, #tasks) + join(MAX_JOBS, task_funs) + if #task_funs > 1 then + a.schedule() + log.info('Uninstalled %d/%d languages', done, #task_funs) end -end, 2) +end) return M diff --git a/scripts/install-parsers.lua b/scripts/install-parsers.lua index 6dbc73d68..f06d3ee46 100755 --- a/scripts/install-parsers.lua +++ b/scripts/install-parsers.lua @@ -21,24 +21,17 @@ vim.opt.runtimepath:append('.') -- needed on CI vim.fn.mkdir(vim.fn.stdpath('cache'), 'p') -local ok = nil -if update then - require('nvim-treesitter.install').update('all', {}, function(success) - ok = success - end) -else - require('nvim-treesitter.install').install( +---@type async.Task +local task = update and require('nvim-treesitter.install').update('all') + or require('nvim-treesitter.install').install( #parsers > 0 and parsers or 'all', - { force = true, generate = generate, max_jobs = max_jobs }, - function(success) - ok = success - end + { force = true, generate = generate, max_jobs = max_jobs } ) -end -vim.wait(6000000, function() - return ok ~= nil -end) +local ok, err_or_ok = task:pwait(1800000) -- wait max. 30 minutes if not ok then + print('ERROR: ', err_or_ok) + vim.cmd.cq() +elseif not err_or_ok then vim.cmd.cq() end From a663e6944784ca39a285348c5b7e3ac8ba14822d Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 16 May 2025 18:12:26 +0200 Subject: [PATCH 2149/2494] feat(parsers): update javadoc, jq, hcl, query, smithy, earthfile, tcl, llvm, godot_resource, git_config, terraform, teal, gdscript, mlir --- lua/nvim-treesitter/parsers.lua | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 75278cd02..9007a600c 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -419,7 +419,7 @@ return { }, earthfile = { install_info = { - revision = '8c93d89e262d9892ad692b3be05cfbcffbb9614f', + revision = 'a37c5ee95ce401ca311c0ae1369d9cfb953e151d', url = 'https://github.com/glehmann/tree-sitter-earthfile', }, maintainers = { '@glehmann' }, @@ -644,7 +644,7 @@ return { }, gdscript = { install_info = { - revision = '25dadb2beaa2bb0f53d5fe97d2588a01e9b0f0b5', + revision = 'e964ce912b5b835f1caedb600df9d5be77e803a8', url = 'https://github.com/PrestonKnopp/tree-sitter-gdscript', }, maintainers = { '@PrestonKnopp' }, @@ -661,7 +661,7 @@ return { }, git_config = { install_info = { - revision = 'edc973f498482529ff2a319249d0f43a22860321', + revision = '0fbc9f99d5a28865f9de8427fb0672d66f9d83a5', url = 'https://github.com/the-mikedavis/tree-sitter-git-config', }, maintainers = { '@amaanq' }, @@ -778,7 +778,7 @@ return { }, godot_resource = { install_info = { - revision = '99417ca9f4eccbf49e4ce5a69d89228811593bf5', + revision = 'a1a7295b376fbd2531601f4ffff191b031ffc795', url = 'https://github.com/PrestonKnopp/tree-sitter-godot-resource', }, maintainers = { '@pierpo' }, @@ -890,7 +890,7 @@ return { }, hcl = { install_info = { - revision = '41a2e702413a53f2614533b2aa9c187816116cbc', + revision = '009def4ae38ec30e5b40beeae26efe93484ab286', url = 'https://github.com/tree-sitter-grammars/tree-sitter-hcl', }, maintainers = { '@MichaHoffmann' }, @@ -1068,7 +1068,7 @@ return { }, javadoc = { install_info = { - revision = 'e49c8f0e26dc79afc999f377121ecceb30ffcc74', + revision = '001a8e4f8e839b640201c49046fbf5957fe1ee2c', url = 'https://github.com/rmuir/tree-sitter-javadoc', }, maintainers = { '@rmuir' }, @@ -1106,7 +1106,7 @@ return { }, jq = { install_info = { - revision = '13990f530e8e6709b7978503da9bc8701d366791', + revision = 'c204e36d2c3c6fce1f57950b12cabcc24e5cc4d9', url = 'https://github.com/flurie/tree-sitter-jq', }, maintainers = { '@ObserverOfTime' }, @@ -1281,7 +1281,7 @@ return { }, llvm = { install_info = { - revision = 'c14cb839003348692158b845db9edda201374548', + revision = '1ac83114e71839fa67f4cce2f864ebbbdf6e2a4f', url = 'https://github.com/benwilliamgraham/tree-sitter-llvm', }, maintainers = { '@benwilliamgraham' }, @@ -1392,7 +1392,7 @@ return { mlir = { install_info = { generate = true, - revision = 'fdaa92565f5902afe81d958a48049f56721fd928', + revision = '3b2ae4ce9a8abca997ed3b34625d462248d1bbac', url = 'https://github.com/artagnon/tree-sitter-mlir', }, maintainers = { '@artagnon' }, @@ -1790,7 +1790,7 @@ return { }, query = { install_info = { - revision = 'eba45dd965e119cb7cd3d5eea584e5d04bbef9a4', + revision = 'b5d39eab2cf3172d81352e5ef9df4639267c5813', url = 'https://github.com/tree-sitter-grammars/tree-sitter-query', }, maintainers = { '@steelsojka' }, @@ -2044,7 +2044,7 @@ return { }, smithy = { install_info = { - revision = 'fa898ac0885d1da9a253695c3e0e91f5efc587cd', + revision = 'ec4fe14586f2b0a1bc65d6db17f8d8acd8a90433', url = 'https://github.com/indoorvivants/tree-sitter-smithy', }, maintainers = { '@amaanq', '@keynmol' }, @@ -2243,7 +2243,7 @@ return { }, tcl = { install_info = { - revision = '93ad361b77faa39af410052e1ece22b9e6b8136c', + revision = '8f11ac7206a54ed11210491cee1e0657e2962c47', url = 'https://github.com/tree-sitter-grammars/tree-sitter-tcl', }, maintainers = { '@lewis6991' }, @@ -2252,7 +2252,7 @@ return { teal = { install_info = { generate = true, - revision = '3db655924b2ff1c54fdf6371b5425ea6b5dccefe', + revision = '05d276e737055e6f77a21335b7573c9d3c091e2f', url = 'https://github.com/euclidianAce/tree-sitter-teal', }, maintainers = { '@euclidianAce' }, @@ -2277,7 +2277,7 @@ return { terraform = { install_info = { location = 'dialects/terraform', - revision = '41a2e702413a53f2614533b2aa9c187816116cbc', + revision = '009def4ae38ec30e5b40beeae26efe93484ab286', url = 'https://github.com/MichaHoffmann/tree-sitter-hcl', }, maintainers = { '@MichaHoffmann' }, From 168fe16cdd9fd441e27e5554bcd9dc02d07e68be Mon Sep 17 00:00:00 2001 From: Riley Bruins Date: Sat, 17 May 2025 21:10:59 -0700 Subject: [PATCH 2150/2494] fix: tidy up some query mistakes Revealed by the capture-less patterns lint --- runtime/queries/erlang/highlights.scm | 4 ++-- runtime/queries/linkerscript/injections.scm | 2 +- runtime/queries/nim_format_string/highlights.scm | 2 -- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/runtime/queries/erlang/highlights.scm b/runtime/queries/erlang/highlights.scm index 8bba348d9..4b5b8ee78 100644 --- a/runtime/queries/erlang/highlights.scm +++ b/runtime/queries/erlang/highlights.scm @@ -93,8 +93,8 @@ lhs: _ @constant.macro (#set! priority 101)) -(_preprocessor_directive) @keyword.directive -(#set! priority 99) +((_preprocessor_directive) @keyword.directive + (#set! priority 99)) ; Attributes (pp_include) @keyword.import diff --git a/runtime/queries/linkerscript/injections.scm b/runtime/queries/linkerscript/injections.scm index 51e6d1f6b..2f0e58eb6 100644 --- a/runtime/queries/linkerscript/injections.scm +++ b/runtime/queries/linkerscript/injections.scm @@ -1,2 +1,2 @@ -((comment) +((comment) @injection.content (#set! injection.language "comment")) diff --git a/runtime/queries/nim_format_string/highlights.scm b/runtime/queries/nim_format_string/highlights.scm index fde9e4ba0..02a75e6a3 100644 --- a/runtime/queries/nim_format_string/highlights.scm +++ b/runtime/queries/nim_format_string/highlights.scm @@ -1,5 +1,3 @@ -(string_literal) - (matching_curlies opening_curly: (opening_curly) @punctuation.special equals: (equals)? @punctuation.special From 40cbddedf7e581caf58bab3fcd114641774178ea Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 18 May 2025 10:15:04 +0200 Subject: [PATCH 2151/2494] feat(parsers): update markdown_inline, markdown, vimdoc, fsharp, pascal, racket, lua, scheme, gleam, ocamllex, query --- lua/nvim-treesitter/parsers.lua | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 9007a600c..4b75837a8 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -601,7 +601,7 @@ return { fsharp = { install_info = { location = 'fsharp', - revision = '02929f084726db969e5b916d144436f248146824', + revision = 'f29605148f24199cf4d9c4a203a5debc0cbcc648', url = 'https://github.com/ionide/tree-sitter-fsharp', }, maintainers = { '@nsidorenco' }, @@ -701,7 +701,7 @@ return { }, gleam = { install_info = { - revision = '5efbe4fdf199f30a90393196bfbf842d866753c2', + revision = '6ece453acf8b14568c10f629f8cd25d3dde3794f', url = 'https://github.com/gleam-lang/tree-sitter-gleam', }, maintainers = { '@amaanq' }, @@ -1289,7 +1289,7 @@ return { }, lua = { install_info = { - revision = 'db16e76558122e834ee214c8dc755b4a3edc82a9', + revision = 'e5e406935ff3e36529545955e2972646ed97f9e2', url = 'https://github.com/tree-sitter-grammars/tree-sitter-lua', }, maintainers = { '@muniftanjim' }, @@ -1340,7 +1340,7 @@ return { markdown = { install_info = { location = 'tree-sitter-markdown', - revision = '071b3b70baad138aa28832cf02d16ca48f2e6f4d', + revision = 'efb075cbd57ce33f694c2bb264b99cdba0f31789', url = 'https://github.com/tree-sitter-grammars/tree-sitter-markdown', }, maintainers = { '@MDeiml' }, @@ -1351,7 +1351,7 @@ return { markdown_inline = { install_info = { location = 'tree-sitter-markdown-inline', - revision = '071b3b70baad138aa28832cf02d16ca48f2e6f4d', + revision = 'efb075cbd57ce33f694c2bb264b99cdba0f31789', url = 'https://github.com/tree-sitter-grammars/tree-sitter-markdown', }, maintainers = { '@MDeiml' }, @@ -1517,7 +1517,7 @@ return { ocamllex = { install_info = { generate = true, - revision = 'c5cf996c23e38a1537069fbe2d4bb83a75fc7b2f', + revision = 'ed488aa334d1b4e3235e1efaaf96f00815ebc0e0', url = 'https://github.com/atom-ocaml/tree-sitter-ocamllex', }, maintainers = { '@undu' }, @@ -1533,7 +1533,7 @@ return { }, pascal = { install_info = { - revision = '78426d96bde7114af979e314283e45d087603428', + revision = '5054931bcd022860dd5936864f981e359fb63aef', url = 'https://github.com/Isopod/tree-sitter-pascal', }, maintainers = { '@Isopod' }, @@ -1790,7 +1790,7 @@ return { }, query = { install_info = { - revision = 'b5d39eab2cf3172d81352e5ef9df4639267c5813', + revision = '8bf3112db43bdba3002bb1f88b7cda5f6278fc88', url = 'https://github.com/tree-sitter-grammars/tree-sitter-query', }, maintainers = { '@steelsojka' }, @@ -1807,7 +1807,7 @@ return { }, racket = { install_info = { - revision = '78e147ac9be60e8e752fffaafa22293a785ac3dc', + revision = '6d63a202602eb350e726b5e7814127ba22ed25fc', url = 'https://github.com/6cdh/tree-sitter-racket', }, tier = 2, @@ -1985,7 +1985,7 @@ return { }, scheme = { install_info = { - revision = 'd5b7655bea905f902d099abd539e1b66e1f4bf27', + revision = '1e4d38d650bf6b53930ec9d41a7000775c134039', url = 'https://github.com/6cdh/tree-sitter-scheme', }, tier = 2, @@ -2509,7 +2509,7 @@ return { }, vimdoc = { install_info = { - revision = '6dab95ab84a006e8adfd6966c5fd9dde48224725', + revision = '9f6191a98702edc1084245abd5523279d4b681fb', url = 'https://github.com/neovim/tree-sitter-vimdoc', }, maintainers = { '@clason' }, From b19b5ce17195f830fd2474c625e242cfc3aa5f90 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 18 May 2025 10:37:50 +0200 Subject: [PATCH 2152/2494] docs: final update after rewrite Make clear this is not the default branch --- CONTRIBUTING.md | 6 +++--- README.md | 47 +++++++++++++++++++++++++---------------------- TODO.md | 28 ---------------------------- 3 files changed, 28 insertions(+), 53 deletions(-) delete mode 100644 TODO.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 983499e81..f665ce1ed 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -22,15 +22,15 @@ To add a new parser, edit the following files: zimbu = { install_info = { url = 'https://github.com/zimbulang/tree-sitter-zimbu', -- git repo; use `path` for local path - revision = 'v2.1', -- tag or commit hash, will be updated automatically + revision = 'v2.1', -- tag or commit hash -- optional entries: branch = 'develop', -- only needed if different from default branch location = 'parser', -- only needed if the parser is in subdirectory of a "monorepo" generate = true, -- only needed if repo does not contain pre-generated src/parser.c - generate_from_json = true, -- only needed if grammar.js has npm-installed dependencies + generate_from_json = false, -- only needed if repo does not contain `src/grammar.json` either }, maintainers = { '@me' }, -- the _query_ maintainers - tier = 1, -- stable: track versioned releases + tier = 1, -- stable: track versioned releases instead of latest commit -- optional entries: requires = { 'vim' }, -- if the queries inherit from another language readme_note = "an example language", diff --git a/README.md b/README.md index 703a41781..ef3a9f32c 100644 --- a/README.md +++ b/README.md @@ -1,30 +1,17 @@

nvim-treesitter

- - - ->[!WARNING] -> This branch is a [full, incompatible, rewrite of `nvim-treesitter`](https://github.com/nvim-treesitter/nvim-treesitter/issues/4767) and [work in progress](TODO.md). The **stable** branch is [`master`](https://github.com/nvim-treesitter/nvim-treesitter/tree/master). The `nvim-treesitter` plugin provides 1. functions for installing, updating, and removing [**tree-sitter parsers**](SUPPORTED_LANGUAGES.md); -2. a collection of **queries** for enabling tree-sitter features built into Neovim for these languages. +2. a collection of **queries** for enabling tree-sitter features built into Neovim for these languages; +3. a staging ground for [treesitter-based features](#Supported-features) considered for upstreaming to Neovim. For details on these and how to help improving them, see [CONTRIBUTING.md](./CONTRIBUTING.md). +>[!CAUTION] +> This is a full, incompatible, rewrite. If you can't or don't want to update, check out the [`master` branch](https://github.com/nvim-treesitter/nvim-treesitter/blob/master/README.md) (which is locked but will remain available for backward compatibility). + # Quickstart ## Requirements @@ -35,6 +22,12 @@ For details on these and how to help improving them, see [CONTRIBUTING.md](./CON - a C compiler in your path (see ) - `Node` (23.0.0 or later) for some parsers (see the [list of supported languages](SUPPORTED_LANGUAGES.md)) +>[!IMPORTANT] +> The **support policy** for Neovim is +> 1. the _latest_ [stable release](https://github.com/neovim/neovim/releases/tag/stable); +> 2. the _latest_ [nightly prerelease](https://github.com/neovim/neovim/releases/tag/nightly). +> Other versions may work but are neither tested nor considered for fixes. In general, compatibility with Nvim 0.X is removed after the release of Nvim 0.(X+1).1. + ## Installation You can install `nvim-treesitter` with your favorite package manager (or using the native `package` feature of vim, see `:h packages`). @@ -43,14 +36,20 @@ This plugin is only guaranteed to work with specific versions of language parser It is strongly recommended to automate this; e.g., using [lazy.nvim](https://github.com/folke/lazy.nvim) ```lua -require('lazy').setup( - { 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate', lazy = false } -) +require('lazy').setup({ + 'nvim-treesitter/nvim-treesitter', + lazy = false, + branch = 'main', + build = ':TSUpdate' +}) ``` >[!IMPORTANT] > This plugin does not support lazy-loading. +>[!IMPORTANT] +> Make sure to specify the `main` branch since (for now) the default branch is [`master`](https://github.com/nvim-treesitter/nvim-treesitter/blob/master/README.md). + ## Setup `nvim-treesitter` can be configured by calling `setup`. The following snippet lists the available options and their default values. **You do not need to call `setup` for `nvim-treesitter` to work using default values.** @@ -69,6 +68,7 @@ require'nvim-treesitter'.install { 'rust', 'javascript', 'zig' } ``` (This is a no-op if the parsers are already installed.) Note that this function runs asynchronously; for synchronous installation in a script context ("bootstrapping"), you need to `wait()` for it to finish: + ```lua require('nvim-treesitter').install({ 'rust', 'javascript', 'zig' }):wait(300000) -- wait max. 5 minutes ``` @@ -143,13 +143,14 @@ callback = function() branch = 'develop', -- only needed if different from default branch location = 'parser', -- only needed if the parser is in subdirectory of a "monorepo" generate = true, -- only needed if repo does not contain pre-generated `src/parser.c` - generate_from_json = false, -- only needed if repo does not contain `src/grammar.json` + generate_from_json = false, -- only needed if repo does not contain `src/grammar.json` either }, } end}) ``` Alternatively, if you have a local checkout, you can instead use + ```lua install_info = { path = '~/parsers/tree-sitter-zimbu', @@ -177,6 +178,7 @@ If Neovim does not detect your language's filetype by default, you can use [Neov ### Modifying parsers You can use the same approach for overriding parser information. E.g., if you always want to generate the `lua` parser from grammar, add + ```lua vim.api.nvim_create_autocmd('User', { pattern = 'TSUpdate', callback = function() @@ -189,6 +191,7 @@ end}) Queries can be placed anywhere in your `runtimepath` under `queries/`, with earlier directories taking precedence unless the queries are marked with `; extends`; see [`:h treesitter-query-modelines`](https://neovim.io/doc/user/treesitter.html#treesitter-query-modeline). E.g., to add queries for `zimbu`, put `highlights.scm` etc. under + ```lua vim.fn.stdpath('data') .. 'site/queries/zimbu' ``` diff --git a/TODO.md b/TODO.md deleted file mode 100644 index 937a8b63b..000000000 --- a/TODO.md +++ /dev/null @@ -1,28 +0,0 @@ -# Roadmap - -This document lists the planned and finished changes in this rewrite towards [Nvim-treesitter 1.0](https://github.com/nvim-treesitter/nvim-treesitter/issues/4767). - -## TODO - -- [ ] **tests:** remove custom crate, plenary dependency -- [ ] **indents:** rewrite (Helix or Zed compatible) -- [ ] **textobjects:** include simple(!) `node`, `scope` (using `locals`) objects - -## DONE - -- [X] remove module framework -- [X] remove extra utilities -- [X] refactor `indent.lua` into standalone -- [X] refactor `locals.lua` into standalone -- [X] refactor commands, predicates, filetypes registration to plugin/ -- [X] support installing tiers of parsers -- [X] install parsers to standard directory by default -- [X] remove bundled queries from runtimepath; copy on parser install -- [X] general refactor and cleanup -- [X] rewrite installation using async module (drop support for sync; use callback instead) -- [X] switch to upstream injection format -- [X] remove locals from highlighting (cf. https://github.com/nvim-treesitter/nvim-treesitter/issues/3944#issuecomment-1458782497) -- [X] drop ensure_install (replace with install) -- [X] **CI:** switch to ts_query_ls, add update readme as check (remove update job) -- [X] **CI:** track versioned releases for tier 1 -- [X] **`install.lua`:** migrate to async v2 From d08cf75e1bb52ce86a895dc287f9480a6d3d78b2 Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Wed, 21 May 2025 21:47:18 +0200 Subject: [PATCH 2153/2494] feat(inko): add scoping to the locals queries This way tooling that makes use of these queries (e.g. snacks.nvim) is aware of the scoping of Inko types and methods. --- runtime/queries/inko/locals.scm | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/runtime/queries/inko/locals.scm b/runtime/queries/inko/locals.scm index 09450f525..b69681cd1 100644 --- a/runtime/queries/inko/locals.scm +++ b/runtime/queries/inko/locals.scm @@ -3,8 +3,9 @@ (block) ] @local.scope -(method - name: _ @local.definition.method) +((method + name: _ @local.definition.method) @local.scope + (#set! definition.function.scope "parent")) (external_function name: _ @local.definition.function) @@ -24,10 +25,11 @@ (named_argument name: _ @local.definition.parameter) -(class +((class modifier: (modifier "enum") - name: _ @local.definition.enum) + name: _ @local.definition.enum) @local.scope + (#set! definition.type.scope "parent")) (class modifier: (modifier @@ -36,11 +38,13 @@ (define_case name: _ @local.definition.field))) -(class - name: _ @local.definition.type) +((class + name: _ @local.definition.type) @local.scope + (#set! definition.type.scope "parent")) -(trait - name: _ @local.definition.type) +((trait + name: _ @local.definition.type) @local.scope + (#set! definition.type.scope "parent")) (import (symbols From 011f02936f5c69500315a32df1a1b01fdd2feaf3 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Thu, 22 May 2025 08:19:22 +0200 Subject: [PATCH 2154/2494] fix(install): return task object in API functions --- lua/nvim-treesitter/init.lua | 6 +++--- scripts/install-parsers.lua | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lua/nvim-treesitter/init.lua b/lua/nvim-treesitter/init.lua index 52eab71c8..561c1697a 100644 --- a/lua/nvim-treesitter/init.lua +++ b/lua/nvim-treesitter/init.lua @@ -5,15 +5,15 @@ function M.setup(...) end function M.install(...) - require('nvim-treesitter.install').install(...) + return require('nvim-treesitter.install').install(...) end function M.uninstall(...) - require('nvim-treesitter.install').uninstall(...) + return require('nvim-treesitter.install').uninstall(...) end function M.update(...) - require('nvim-treesitter.install').update(...) + return require('nvim-treesitter.install').update(...) end function M.indentexpr() diff --git a/scripts/install-parsers.lua b/scripts/install-parsers.lua index f06d3ee46..f2fd56082 100755 --- a/scripts/install-parsers.lua +++ b/scripts/install-parsers.lua @@ -22,8 +22,8 @@ vim.opt.runtimepath:append('.') vim.fn.mkdir(vim.fn.stdpath('cache'), 'p') ---@type async.Task -local task = update and require('nvim-treesitter.install').update('all') - or require('nvim-treesitter.install').install( +local task = update and require('nvim-treesitter').update('all') + or require('nvim-treesitter').install( #parsers > 0 and parsers or 'all', { force = true, generate = generate, max_jobs = max_jobs } ) From c78594ce064b9072ad94f660c81c1a17b26fcd29 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Thu, 22 May 2025 19:44:58 +0200 Subject: [PATCH 2155/2494] ci(test): throttle all install steps --- .github/workflows/test-core.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-core.yml b/.github/workflows/test-core.yml index 0c0ae594c..d91c1bb4c 100644 --- a/.github/workflows/test-core.yml +++ b/.github/workflows/test-core.yml @@ -33,7 +33,7 @@ jobs: - if: inputs.type == 'build' name: Compile parsers - run: $NVIM -l ./scripts/install-parsers.lua + run: $NVIM -l ./scripts/install-parsers.lua --max-jobs=10 - if: inputs.type == 'generate' name: Generate and compile parsers From 652831b231270da36cfaa03af24df85d1bb47ae9 Mon Sep 17 00:00:00 2001 From: Omar Valdez Date: Sun, 23 Mar 2025 01:14:22 -0700 Subject: [PATCH 2156/2494] feat(bash): highlight variable argument for `printf -v` --- runtime/queries/bash/highlights.scm | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/runtime/queries/bash/highlights.scm b/runtime/queries/bash/highlights.scm index 58d57d9e5..428207b94 100644 --- a/runtime/queries/bash/highlights.scm +++ b/runtime/queries/bash/highlights.scm @@ -247,6 +247,17 @@ "READLINE_ARGUMENT" "READLINE_LINE" "READLINE_MARK" "READLINE_POINT" "REPLY" "SECONDS" "SHELL" "SHELLOPTS" "SHLVL" "SRANDOM" "TIMEFORMAT" "TMOUT" "TMPDIR" "UID")) +((command + name: (command_name + (word) @_printf) + . + argument: (word) @_v + . + argument: (word) @variable) + (#eq? @_printf "printf") + (#eq? @_v "-v") + (#lua-match? @variable "^[a-zA-Z_][a-zA-Z0-9_]*$")) + (case_item value: (word) @variable.parameter) From 354c30d2a2f0996b56886928cb3d36e9c6664a06 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sat, 24 May 2025 18:25:34 +0200 Subject: [PATCH 2157/2494] feat(parsers): update desktop, dtd, editorconfig, janet_simple, liquid, c, v, perl, mlir, templ, vhdl, xml, xresources, yaml, tlaplus, cmake --- lua/nvim-treesitter/parsers.lua | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 4b75837a8..6583bd3b9 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -158,7 +158,7 @@ return { }, c = { install_info = { - revision = '2a265d69a4caf57108a73ad2ed1e6922dd2f998c', + revision = '091093731389448e10822dd140621cfec1ff96b2', url = 'https://github.com/tree-sitter/tree-sitter-c', }, maintainers = { '@amaanq' }, @@ -222,7 +222,7 @@ return { }, cmake = { install_info = { - revision = 'c2fdefaf7ae3b7c5cf11705fe63c516b1c490590', + revision = 'cf9799600b2ba5e6620fdabddec3b2db8306bc46', url = 'https://github.com/uyha/tree-sitter-cmake', }, maintainers = { '@uyha' }, @@ -338,7 +338,7 @@ return { }, desktop = { install_info = { - revision = '6d66eea37afa1d6bc1e25ef457113743df42416d', + revision = 'afec3093f6102b83a72aece728c53d17d3fcb2d4', url = 'https://github.com/ValdezFOmar/tree-sitter-desktop', }, maintainers = { '@ValdezFOmar' }, @@ -411,7 +411,7 @@ return { dtd = { install_info = { location = 'dtd', - revision = '0d9a8099c963ed53e183425c1b47fa2622c8eaf7', + revision = '291b02018c525abe70fec41559cfe8f2f1cc84b2', url = 'https://github.com/tree-sitter-grammars/tree-sitter-xml', }, maintainers = { '@ObserverOfTime' }, @@ -441,7 +441,7 @@ return { }, editorconfig = { install_info = { - revision = '3f2b371537355f6e53cc3af37f79ba450efb5132', + revision = '65de8da4ff21a8be40adb5dadcd7a0f39d2f0747', url = 'https://github.com/ValdezFOmar/tree-sitter-editorconfig', }, maintainers = { '@ValdezFOmar' }, @@ -1052,7 +1052,7 @@ return { }, janet_simple = { install_info = { - revision = 'b08b402207fba0037d5152ce7c521351147f4388', + revision = '7e28cbf1ca061887ea43591a2898001f4245fddf', url = 'https://github.com/sogaiu/tree-sitter-janet-simple', }, maintainers = { '@sogaiu' }, @@ -1265,7 +1265,7 @@ return { }, liquid = { install_info = { - revision = 'd269f4d52cd08f6cbc6636ee23cc30a9f6c32e42', + revision = 'd6ebde3974742cd1b61b55d1d94aab1dacb41056', url = 'https://github.com/hankthetank27/tree-sitter-liquid', }, maintainers = { '@hankthetank27' }, @@ -1392,7 +1392,7 @@ return { mlir = { install_info = { generate = true, - revision = '3b2ae4ce9a8abca997ed3b34625d462248d1bbac', + revision = '4d2396f21722d0c8d2ea285f380b21f1a71668b3', url = 'https://github.com/artagnon/tree-sitter-mlir', }, maintainers = { '@artagnon' }, @@ -1558,7 +1558,7 @@ return { perl = { install_info = { branch = 'release', - revision = 'ecd90bd8b381bcc7219fed4fe351903630e761c6', + revision = 'a2d8e5a32a63019d25bb7452455f4d646d11cce5', url = 'https://github.com/tree-sitter-perl/tree-sitter-perl', }, maintainers = { '@RabbiVeesh', '@LeoNerd' }, @@ -2260,7 +2260,7 @@ return { }, templ = { install_info = { - revision = '54367acb2b250879f39f2afee123c917ed0798e0', + revision = '5504cc96fbf5c9a029add2dfcb6e585e8fdaad75', url = 'https://github.com/vrischmann/tree-sitter-templ', }, maintainers = { '@vrischmann' }, @@ -2310,7 +2310,7 @@ return { }, tlaplus = { install_info = { - revision = '4ba91b07b97741a67f61221d0d50e6d962e4987e', + revision = '2d831940c782850f64dabf5b7b17e9e51f7f0ebb', url = 'https://github.com/tlaplus-community/tree-sitter-tlaplus', }, maintainers = { '@ahelwer', '@susliko' }, @@ -2453,7 +2453,7 @@ return { v = { install_info = { location = 'tree_sitter_v', - revision = '59a8889d84a293d7c0366d14c8dbb0eec24fe889', + revision = '0f963ca4c0cc888252f5a31f37c974d5e2527d06', url = 'https://github.com/vlang/v-analyzer', }, maintainers = { '@kkharji', '@amaanq' }, @@ -2485,7 +2485,7 @@ return { }, vhdl = { install_info = { - revision = '35ed277d3e98836796bc764010dc3fb800d14ee4', + revision = 'ec2cb14f68053cf49d1d18cd5742af8e81771ebb', url = 'https://github.com/jpt13653903/tree-sitter-vhdl', }, maintainers = { '@jpt13653903' }, @@ -2576,7 +2576,7 @@ return { xml = { install_info = { location = 'xml', - revision = '0d9a8099c963ed53e183425c1b47fa2622c8eaf7', + revision = '291b02018c525abe70fec41559cfe8f2f1cc84b2', url = 'https://github.com/tree-sitter-grammars/tree-sitter-xml', }, maintainers = { '@ObserverOfTime' }, @@ -2585,7 +2585,7 @@ return { }, xresources = { install_info = { - revision = 'd0f9dc7cec4dc15fc6f9d556bb4e9dd5050328a6', + revision = 'dcbce0c5dde0fca01dd83a8f497ebe4d053eab1d', url = 'https://github.com/ValdezFOmar/tree-sitter-xresources', }, maintainers = { '@ValdezFOmar' }, @@ -2593,7 +2593,7 @@ return { }, yaml = { install_info = { - revision = '1805917414a9a8ba2473717fd69447277a175fae', + revision = '08c5caaeb34e5ccd614706d3b5359a78f1c9e275', url = 'https://github.com/tree-sitter-grammars/tree-sitter-yaml', }, maintainers = { '@amaanq' }, From 0d60a092525ed669ae37289f9057988b8313ec59 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 25 May 2025 10:47:20 +0200 Subject: [PATCH 2158/2494] fix(typst): restore missing injections --- runtime/queries/typst/injections.scm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/runtime/queries/typst/injections.scm b/runtime/queries/typst/injections.scm index 2f0e58eb6..344c6a308 100644 --- a/runtime/queries/typst/injections.scm +++ b/runtime/queries/typst/injections.scm @@ -1,2 +1,6 @@ ((comment) @injection.content (#set! injection.language "comment")) + +(raw_blck + (ident) @injection.language + (blob) @injection.content) From c1dfc39285e4a11983dfbe556fb0be7f2a749977 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 25 May 2025 13:02:26 +0200 Subject: [PATCH 2159/2494] fix(config): prepend install_dir to rtp --- doc/nvim-treesitter.txt | 2 +- lua/nvim-treesitter/config.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/nvim-treesitter.txt b/doc/nvim-treesitter.txt index b57687961..77e6f037f 100644 --- a/doc/nvim-treesitter.txt +++ b/doc/nvim-treesitter.txt @@ -100,7 +100,7 @@ setup({opts}) *nvim-treesitter.setup()* • {opts} `(table?)` Optional parameters: • {install_dir} (`string?`, default `stdpath('data')/site/`) directory to install parsers and queries to. Note: will be - appended to |runtimepath|. + prepended to |runtimepath|. install({languages} [, {opts}]) *nvim-treesitter.install()* diff --git a/lua/nvim-treesitter/config.lua b/lua/nvim-treesitter/config.lua index 8dcbdb37e..d78ee50c4 100644 --- a/lua/nvim-treesitter/config.lua +++ b/lua/nvim-treesitter/config.lua @@ -16,7 +16,7 @@ function M.setup(user_data) if user_data then if user_data.install_dir then user_data.install_dir = vim.fs.normalize(user_data.install_dir) - vim.opt.runtimepath:append(user_data.install_dir) + vim.opt.runtimepath:prepend(user_data.install_dir) end config = vim.tbl_deep_extend('force', config, user_data) end From 1043871ef43e009aedfc1d9965335e168a4a0a08 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Mon, 26 May 2025 14:52:28 +0200 Subject: [PATCH 2160/2494] fix(swift): mark as unmaintained Prevent from updating parser with breaking changes until queries are adapted. --- SUPPORTED_LANGUAGES.md | 2 +- lua/nvim-treesitter/parsers.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/SUPPORTED_LANGUAGES.md b/SUPPORTED_LANGUAGES.md index 94e105085..bb13fc2f7 100644 --- a/SUPPORTED_LANGUAGES.md +++ b/SUPPORTED_LANGUAGES.md @@ -278,7 +278,7 @@ jsx (queries only)[^jsx] | unstable | `HFIJ ` | | @steelsojka [surface](https://github.com/connorlay/tree-sitter-surface) | unstable | `HFIJ ` | | @connorlay [svelte](https://github.com/tree-sitter-grammars/tree-sitter-svelte) | unstable | `HFIJL` | | @amaanq [sway](https://github.com/FuelLabs/tree-sitter-sway.git) | unstable | `HFIJL` | | @ribru17 -[swift](https://github.com/alex-pinkus/tree-sitter-swift) | unstable | `HFIJL` | X | @alex-pinkus +[swift](https://github.com/alex-pinkus/tree-sitter-swift) | unmaintained | `HFIJL` | X | @alex-pinkus [sxhkdrc](https://github.com/RaafatTurki/tree-sitter-sxhkdrc) | unstable | `HF J ` | | @RaafatTurki [systemtap](https://github.com/ok-ryoko/tree-sitter-systemtap) | unstable | `HF JL` | | @ok-ryoko [t32](https://gitlab.com/xasc/tree-sitter-t32) | unstable | `HFIJL` | | @xasc diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 6583bd3b9..bcd5598cf 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -2199,7 +2199,7 @@ return { url = 'https://github.com/alex-pinkus/tree-sitter-swift', }, maintainers = { '@alex-pinkus' }, - tier = 2, + tier = 3, }, sxhkdrc = { install_info = { From 61b0a05ec07280540d839aa9edfb81a84048fdf2 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Mon, 26 May 2025 14:42:03 +0200 Subject: [PATCH 2161/2494] fix(install): create cache dir if not existing --- lua/nvim-treesitter/install.lua | 4 ++++ scripts/install-parsers.lua | 3 --- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lua/nvim-treesitter/install.lua b/lua/nvim-treesitter/install.lua index 6d60b7921..e6933fe58 100644 --- a/lua/nvim-treesitter/install.lua +++ b/lua/nvim-treesitter/install.lua @@ -440,6 +440,10 @@ local function install(languages, options) options = options or {} local cache_dir = fs.normalize(fn.stdpath('cache')) + if not vim.uv.fs_stat(cache_dir) then + vim.fn.mkdir(cache_dir, 'p') + end + local install_dir = config.get_install_dir('parser') local task_funs = {} ---@type async.TaskFun[] diff --git a/scripts/install-parsers.lua b/scripts/install-parsers.lua index f2fd56082..e3804cab8 100755 --- a/scripts/install-parsers.lua +++ b/scripts/install-parsers.lua @@ -18,9 +18,6 @@ end vim.opt.runtimepath:append('.') --- needed on CI -vim.fn.mkdir(vim.fn.stdpath('cache'), 'p') - ---@type async.Task local task = update and require('nvim-treesitter').update('all') or require('nvim-treesitter').install( From dd63d7141faa8bb551c1ed76e6d0d0006aa1db2d Mon Sep 17 00:00:00 2001 From: Marc Jakobi Date: Tue, 27 May 2025 10:17:09 +0200 Subject: [PATCH 2162/2494] fix(haskell): properly set inline-python injection language --- runtime/queries/haskell/injections.scm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/runtime/queries/haskell/injections.scm b/runtime/queries/haskell/injections.scm index a82addbce..98a396e5e 100644 --- a/runtime/queries/haskell/injections.scm +++ b/runtime/queries/haskell/injections.scm @@ -79,6 +79,7 @@ ; Python ; inline-python (quasiquote - (quoter) @injection.language - (#any-of? @injection.language "pymain" "pye" "py_" "pyf") - (quasiquote_body) @injection.content) + (quoter) @_name + (#any-of? @_name "pymain" "pye" "py_" "pyf") + (quasiquote_body) @injection.content + (#set! injection.language "python")) From 0140c29b31d56be040697176ae809ba0c709da02 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 27 May 2025 15:20:55 +0200 Subject: [PATCH 2163/2494] fix(health): only require ts>=v0.25 --- lua/nvim-treesitter/health.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/nvim-treesitter/health.lua b/lua/nvim-treesitter/health.lua index 6904899f6..57131f778 100644 --- a/lua/nvim-treesitter/health.lua +++ b/lua/nvim-treesitter/health.lua @@ -7,7 +7,7 @@ local health = vim.health local M = {} local NVIM_TREESITTER_MINIMUM_ABI = 13 -local TREE_SITTER_MIN_VER = { 0, 25, 4 } +local TREE_SITTER_MIN_VER = { 0, 25, 0 } ---@param name string ---@return table? From 024e6c5e46f8ec4237695b9e3020ecb601d817df Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Wed, 28 May 2025 09:41:11 +0200 Subject: [PATCH 2164/2494] fix(queries): fix rebase errors on main --- runtime/queries/agda/injections.scm | 12 ------------ runtime/queries/scala/injections.scm | 3 +++ runtime/queries/solidity/injections.scm | 12 ++++++++++++ 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/runtime/queries/agda/injections.scm b/runtime/queries/agda/injections.scm index a772e0bd9..2f0e58eb6 100644 --- a/runtime/queries/agda/injections.scm +++ b/runtime/queries/agda/injections.scm @@ -1,14 +1,2 @@ ((comment) @injection.content (#set! injection.language "comment")) - -((comment) @injection.content - (#lua-match? @injection.content "^///[^/]") - (#set! injection.language "doxygen")) - -((comment) @injection.content - (#lua-match? @injection.content "^///$") - (#set! injection.language "doxygen")) - -((comment) @injection.content - (#lua-match? @injection.content "^/[*][*][^*].*[*]/$") - (#set! injection.language "doxygen")) diff --git a/runtime/queries/scala/injections.scm b/runtime/queries/scala/injections.scm index 2f0e58eb6..1c2fe3cc9 100644 --- a/runtime/queries/scala/injections.scm +++ b/runtime/queries/scala/injections.scm @@ -1,2 +1,5 @@ ((comment) @injection.content (#set! injection.language "comment")) + +((block_comment) @injection.content + (#set! injection.language "comment")) diff --git a/runtime/queries/solidity/injections.scm b/runtime/queries/solidity/injections.scm index 2f0e58eb6..a772e0bd9 100644 --- a/runtime/queries/solidity/injections.scm +++ b/runtime/queries/solidity/injections.scm @@ -1,2 +1,14 @@ ((comment) @injection.content (#set! injection.language "comment")) + +((comment) @injection.content + (#lua-match? @injection.content "^///[^/]") + (#set! injection.language "doxygen")) + +((comment) @injection.content + (#lua-match? @injection.content "^///$") + (#set! injection.language "doxygen")) + +((comment) @injection.content + (#lua-match? @injection.content "^/[*][*][^*].*[*]/$") + (#set! injection.language "doxygen")) From 71d2fd1bd410da85d03ee1da7a35e895ee7a8494 Mon Sep 17 00:00:00 2001 From: Noah Bogart Date: Wed, 28 May 2025 16:44:34 -0400 Subject: [PATCH 2165/2494] fix(just): do not restrict `@function.call` to explicit list (#7905) --- runtime/queries/just/highlights.scm | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/runtime/queries/just/highlights.scm b/runtime/queries/just/highlights.scm index fbbf4eece..743de4314 100644 --- a/runtime/queries/just/highlights.scm +++ b/runtime/queries/just/highlights.scm @@ -135,15 +135,5 @@ argument: (string) @string.special.path)) (#eq? @_dir "working-directory")) -; Ref: https://just.systems/man/en/chapter_31.html -;(function_call (identifier) @error) (function_call - (identifier) @function.call - (#any-of? @function.call - "arch" "num_cpus" "os" "os_family" "env_var" "env_var_or_default" "env" "invocation_directory" - "invocation_directory_native" "justfile" "justfile_directory" "just_executable" "quote" - "replace" "replace_regex" "trim" "trim_end" "trim_end_match" "trim_end_matches" "trim_start" - "trim_start_match" "trim_start_matches" "capitalize" "kebabcase" "lowercamelcase" "lowercase" - "shoutykebabcase" "shoutysnakecase" "snakecase" "titlecase" "uppercamelcase" "uppercase" - "absolute_path" "extension" "file_name" "file_stem" "parent_directory" "without_extension" - "clean" "join" "path_exists" "error" "sha256" "sha256_file" "uuid" "semver_matches")) + (identifier) @function.call) From c59004f1e03e111099978932e86bb2f479b5ea73 Mon Sep 17 00:00:00 2001 From: Christian Buttner Date: Wed, 28 May 2025 23:04:10 +0200 Subject: [PATCH 2166/2494] feat: add c3 (#7891) --- SUPPORTED_LANGUAGES.md | 1 + lua/nvim-treesitter/parsers.lua | 8 + runtime/queries/c3/folds.scm | 35 +++ runtime/queries/c3/highlights.scm | 408 ++++++++++++++++++++++++++++++ runtime/queries/c3/indents.scm | 73 ++++++ runtime/queries/c3/injections.scm | 5 + 6 files changed, 530 insertions(+) create mode 100644 runtime/queries/c3/folds.scm create mode 100644 runtime/queries/c3/highlights.scm create mode 100644 runtime/queries/c3/indents.scm create mode 100644 runtime/queries/c3/injections.scm diff --git a/SUPPORTED_LANGUAGES.md b/SUPPORTED_LANGUAGES.md index bb13fc2f7..0e6417529 100644 --- a/SUPPORTED_LANGUAGES.md +++ b/SUPPORTED_LANGUAGES.md @@ -32,6 +32,7 @@ Language | Tier | Queries | Node | Maintainer [bp](https://github.com/ambroisie/tree-sitter-bp)[^bp] | unstable | `HFIJL` | | @ambroisie [brightscript](https://github.com/ajdelcimmuto/tree-sitter-brightscript) | unstable | `HFIJ ` | | @ajdelcimmuto [c](https://github.com/tree-sitter/tree-sitter-c) | unstable | `HFIJL` | | @amaanq +[c3](https://github.com/c3lang/tree-sitter-c3) | unstable | `HFIJ ` | | @cbuttner [c_sharp](https://github.com/tree-sitter/tree-sitter-c-sharp) | unstable | `HF JL` | | @amaanq [caddy](https://github.com/opa-oz/tree-sitter-caddy) | unmaintained | `HFIJ ` | | @opa-oz [cairo](https://github.com/tree-sitter-grammars/tree-sitter-cairo) | unstable | `HFIJL` | | @amaanq diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index bcd5598cf..5b30d8003 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -164,6 +164,14 @@ return { maintainers = { '@amaanq' }, tier = 2, }, + c3 = { + install_info = { + revision = 'dce56ccc5d2731ac14a0f6bb3fd1666d994b2a25', + url = 'https://github.com/c3lang/tree-sitter-c3', + }, + maintainers = { '@cbuttner' }, + tier = 2, + }, c_sharp = { install_info = { revision = 'b5eb5742f6a7e9438bee22ce8026d6b927be2cd7', diff --git a/runtime/queries/c3/folds.scm b/runtime/queries/c3/folds.scm new file mode 100644 index 000000000..0776e7678 --- /dev/null +++ b/runtime/queries/c3/folds.scm @@ -0,0 +1,35 @@ +[ + ; Top-level declarations + (bitstruct_declaration) + (enum_declaration) + (faultdef_declaration) + (func_definition) + (import_declaration)+ + (interface_declaration) + (macro_declaration) + (struct_declaration) + ; Statements + (asm_block_stmt) + (case_stmt) + (defer_stmt) + (do_stmt) + (for_stmt) + (foreach_stmt) + (if_stmt) + (switch_stmt) + (while_stmt) + (ct_for_stmt) + (ct_foreach_stmt) + (ct_switch_stmt) + (ct_case_stmt) + (ct_if_stmt) + (ct_else_stmt) + ; Comments + (block_comment) + (doc_comment) + ; Initializer list + (initializer_list) +] @fold + +(compound_stmt + (compound_stmt) @fold) diff --git a/runtime/queries/c3/highlights.scm b/runtime/queries/c3/highlights.scm new file mode 100644 index 000000000..1f02496b8 --- /dev/null +++ b/runtime/queries/c3/highlights.scm @@ -0,0 +1,408 @@ +; Punctuation +[ + "(" + ")" + "[" + "]" + "{" + "}" + "[<" + ">]" +] @punctuation.bracket + +[ + ";" + "," + ":" + "::" +] @punctuation.delimiter + +; Constant +(const_ident) @constant + +[ + "true" + "false" +] @boolean + +"null" @constant.builtin + +; Variable +[ + (ident) + (ct_ident) + (hash_ident) +] @variable + +; 1) Member +(field_expr + field: (access_ident + (ident) @variable.member)) + +(struct_member_declaration + (ident) @variable.member) + +(struct_member_declaration + (identifier_list + (ident) @variable.member)) + +(bitstruct_member_declaration + (ident) @variable.member) + +(initializer_list + (initializer_element + (param_path + (param_path_element + (access_ident + (ident) @variable.member))))) + +; 2) Parameter +(param + name: (_) @variable.parameter) + +(trailing_block_param + (at_ident) @variable.parameter) + +(call_arg_list + (call_arg + name: (_) @variable.parameter)) + +(enum_param + (ident) @variable.parameter) + +; Keyword (from `c3c --list-keywords`) +[ + "alias" + "asm" + "attrdef" + "catch" + "defer" + "try" + "var" +] @keyword + +[ + "$alignof" + "$assert" + "$assignable" + "$case" + "$default" + "$defined" + "$echo" + "$else" + "$embed" + "$endfor" + "$endforeach" + "$endif" + "$endswitch" + "$eval" + "$evaltype" + "$error" + "$exec" + "$extnameof" + "$feature" + "$for" + "$foreach" + "$if" + "$include" + "$is_const" + "$nameof" + "$offsetof" + "$qnameof" + "$sizeof" + "$stringify" + "$switch" + "$typefrom" + "$typeof" + "$vacount" + "$vatype" + "$vaconst" + "$vaarg" + "$vaexpr" + "$vasplat" +] @keyword.directive + +"assert" @keyword.debug + +"fn" @keyword.function + +"macro" @keyword.function + +"return" @keyword.return + +[ + "import" + "module" +] @keyword.import + +[ + "bitstruct" + "enum" + "faultdef" + "interface" + "struct" + "typedef" + "union" +] @keyword.type + +[ + "case" + "default" + "else" + "if" + "nextcase" + "switch" +] @keyword.conditional + +[ + "break" + "continue" + "do" + "for" + "foreach" + "foreach_r" + "while" +] @keyword.repeat + +[ + "const" + "extern" + "inline" + "static" + "tlocal" +] @keyword.modifier + +; Operator (from `c3c --list-operators`) +[ + "&" + "!" + "~" + "|" + "^" + "=" + ">" + "/" + "." + "<" + "-" + "%" + "+" + "?" + "*" + "&&" + "!!" + "&=" + "|=" + "^=" + "/=" + ".." + "?:" + "==" + ">=" + "=>" + "<=" + "-=" + "--" + "%=" + "*=" + "!=" + "||" + "+=" + "++" + "??" + "<<" + ">>" + "..." + "<<=" + ">>=" + "&&&" + "+++" + "|||" +] @operator + +(range_expr + ":" @operator) + +(foreach_cond + ":" @operator) + +(ct_foreach_cond + ":" @operator) + +(ternary_expr + [ + "?" + ":" + ] @keyword.conditional.ternary) + +(elvis_orelse_expr + [ + "?:" + "??" + ] @keyword.conditional.ternary) + +; Literal +(integer_literal) @number + +(real_literal) @number.float + +(char_literal) @character + +(bytes_literal) @number + +; String +(string_literal) @string + +(raw_string_literal) @string + +; Escape Sequence +(escape_sequence) @string.escape + +; Builtin (constants) +(builtin_const) @constant.builtin + +; Type Property (from `c3c --list-type-properties`) +(type_access_expr + (access_ident + (ident) @variable.builtin + (#any-of? @variable.builtin + "alignof" "associated" "elements" "extnameof" "from_ordinal" "get" "inf" "is_eq" "is_ordered" + "is_substruct" "len" "lookup" "lookup_field" "max" "membersof" "methodsof" "min" "nan" "inner" + "kindof" "names" "nameof" "params" "paramsof" "parentof" "qnameof" "returns" "sizeof" "tagof" + "has_tagof" "values" "typeid"))) + +; Label +[ + (label) + (label_target) +] @label + +; Module +(module_resolution + (ident) @module) + +(module_declaration + (path_ident + (ident) @module)) + +(import_declaration + (path_ident + (ident) @module)) + +; Attribute +(attribute + name: (at_ident) @attribute) + +(at_type_ident) @attribute + +(call_inline_attributes + (at_ident) @attribute) + +(asm_block_stmt + (at_ident) @attribute) + +; Type +[ + (type_ident) + (ct_type_ident) +] @type + +(base_type_name) @type.builtin + +; Function Definition +(func_header + name: (_) @function) + +(func_header + method_type: (_) + name: (_) @function.method) + +(macro_header + name: (_) @function) + +(macro_header + method_type: (_) + name: (_) @function.method) + +; Function Call +(call_expr + function: (ident_expr + [ + (ident) + (at_ident) + ] @function.call)) + +(call_expr + function: (trailing_generic_expr + argument: (ident_expr + [ + (ident) + (at_ident) + ] @function.call))) + +; Method call +(call_expr + function: (field_expr + field: (access_ident + [ + (ident) + (at_ident) + ] @function.method.call))) + +; Method on type +(call_expr + function: (type_access_expr + field: (access_ident + [ + (ident) + (at_ident) + ] @function.method.call))) + +; Builtin call +(call_expr + function: (builtin) @function.builtin) + +; Asm +(asm_instr + [ + (ident) + "int" + ] @function.builtin) + +(asm_expr + [ + (ct_ident) + (ct_const_ident) + ] @variable.builtin) + +; Comment +[ + (line_comment) + (block_comment) +] @comment @spell + +(doc_comment) @comment.documentation + +(doc_comment_text) @spell + +(doc_comment_contract + name: (_) @attribute) + +(doc_comment_contract + parameter: [ + (ident) + (ct_ident) + (hash_ident) + ] @variable.parameter + (#set! priority 110)) + +(doc_comment_contract + [ + ":" + "?" + ] @comment.documentation + (#set! priority 110)) + +(doc_comment_contract + description: (_) @comment.documentation + (#set! priority 110)) diff --git a/runtime/queries/c3/indents.scm b/runtime/queries/c3/indents.scm new file mode 100644 index 000000000..61758ce32 --- /dev/null +++ b/runtime/queries/c3/indents.scm @@ -0,0 +1,73 @@ +[ + (compound_stmt) + (initializer_list) + (implies_body) + (struct_body) + (bitstruct_body) + (enum_body) + (interface_body) + (switch_body) + (ct_if_stmt) + (ct_for_stmt) + (ct_foreach_stmt) + (ct_switch_stmt) +] @indent.begin + +([ + (case_stmt) + (default_stmt) + (ct_case_stmt) +] @indent.begin + (#set! indent.immediate 1)) + +(expr_stmt + ";" @indent.end) @indent.begin + +(declaration + ";" @indent.end) @indent.begin + +(const_declaration + ";" @indent.end) @indent.begin + +(return_stmt + ";" @indent.end) @indent.begin + +(faultdef_declaration + ";" @indent.end) @indent.begin + +(macro_func_body + ";" @indent.end) + +[ + ")" + "}" + "$endfor" + "$endforeach" + "$endswitch" + "$endif" +] @indent.branch @indent.end + +"$else" @indent.branch + +([ + (func_param_list) + (macro_param_list) + (enum_param_list) + (attribute_param_list) + (call_arg_list) + (paren_cond) + (for_cond) + (foreach_cond) + (paren_expr) +] @indent.align + (#set! indent.open_delimiter "(") + (#set! indent.close_delimiter ")")) + +[ + (block_comment) + (doc_comment) + (raw_string_literal) + (bytes_literal) +] @indent.auto + +(string_literal) @indent.ignore diff --git a/runtime/queries/c3/injections.scm b/runtime/queries/c3/injections.scm new file mode 100644 index 000000000..3cd6aac8e --- /dev/null +++ b/runtime/queries/c3/injections.scm @@ -0,0 +1,5 @@ +([ + (line_comment) + (block_comment) +] @injection.content + (#set! injection.language "comment")) From f9ab837ca15b08628a43027623011ab96cba5bb7 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Wed, 28 May 2025 09:25:08 +0200 Subject: [PATCH 2167/2494] fix(install): don't skip un-tiered parsers --- lua/nvim-treesitter/config.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/nvim-treesitter/config.lua b/lua/nvim-treesitter/config.lua index d78ee50c4..d073e3516 100644 --- a/lua/nvim-treesitter/config.lua +++ b/lua/nvim-treesitter/config.lua @@ -144,7 +144,7 @@ function M.norm_languages(languages, skip) languages = vim.tbl_filter( --- @param v string function(v) - return parsers[v].tier < 4 + return not (parsers[v].tier and parsers[v].tier == 4) end, languages ) From 03c90480907fd4ec7ce3f76bbf3264100223b5df Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Wed, 28 May 2025 09:23:55 +0200 Subject: [PATCH 2168/2494] fix(install): only install queries for bundled parsers --- lua/nvim-treesitter/install.lua | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/lua/nvim-treesitter/install.lua b/lua/nvim-treesitter/install.lua index e6933fe58..b669127ad 100644 --- a/lua/nvim-treesitter/install.lua +++ b/lua/nvim-treesitter/install.lua @@ -369,14 +369,20 @@ local function try_install_lang(lang, cache_dir, install_dir, generate) end end - local queries = fs.joinpath(config.get_install_dir('queries'), lang) - local queries_src = M.get_package_path('runtime', 'queries', lang) - uv_unlink(queries) - local err = uv_symlink(queries_src, queries, { dir = true, junction = true }) - a.schedule() - if err then - return logger:error(err) + do -- install queries + local queries_src = M.get_package_path('runtime', 'queries', lang) + if uv.fs_stat(queries_src) then + local queries = fs.joinpath(config.get_install_dir('queries'), lang) + + uv_unlink(queries) + local err = uv_symlink(queries_src, queries, { dir = true, junction = true }) + a.schedule() + if err then + return logger:error(err) + end + end end + logger:info('Language installed') end @@ -440,8 +446,8 @@ local function install(languages, options) options = options or {} local cache_dir = fs.normalize(fn.stdpath('cache')) - if not vim.uv.fs_stat(cache_dir) then - vim.fn.mkdir(cache_dir, 'p') + if not uv.fs_stat(cache_dir) then + fn.mkdir(cache_dir, 'p') end local install_dir = config.get_install_dir('parser') @@ -526,6 +532,7 @@ end ---@param languages string[]|string M.uninstall = a.async(function(languages) + reload_parsers() languages = config.norm_languages(languages or 'all', { missing = true, dependencies = true }) local parser_dir = config.get_install_dir('parser') @@ -537,7 +544,7 @@ M.uninstall = a.async(function(languages) for _, lang in ipairs(languages) do local logger = log.new('uninstall/' .. lang) if not vim.list_contains(installed, lang) then - log.warn('Parser for ' .. lang .. ' is is not managed by nvim-treesitter') + log.warn('Parser for ' .. lang .. ' is not managed by nvim-treesitter') else local parser = fs.joinpath(parser_dir, lang) .. '.so' local queries = fs.joinpath(query_dir, lang) From 0860b9b1070c4e1bcce66416844b633acd8e0d2a Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Wed, 28 May 2025 13:55:33 +0200 Subject: [PATCH 2169/2494] fix(config): check both installed parsers and queries Problem: Can't uninstall custom parsers without queries since `installed_parsers` only iterates over installed queries (to include query-only languages, and to avoid string manipulation). Solution: Iterate over both queries and parsers to collect list of installed languages (optionally only queries or only parsers). --- lua/nvim-treesitter/config.lua | 28 +++++++++++++++++----------- lua/nvim-treesitter/health.lua | 2 +- lua/nvim-treesitter/install.lua | 6 +++--- plugin/nvim-treesitter.lua | 2 +- scripts/check-parsers.lua | 2 +- scripts/check-queries.lua | 2 +- 6 files changed, 24 insertions(+), 18 deletions(-) diff --git a/lua/nvim-treesitter/config.lua b/lua/nvim-treesitter/config.lua index d073e3516..e46e2d5d1 100644 --- a/lua/nvim-treesitter/config.lua +++ b/lua/nvim-treesitter/config.lua @@ -39,22 +39,28 @@ function M.get_install_dir(dir_name) return dir end +---@param type 'queries'|'parsers'? ---@return string[] -function M.installed_parsers() - local install_dir = M.get_install_dir('queries') - - local installed = {} --- @type string[] - for f in vim.fs.dir(install_dir) do - installed[#installed + 1] = f +function M.installed_languages(type) + local installed = {} --- @type table + if not (type and type == 'parsers') then + for f in vim.fs.dir(M.get_install_dir('queries')) do + installed[f] = true + end end - - return installed + if not (type and type == 'queries') then + for f in vim.fs.dir(M.get_install_dir('parser')) do + installed[vim.fn.fnamemodify(f, ':r')] = true + end + end + return vim.tbl_keys(installed) end -- Get a list of all available parsers ---@param tier integer? only get parsers of specified tier ---@return string[] function M.get_available(tier) + vim.api.nvim_exec_autocmds('User', { pattern = 'TSUpdate' }) local parsers = require('nvim-treesitter.parsers') --- @type string[] local languages = vim.tbl_keys(parsers) @@ -101,7 +107,7 @@ function M.norm_languages(languages, skip) if vim.list_contains(languages, 'all') then if skip and skip.missing then - return M.installed_parsers() + return M.installed_languages() end languages = M.get_available() end @@ -109,7 +115,7 @@ function M.norm_languages(languages, skip) languages = expand_tiers(languages) if skip and skip.installed then - local installed = M.installed_parsers() + local installed = M.installed_languages() languages = vim.tbl_filter( --- @param v string function(v) @@ -120,7 +126,7 @@ function M.norm_languages(languages, skip) end if skip and skip.missing then - local installed = M.installed_parsers() + local installed = M.installed_languages() languages = vim.tbl_filter( --- @param v string function(v) diff --git a/lua/nvim-treesitter/health.lua b/lua/nvim-treesitter/health.lua index 57131f778..4095bce00 100644 --- a/lua/nvim-treesitter/health.lua +++ b/lua/nvim-treesitter/health.lua @@ -136,7 +136,7 @@ function M.check() -- Parser installation checks health.start('Installed languages' .. string.rep(' ', 5) .. 'H L F I J') - local languages = config.installed_parsers() + local languages = config.installed_languages() for _, lang in pairs(languages) do local parser = parsers[lang] local out = lang .. string.rep(' ', 22 - #lang) diff --git a/lua/nvim-treesitter/install.lua b/lua/nvim-treesitter/install.lua index b669127ad..6391beba9 100644 --- a/lua/nvim-treesitter/install.lua +++ b/lua/nvim-treesitter/install.lua @@ -402,7 +402,7 @@ local install_status = {} ---@type table ---@param generate? boolean ---@return InstallStatus status local function install_lang(lang, cache_dir, install_dir, force, generate) - if not force and vim.list_contains(config.installed_parsers(), lang) then + if not force and vim.list_contains(config.installed_languages(), lang) then install_status[lang] = 'installed' return 'installed' end @@ -532,12 +532,12 @@ end ---@param languages string[]|string M.uninstall = a.async(function(languages) - reload_parsers() + vim.api.nvim_exec_autocmds('User', { pattern = 'TSUpdate' }) languages = config.norm_languages(languages or 'all', { missing = true, dependencies = true }) local parser_dir = config.get_install_dir('parser') local query_dir = config.get_install_dir('queries') - local installed = config.installed_parsers() + local installed = config.installed_languages() local task_funs = {} ---@type async.TaskFun[] local done = 0 diff --git a/plugin/nvim-treesitter.lua b/plugin/nvim-treesitter.lua index b007ca29b..d4ccf3049 100644 --- a/plugin/nvim-treesitter.lua +++ b/plugin/nvim-treesitter.lua @@ -21,7 +21,7 @@ local function complete_installed_parsers(arglead) function(v) return v:find(arglead) ~= nil end, - require('nvim-treesitter.config').installed_parsers() + require('nvim-treesitter.config').installed_languages() ) end diff --git a/scripts/check-parsers.lua b/scripts/check-parsers.lua index 08e48740d..152c8f7ea 100755 --- a/scripts/check-parsers.lua +++ b/scripts/check-parsers.lua @@ -3,7 +3,7 @@ vim.opt.runtimepath:append('.') local configs = require('nvim-treesitter.parsers') local parsers = #_G.arg > 0 and { unpack(_G.arg) } - or require('nvim-treesitter.config').installed_parsers() + or require('nvim-treesitter.config').installed_languages('parsers') local data = {} ---@type table[] local errors = {} ---@type string[] diff --git a/scripts/check-queries.lua b/scripts/check-queries.lua index 0a684f5eb..27869b6b5 100755 --- a/scripts/check-queries.lua +++ b/scripts/check-queries.lua @@ -4,7 +4,7 @@ vim.opt.runtimepath:append('.') local query_types = require('nvim-treesitter.health').bundled_queries local configs = require('nvim-treesitter.parsers') local parsers = #_G.arg > 0 and { unpack(_G.arg) } - or require('nvim-treesitter.config').installed_parsers() + or require('nvim-treesitter.config').installed_languages('queries') -- Check queries for each installed parser in parsers local errors = {} ---@type string[] From ce903fde5d36d7955d34faaf0b812a186417e746 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Thu, 29 May 2025 12:04:37 +0200 Subject: [PATCH 2170/2494] feat(api): expose list of available and installed languages --- doc/nvim-treesitter.txt | 21 ++++++++++++++++++--- lua/nvim-treesitter/config.lua | 8 ++++---- lua/nvim-treesitter/health.lua | 2 +- lua/nvim-treesitter/init.lua | 8 ++++++++ lua/nvim-treesitter/install.lua | 4 ++-- plugin/nvim-treesitter.lua | 2 +- scripts/check-parsers.lua | 2 +- scripts/check-queries.lua | 2 +- 8 files changed, 36 insertions(+), 13 deletions(-) diff --git a/doc/nvim-treesitter.txt b/doc/nvim-treesitter.txt index 77e6f037f..9ba6909b7 100644 --- a/doc/nvim-treesitter.txt +++ b/doc/nvim-treesitter.txt @@ -102,7 +102,7 @@ setup({opts}) *nvim-treesitter.setup()* directory to install parsers and queries to. Note: will be prepended to |runtimepath|. -install({languages} [, {opts}]) *nvim-treesitter.install()* +install({languages} [, {opts}]) *nvim-treesitter.install()* Download, compile, and install the specified treesitter parsers and copy the corresponding queries to a directory on |runtimepath|, enabling their @@ -126,7 +126,7 @@ install({languages} [, {opts}]) *nvim-treesitter.install()* • {max_jobs} (`integer?`) limit parallel tasks (useful in combination with {generate} on memory-limited systems). -uninstall({languages}) *nvim-treesitter.uninstall()* +uninstall({languages}) *nvim-treesitter.uninstall()* Remove the parser and queries for the specified language(s). @@ -134,7 +134,7 @@ uninstall({languages}) *nvim-treesitter.uninstall() • {languages} `(string[]|string)` (List of) languages or tiers (`stable`, `unstable`) to update. -update([{languages}]) *nvim-treesitter.update()* +update([{languages}]) *nvim-treesitter.update()* Update the parsers and queries if older than the revision specified in the manifest. @@ -153,5 +153,20 @@ indentexpr() *nvim-treesitter.indentexpr()* Used to enable treesitter indentation for a language via >lua vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()" < +get_available([{tier}]) *nvim-treesitter.get_available()* + + Return list of languages available for installation. + + Parameters: ~ + • {tier} `(integer?)` Only return languages of specified {tier} (`1`: + stable, `2`: unstable, `3`: unmaintained, `4`: unsupported) + +get_installed([{type}]) *nvim-treesitter.get_installed()* + + Return list of languages installed via `nvim-treesitter`. + + Parameters: ~ + • {type} `('queries'|parsers'?)` If specified, only show languages with + installed queries or parsers, respectively. vim:tw=78:ts=8:expandtab:noet:ft=help:norl: diff --git a/lua/nvim-treesitter/config.lua b/lua/nvim-treesitter/config.lua index e46e2d5d1..1a5b56cdb 100644 --- a/lua/nvim-treesitter/config.lua +++ b/lua/nvim-treesitter/config.lua @@ -41,7 +41,7 @@ end ---@param type 'queries'|'parsers'? ---@return string[] -function M.installed_languages(type) +function M.get_installed(type) local installed = {} --- @type table if not (type and type == 'parsers') then for f in vim.fs.dir(M.get_install_dir('queries')) do @@ -107,7 +107,7 @@ function M.norm_languages(languages, skip) if vim.list_contains(languages, 'all') then if skip and skip.missing then - return M.installed_languages() + return M.get_installed() end languages = M.get_available() end @@ -115,7 +115,7 @@ function M.norm_languages(languages, skip) languages = expand_tiers(languages) if skip and skip.installed then - local installed = M.installed_languages() + local installed = M.get_installed() languages = vim.tbl_filter( --- @param v string function(v) @@ -126,7 +126,7 @@ function M.norm_languages(languages, skip) end if skip and skip.missing then - local installed = M.installed_languages() + local installed = M.get_installed() languages = vim.tbl_filter( --- @param v string function(v) diff --git a/lua/nvim-treesitter/health.lua b/lua/nvim-treesitter/health.lua index 4095bce00..3f5058996 100644 --- a/lua/nvim-treesitter/health.lua +++ b/lua/nvim-treesitter/health.lua @@ -136,7 +136,7 @@ function M.check() -- Parser installation checks health.start('Installed languages' .. string.rep(' ', 5) .. 'H L F I J') - local languages = config.installed_languages() + local languages = config.get_installed() for _, lang in pairs(languages) do local parser = parsers[lang] local out = lang .. string.rep(' ', 22 - #lang) diff --git a/lua/nvim-treesitter/init.lua b/lua/nvim-treesitter/init.lua index 561c1697a..c5a9201f3 100644 --- a/lua/nvim-treesitter/init.lua +++ b/lua/nvim-treesitter/init.lua @@ -4,6 +4,14 @@ function M.setup(...) require('nvim-treesitter.config').setup(...) end +function M.get_available(...) + return require('nvim-treesitter.config').get_available(...) +end + +function M.get_installed(...) + return require('nvim-treesitter.config').get_installed(...) +end + function M.install(...) return require('nvim-treesitter.install').install(...) end diff --git a/lua/nvim-treesitter/install.lua b/lua/nvim-treesitter/install.lua index 6391beba9..eb55d0191 100644 --- a/lua/nvim-treesitter/install.lua +++ b/lua/nvim-treesitter/install.lua @@ -402,7 +402,7 @@ local install_status = {} ---@type table ---@param generate? boolean ---@return InstallStatus status local function install_lang(lang, cache_dir, install_dir, force, generate) - if not force and vim.list_contains(config.installed_languages(), lang) then + if not force and vim.list_contains(config.get_installed(), lang) then install_status[lang] = 'installed' return 'installed' end @@ -537,7 +537,7 @@ M.uninstall = a.async(function(languages) local parser_dir = config.get_install_dir('parser') local query_dir = config.get_install_dir('queries') - local installed = config.installed_languages() + local installed = config.get_installed() local task_funs = {} ---@type async.TaskFun[] local done = 0 diff --git a/plugin/nvim-treesitter.lua b/plugin/nvim-treesitter.lua index d4ccf3049..8bf2dbfde 100644 --- a/plugin/nvim-treesitter.lua +++ b/plugin/nvim-treesitter.lua @@ -21,7 +21,7 @@ local function complete_installed_parsers(arglead) function(v) return v:find(arglead) ~= nil end, - require('nvim-treesitter.config').installed_languages() + require('nvim-treesitter.config').get_installed() ) end diff --git a/scripts/check-parsers.lua b/scripts/check-parsers.lua index 152c8f7ea..c2eefd7c9 100755 --- a/scripts/check-parsers.lua +++ b/scripts/check-parsers.lua @@ -3,7 +3,7 @@ vim.opt.runtimepath:append('.') local configs = require('nvim-treesitter.parsers') local parsers = #_G.arg > 0 and { unpack(_G.arg) } - or require('nvim-treesitter.config').installed_languages('parsers') + or require('nvim-treesitter.config').get_installed('parsers') local data = {} ---@type table[] local errors = {} ---@type string[] diff --git a/scripts/check-queries.lua b/scripts/check-queries.lua index 27869b6b5..796e3f5fc 100755 --- a/scripts/check-queries.lua +++ b/scripts/check-queries.lua @@ -4,7 +4,7 @@ vim.opt.runtimepath:append('.') local query_types = require('nvim-treesitter.health').bundled_queries local configs = require('nvim-treesitter.parsers') local parsers = #_G.arg > 0 and { unpack(_G.arg) } - or require('nvim-treesitter.config').installed_languages('queries') + or require('nvim-treesitter.config').get_installed('queries') -- Check queries for each installed parser in parsers local errors = {} ---@type string[] From ff770d718b34db10e33d18594153b4d1e0954882 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Thu, 29 May 2025 12:25:13 +0200 Subject: [PATCH 2171/2494] fix(install): don't print operation summary by default Problem: People complain about noisy `install()`. Solution: Gate operation summary behind `summary` install option (default false, set to true for interactive `:TS*` commands). --- doc/nvim-treesitter.txt | 20 ++++++++++++++++++-- lua/nvim-treesitter/install.lua | 25 +++++++++++++++++++------ plugin/nvim-treesitter.lua | 7 ++++--- scripts/install-parsers.lua | 4 ++-- 4 files changed, 43 insertions(+), 13 deletions(-) diff --git a/doc/nvim-treesitter.txt b/doc/nvim-treesitter.txt index 9ba6909b7..f77cb061b 100644 --- a/doc/nvim-treesitter.txt +++ b/doc/nvim-treesitter.txt @@ -125,16 +125,21 @@ install({languages} [, {opts}]) *nvim-treesitter.install()* compiling. • {max_jobs} (`integer?`) limit parallel tasks (useful in combination with {generate} on memory-limited systems). + • {summary} (`boolean?`, default `false`) print summary of + successful and total operations for multiple languages. -uninstall({languages}) *nvim-treesitter.uninstall()* +uninstall({languages} [, {opts}]) *nvim-treesitter.uninstall()* Remove the parser and queries for the specified language(s). Parameters: ~ • {languages} `(string[]|string)` (List of) languages or tiers (`stable`, `unstable`) to update. + • {opts} `(table?)` Optional parameters: + • {summary} (`boolean?`, default `false`) print summary of + successful and total operations for multiple languages. -update([{languages}]) *nvim-treesitter.update()* +update([{languages}, {opts}]) *nvim-treesitter.update()* Update the parsers and queries if older than the revision specified in the manifest. @@ -147,6 +152,11 @@ update([{languages}]) *nvim-treesitter.update()* Parameters: ~ • {languages} `(string[]|string)?` (List of) languages or tiers to update (default: all installed). + • {opts} `(table?)` Optional parameters: + • {max_jobs} (`integer?`) limit parallel tasks (useful in + combination with {generate} on memory-limited systems). + • {summary} (`boolean?`, default `false`) print summary of + successful and total operations for multiple languages. indentexpr() *nvim-treesitter.indentexpr()* @@ -165,6 +175,12 @@ get_installed([{type}]) *nvim-treesitter.get_installed()* Return list of languages installed via `nvim-treesitter`. + Note: This only searches `nvim-treesitter`'s (configured or default) + installation directory; parsers and queries from other sources can be + placed anywhere on 'runtimepath' and are not included. To list all, e.g., + parsers that are installed from any source, use >lua + vim.api.nvim_get_runtime_file('parser/*', true) +< Parameters: ~ • {type} `('queries'|parsers'?)` If specified, only show languages with installed queries or parsers, respectively. diff --git a/lua/nvim-treesitter/install.lua b/lua/nvim-treesitter/install.lua index eb55d0191..a5a2eb2a5 100644 --- a/lua/nvim-treesitter/install.lua +++ b/lua/nvim-treesitter/install.lua @@ -437,6 +437,7 @@ end ---@field force? boolean ---@field generate? boolean ---@field max_jobs? integer +---@field summary? boolean --- Install a parser ---@async @@ -467,7 +468,9 @@ local function install(languages, options) join(options and options.max_jobs or MAX_JOBS, task_funs) if #task_funs > 1 then a.schedule() - log.info('Installed %d/%d languages', done, #task_funs) + if options and options.summary then + log.info('Installed %d/%d languages', done, #task_funs) + end end return done == #task_funs end @@ -481,7 +484,8 @@ M.install = a.async(function(languages, options) end) ---@param languages? string[]|string -M.update = a.async(function(languages) +---@param options? InstallOptions +M.update = a.async(function(languages, options) reload_parsers() if not languages or #languages == 0 then languages = 'all' @@ -489,10 +493,16 @@ M.update = a.async(function(languages) languages = config.norm_languages(languages, { missing = true, unsupported = true }) languages = vim.tbl_filter(needs_update, languages) ---@type string[] + local summary = options and options.summary if #languages > 0 then - return install(languages, { force = true }) + return install( + languages, + { force = true, summary = summary, max_jobs = options and options.max_jobs } + ) else - log.info('All parsers are up-to-date') + if summary then + log.info('All parsers are up-to-date') + end return true end end) @@ -531,7 +541,8 @@ local function uninstall_lang(logger, lang, parser, queries) end ---@param languages string[]|string -M.uninstall = a.async(function(languages) +---@param options? InstallOptions +M.uninstall = a.async(function(languages, options) vim.api.nvim_exec_autocmds('User', { pattern = 'TSUpdate' }) languages = config.norm_languages(languages or 'all', { missing = true, dependencies = true }) @@ -560,7 +571,9 @@ M.uninstall = a.async(function(languages) join(MAX_JOBS, task_funs) if #task_funs > 1 then a.schedule() - log.info('Uninstalled %d/%d languages', done, #task_funs) + if options and options.summary then + log.info('Uninstalled %d/%d languages', done, #task_funs) + end end end) diff --git a/plugin/nvim-treesitter.lua b/plugin/nvim-treesitter.lua index 8bf2dbfde..adeb41425 100644 --- a/plugin/nvim-treesitter.lua +++ b/plugin/nvim-treesitter.lua @@ -27,7 +27,7 @@ end -- create user commands api.nvim_create_user_command('TSInstall', function(args) - require('nvim-treesitter.install').install(args.fargs, { force = args.bang }) + require('nvim-treesitter.install').install(args.fargs, { force = args.bang, summary = true }) end, { nargs = '+', bang = true, @@ -39,6 +39,7 @@ end, { api.nvim_create_user_command('TSInstallFromGrammar', function(args) require('nvim-treesitter.install').install(args.fargs, { generate = true, + summary = true, force = args.bang, }) end, { @@ -50,7 +51,7 @@ end, { }) api.nvim_create_user_command('TSUpdate', function(args) - require('nvim-treesitter.install').update(args.fargs) + require('nvim-treesitter.install').update(args.fargs, { summary = true }) end, { nargs = '*', bar = true, @@ -59,7 +60,7 @@ end, { }) api.nvim_create_user_command('TSUninstall', function(args) - require('nvim-treesitter.install').uninstall(args.fargs) + require('nvim-treesitter.install').uninstall(args.fargs, { summary = true }) end, { nargs = '+', bar = true, diff --git a/scripts/install-parsers.lua b/scripts/install-parsers.lua index e3804cab8..2d083f3c3 100755 --- a/scripts/install-parsers.lua +++ b/scripts/install-parsers.lua @@ -19,10 +19,10 @@ end vim.opt.runtimepath:append('.') ---@type async.Task -local task = update and require('nvim-treesitter').update('all') +local task = update and require('nvim-treesitter').update('all', { summary = true }) or require('nvim-treesitter').install( #parsers > 0 and parsers or 'all', - { force = true, generate = generate, max_jobs = max_jobs } + { force = true, summary = true, generate = generate, max_jobs = max_jobs } ) local ok, err_or_ok = task:pwait(1800000) -- wait max. 30 minutes From fa0bb30ebdd032f485f44b5caaae1db2b773c0c8 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 30 May 2025 10:21:19 +0200 Subject: [PATCH 2172/2494] feat(parsers): update gdscript, gitattributes, godot_resource, xresources, yaml, ocaml, koto, ocaml_interface, c, ini, mlir, scheme, slint, c3, r, clojure, desktop, editorconfig, fortran --- lua/nvim-treesitter/parsers.lua | 38 ++++++++++++++++----------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 5b30d8003..b1c39501f 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -158,7 +158,7 @@ return { }, c = { install_info = { - revision = '091093731389448e10822dd140621cfec1ff96b2', + revision = '7fa1be1b694b6e763686793d97da01f36a0e5c12', url = 'https://github.com/tree-sitter/tree-sitter-c', }, maintainers = { '@amaanq' }, @@ -166,7 +166,7 @@ return { }, c3 = { install_info = { - revision = 'dce56ccc5d2731ac14a0f6bb3fd1666d994b2a25', + revision = '6eb8acc275961d137b4b4dd7fe84a19a0680c893', url = 'https://github.com/c3lang/tree-sitter-c3', }, maintainers = { '@cbuttner' }, @@ -222,7 +222,7 @@ return { }, clojure = { install_info = { - revision = 'f4236d4da8aa92bc105d9c118746474c608e6af7', + revision = '40c5fc2e2a0f511a802a82002553c5de00feeaf4', url = 'https://github.com/sogaiu/tree-sitter-clojure', }, maintainers = { '@NoahTheDuke' }, @@ -346,7 +346,7 @@ return { }, desktop = { install_info = { - revision = 'afec3093f6102b83a72aece728c53d17d3fcb2d4', + revision = '752bab671c3a4ad0e566fa2c680af895f7fd1b77', url = 'https://github.com/ValdezFOmar/tree-sitter-desktop', }, maintainers = { '@ValdezFOmar' }, @@ -449,7 +449,7 @@ return { }, editorconfig = { install_info = { - revision = '65de8da4ff21a8be40adb5dadcd7a0f39d2f0747', + revision = '301edd3fff4486acca5ca9991ba76ba372059451', url = 'https://github.com/ValdezFOmar/tree-sitter-editorconfig', }, maintainers = { '@ValdezFOmar' }, @@ -592,7 +592,7 @@ return { }, fortran = { install_info = { - revision = 'd738334e4a21866a1ab81fb3f27f9b0b2ad2e515', + revision = 'c687ba7b469cc22e22db6c90396ff2c98ba00d3b', url = 'https://github.com/stadelmanma/tree-sitter-fortran', }, maintainers = { '@amaanq' }, @@ -652,7 +652,7 @@ return { }, gdscript = { install_info = { - revision = 'e964ce912b5b835f1caedb600df9d5be77e803a8', + revision = '2ed3ef9e30a7998a98eea4dfbcd308678f93b88f', url = 'https://github.com/PrestonKnopp/tree-sitter-gdscript', }, maintainers = { '@PrestonKnopp' }, @@ -685,7 +685,7 @@ return { }, gitattributes = { install_info = { - revision = '5425944fd61bf2b3bad2c17c2dc9f53172b0f01d', + revision = 'f23072a51e1c764d6c5bf461194a775c8a5c7a95', url = 'https://github.com/tree-sitter-grammars/tree-sitter-gitattributes', }, maintainers = { '@ObserverOfTime' }, @@ -786,7 +786,7 @@ return { }, godot_resource = { install_info = { - revision = 'a1a7295b376fbd2531601f4ffff191b031ffc795', + revision = '9bbb540e8a2734101c6857bd437f04baa974e03d', url = 'https://github.com/PrestonKnopp/tree-sitter-godot-resource', }, maintainers = { '@pierpo' }, @@ -1027,7 +1027,7 @@ return { }, ini = { install_info = { - revision = '32b31863f222bf22eb43b07d4e9be8017e36fb31', + revision = '0e152b17fc0e929dd71f4bc4e317b3421ed39029', url = 'https://github.com/justinmk/tree-sitter-ini', }, maintainers = { '@theHamsta' }, @@ -1216,7 +1216,7 @@ return { }, koto = { install_info = { - revision = '1e610746f48c24607733fac158d5bae79accd845', + revision = '620ff8a32143f24f6f8e157bd1836183599d334d', url = 'https://github.com/koto-lang/tree-sitter-koto', }, maintainers = { '@irh' }, @@ -1400,7 +1400,7 @@ return { mlir = { install_info = { generate = true, - revision = '4d2396f21722d0c8d2ea285f380b21f1a71668b3', + revision = '56753db408dbcc098e514c73cbb2351d344039e0', url = 'https://github.com/artagnon/tree-sitter-mlir', }, maintainers = { '@artagnon' }, @@ -1506,7 +1506,7 @@ return { ocaml = { install_info = { location = 'grammars/ocaml', - revision = 'ef6ed4a773a260545f0b03c43d2ca78235e9a488', + revision = '029b1b6a87a8f1e8a9a7913a8a5bdecd36720789', url = 'https://github.com/tree-sitter/tree-sitter-ocaml', }, maintainers = { '@undu' }, @@ -1515,7 +1515,7 @@ return { ocaml_interface = { install_info = { location = 'grammars/interface', - revision = 'ef6ed4a773a260545f0b03c43d2ca78235e9a488', + revision = '029b1b6a87a8f1e8a9a7913a8a5bdecd36720789', url = 'https://github.com/tree-sitter/tree-sitter-ocaml', }, maintainers = { '@undu' }, @@ -1807,7 +1807,7 @@ return { }, r = { install_info = { - revision = 'a0d3e3307489c3ca54da8c7b5b4e0c5f5fd6953a', + revision = '7a7d4e04a325b336d53dbfef508918edba5ba240', url = 'https://github.com/r-lib/tree-sitter-r', }, maintainers = { '@ribru17' }, @@ -1993,7 +1993,7 @@ return { }, scheme = { install_info = { - revision = '1e4d38d650bf6b53930ec9d41a7000775c134039', + revision = 'e35b41a183164f4a12e10da3d0c430e837c3d75a', url = 'https://github.com/6cdh/tree-sitter-scheme', }, tier = 2, @@ -2036,7 +2036,7 @@ return { }, slint = { install_info = { - revision = '3493309534cd08ae176c7b917ec79068dca2c1c9', + revision = '32f970b57720010e77a486bc2001ee9e6c7c8250', url = 'https://github.com/slint-ui/tree-sitter-slint', }, maintainers = { '@hunger' }, @@ -2593,7 +2593,7 @@ return { }, xresources = { install_info = { - revision = 'dcbce0c5dde0fca01dd83a8f497ebe4d053eab1d', + revision = 'd09b560bb78a3304211db5110f9bd6b053becba4', url = 'https://github.com/ValdezFOmar/tree-sitter-xresources', }, maintainers = { '@ValdezFOmar' }, @@ -2601,7 +2601,7 @@ return { }, yaml = { install_info = { - revision = '08c5caaeb34e5ccd614706d3b5359a78f1c9e275', + revision = '3431ec21da1dde751bab55520963cf3a4f1121f3', url = 'https://github.com/tree-sitter-grammars/tree-sitter-yaml', }, maintainers = { '@amaanq' }, From 01dd4b05cf83bf3e4aaac7133a227de7226c1d1e Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 30 May 2025 15:55:30 +0200 Subject: [PATCH 2173/2494] fix(check-queries): only show timings for existing queries --- scripts/check-queries.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/check-queries.lua b/scripts/check-queries.lua index 796e3f5fc..d951cf2d6 100755 --- a/scripts/check-queries.lua +++ b/scripts/check-queries.lua @@ -19,8 +19,10 @@ do local before = vim.uv.hrtime() local ok, query = pcall(vim.treesitter.query.get, lang, query_type) local duration = vim.uv.hrtime() - before - table.insert(timings, { duration = duration, lang = lang, query_type = query_type }) - print(string.format('Checking %s %s (%.02fms)', lang, query_type, duration * 1e-6)) + if query then + table.insert(timings, { duration = duration, lang = lang, query_type = query_type }) + print(string.format('Checking %s %s (%.02fms)', lang, query_type, duration * 1e-6)) + end if not ok then errors[#errors + 1] = string.format('%s (%s): %s', lang, query_type, query) end From 9a51f860c123ee072c08ff3e093d480d32699390 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20NICOLAS?= Date: Sat, 31 May 2025 02:26:17 +0200 Subject: [PATCH 2174/2494] fix(git_config): match lowercase Git config vars Git config's sections, variable names, and (sometimes) subsections are case-insensitive. This commit proposes to match the full lowercase variants in addition to the non-normalised, lowerCamelCase ones. See `git help config` --- runtime/queries/git_config/highlights.scm | 4 ++-- runtime/queries/git_config/injections.scm | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/runtime/queries/git_config/highlights.scm b/runtime/queries/git_config/highlights.scm index 6b37e9090..557ac60ec 100644 --- a/runtime/queries/git_config/highlights.scm +++ b/runtime/queries/git_config/highlights.scm @@ -7,7 +7,7 @@ ((section_header (section_name) @keyword.import (subsection_name)) - (#eq? @keyword.import "includeIf")) + (#any-of? @keyword.import "includeIf" "includeif")) (variable (name) @property) @@ -47,7 +47,7 @@ ((variable (name) @_name value: (string) @string.special.url) - (#eq? @_name "insteadOf")) + (#any-of? @_name "insteadOf" "insteadof")) ; Punctuation [ diff --git a/runtime/queries/git_config/injections.scm b/runtime/queries/git_config/injections.scm index 7bda6979c..8b4d69282 100644 --- a/runtime/queries/git_config/injections.scm +++ b/runtime/queries/git_config/injections.scm @@ -4,7 +4,7 @@ ((variable (name) @_name value: (string) @injection.content) - (#any-of? @_name "cmd" "command" "textconv" "sendmailCmd") + (#any-of? @_name "cmd" "command" "textconv" "sendmailCmd" "sendmailcmd") (#set! injection.language "bash")) (section @@ -29,7 +29,7 @@ (name) @_name value: (string) @injection.content) (#eq? @_interactive "interactive") - (#eq? @_name "diffFilter") + (#any-of? @_name "diffFilter" "difffilter") (#set! injection.language "bash")) ; https://github.com/git-lfs/git-lfs From 3cad4eb434ba886a1a7035ae8955b7391a42aa05 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sat, 31 May 2025 11:26:24 +0200 Subject: [PATCH 2175/2494] fix(lua): fix some emmyluals warnings --- lua/nvim-treesitter/config.lua | 6 ++--- lua/nvim-treesitter/health.lua | 44 ++++++++++++++++----------------- lua/nvim-treesitter/indent.lua | 2 +- lua/nvim-treesitter/install.lua | 7 +++--- 4 files changed, 28 insertions(+), 31 deletions(-) diff --git a/lua/nvim-treesitter/config.lua b/lua/nvim-treesitter/config.lua index 1a5b56cdb..9a586b7b5 100644 --- a/lua/nvim-treesitter/config.lua +++ b/lua/nvim-treesitter/config.lua @@ -96,7 +96,7 @@ end ---Normalize languages ---@param languages? string[]|string ----@param skip? { missing: boolean, unsupported: boolean, installed: boolean, dependencies: boolean } +---@param skip? { missing: boolean?, unsupported: boolean?, installed: boolean?, dependencies: boolean? } ---@return string[] function M.norm_languages(languages, skip) if not languages then @@ -150,7 +150,7 @@ function M.norm_languages(languages, skip) languages = vim.tbl_filter( --- @param v string function(v) - return not (parsers[v].tier and parsers[v].tier == 4) + return not (parsers[v] and parsers[v].tier and parsers[v].tier == 4) end, languages ) @@ -158,7 +158,7 @@ function M.norm_languages(languages, skip) if not (skip and skip.dependencies) then for _, lang in pairs(languages) do - if parsers[lang].requires then + if parsers[lang] and parsers[lang].requires then vim.list_extend(languages, parsers[lang].requires) end end diff --git a/lua/nvim-treesitter/health.lua b/lua/nvim-treesitter/health.lua index 3f5058996..e284381dd 100644 --- a/lua/nvim-treesitter/health.lua +++ b/lua/nvim-treesitter/health.lua @@ -28,27 +28,25 @@ local function install_health() health.error('Nvim-treesitter requires Neovim 0.11.0 or later.') end - if vim.treesitter.language_version then - if vim.treesitter.language_version >= NVIM_TREESITTER_MINIMUM_ABI then - health.ok( - 'Neovim was compiled with tree-sitter runtime ABI version ' - .. vim.treesitter.language_version - .. ' (required >=' - .. NVIM_TREESITTER_MINIMUM_ABI - .. ').' - ) - else - health.error( - 'Neovim was compiled with tree-sitter runtime ABI version ' - .. vim.treesitter.language_version - .. '.\n' - .. 'nvim-treesitter expects at least ABI version ' - .. NVIM_TREESITTER_MINIMUM_ABI - .. '\n' - .. 'Please make sure that Neovim is linked against a recent tree-sitter library when building' - .. ' or raise an issue at your Neovim packager. Parsers must be compatible with runtime ABI.' - ) - end + if vim.treesitter.language_version >= NVIM_TREESITTER_MINIMUM_ABI then + health.ok( + 'Neovim was compiled with tree-sitter runtime ABI version ' + .. vim.treesitter.language_version + .. ' (required >=' + .. NVIM_TREESITTER_MINIMUM_ABI + .. ').' + ) + else + health.error( + 'Neovim was compiled with tree-sitter runtime ABI version ' + .. vim.treesitter.language_version + .. '.\n' + .. 'nvim-treesitter expects at least ABI version ' + .. NVIM_TREESITTER_MINIMUM_ABI + .. '\n' + .. 'Please make sure that Neovim is linked against a recent tree-sitter library when building' + .. ' or raise an issue at your Neovim packager. Parsers must be compatible with runtime ABI.' + ) end end @@ -140,7 +138,7 @@ function M.check() for _, lang in pairs(languages) do local parser = parsers[lang] local out = lang .. string.rep(' ', 22 - #lang) - if parser.install_info then + if parser and parser.install_info then for _, query_group in pairs(M.bundled_queries) do local status, err = query_status(lang, query_group) out = out .. status .. ' ' @@ -149,7 +147,7 @@ function M.check() end end end - if parser.requires then + if parser and parser.requires then for _, p in pairs(parser.requires) do if not vim.list_contains(languages, p) then table.insert(error_collection, { lang, 'queries', 'dependency ' .. p .. ' missing' }) diff --git a/lua/nvim-treesitter/indent.lua b/lua/nvim-treesitter/indent.lua index b0982c6c6..13f7b2740 100644 --- a/lua/nvim-treesitter/indent.lua +++ b/lua/nvim-treesitter/indent.lua @@ -106,7 +106,7 @@ end, function(bufnr, root, lang) return tostring(bufnr) .. root:id() .. '_' .. lang end) ----@param lnum number (1-indexed) +---@param lnum integer (1-indexed) ---@return integer function M.get_indent(lnum) local bufnr = vim.api.nvim_get_current_buf() diff --git a/lua/nvim-treesitter/install.lua b/lua/nvim-treesitter/install.lua index a5a2eb2a5..c56069621 100644 --- a/lua/nvim-treesitter/install.lua +++ b/lua/nvim-treesitter/install.lua @@ -97,15 +97,14 @@ end ---@async ---@param path string ----@param mode? string ---@return string? err -local function mkpath(path, mode) +local function mkpath(path) local parent = fs.dirname(path) if not parent:match('^[./]$') and not uv.fs_stat(parent) then - mkpath(parent, mode) + mkpath(parent) end - return uv_mkdir(path, tonumber(mode or '755', 8)) + return uv_mkdir(path, 493) -- tonumber('755', 8) end local M = {} From 6d54a47f44e5e441cd546c89fb6462b1f50aaca9 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Mon, 2 Jun 2025 13:23:26 +0200 Subject: [PATCH 2176/2494] feat(parsers): update desktop, javadoc, t32, templ, fortran, editorconfig, mlir, xresources, ocaml_interface, r, ocaml --- lua/nvim-treesitter/parsers.lua | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index b1c39501f..843fb16df 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -346,7 +346,7 @@ return { }, desktop = { install_info = { - revision = '752bab671c3a4ad0e566fa2c680af895f7fd1b77', + revision = '6eb323a20db2f1e8736c3a05915afe1687283965', url = 'https://github.com/ValdezFOmar/tree-sitter-desktop', }, maintainers = { '@ValdezFOmar' }, @@ -449,7 +449,7 @@ return { }, editorconfig = { install_info = { - revision = '301edd3fff4486acca5ca9991ba76ba372059451', + revision = '4a00eb4b0e8fbf8f1594efa9b5b15386fbd7d563', url = 'https://github.com/ValdezFOmar/tree-sitter-editorconfig', }, maintainers = { '@ValdezFOmar' }, @@ -592,7 +592,7 @@ return { }, fortran = { install_info = { - revision = 'c687ba7b469cc22e22db6c90396ff2c98ba00d3b', + revision = 'ab9aa007a8d982a5a7926663a8ab989cea0f5d9e', url = 'https://github.com/stadelmanma/tree-sitter-fortran', }, maintainers = { '@amaanq' }, @@ -1076,7 +1076,7 @@ return { }, javadoc = { install_info = { - revision = '001a8e4f8e839b640201c49046fbf5957fe1ee2c', + revision = 'c1bc2b76d8ff9fbc5aed7f823421bd5661f96828', url = 'https://github.com/rmuir/tree-sitter-javadoc', }, maintainers = { '@rmuir' }, @@ -1400,7 +1400,7 @@ return { mlir = { install_info = { generate = true, - revision = '56753db408dbcc098e514c73cbb2351d344039e0', + revision = '0f77bc710f61ec6be658ddf51851b2ed2cdaa20d', url = 'https://github.com/artagnon/tree-sitter-mlir', }, maintainers = { '@artagnon' }, @@ -1506,7 +1506,7 @@ return { ocaml = { install_info = { location = 'grammars/ocaml', - revision = '029b1b6a87a8f1e8a9a7913a8a5bdecd36720789', + revision = '3ef7c00b29e41e3a0c1d18e82ea37c64d72b93fc', url = 'https://github.com/tree-sitter/tree-sitter-ocaml', }, maintainers = { '@undu' }, @@ -1515,7 +1515,7 @@ return { ocaml_interface = { install_info = { location = 'grammars/interface', - revision = '029b1b6a87a8f1e8a9a7913a8a5bdecd36720789', + revision = '3ef7c00b29e41e3a0c1d18e82ea37c64d72b93fc', url = 'https://github.com/tree-sitter/tree-sitter-ocaml', }, maintainers = { '@undu' }, @@ -1807,7 +1807,7 @@ return { }, r = { install_info = { - revision = '7a7d4e04a325b336d53dbfef508918edba5ba240', + revision = '29c816328a086ef056799e3924ef6e09e6a9a8cb', url = 'https://github.com/r-lib/tree-sitter-r', }, maintainers = { '@ribru17' }, @@ -2227,7 +2227,7 @@ return { }, t32 = { install_info = { - revision = '61607b32915fdeda275b2346e6a76a7c9b363251', + revision = '15f0032f3eadf95988293338e883c095fd5936f6', url = 'https://gitlab.com/xasc/tree-sitter-t32', }, maintainers = { '@xasc' }, @@ -2268,7 +2268,7 @@ return { }, templ = { install_info = { - revision = '5504cc96fbf5c9a029add2dfcb6e585e8fdaad75', + revision = 'de35706f89beed5087670a9c4421b7794ef02411', url = 'https://github.com/vrischmann/tree-sitter-templ', }, maintainers = { '@vrischmann' }, @@ -2593,7 +2593,7 @@ return { }, xresources = { install_info = { - revision = 'd09b560bb78a3304211db5110f9bd6b053becba4', + revision = '7e9f6fa9a6e9e4e5ced1683afc89a0d5b32a4ebc', url = 'https://github.com/ValdezFOmar/tree-sitter-xresources', }, maintainers = { '@ValdezFOmar' }, From 27b0bd487c4a1c72c9b53d0ca6f67f0ac6956b0a Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Mon, 2 Jun 2025 13:25:17 +0200 Subject: [PATCH 2177/2494] feat(nickel)!: update parser and queries Breaking change: `(record_field)` -> `field_decl` --- lua/nvim-treesitter/parsers.lua | 2 +- runtime/queries/nickel/highlights.scm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 843fb16df..dd7d3c75e 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -1432,7 +1432,7 @@ return { }, nickel = { install_info = { - revision = 'f77c02df6dd0845594846beeeedf3715d4b68758', + revision = '9a05ab045c000cf37f02cff5c4de32b081444244', url = 'https://github.com/nickel-lang/tree-sitter-nickel', }, tier = 2, diff --git a/runtime/queries/nickel/highlights.scm b/runtime/queries/nickel/highlights.scm index 07673d797..c5ebfe166 100644 --- a/runtime/queries/nickel/highlights.scm +++ b/runtime/queries/nickel/highlights.scm @@ -61,7 +61,7 @@ (interpolation_end) @punctuation.bracket -(record_field) @variable.member +(field_decl) @variable.member (builtin) @function.builtin From fb9b2cfdc3e9b2488c315606e159022acb24f129 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Wed, 4 Jun 2025 10:32:50 +0200 Subject: [PATCH 2178/2494] feat(parsers): update bash, scala, slang, hyprlang, ini, query, javadoc, xml, php_only, angular, dtd, nu, php --- lua/nvim-treesitter/parsers.lua | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index dd7d3c75e..d901ab810 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -18,7 +18,7 @@ return { }, angular = { install_info = { - revision = '843525141575e397541e119698f0532755e959f6', + revision = '820566bb4eb3d288822dbfee42417a5a9491aea6', url = 'https://github.com/dlvandenberg/tree-sitter-angular', }, maintainers = { '@dlvandenberg' }, @@ -77,7 +77,7 @@ return { }, bash = { install_info = { - revision = '0c46d792d54c536be5ff7eb18eb95c70fccdb232', + revision = '8509e3229b863c255ab6b61f3bf74ad0bf14e8bc', url = 'https://github.com/tree-sitter/tree-sitter-bash', }, maintainers = { '@TravonteD' }, @@ -419,7 +419,7 @@ return { dtd = { install_info = { location = 'dtd', - revision = '291b02018c525abe70fec41559cfe8f2f1cc84b2', + revision = '87be254e12169240a0e0214dbee5e208df96fa75', url = 'https://github.com/tree-sitter-grammars/tree-sitter-xml', }, maintainers = { '@ObserverOfTime' }, @@ -1003,7 +1003,7 @@ return { }, hyprlang = { install_info = { - revision = 'd0441fd4b883ecc0e70140723a1cf5907992639a', + revision = 'd626ec06e4d876fc41200a30b3e6f2b4714c7367', url = 'https://github.com/tree-sitter-grammars/tree-sitter-hyprlang', }, maintainers = { '@luckasRanarison' }, @@ -1027,7 +1027,7 @@ return { }, ini = { install_info = { - revision = '0e152b17fc0e929dd71f4bc4e317b3421ed39029', + revision = '31899dfa3b91622ea39e5c0bcddc88f45a9a3cfe', url = 'https://github.com/justinmk/tree-sitter-ini', }, maintainers = { '@theHamsta' }, @@ -1076,7 +1076,7 @@ return { }, javadoc = { install_info = { - revision = 'c1bc2b76d8ff9fbc5aed7f823421bd5661f96828', + revision = 'ddf03959c0152bb61ed567f301ad6ecdab72f6ab', url = 'https://github.com/rmuir/tree-sitter-javadoc', }, maintainers = { '@rmuir' }, @@ -1480,7 +1480,7 @@ return { }, nu = { install_info = { - revision = 'd5c71a10b4d1b02e38967b05f8de70e847448dd1', + revision = '100d06e29d13a8ebfc3f29173c07a5c4f2050586', url = 'https://github.com/nushell/tree-sitter-nu', }, maintainers = { '@abhisheksingh0x558' }, @@ -1575,7 +1575,7 @@ return { php = { install_info = { location = 'php', - revision = 'eb289f127fc341ae7129902a2dd1c6c197a4c1e7', + revision = 'e771eb9fb5ccc65af35879487b66751568d10e48', url = 'https://github.com/tree-sitter/tree-sitter-php', }, maintainers = { '@tk-shirasaka', '@calebdw' }, @@ -1586,7 +1586,7 @@ return { php_only = { install_info = { location = 'php_only', - revision = 'eb289f127fc341ae7129902a2dd1c6c197a4c1e7', + revision = 'e771eb9fb5ccc65af35879487b66751568d10e48', url = 'https://github.com/tree-sitter/tree-sitter-php', }, maintainers = { '@tk-shirasaka', '@calebdw' }, @@ -1798,7 +1798,7 @@ return { }, query = { install_info = { - revision = '8bf3112db43bdba3002bb1f88b7cda5f6278fc88', + revision = '55baffbdc6bd00bf177b796950497a01bb496241', url = 'https://github.com/tree-sitter-grammars/tree-sitter-query', }, maintainers = { '@steelsojka' }, @@ -1975,7 +1975,7 @@ return { }, scala = { install_info = { - revision = 'c1189954df854977c3a52003ca8a247c5f4729ba', + revision = 'a2e91c845064bb4031e31b103e32bcdaefeea139', url = 'https://github.com/tree-sitter/tree-sitter-scala', }, maintainers = { '@stevanmilic' }, @@ -2019,7 +2019,7 @@ return { }, slang = { install_info = { - revision = '327b1b821c255867a4fb724c8eee48887e3d014b', + revision = 'a4454e3004a9e8fea2df7fd2535fbaa05500da21', url = 'https://github.com/tree-sitter-grammars/tree-sitter-slang', }, maintainers = { '@theHamsta' }, @@ -2584,7 +2584,7 @@ return { xml = { install_info = { location = 'xml', - revision = '291b02018c525abe70fec41559cfe8f2f1cc84b2', + revision = '87be254e12169240a0e0214dbee5e208df96fa75', url = 'https://github.com/tree-sitter-grammars/tree-sitter-xml', }, maintainers = { '@ObserverOfTime' }, From 057e845518222c968251da7c7e7d4074c9620a1b Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Thu, 29 May 2025 18:23:42 +0200 Subject: [PATCH 2179/2494] feat(install): support custom queries --- README.md | 10 +- lua/nvim-treesitter/_meta/parsers.lua | 3 + lua/nvim-treesitter/install.lua | 133 +++++++++++++++++++------- lua/nvim-treesitter/util.lua | 6 -- 4 files changed, 107 insertions(+), 45 deletions(-) diff --git a/README.md b/README.md index ef3a9f32c..921b11002 100644 --- a/README.md +++ b/README.md @@ -126,7 +126,7 @@ These queries can be used to look up definitions and references to identifiers i # Advanced setup -## Adding parsers +## Adding custom languages If you have a parser that is not on the list of supported languages (either as a repository on Github or in a local directory), you can add it manually for use by `nvim-treesitter` as follows: @@ -144,6 +144,7 @@ callback = function() location = 'parser', -- only needed if the parser is in subdirectory of a "monorepo" generate = true, -- only needed if repo does not contain pre-generated `src/parser.c` generate_from_json = false, -- only needed if repo does not contain `src/grammar.json` either + queries = 'queries/neovim', -- also install queries from given directory }, } end}) @@ -158,6 +159,7 @@ Alternatively, if you have a local checkout, you can instead use location = 'parser', generate = true, generate_from_json = false, + queries = 'queries/neovim', -- symlink queries from given directory }, ``` This will always use the state of the directory as-is (i.e., `branch` and `revision` will be ignored). @@ -189,9 +191,3 @@ end}) ## Adding queries Queries can be placed anywhere in your `runtimepath` under `queries/`, with earlier directories taking precedence unless the queries are marked with `; extends`; see [`:h treesitter-query-modelines`](https://neovim.io/doc/user/treesitter.html#treesitter-query-modeline). - -E.g., to add queries for `zimbu`, put `highlights.scm` etc. under - -```lua -vim.fn.stdpath('data') .. 'site/queries/zimbu' -``` diff --git a/lua/nvim-treesitter/_meta/parsers.lua b/lua/nvim-treesitter/_meta/parsers.lua index 9ec2f0b9a..5af809bb0 100644 --- a/lua/nvim-treesitter/_meta/parsers.lua +++ b/lua/nvim-treesitter/_meta/parsers.lua @@ -23,6 +23,9 @@ error('Cannot require a meta file') --- ---Parser repo is a local directory; overrides `url`, `revision`, and `branch` ---@field path? string +--- +---Directory with queries to be installed +---@field queries? string ---@class ParserInfo --- diff --git a/lua/nvim-treesitter/install.lua b/lua/nvim-treesitter/install.lua index c56069621..336f83717 100644 --- a/lua/nvim-treesitter/install.lua +++ b/lua/nvim-treesitter/install.lua @@ -14,6 +14,9 @@ local uv_copyfile = a.awrap(4, uv.fs_copyfile) ---@type fun(path: string, mode: integer): string? local uv_mkdir = a.awrap(3, uv.fs_mkdir) +---@type fun(path: string): string? +local uv_rmdir = a.awrap(2, uv.fs_rmdir) + ---@type fun(path: string, new_path: string): string? local uv_rename = a.awrap(3, uv.fs_rename) @@ -23,6 +26,36 @@ local uv_symlink = a.awrap(4, uv.fs_symlink) ---@type fun(path: string): string? local uv_unlink = a.awrap(2, uv.fs_unlink) +---@async +---@param path string +---@return string? err +local function mkpath(path) + local parent = fs.dirname(path) + if not parent:match('^[./]$') and not uv.fs_stat(parent) then + mkpath(parent) + end + + return uv_mkdir(path, 493) -- tonumber('755', 8) +end + +---@async +---@param path string +local function rmdir(path) + local stat = uv.fs_lstat(path) + if not stat then + return + end + + if stat.type == 'directory' then + for file in fs.dir(path) do + rmdir(fs.joinpath(path, file)) + end + return uv_rmdir(path) + else + return uv_unlink(path) + end +end + local MAX_JOBS = 100 local INSTALL_TIMEOUT = 60000 @@ -95,18 +128,6 @@ local function download_file(url, output) end end ----@async ----@param path string ----@return string? err -local function mkpath(path) - local parent = fs.dirname(path) - if not parent:match('^[./]$') and not uv.fs_stat(parent) then - mkpath(parent) - end - - return uv_mkdir(path, 493) -- tonumber('755', 8) -end - local M = {} --- @@ -199,7 +220,8 @@ local function do_download(logger, url, project_name, cache_dir, revision, outpu local tmp = output_dir .. '-tmp' - util.delete(tmp) + rmdir(tmp) + a.schedule() url = url:gsub('.git$', '') local target = is_gitlab @@ -258,7 +280,8 @@ local function do_download(logger, url, project_name, cache_dir, revision, outpu end end - util.delete(tmp) + rmdir(tmp) + a.schedule() end ---@async @@ -300,6 +323,38 @@ local function do_install(logger, compile_location, target_location) end end +---@async +---@param logger Logger +---@param query_src string +---@param query_dir string +---@return string? err +local function do_link_queries(logger, query_src, query_dir) + uv_unlink(query_dir) + local err = uv_symlink(query_src, query_dir, { dir = true, junction = true }) + a.schedule() + if err then + return logger:error(err) + end +end + +---@async +---@param logger Logger +---@param query_src string +---@param query_dir string +---@return string? err +local function do_copy_queries(logger, query_src, query_dir) + rmdir(query_dir) + local err = uv_mkdir(query_dir, 493) -- tonumber('755', 8) + + for f in fs.dir(query_src) do + err = uv_copyfile(fs.joinpath(query_src, f), fs.joinpath(query_dir, f)) + end + a.schedule() + if err then + return logger:error(err) + end +end + ---@async ---@param lang string ---@param cache_dir string @@ -310,9 +365,8 @@ local function try_install_lang(lang, cache_dir, install_dir, generate) local logger = log.new('install/' .. lang) local repo = get_parser_install_info(lang) + local project_name = 'tree-sitter-' .. lang if repo then - local project_name = 'tree-sitter-' .. lang - local revision = repo.revision local compile_location ---@type string @@ -320,7 +374,7 @@ local function try_install_lang(lang, cache_dir, install_dir, generate) compile_location = fs.normalize(repo.path) else local project_dir = fs.joinpath(cache_dir, project_name) - util.delete(project_dir) + rmdir(project_dir) revision = revision or repo.branch or 'main' @@ -362,26 +416,37 @@ local function try_install_lang(lang, cache_dir, install_dir, generate) local revfile = fs.joinpath(config.get_install_dir('parser-info') or '', lang .. '.revision') util.write_file(revfile, revision or '') end - - if not repo.path then - util.delete(fs.joinpath(cache_dir, project_name)) - end end do -- install queries - local queries_src = M.get_package_path('runtime', 'queries', lang) - if uv.fs_stat(queries_src) then - local queries = fs.joinpath(config.get_install_dir('queries'), lang) + local query_src = M.get_package_path('runtime', 'queries', lang) + local query_dir = fs.joinpath(config.get_install_dir('queries'), lang) + local task ---@type function - uv_unlink(queries) - local err = uv_symlink(queries_src, queries, { dir = true, junction = true }) - a.schedule() + if repo and repo.queries and repo.path then -- link queries from local repo + query_src = fs.joinpath(fs.normalize(repo.path), repo.queries) + task = do_link_queries + elseif repo and repo.queries then -- copy queries from tarball + query_src = fs.joinpath(cache_dir, project_name, repo.queries) + task = do_copy_queries + elseif uv.fs_stat(query_src) then -- link queries from runtime + task = do_link_queries + end + + if task then + local err = task(logger, query_src, query_dir) if err then - return logger:error(err) + return err end end end + -- clean up + if repo and not repo.path then + rmdir(fs.joinpath(cache_dir, project_name)) + a.schedule() + end + logger:info('Language installed') end @@ -520,17 +585,21 @@ local function uninstall_lang(logger, lang, parser, queries) logger:debug('Unlinking ' .. parser) local perr = uv_unlink(parser) a.schedule() - if perr then return logger:error(perr) end end - if fn.isdirectory(queries) == 1 then + local stat = uv.fs_lstat(queries) + if stat then logger:debug('Unlinking ' .. queries) - local qerr = uv_unlink(queries) + local qerr ---@type string? + if stat.type == 'link' then + qerr = uv_unlink(queries) + else + qerr = rmdir(queries) + end a.schedule() - if qerr then return logger:error(qerr) end diff --git a/lua/nvim-treesitter/util.lua b/lua/nvim-treesitter/util.lua index 8a9779617..f2ff2f77f 100644 --- a/lua/nvim-treesitter/util.lua +++ b/lua/nvim-treesitter/util.lua @@ -17,10 +17,4 @@ function M.write_file(filename, content) file:close() end ---- Recursively delete a directory ---- @param name string -function M.delete(name) - vim.fs.rm(name, { recursive = true, force = true }) -end - return M From f976acdc9c8214145a11372d2a7ae4a032f62a39 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sat, 31 May 2025 15:45:59 +0200 Subject: [PATCH 2180/2494] refactor(install): inline, rename, annotate --- lua/nvim-treesitter/install.lua | 90 +++++++++++++++------------------ 1 file changed, 41 insertions(+), 49 deletions(-) diff --git a/lua/nvim-treesitter/install.lua b/lua/nvim-treesitter/install.lua index 336f83717..c179600b6 100644 --- a/lua/nvim-treesitter/install.lua +++ b/lua/nvim-treesitter/install.lua @@ -40,7 +40,7 @@ end ---@async ---@param path string -local function rmdir(path) +local function rmpath(path) local stat = uv.fs_lstat(path) if not stat then return @@ -48,7 +48,7 @@ local function rmdir(path) if stat.type == 'directory' then for file in fs.dir(path) do - rmdir(fs.joinpath(path, file)) + rmpath(fs.joinpath(path, file)) end return uv_rmdir(path) else @@ -61,16 +61,16 @@ local INSTALL_TIMEOUT = 60000 --- @async --- @param max_jobs integer ---- @param task_funs async.TaskFun[] -local function join(max_jobs, task_funs) - if #task_funs == 0 then +--- @param tasks async.TaskFun[] +local function join(max_jobs, tasks) + if #tasks == 0 then return end - max_jobs = math.min(max_jobs, #task_funs) + max_jobs = math.min(max_jobs, #tasks) - local remaining = { select(max_jobs + 1, unpack(task_funs)) } - local to_go = #task_funs + local remaining = { select(max_jobs + 1, unpack(tasks)) } + local to_go = #tasks a.await(1, function(finish) local function cb() @@ -84,7 +84,7 @@ local function join(max_jobs, task_funs) end for i = 1, max_jobs do - task_funs[i]():await(cb) + tasks[i]():await(cb) end end) end @@ -108,26 +108,6 @@ local function system(cmd, opts) return r end ----@async ----@param url string ----@param output string ----@return string? err -local function download_file(url, output) - local r = system({ - 'curl', - '--silent', - '--fail', - '--show-error', - '-L', -- follow redirects - url, - '--output', - output, - }) - if r.code > 0 then - return r.stderr - end -end - local M = {} --- @@ -220,7 +200,7 @@ local function do_download(logger, url, project_name, cache_dir, revision, outpu local tmp = output_dir .. '-tmp' - rmdir(tmp) + rmpath(tmp) a.schedule() url = url:gsub('.git$', '') @@ -232,9 +212,18 @@ local function do_download(logger, url, project_name, cache_dir, revision, outpu do -- Download tarball logger:info('Downloading %s...', project_name) - local err = download_file(target, tarball_path) - if err then - return logger:error('Error during download: %s', err) + local r = system({ + 'curl', + '--silent', + '--fail', + '--show-error', + '-L', -- follow redirects + target, + '--output', + tarball_path, + }) + if r.code > 0 then + return logger:error('Error during download: %s', r.stderr) end end @@ -280,7 +269,7 @@ local function do_download(logger, url, project_name, cache_dir, revision, outpu end end - rmdir(tmp) + rmpath(tmp) a.schedule() end @@ -343,7 +332,7 @@ end ---@param query_dir string ---@return string? err local function do_copy_queries(logger, query_src, query_dir) - rmdir(query_dir) + rmpath(query_dir) local err = uv_mkdir(query_dir, 493) -- tonumber('755', 8) for f in fs.dir(query_src) do @@ -374,7 +363,7 @@ local function try_install_lang(lang, cache_dir, install_dir, generate) compile_location = fs.normalize(repo.path) else local project_dir = fs.joinpath(cache_dir, project_name) - rmdir(project_dir) + rmpath(project_dir) revision = revision or repo.branch or 'main' @@ -443,7 +432,7 @@ local function try_install_lang(lang, cache_dir, install_dir, generate) -- clean up if repo and not repo.path then - rmdir(fs.joinpath(cache_dir, project_name)) + rmpath(fs.joinpath(cache_dir, project_name)) a.schedule() end @@ -517,10 +506,10 @@ local function install(languages, options) local install_dir = config.get_install_dir('parser') - local task_funs = {} ---@type async.TaskFun[] + local tasks = {} ---@type async.TaskFun[] local done = 0 for _, lang in ipairs(languages) do - task_funs[#task_funs + 1] = a.async(function() + tasks[#tasks + 1] = a.async(--[[@async]] function() a.schedule() local status = install_lang(lang, cache_dir, install_dir, options.force, options.generate) if status ~= 'failed' then @@ -529,16 +518,17 @@ local function install(languages, options) end) end - join(options and options.max_jobs or MAX_JOBS, task_funs) - if #task_funs > 1 then + join(options and options.max_jobs or MAX_JOBS, tasks) + if #tasks > 1 then a.schedule() if options and options.summary then - log.info('Installed %d/%d languages', done, #task_funs) + log.info('Installed %d/%d languages', done, #tasks) end end - return done == #task_funs + return done == #tasks end +---@async ---@param languages string[]|string ---@param options? InstallOptions M.install = a.async(function(languages, options) @@ -547,6 +537,7 @@ M.install = a.async(function(languages, options) return install(languages, options) end) +---@async ---@param languages? string[]|string ---@param options? InstallOptions M.update = a.async(function(languages, options) @@ -597,7 +588,7 @@ local function uninstall_lang(logger, lang, parser, queries) if stat.type == 'link' then qerr = uv_unlink(queries) else - qerr = rmdir(queries) + qerr = rmpath(queries) end a.schedule() if qerr then @@ -608,6 +599,7 @@ local function uninstall_lang(logger, lang, parser, queries) logger:info('Language uninstalled') end +---@async ---@param languages string[]|string ---@param options? InstallOptions M.uninstall = a.async(function(languages, options) @@ -618,7 +610,7 @@ M.uninstall = a.async(function(languages, options) local query_dir = config.get_install_dir('queries') local installed = config.get_installed() - local task_funs = {} ---@type async.TaskFun[] + local tasks = {} ---@type async.TaskFun[] local done = 0 for _, lang in ipairs(languages) do local logger = log.new('uninstall/' .. lang) @@ -627,7 +619,7 @@ M.uninstall = a.async(function(languages, options) else local parser = fs.joinpath(parser_dir, lang) .. '.so' local queries = fs.joinpath(query_dir, lang) - task_funs[#task_funs + 1] = a.async(function() + tasks[#tasks + 1] = a.async(--[[@async]] function() local err = uninstall_lang(logger, lang, parser, queries) if not err then done = done + 1 @@ -636,11 +628,11 @@ M.uninstall = a.async(function(languages, options) end end - join(MAX_JOBS, task_funs) - if #task_funs > 1 then + join(MAX_JOBS, tasks) + if #tasks > 1 then a.schedule() if options and options.summary then - log.info('Uninstalled %d/%d languages', done, #task_funs) + log.info('Uninstalled %d/%d languages', done, #tasks) end end end) From 27d0bef81e4086c00ed0dde7dc53ec8151bd7c89 Mon Sep 17 00:00:00 2001 From: Omar Valdez Date: Thu, 5 Jun 2025 02:11:40 -0700 Subject: [PATCH 2181/2494] feat(desktop): update parser and queries --- lua/nvim-treesitter/parsers.lua | 2 +- runtime/queries/desktop/highlights.scm | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index d901ab810..3447c273d 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -346,7 +346,7 @@ return { }, desktop = { install_info = { - revision = '6eb323a20db2f1e8736c3a05915afe1687283965', + revision = 'b2cad1212116f23b3e8d0607b628bc6f72224c51', url = 'https://github.com/ValdezFOmar/tree-sitter-desktop', }, maintainers = { '@ValdezFOmar' }, diff --git a/runtime/queries/desktop/highlights.scm b/runtime/queries/desktop/highlights.scm index 7a5ebf241..ce55d7432 100644 --- a/runtime/queries/desktop/highlights.scm +++ b/runtime/queries/desktop/highlights.scm @@ -5,9 +5,6 @@ (entry key: (identifier) @property) -(localized_key - name: (identifier) @property) - [ (language) (country) From faf63903ffa05a9dadd56258d737a0243393c0f5 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 6 Jun 2025 16:41:38 +0200 Subject: [PATCH 2182/2494] fix(ipkg)!: remove parser and queries grammar repo is 404 (user removed) and no forks exist --- SUPPORTED_LANGUAGES.md | 3 +- lua/nvim-treesitter/parsers.lua | 9 ----- runtime/queries/ipkg/folds.scm | 13 ------- runtime/queries/ipkg/highlights.scm | 56 ----------------------------- runtime/queries/ipkg/indents.scm | 33 ----------------- runtime/queries/ipkg/injections.scm | 5 --- runtime/queries/ipkg/locals.scm | 24 ------------- 7 files changed, 1 insertion(+), 142 deletions(-) delete mode 100644 runtime/queries/ipkg/folds.scm delete mode 100644 runtime/queries/ipkg/highlights.scm delete mode 100644 runtime/queries/ipkg/indents.scm delete mode 100644 runtime/queries/ipkg/injections.scm delete mode 100644 runtime/queries/ipkg/locals.scm diff --git a/SUPPORTED_LANGUAGES.md b/SUPPORTED_LANGUAGES.md index 0e6417529..d9c56c4f2 100644 --- a/SUPPORTED_LANGUAGES.md +++ b/SUPPORTED_LANGUAGES.md @@ -137,10 +137,9 @@ html_tags (queries only)[^html_tags] | unstable | `H IJ ` | | @TravonteD [hurl](https://github.com/pfeiferj/tree-sitter-hurl) | unstable | `HFIJ ` | | @pfeiferj [hyprlang](https://github.com/tree-sitter-grammars/tree-sitter-hyprlang) | unstable | `HFIJ ` | | @luckasRanarison [idl](https://github.com/cathaysia/tree-sitter-idl) | unstable | `H IJ ` | | @cathaysia -[idris](https://github.com/kayhide/tree-sitter-idris) | unstable | `HF JL` | | @srghma +[idris](https://github.com/kayhide/tree-sitter-idris) | unstable | `HF JL` | | [ini](https://github.com/justinmk/tree-sitter-ini) | unstable | `HF J ` | | @theHamsta [inko](https://github.com/inko-lang/tree-sitter-inko) | unstable | `HFIJL` | | @yorickpeterse -[ipkg](https://github.com/srghma/tree-sitter-ipkg) | unstable | `HFIJL` | | @srghma [ispc](https://github.com/tree-sitter-grammars/tree-sitter-ispc) | unstable | `HFIJL` | | @fab4100 [janet_simple](https://github.com/sogaiu/tree-sitter-janet-simple) | unstable | `HF JL` | | @sogaiu [java](https://github.com/tree-sitter/tree-sitter-java) | unstable | `HFIJL` | | @p00f diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 3447c273d..cbe6aac12 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -1022,7 +1022,6 @@ return { revision = 'c56a25cf57c68ff929356db25505c1cc4c7820f6', url = 'https://github.com/kayhide/tree-sitter-idris', }, - maintainers = { '@srghma' }, tier = 2, }, ini = { @@ -1041,14 +1040,6 @@ return { maintainers = { '@yorickpeterse' }, tier = 2, }, - ipkg = { - install_info = { - revision = '8d3e9782f2d091d0cd39c13bfb3068db0c675960', - url = 'https://github.com/srghma/tree-sitter-ipkg', - }, - maintainers = { '@srghma' }, - tier = 2, - }, ispc = { install_info = { revision = '9b2f9aec2106b94b4e099fe75e73ebd8ae707c04', diff --git a/runtime/queries/ipkg/folds.scm b/runtime/queries/ipkg/folds.scm deleted file mode 100644 index 271654f9a..000000000 --- a/runtime/queries/ipkg/folds.scm +++ /dev/null @@ -1,13 +0,0 @@ -[ - (source_file) - (dependency_list) - (module_list) - (dependency_declaration) - (module_declaration) - (module_declaration) - (package_declaration) - (main_declaration) - (executable_declaration) - (version_declaration) - (langversion_declaration) -] @fold diff --git a/runtime/queries/ipkg/highlights.scm b/runtime/queries/ipkg/highlights.scm deleted file mode 100644 index 13c102018..000000000 --- a/runtime/queries/ipkg/highlights.scm +++ /dev/null @@ -1,56 +0,0 @@ -; Keywords -"package" @keyword.import - -[ - "authors" - "maintainers" - "license" - "brief" - "readme" - "homepage" - "sourceloc" - "bugtracker" - "opts" - "sourcedir" - "builddir" - "outputdir" - "prebuild" - "postbuild" - "preinstall" - "postinstall" - "preclean" - "postclean" - "version" - "langversion" - "modules" - "main" - "executable" - "depends" -] @keyword - -[ - "=" - (version_range_op) -] @operator - -"," @punctuation.delimiter - -; Field values -(string_value) @string - -(boolean_value) @boolean - -; Version numbers and ranges -(version_number) @string.special - -[ - (dependency_item) - (package_name) - (module_name) -] @module - -; Comments -[ - (line_comment) - (block_comment) -] @comment @spell diff --git a/runtime/queries/ipkg/indents.scm b/runtime/queries/ipkg/indents.scm deleted file mode 100644 index a596e9ebe..000000000 --- a/runtime/queries/ipkg/indents.scm +++ /dev/null @@ -1,33 +0,0 @@ -; Indentation rules for Idris .ipkg files -[ - (package_declaration) - (field_declaration) - (main_declaration) - (executable_declaration) - (version_declaration) - (langversion_declaration) -] @indent.begin - -(dependency_declaration - "=" @indent.begin - (dependency_list - "," @indent.begin)) - -(module_declaration - "=" @indent.begin - (module_list - "," @indent.begin)) - -(field_declaration - "=" @indent.begin) - -"=" @indent.branch - -(string_value) @indent.begin - -[ - (line_comment) - (block_comment) -] @indent.ignore - -(ERROR) @indent.auto diff --git a/runtime/queries/ipkg/injections.scm b/runtime/queries/ipkg/injections.scm deleted file mode 100644 index 3cd6aac8e..000000000 --- a/runtime/queries/ipkg/injections.scm +++ /dev/null @@ -1,5 +0,0 @@ -([ - (line_comment) - (block_comment) -] @injection.content - (#set! injection.language "comment")) diff --git a/runtime/queries/ipkg/locals.scm b/runtime/queries/ipkg/locals.scm deleted file mode 100644 index c1970fcdf..000000000 --- a/runtime/queries/ipkg/locals.scm +++ /dev/null @@ -1,24 +0,0 @@ -; Scopes -(source_file) @local.scope - -; Definitions -(package_declaration - (package_name) @local.definition.import) - -(module_declaration - (module_list - (module_name) @local.definition.namespace)) - -(main_declaration - (module_name) @local.definition.import) - -(executable_declaration - (package_name) @local.definition.import) - -; References -(dependency_declaration - (dependency_list - (dependency_item - (package_name) @local.reference))) - -(module_name) @local.reference From c48b37a3c9cb8baedcb667c8c5f22b62185c8916 Mon Sep 17 00:00:00 2001 From: Jaehwang Jung Date: Fri, 6 Jun 2025 19:36:48 +0900 Subject: [PATCH 2183/2494] feat(cpp): highlight template method call --- runtime/queries/cpp/highlights.scm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/runtime/queries/cpp/highlights.scm b/runtime/queries/cpp/highlights.scm index 85ff2dc40..ac0315275 100644 --- a/runtime/queries/cpp/highlights.scm +++ b/runtime/queries/cpp/highlights.scm @@ -154,6 +154,11 @@ (field_expression (field_identifier) @function.method.call)) +(call_expression + (field_expression + (template_method + (field_identifier) @function.method.call))) + ; constructors ((function_declarator (qualified_identifier From 9c03c835fb2c7f0348742221d9c9540a69f47bdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20NICOLAS?= Date: Thu, 5 Jun 2025 15:04:43 +0200 Subject: [PATCH 2184/2494] fix(bash): highlight shebang also when spaced This commit aligns the shebang highlighting in bash syntax to what the Linux kernel will recognise as a valid shebang construct. In summary, the kernel will accept both headers: #!/usr/bin/env lua #! /usr/bin/env lua The second one is quite prominently used throughout documentation online, such as on Wikipedia's page for Shebang (Unix) [1]. Some sources are adamant it wouldn't be supported at a kernel level, but it looks to me, upon closer inspection of the current kernel code [2], that it is indeed quite evidently valid. It'll simply skip over to the first character that's neither a space 0x20 nor a tab 0x09. [1] https://en.wikipedia.org/wiki/Shebang_(Unix) [2] https://github.com/torvalds/linux/blob/ec7714e4947909190ffb3041a03311a975350fe0/fs/binfmt_script.c#L44-L71 --- runtime/queries/bash/highlights.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/queries/bash/highlights.scm b/runtime/queries/bash/highlights.scm index 428207b94..6fe370011 100644 --- a/runtime/queries/bash/highlights.scm +++ b/runtime/queries/bash/highlights.scm @@ -269,4 +269,4 @@ ((program . (comment) @keyword.directive @nospell) - (#lua-match? @keyword.directive "^#!/")) + (#lua-match? @keyword.directive "^#![ \t]*/")) From 0fb1c6e92e6a03374d578b362301dbd22abd3840 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Mon, 9 Jun 2025 17:42:54 +0200 Subject: [PATCH 2185/2494] feat(parsers): update bash, purescript, r, cylc, meson, mlir, xresources, markdown, markdown_inline, scala, javadoc, slint, desktop, enforce, editorconfig, query --- lua/nvim-treesitter/parsers.lua | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index cbe6aac12..72d4f69ad 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -77,7 +77,7 @@ return { }, bash = { install_info = { - revision = '8509e3229b863c255ab6b61f3bf74ad0bf14e8bc', + revision = '56b54c61fb48bce0c63e3dfa2240b5d274384763', url = 'https://github.com/tree-sitter/tree-sitter-bash', }, maintainers = { '@TravonteD' }, @@ -322,7 +322,7 @@ return { }, cylc = { install_info = { - revision = '1f3cb70200b4e238e19652705336e7f2c52b8e2f', + revision = '5517ecade85b1de85ed8e0cb742b81decc64183a', url = 'https://github.com/elliotfontaine/tree-sitter-cylc', }, maintainers = { '@elliotfontaine' }, @@ -346,7 +346,7 @@ return { }, desktop = { install_info = { - revision = 'b2cad1212116f23b3e8d0607b628bc6f72224c51', + revision = '35db988d318c0ddfb8445adec1fd006095e73d89', url = 'https://github.com/ValdezFOmar/tree-sitter-desktop', }, maintainers = { '@ValdezFOmar' }, @@ -449,7 +449,7 @@ return { }, editorconfig = { install_info = { - revision = '4a00eb4b0e8fbf8f1594efa9b5b15386fbd7d563', + revision = 'cbe0d13e8d67d3a97856f29e5b1d4233cbf32577', url = 'https://github.com/ValdezFOmar/tree-sitter-editorconfig', }, maintainers = { '@ValdezFOmar' }, @@ -512,7 +512,7 @@ return { }, enforce = { install_info = { - revision = '36064bd71ce22e9a8c73b64b1a3448cc600a4312', + revision = '8e4c84144153deaf2b8461def43126cea6790020', url = 'https://github.com/simonvic/tree-sitter-enforce', }, maintainers = { '@simonvic' }, @@ -1067,7 +1067,7 @@ return { }, javadoc = { install_info = { - revision = 'ddf03959c0152bb61ed567f301ad6ecdab72f6ab', + revision = '32c3d81dda0e4dd70fef7e93f15dc8861d3f5818', url = 'https://github.com/rmuir/tree-sitter-javadoc', }, maintainers = { '@rmuir' }, @@ -1339,7 +1339,7 @@ return { markdown = { install_info = { location = 'tree-sitter-markdown', - revision = 'efb075cbd57ce33f694c2bb264b99cdba0f31789', + revision = '9dca2b6834df9be17bed2ec0fc05c215fa10acf3', url = 'https://github.com/tree-sitter-grammars/tree-sitter-markdown', }, maintainers = { '@MDeiml' }, @@ -1350,7 +1350,7 @@ return { markdown_inline = { install_info = { location = 'tree-sitter-markdown-inline', - revision = 'efb075cbd57ce33f694c2bb264b99cdba0f31789', + revision = '9dca2b6834df9be17bed2ec0fc05c215fa10acf3', url = 'https://github.com/tree-sitter-grammars/tree-sitter-markdown', }, maintainers = { '@MDeiml' }, @@ -1382,7 +1382,7 @@ return { }, meson = { install_info = { - revision = 'b1ff0037b665e7e84715390820d6ecbe763a9c79', + revision = '243aa33382d6ac7b8b66d962024d339cb3bae3f6', url = 'https://github.com/tree-sitter-grammars/tree-sitter-meson', }, maintainers = { '@Decodetalkers' }, @@ -1391,7 +1391,7 @@ return { mlir = { install_info = { generate = true, - revision = '0f77bc710f61ec6be658ddf51851b2ed2cdaa20d', + revision = '3e214fc380b1159dd157cd6ed489a3b8fd8888a8', url = 'https://github.com/artagnon/tree-sitter-mlir', }, maintainers = { '@artagnon' }, @@ -1739,7 +1739,7 @@ return { }, purescript = { install_info = { - revision = '4cacfdaa75090bb790965674fe387bb215bab64b', + revision = '603daa9178bcef3386b3040d86435794965fc6f2', url = 'https://github.com/postsolar/tree-sitter-purescript', }, maintainers = { '@postsolar' }, @@ -1789,7 +1789,7 @@ return { }, query = { install_info = { - revision = '55baffbdc6bd00bf177b796950497a01bb496241', + revision = '2b3669919b22f1a6e5bfcf3753caaa63fd14e8ec', url = 'https://github.com/tree-sitter-grammars/tree-sitter-query', }, maintainers = { '@steelsojka' }, @@ -1798,7 +1798,7 @@ return { }, r = { install_info = { - revision = '29c816328a086ef056799e3924ef6e09e6a9a8cb', + revision = '95aff097aa927a66bb357f715b58cde821be8867', url = 'https://github.com/r-lib/tree-sitter-r', }, maintainers = { '@ribru17' }, @@ -1966,7 +1966,7 @@ return { }, scala = { install_info = { - revision = 'a2e91c845064bb4031e31b103e32bcdaefeea139', + revision = '2d55e74b0485fe05058ffe5e8155506c9710c767', url = 'https://github.com/tree-sitter/tree-sitter-scala', }, maintainers = { '@stevanmilic' }, @@ -2027,7 +2027,7 @@ return { }, slint = { install_info = { - revision = '32f970b57720010e77a486bc2001ee9e6c7c8250', + revision = 'cd04d91ff4eaff3467a6a0968e29fa9e4ac8f024', url = 'https://github.com/slint-ui/tree-sitter-slint', }, maintainers = { '@hunger' }, @@ -2584,7 +2584,7 @@ return { }, xresources = { install_info = { - revision = '7e9f6fa9a6e9e4e5ced1683afc89a0d5b32a4ebc', + revision = '45c020e74e924d8e3a0656a0dbe18688c063f5f0', url = 'https://github.com/ValdezFOmar/tree-sitter-xresources', }, maintainers = { '@ValdezFOmar' }, From c29969e8efbea20b65dcc398d3fc403d5e51d006 Mon Sep 17 00:00:00 2001 From: Igor Date: Thu, 12 Jun 2025 23:14:30 -0300 Subject: [PATCH 2186/2494] feat(dot): fold queries --- SUPPORTED_LANGUAGES.md | 2 +- runtime/queries/dot/folds.scm | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 runtime/queries/dot/folds.scm diff --git a/SUPPORTED_LANGUAGES.md b/SUPPORTED_LANGUAGES.md index d9c56c4f2..4e3fe466d 100644 --- a/SUPPORTED_LANGUAGES.md +++ b/SUPPORTED_LANGUAGES.md @@ -61,7 +61,7 @@ Language | Tier | Queries | Node | Maintainer [disassembly](https://github.com/ColinKennedy/tree-sitter-disassembly) | unstable | `H  J ` | | @ColinKennedy [djot](https://github.com/treeman/tree-sitter-djot) | unstable | `HFIJL` | | @NoahTheDuke [dockerfile](https://github.com/camdencheek/tree-sitter-dockerfile) | unstable | `H  J ` | | @camdencheek -[dot](https://github.com/rydesun/tree-sitter-dot) | unstable | `H IJ ` | | @rydesun +[dot](https://github.com/rydesun/tree-sitter-dot) | unstable | `HFIJ ` | | @rydesun [doxygen](https://github.com/tree-sitter-grammars/tree-sitter-doxygen) | unstable | `H IJ ` | | @amaanq [dtd](https://github.com/tree-sitter-grammars/tree-sitter-xml) | unstable | `HF JL` | | @ObserverOfTime [earthfile](https://github.com/glehmann/tree-sitter-earthfile) | unstable | `H  J ` | | @glehmann diff --git a/runtime/queries/dot/folds.scm b/runtime/queries/dot/folds.scm new file mode 100644 index 000000000..280bbb465 --- /dev/null +++ b/runtime/queries/dot/folds.scm @@ -0,0 +1,4 @@ +[ + (edge_stmt)+ + (node_stmt) +] @fold From a64ef334be4f47cab7effdd08b57d7b38235eeb7 Mon Sep 17 00:00:00 2001 From: uncenter Date: Sat, 14 Jun 2025 05:01:04 -0400 Subject: [PATCH 2187/2494] fix(css): universal selector "*" has precedence over operator (#7948) --- runtime/queries/css/highlights.scm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/runtime/queries/css/highlights.scm b/runtime/queries/css/highlights.scm index 49471fdb2..5b43c014a 100644 --- a/runtime/queries/css/highlights.scm +++ b/runtime/queries/css/highlights.scm @@ -27,11 +27,6 @@ (feature_name) ] @property -[ - (nesting_selector) - (universal_selector) -] @character.special - (function_name) @function [ @@ -58,6 +53,11 @@ (important) @keyword.modifier +[ + (nesting_selector) + (universal_selector) +] @character.special + (attribute_selector (plain_value) @string) From 43b7f16c50cda8f0bd571594d63f9ba8a46f0e45 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 15 Jun 2025 10:48:01 +0200 Subject: [PATCH 2188/2494] feat(parsers): update php_only, javadoc, erlang, faust, php, roc, slim, fortran, terraform, fish, mlir, sourcepawn, latex, matlab, hcl, vhdl --- lua/nvim-treesitter/parsers.lua | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 72d4f69ad..b493d0917 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -520,7 +520,7 @@ return { }, erlang = { install_info = { - revision = '067d66937c8eeb6651e349f400c1756c2ea90b2e', + revision = '07dad1469ecb7df80f2b6d5178f79564d19d67e0', url = 'https://github.com/WhatsApp/tree-sitter-erlang', }, maintainers = { '@filmor' }, @@ -536,7 +536,7 @@ return { }, faust = { install_info = { - revision = 'f3b9274514b5f9bf6b0dd4a01c30f9cc15c58bc4', + revision = 'aa033eb46c3b40e936db5847e0e91445ab606ee4', url = 'https://github.com/khiner/tree-sitter-faust', }, maintainers = { '@khiner' }, @@ -568,7 +568,7 @@ return { }, fish = { install_info = { - revision = '70640c0696abde32622afc43291a385681afbd32', + revision = 'aa074a0bacde8b5823c592574d7138f156a95776', url = 'https://github.com/ram02z/tree-sitter-fish', }, maintainers = { '@ram02z' }, @@ -592,7 +592,7 @@ return { }, fortran = { install_info = { - revision = 'ab9aa007a8d982a5a7926663a8ab989cea0f5d9e', + revision = '1b08f4c65fb47c76d3532cd3f7432d03abb9ef69', url = 'https://github.com/stadelmanma/tree-sitter-fortran', }, maintainers = { '@amaanq' }, @@ -898,7 +898,7 @@ return { }, hcl = { install_info = { - revision = '009def4ae38ec30e5b40beeae26efe93484ab286', + revision = '28e327cd3f5be4816020b1230c0602a6deb40290', url = 'https://github.com/tree-sitter-grammars/tree-sitter-hcl', }, maintainers = { '@MichaHoffmann' }, @@ -1067,7 +1067,7 @@ return { }, javadoc = { install_info = { - revision = '32c3d81dda0e4dd70fef7e93f15dc8861d3f5818', + revision = '573ff1f5e909daade4fba984fc5e8b14afe278ef', url = 'https://github.com/rmuir/tree-sitter-javadoc', }, maintainers = { '@rmuir' }, @@ -1232,7 +1232,7 @@ return { latex = { install_info = { generate = true, - revision = 'f736d24d89acbd90092d92089e5171e6a449db40', + revision = '8e130cd5394487f5b686fbbb547f4ad7dbe811db', url = 'https://github.com/latex-lsp/tree-sitter-latex', }, maintainers = { '@theHamsta', '@clason' }, @@ -1359,7 +1359,7 @@ return { }, matlab = { install_info = { - revision = '88ccb5ee90711e9961582d421c42bc8c6bd53f59', + revision = 'a419361e4a6f2ec435dac4465fb0c0e5b2446b08', url = 'https://github.com/acristoffers/tree-sitter-matlab', }, maintainers = { '@acristoffers' }, @@ -1391,7 +1391,7 @@ return { mlir = { install_info = { generate = true, - revision = '3e214fc380b1159dd157cd6ed489a3b8fd8888a8', + revision = 'eb78968fdb3728510f9260129a2dd57b7c04f761', url = 'https://github.com/artagnon/tree-sitter-mlir', }, maintainers = { '@artagnon' }, @@ -1566,7 +1566,7 @@ return { php = { install_info = { location = 'php', - revision = 'e771eb9fb5ccc65af35879487b66751568d10e48', + revision = 'b2278dbac9d58b02653fe6a8530ccebc492e4ed4', url = 'https://github.com/tree-sitter/tree-sitter-php', }, maintainers = { '@tk-shirasaka', '@calebdw' }, @@ -1577,7 +1577,7 @@ return { php_only = { install_info = { location = 'php_only', - revision = 'e771eb9fb5ccc65af35879487b66751568d10e48', + revision = 'b2278dbac9d58b02653fe6a8530ccebc492e4ed4', url = 'https://github.com/tree-sitter/tree-sitter-php', }, maintainers = { '@tk-shirasaka', '@calebdw' }, @@ -1918,7 +1918,7 @@ return { }, roc = { install_info = { - revision = '0b1afe88161cbd81f5ddea1bb4fa786314ed49a7', + revision = '94634c7e882d3c55066aa074cab4911284326deb', url = 'https://github.com/faldor20/tree-sitter-roc', }, maintainers = { '@nat-418' }, @@ -2019,7 +2019,7 @@ return { }, slim = { install_info = { - revision = 'd8a79d15c7b9a68d2d1616c319d2b04d1999ab9f', + revision = 'a06113f5175b805a37d20df0a6f9d722e0ab6cfe', url = 'https://github.com/theoo/tree-sitter-slim', }, maintainers = { '@theoo' }, @@ -2085,7 +2085,7 @@ return { }, sourcepawn = { install_info = { - revision = 'f2af8d0dc14c6790130cceb2a20027eb41a8297c', + revision = '5a8fdd446b516c81e218245c12129c6ad4bccfa2', url = 'https://github.com/nilshelmig/tree-sitter-sourcepawn', }, maintainers = { '@Sarrus1' }, @@ -2276,7 +2276,7 @@ return { terraform = { install_info = { location = 'dialects/terraform', - revision = '009def4ae38ec30e5b40beeae26efe93484ab286', + revision = '28e327cd3f5be4816020b1230c0602a6deb40290', url = 'https://github.com/MichaHoffmann/tree-sitter-hcl', }, maintainers = { '@MichaHoffmann' }, @@ -2484,7 +2484,7 @@ return { }, vhdl = { install_info = { - revision = 'ec2cb14f68053cf49d1d18cd5742af8e81771ebb', + revision = '5840549516f2faf8c45cae5a3b16c1b81a2498a1', url = 'https://github.com/jpt13653903/tree-sitter-vhdl', }, maintainers = { '@jpt13653903' }, From 9807487fe90afb7f53ddc22179272dad19c1044a Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 17 Jun 2025 15:49:02 +0200 Subject: [PATCH 2189/2494] feat(parsers): update desktop, query, editorconfig, xresources, hcl, slint, markdown_inline, matlab, terraform, templ, nu, vhdl, tera, markdown, javadoc --- lua/nvim-treesitter/parsers.lua | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index b493d0917..c230e6979 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -346,7 +346,7 @@ return { }, desktop = { install_info = { - revision = '35db988d318c0ddfb8445adec1fd006095e73d89', + revision = '5fc42b211b261d7c10f97f2c7fa9665cd0d3c8a0', url = 'https://github.com/ValdezFOmar/tree-sitter-desktop', }, maintainers = { '@ValdezFOmar' }, @@ -449,7 +449,7 @@ return { }, editorconfig = { install_info = { - revision = 'cbe0d13e8d67d3a97856f29e5b1d4233cbf32577', + revision = '9281e7d8522cc0d06b61f97920e27936fa12be11', url = 'https://github.com/ValdezFOmar/tree-sitter-editorconfig', }, maintainers = { '@ValdezFOmar' }, @@ -898,7 +898,7 @@ return { }, hcl = { install_info = { - revision = '28e327cd3f5be4816020b1230c0602a6deb40290', + revision = 'fad991865fee927dd1de5e172fb3f08ac674d914', url = 'https://github.com/tree-sitter-grammars/tree-sitter-hcl', }, maintainers = { '@MichaHoffmann' }, @@ -1067,7 +1067,7 @@ return { }, javadoc = { install_info = { - revision = '573ff1f5e909daade4fba984fc5e8b14afe278ef', + revision = '3f2ed5575909874927489d2d47a3a2fda36959ee', url = 'https://github.com/rmuir/tree-sitter-javadoc', }, maintainers = { '@rmuir' }, @@ -1339,7 +1339,7 @@ return { markdown = { install_info = { location = 'tree-sitter-markdown', - revision = '9dca2b6834df9be17bed2ec0fc05c215fa10acf3', + revision = '7462bb66ac7e90312082269007fac2772fe5efd1', url = 'https://github.com/tree-sitter-grammars/tree-sitter-markdown', }, maintainers = { '@MDeiml' }, @@ -1350,7 +1350,7 @@ return { markdown_inline = { install_info = { location = 'tree-sitter-markdown-inline', - revision = '9dca2b6834df9be17bed2ec0fc05c215fa10acf3', + revision = '7462bb66ac7e90312082269007fac2772fe5efd1', url = 'https://github.com/tree-sitter-grammars/tree-sitter-markdown', }, maintainers = { '@MDeiml' }, @@ -1359,7 +1359,7 @@ return { }, matlab = { install_info = { - revision = 'a419361e4a6f2ec435dac4465fb0c0e5b2446b08', + revision = 'd5fd97c7aec0881d3429642a240ad536c74582b9', url = 'https://github.com/acristoffers/tree-sitter-matlab', }, maintainers = { '@acristoffers' }, @@ -1471,7 +1471,7 @@ return { }, nu = { install_info = { - revision = '100d06e29d13a8ebfc3f29173c07a5c4f2050586', + revision = '7983592fe54750b750f2ee9dc8e89449257855d4', url = 'https://github.com/nushell/tree-sitter-nu', }, maintainers = { '@abhisheksingh0x558' }, @@ -1789,7 +1789,7 @@ return { }, query = { install_info = { - revision = '2b3669919b22f1a6e5bfcf3753caaa63fd14e8ec', + revision = '8a43889f89fd0667289936341bff3a77bafade17', url = 'https://github.com/tree-sitter-grammars/tree-sitter-query', }, maintainers = { '@steelsojka' }, @@ -2027,7 +2027,7 @@ return { }, slint = { install_info = { - revision = 'cd04d91ff4eaff3467a6a0968e29fa9e4ac8f024', + revision = '03f24aa22d6712f79004286df6dd416ca6d2a91d', url = 'https://github.com/slint-ui/tree-sitter-slint', }, maintainers = { '@hunger' }, @@ -2259,7 +2259,7 @@ return { }, templ = { install_info = { - revision = 'de35706f89beed5087670a9c4421b7794ef02411', + revision = 'a35a02cb608291ac8c12082dcbd2b5f34a7ad45f', url = 'https://github.com/vrischmann/tree-sitter-templ', }, maintainers = { '@vrischmann' }, @@ -2267,7 +2267,7 @@ return { }, tera = { install_info = { - revision = 'd006172998fa8b81f96b0f2fc7fa2bf25207c46b', + revision = '53ca9100f231b72474225d98c9e53d1a4275046d', url = 'https://github.com/uncenter/tree-sitter-tera', }, maintainers = { '@uncenter' }, @@ -2276,7 +2276,7 @@ return { terraform = { install_info = { location = 'dialects/terraform', - revision = '28e327cd3f5be4816020b1230c0602a6deb40290', + revision = 'fad991865fee927dd1de5e172fb3f08ac674d914', url = 'https://github.com/MichaHoffmann/tree-sitter-hcl', }, maintainers = { '@MichaHoffmann' }, @@ -2484,7 +2484,7 @@ return { }, vhdl = { install_info = { - revision = '5840549516f2faf8c45cae5a3b16c1b81a2498a1', + revision = 'eacafa5d612fdea1d12332fe0f83e089e5571cf3', url = 'https://github.com/jpt13653903/tree-sitter-vhdl', }, maintainers = { '@jpt13653903' }, @@ -2584,7 +2584,7 @@ return { }, xresources = { install_info = { - revision = '45c020e74e924d8e3a0656a0dbe18688c063f5f0', + revision = '65d52b286af0b2dd7153e045869a566b33a28f44', url = 'https://github.com/ValdezFOmar/tree-sitter-xresources', }, maintainers = { '@ValdezFOmar' }, From 7e6fbcaa20e70b48990b199eb1310bee22adee0f Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 17 Jun 2025 15:49:52 +0200 Subject: [PATCH 2190/2494] feat(purescript)!: update parser and queries removed note: `(constructor_operator)` --- lua/nvim-treesitter/parsers.lua | 2 +- runtime/queries/purescript/highlights.scm | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index c230e6979..3194af27c 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -1739,7 +1739,7 @@ return { }, purescript = { install_info = { - revision = '603daa9178bcef3386b3040d86435794965fc6f2', + revision = '03bafc129e390d65178caaa72d8a1b91439d170e', url = 'https://github.com/postsolar/tree-sitter-purescript', }, maintainers = { '@postsolar' }, diff --git a/runtime/queries/purescript/highlights.scm b/runtime/queries/purescript/highlights.scm index 02426b0ab..33b62725c 100644 --- a/runtime/queries/purescript/highlights.scm +++ b/runtime/queries/purescript/highlights.scm @@ -52,7 +52,6 @@ [ (operator) - (constructor_operator) (type_operator) (all_names) "=" From 2a677dede2ea45d872ee32ea55e2f93bec0b0f4f Mon Sep 17 00:00:00 2001 From: guilhas07 Date: Wed, 18 Jun 2025 16:22:31 +0100 Subject: [PATCH 2191/2494] feat(vue): add template commentstring metadata --- runtime/queries/vue/highlights.scm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/runtime/queries/vue/highlights.scm b/runtime/queries/vue/highlights.scm index 64195c346..66b7ea61e 100644 --- a/runtime/queries/vue/highlights.scm +++ b/runtime/queries/vue/highlights.scm @@ -41,3 +41,6 @@ (attribute_value) @none)) (directive_modifier) @function.method + +((template_element) @_template + (#set! @_template bo.commentstring "")) From 1bfa557b7d6bd7b3a594e89652ba7117a2b7d04d Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 22 Jun 2025 15:40:36 +0200 Subject: [PATCH 2192/2494] feat(parsers): update gleam, latex, typespec, purescript, heex, nu --- lua/nvim-treesitter/parsers.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 3194af27c..24fdded9c 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -709,7 +709,7 @@ return { }, gleam = { install_info = { - revision = '6ece453acf8b14568c10f629f8cd25d3dde3794f', + revision = 'ee93c639dc82148d716919df336ad612fd33538e', url = 'https://github.com/gleam-lang/tree-sitter-gleam', }, maintainers = { '@amaanq' }, @@ -906,7 +906,7 @@ return { }, heex = { install_info = { - revision = '008626a3fad379d17c81d5ed576edd9bd7a4fbf7', + revision = '6603380caf806b3e6c7f0bf61627bb47023d79f1', url = 'https://github.com/connorlay/tree-sitter-heex', }, maintainers = { '@connorlay' }, @@ -1232,7 +1232,7 @@ return { latex = { install_info = { generate = true, - revision = '8e130cd5394487f5b686fbbb547f4ad7dbe811db', + revision = '73c9b8992f72203386092ffd2a05f2dcba02d2cb', url = 'https://github.com/latex-lsp/tree-sitter-latex', }, maintainers = { '@theHamsta', '@clason' }, @@ -1471,7 +1471,7 @@ return { }, nu = { install_info = { - revision = '7983592fe54750b750f2ee9dc8e89449257855d4', + revision = 'b64f0d1c93a76d167fabb01271905f0d18c5f10c', url = 'https://github.com/nushell/tree-sitter-nu', }, maintainers = { '@abhisheksingh0x558' }, @@ -1739,7 +1739,7 @@ return { }, purescript = { install_info = { - revision = '03bafc129e390d65178caaa72d8a1b91439d170e', + revision = 'f541f95ffd6852fbbe88636317c613285bc105af', url = 'https://github.com/postsolar/tree-sitter-purescript', }, maintainers = { '@postsolar' }, @@ -2386,7 +2386,7 @@ return { }, typespec = { install_info = { - revision = 'b6b6a66a18e98f44cc2f2cdbfd2e1df845b59852', + revision = '814c98283fd92a248ba9d49ebfe61bc672a35875', url = 'https://github.com/happenslol/tree-sitter-typespec', }, maintainers = { '@happenslol' }, From 8867a9d6bf85a7847e3dff35b049880dbffb44d6 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 22 Jun 2025 15:45:57 +0200 Subject: [PATCH 2193/2494] feat(powershell)!: update parser and queries removed nodes: `"class"`, `"enum"` --- lua/nvim-treesitter/parsers.lua | 2 +- runtime/queries/powershell/highlights.scm | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 24fdded9c..ade94c60c 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -1637,7 +1637,7 @@ return { powershell = { filetype = 'ps1', install_info = { - revision = '66d5e61126989c0aca57ff77d19b2064919b51e1', + revision = '01b67e81917482fb714409a40a8fea8fe21c42f6', url = 'https://github.com/airbus-cert/tree-sitter-powershell', }, maintainers = { '@L2jLiga' }, diff --git a/runtime/queries/powershell/highlights.scm b/runtime/queries/powershell/highlights.scm index 7d334ba2a..d26864275 100644 --- a/runtime/queries/powershell/highlights.scm +++ b/runtime/queries/powershell/highlights.scm @@ -62,11 +62,6 @@ "return" @keyword.return -[ - "class" - "enum" -] @keyword.type - [ "data" (class_attribute) From 231724189636fc31950f071bca0d2d35c228035b Mon Sep 17 00:00:00 2001 From: Luis Calle <53507599+TheLeoP@users.noreply.github.com> Date: Mon, 23 Jun 2025 13:15:08 -0500 Subject: [PATCH 2194/2494] fix: register `powershell` language for `ps1` filetype (#7965) * chore: sort languages * fix: register `powershell` language for `ps1` filetype --- plugin/filetypes.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugin/filetypes.lua b/plugin/filetypes.lua index feb1194a6..fdfaefe30 100644 --- a/plugin/filetypes.lua +++ b/plugin/filetypes.lua @@ -24,8 +24,8 @@ local filetypes = { janet_simple = { 'janet' }, javascript = { 'javascriptreact', 'ecma', 'ecmascript', 'jsx', 'js' }, javascript_glimmer = { 'javascript.glimmer' }, - linkerscript = { 'ld' }, latex = { 'tex' }, + linkerscript = { 'ld' }, m68k = { 'asm68k' }, make = { 'automake' }, markdown = { 'pandoc' }, @@ -33,6 +33,7 @@ local filetypes = { ocaml_interface = { 'ocamlinterface' }, perl = { 'pl' }, poe_filter = { 'poefilter' }, + powershell = { 'ps1' }, properties = { 'jproperties' }, python = { 'py', 'gyp' }, qmljs = { 'qml' }, From 6c503103710e6ba95632b540f0f337c648b92f17 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Mon, 23 Jun 2025 19:28:22 +0200 Subject: [PATCH 2195/2494] chore(wit): mark as unmaintained --- SUPPORTED_LANGUAGES.md | 2 +- lua/nvim-treesitter/parsers.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/SUPPORTED_LANGUAGES.md b/SUPPORTED_LANGUAGES.md index 4e3fe466d..9367de7db 100644 --- a/SUPPORTED_LANGUAGES.md +++ b/SUPPORTED_LANGUAGES.md @@ -322,7 +322,7 @@ jsx (queries only)[^jsx] | unstable | `HFIJ ` | | @steelsojka [wgsl](https://github.com/szebniok/tree-sitter-wgsl) | unstable | `HFIJ ` | | @szebniok [wgsl_bevy](https://github.com/tree-sitter-grammars/tree-sitter-wgsl-bevy) | unstable | `HFI  ` | | @theHamsta [wing](https://github.com/winglang/tree-sitter-wing) | unstable | `HF JL` | | @gshpychka, @MarkMcCulloh -[wit](https://github.com/liamwh/tree-sitter-wit) | unstable | `HF J ` | | @liamwh +[wit](https://github.com/liamwh/tree-sitter-wit) | unmaintained | `HF J ` | | @liamwh [xcompose](https://github.com/tree-sitter-grammars/tree-sitter-xcompose) | unstable | `H  JL` | | @ObserverOfTime [xml](https://github.com/tree-sitter-grammars/tree-sitter-xml) | unstable | `HFIJL` | | @ObserverOfTime [xresources](https://github.com/ValdezFOmar/tree-sitter-xresources) | unstable | `HF JL` | | @ValdezFOmar diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index ade94c60c..fcfcbd45d 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -2562,7 +2562,7 @@ return { url = 'https://github.com/liamwh/tree-sitter-wit', }, maintainers = { '@liamwh' }, - tier = 2, + tier = 3, }, xcompose = { install_info = { From 13ddd4d7522ce3e5a1abc0ea34e10ec4e445908a Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Mon, 23 Jun 2025 10:48:39 +0200 Subject: [PATCH 2196/2494] feat(swift)!: update parser and queries --- SUPPORTED_LANGUAGES.md | 2 +- lua/nvim-treesitter/parsers.lua | 5 ++--- runtime/queries/swift/folds.scm | 2 +- runtime/queries/swift/highlights.scm | 23 ++++++----------------- runtime/queries/swift/indents.scm | 2 +- runtime/queries/swift/injections.scm | 3 +++ 6 files changed, 14 insertions(+), 23 deletions(-) diff --git a/SUPPORTED_LANGUAGES.md b/SUPPORTED_LANGUAGES.md index 9367de7db..3fa4621d5 100644 --- a/SUPPORTED_LANGUAGES.md +++ b/SUPPORTED_LANGUAGES.md @@ -278,7 +278,7 @@ jsx (queries only)[^jsx] | unstable | `HFIJ ` | | @steelsojka [surface](https://github.com/connorlay/tree-sitter-surface) | unstable | `HFIJ ` | | @connorlay [svelte](https://github.com/tree-sitter-grammars/tree-sitter-svelte) | unstable | `HFIJL` | | @amaanq [sway](https://github.com/FuelLabs/tree-sitter-sway.git) | unstable | `HFIJL` | | @ribru17 -[swift](https://github.com/alex-pinkus/tree-sitter-swift) | unmaintained | `HFIJL` | X | @alex-pinkus +[swift](https://github.com/alex-pinkus/tree-sitter-swift) | unstable | `HFIJL` | | @alex-pinkus [sxhkdrc](https://github.com/RaafatTurki/tree-sitter-sxhkdrc) | unstable | `HF J ` | | @RaafatTurki [systemtap](https://github.com/ok-ryoko/tree-sitter-systemtap) | unstable | `HF JL` | | @ok-ryoko [t32](https://gitlab.com/xasc/tree-sitter-t32) | unstable | `HFIJL` | | @xasc diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index fcfcbd45d..591fcf25e 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -2193,12 +2193,11 @@ return { swift = { install_info = { generate = true, - generate_from_json = false, - revision = '99a5241ceac351a4af57bcc3571cef5064bde0a3', + revision = 'ebefe3134fba71f61c1103cbf27047f749f2b587', url = 'https://github.com/alex-pinkus/tree-sitter-swift', }, maintainers = { '@alex-pinkus' }, - tier = 3, + tier = 2, }, sxhkdrc = { install_info = { diff --git a/runtime/queries/swift/folds.scm b/runtime/queries/swift/folds.scm index cfbc6d0b1..ca7f72593 100644 --- a/runtime/queries/swift/folds.scm +++ b/runtime/queries/swift/folds.scm @@ -26,7 +26,7 @@ (tuple_expression) ; ( foo + bar ) (array_literal) ; [ foo, bar ] (dictionary_literal) ; [ foo: bar, x: y ] - (lambda_literal) + (lambda_literal) (willset_didset_block) (willset_clause) (didset_clause) diff --git a/runtime/queries/swift/highlights.scm b/runtime/queries/swift/highlights.scm index 5c52ee9d6..b911183d1 100644 --- a/runtime/queries/swift/highlights.scm +++ b/runtime/queries/swift/highlights.scm @@ -158,25 +158,14 @@ ; See https://docs.swift.org/swift-book/documentation/the-swift-programming-language/lexicalstructure/#Keywords-and-Punctuation [ (diagnostic) - "#available" - "#unavailable" - "#fileLiteral" - "#colorLiteral" - "#imageLiteral" - "#keyPath" - "#selector" - "#externalMacro" + (availability_condition) + (playground_literal) + (key_path_string_expression) + (selector_expression) + (external_macro_definition) ] @function.macro -[ - "#column" - "#dsohandle" - "#fileID" - "#filePath" - "#file" - "#function" - "#line" -] @constant.macro +(special_literal) @constant.macro ; Statements (for_statement diff --git a/runtime/queries/swift/indents.scm b/runtime/queries/swift/indents.scm index 2366c3bd6..21a11bfa5 100644 --- a/runtime/queries/swift/indents.scm +++ b/runtime/queries/swift/indents.scm @@ -33,7 +33,7 @@ (tuple_expression) ; ( foo + bar ) (array_literal) ; [ foo, bar ] (dictionary_literal) ; [ foo: bar, x: y ] - (lambda_literal) + (lambda_literal) (willset_didset_block) (willset_clause) (didset_clause) diff --git a/runtime/queries/swift/injections.scm b/runtime/queries/swift/injections.scm index 19aae904e..6e01e2d4c 100644 --- a/runtime/queries/swift/injections.scm +++ b/runtime/queries/swift/injections.scm @@ -1,3 +1,6 @@ +((regex_literal) @injection.content + (#set! injection.language "regex")) + ([ (comment) (multiline_comment) From 1181cd9a25360194b208bb9296ec26dc16433699 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Mon, 23 Jun 2025 13:32:46 +0200 Subject: [PATCH 2197/2494] feat(verilog)!: rename to systemverilog Grammar name was changed to coincide with repository name --- SUPPORTED_LANGUAGES.md | 2 +- lua/nvim-treesitter/parsers.lua | 16 ++++++++-------- plugin/filetypes.lua | 2 +- .../queries/{verilog => systemverilog}/folds.scm | 0 .../{verilog => systemverilog}/highlights.scm | 0 .../{verilog => systemverilog}/injections.scm | 0 6 files changed, 10 insertions(+), 10 deletions(-) rename runtime/queries/{verilog => systemverilog}/folds.scm (100%) rename runtime/queries/{verilog => systemverilog}/highlights.scm (100%) rename runtime/queries/{verilog => systemverilog}/injections.scm (100%) diff --git a/SUPPORTED_LANGUAGES.md b/SUPPORTED_LANGUAGES.md index 3fa4621d5..a3aabea78 100644 --- a/SUPPORTED_LANGUAGES.md +++ b/SUPPORTED_LANGUAGES.md @@ -281,6 +281,7 @@ jsx (queries only)[^jsx] | unstable | `HFIJ ` | | @steelsojka [swift](https://github.com/alex-pinkus/tree-sitter-swift) | unstable | `HFIJL` | | @alex-pinkus [sxhkdrc](https://github.com/RaafatTurki/tree-sitter-sxhkdrc) | unstable | `HF J ` | | @RaafatTurki [systemtap](https://github.com/ok-ryoko/tree-sitter-systemtap) | unstable | `HF JL` | | @ok-ryoko +[systemverilog](https://github.com/gmlarumbe/tree-sitter-systemverilog) | unstable | `HF J ` | | @zhangwwpeng [t32](https://gitlab.com/xasc/tree-sitter-t32) | unstable | `HFIJL` | | @xasc [tablegen](https://github.com/tree-sitter-grammars/tree-sitter-tablegen) | unstable | `HFIJL` | | @amaanq [tact](https://github.com/tact-lang/tree-sitter-tact) | unstable | `HFIJL` | | @novusnota @@ -312,7 +313,6 @@ jsx (queries only)[^jsx] | unstable | `HFIJ ` | | @steelsojka [v](https://github.com/vlang/v-analyzer) | unstable | `HFIJL` | | @kkharji, @amaanq [vala](https://github.com/vala-lang/tree-sitter-vala) | unstable | `HF J ` | | @Prince781 [vento](https://github.com/ventojs/tree-sitter-vento) | unstable | `H  J ` | | @wrapperup, @oscarotero -[verilog](https://github.com/gmlarumbe/tree-sitter-systemverilog) | unstable | `HF J ` | | @zhangwwpeng [vhdl](https://github.com/jpt13653903/tree-sitter-vhdl) | unstable | `HF J ` | | @jpt13653903 [vhs](https://github.com/charmbracelet/tree-sitter-vhs) | unstable | `H  J ` | | @caarlos0 [vim](https://github.com/tree-sitter-grammars/tree-sitter-vim) | unstable | `HF JL` | | @clason diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 591fcf25e..3cc89a884 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -2215,6 +2215,14 @@ return { maintainers = { '@ok-ryoko' }, tier = 2, }, + systemverilog = { + install_info = { + revision = 'a412f4a00a6e56c65f519117969c926c35e80ce4', + url = 'https://github.com/gmlarumbe/tree-sitter-systemverilog', + }, + maintainers = { '@zhangwwpeng' }, + tier = 2, + }, t32 = { install_info = { revision = '15f0032f3eadf95988293338e883c095fd5936f6', @@ -2473,14 +2481,6 @@ return { maintainers = { '@wrapperup', '@oscarotero' }, tier = 2, }, - verilog = { - install_info = { - revision = 'ba3c1e305caf948f718293c86c6018a82ed5043e', - url = 'https://github.com/gmlarumbe/tree-sitter-systemverilog', - }, - maintainers = { '@zhangwwpeng' }, - tier = 2, - }, vhdl = { install_info = { revision = 'eacafa5d612fdea1d12332fe0f83e089e5571cf3', diff --git a/plugin/filetypes.lua b/plugin/filetypes.lua index fdfaefe30..ecddea292 100644 --- a/plugin/filetypes.lua +++ b/plugin/filetypes.lua @@ -44,6 +44,7 @@ local filetypes = { ssh_config = { 'sshconfig' }, starlark = { 'bzl' }, surface = { 'sface' }, + systemverilog = { 'verilog' }, t32 = { 'trace32' }, tcl = { 'expect' }, terraform = { 'terraform-vars' }, @@ -56,7 +57,6 @@ local filetypes = { udev = { 'udevrules' }, uxntal = { 'tal', 'uxn' }, v = { 'vlang' }, - verilog = { 'systemverilog' }, vhs = { 'tape' }, xml = { 'xsd', 'xslt', 'svg' }, xresources = { 'xdefaults' }, diff --git a/runtime/queries/verilog/folds.scm b/runtime/queries/systemverilog/folds.scm similarity index 100% rename from runtime/queries/verilog/folds.scm rename to runtime/queries/systemverilog/folds.scm diff --git a/runtime/queries/verilog/highlights.scm b/runtime/queries/systemverilog/highlights.scm similarity index 100% rename from runtime/queries/verilog/highlights.scm rename to runtime/queries/systemverilog/highlights.scm diff --git a/runtime/queries/verilog/injections.scm b/runtime/queries/systemverilog/injections.scm similarity index 100% rename from runtime/queries/verilog/injections.scm rename to runtime/queries/systemverilog/injections.scm From 98459ffcf7dfbeea83081166a2d732a8083a91c2 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 24 Jun 2025 12:18:54 +0200 Subject: [PATCH 2198/2494] fix(health): sort language names --- lua/nvim-treesitter/health.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/nvim-treesitter/health.lua b/lua/nvim-treesitter/health.lua index e284381dd..b4d0c62d5 100644 --- a/lua/nvim-treesitter/health.lua +++ b/lua/nvim-treesitter/health.lua @@ -135,7 +135,8 @@ function M.check() -- Parser installation checks health.start('Installed languages' .. string.rep(' ', 5) .. 'H L F I J') local languages = config.get_installed() - for _, lang in pairs(languages) do + table.sort(languages) + for _, lang in ipairs(languages) do local parser = parsers[lang] local out = lang .. string.rep(' ', 22 - #lang) if parser and parser.install_info then From 77ba555ceffaedd61ee1034e417368da24b9e540 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Wed, 25 Jun 2025 11:55:16 +0200 Subject: [PATCH 2199/2494] ci: bump luals to 3.15.0 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 54fb96ed4..15482e03b 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ NVIM_VERSION ?= nightly -LUALS_VERSION := 3.14.0 +LUALS_VERSION := 3.15.0 DEPDIR ?= .test-deps CURL ?= curl -sL --create-dirs From 7110df63e1172eb9fa98cde61bbd38a4d325f97a Mon Sep 17 00:00:00 2001 From: Eric Mrak Date: Thu, 26 Jun 2025 00:04:48 -0700 Subject: [PATCH 2200/2494] feat(fish): more builtin commands and variables (#7972) builtin commands: * abbr * path builtin variables: * fish_cursor_* --- runtime/queries/fish/highlights.scm | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/runtime/queries/fish/highlights.scm b/runtime/queries/fish/highlights.scm index a7c451175..549bceda0 100644 --- a/runtime/queries/fish/highlights.scm +++ b/runtime/queries/fish/highlights.scm @@ -117,10 +117,10 @@ name: [ (word) @function.builtin (#any-of? @function.builtin - "." ":" "_" "alias" "argparse" "bg" "bind" "block" "breakpoint" "builtin" "cd" "command" - "commandline" "complete" "contains" "count" "disown" "echo" "emit" "eval" "exec" "exit" "fg" - "functions" "history" "isatty" "jobs" "math" "printf" "pwd" "random" "read" "realpath" "set" - "set_color" "source" "status" "string" "test" "time" "type" "ulimit" "wait") + "." ":" "_" "abbr" "alias" "argparse" "bg" "bind" "block" "breakpoint" "builtin" "cd" + "command" "commandline" "complete" "contains" "count" "disown" "echo" "emit" "eval" "exec" + "exit" "fg" "functions" "history" "isatty" "jobs" "math" "path" "printf" "pwd" "random" "read" + "realpath" "set" "set_color" "source" "status" "string" "test" "time" "type" "ulimit" "wait") ]) ; Functions @@ -179,11 +179,12 @@ "fish_term24bit" "fish_term256" "fish_ambiguous_width" "fish_emoji_width" "fish_autosuggestion_enabled" "fish_handle_reflow" "fish_key_bindings" "fish_escape_delay_ms" "fish_sequence_key_delay_ms" "fish_complete_path" "fish_cursor_selection_mode" - "fish_function_path" "fish_greeting" "fish_history" "fish_trace" "FISH_DEBUG" - "FISH_DEBUG_OUTPUT" "fish_user_paths" "umask" "BROWSER" "_" "argv" "CMD_DURATION" "COLUMNS" - "LINES" "fish_kill_signal" "fish_killring" "fish_read_limit" "fish_pid" "history" "HOME" - "hostname" "IFS" "last_pid" "PWD" "pipestatus" "SHLVL" "status" "status_generation" "TERM" - "USER" "EUID" "version" "FISH_VERSION")) + "fish_cursor_default" "fish_cursor_insert" "fish_cursor_replace" "fish_cursor_replace_one" + "fish_cursor_visual" "fish_cursor_external" "fish_function_path" "fish_greeting" "fish_history" + "fish_trace" "FISH_DEBUG" "FISH_DEBUG_OUTPUT" "fish_user_paths" "umask" "BROWSER" "_" "argv" + "CMD_DURATION" "COLUMNS" "LINES" "fish_kill_signal" "fish_killring" "fish_read_limit" "fish_pid" + "history" "HOME" "hostname" "IFS" "last_pid" "PWD" "pipestatus" "SHLVL" "status" + "status_generation" "TERM" "USER" "EUID" "version" "FISH_VERSION")) ; Nodes [ From 2e8f8562e6e32bfd4554f38ae00ffd72a2b4515d Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 29 Jun 2025 11:34:46 +0200 Subject: [PATCH 2201/2494] fix(scripts): sort list of updated parsers --- scripts/update-parsers.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/update-parsers.lua b/scripts/update-parsers.lua index fb09b9933..83f724970 100755 --- a/scripts/update-parsers.lua +++ b/scripts/update-parsers.lua @@ -83,6 +83,7 @@ if #updates > 0 then end util.write_file('lua/nvim-treesitter/parsers.lua', parser_file) + table.sort(updates) local update_list = table.concat(updates, ', ') print(string.format('\nUpdated parsers: %s', update_list)) -- pass list to workflow From 5948977de47457de10f2b0fb55d851cdf988e2dc Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 29 Jun 2025 11:35:00 +0200 Subject: [PATCH 2202/2494] feat(parsers): update angular, clojure, gleam, idl, javadoc, jinja, jinja_inline, liquidsoap, nim, nu, poe_filter, r, ssh_config, systemverilog, v --- lua/nvim-treesitter/parsers.lua | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 3cc89a884..69ac17aa8 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -18,7 +18,7 @@ return { }, angular = { install_info = { - revision = '820566bb4eb3d288822dbfee42417a5a9491aea6', + revision = '93bb92f1289b7fe765da6cc747c82ccdc0afeb8d', url = 'https://github.com/dlvandenberg/tree-sitter-angular', }, maintainers = { '@dlvandenberg' }, @@ -222,7 +222,7 @@ return { }, clojure = { install_info = { - revision = '40c5fc2e2a0f511a802a82002553c5de00feeaf4', + revision = 'be514eec2c86d560c18fab146e9298e21b8eab62', url = 'https://github.com/sogaiu/tree-sitter-clojure', }, maintainers = { '@NoahTheDuke' }, @@ -709,7 +709,7 @@ return { }, gleam = { install_info = { - revision = 'ee93c639dc82148d716919df336ad612fd33538e', + revision = '21e0e7ba6f4f60ee80934cb368aa13c00d370734', url = 'https://github.com/gleam-lang/tree-sitter-gleam', }, maintainers = { '@amaanq' }, @@ -1011,7 +1011,7 @@ return { }, idl = { install_info = { - revision = 'b14e7971cfbd64fa0ebcdeaa4dfbb3cb0bfabd7c', + revision = 'da50751d826030fcf8b1424de9f56cec2a274b38', url = 'https://github.com/cathaysia/tree-sitter-idl', }, maintainers = { '@cathaysia' }, @@ -1067,7 +1067,7 @@ return { }, javadoc = { install_info = { - revision = '3f2ed5575909874927489d2d47a3a2fda36959ee', + revision = 'ac58d03fde1aaf7dbf499e57bfed9ce87e36188d', url = 'https://github.com/rmuir/tree-sitter-javadoc', }, maintainers = { '@rmuir' }, @@ -1085,7 +1085,7 @@ return { jinja = { install_info = { location = 'tree-sitter-jinja', - revision = '258d7fb22fa6cd2dc800f201cfdcbe05111a836c', + revision = '251101981d86ccb2901741eddf3e7cf21567a66d', url = 'https://github.com/cathaysia/tree-sitter-jinja', }, maintainers = { '@cathaysia' }, @@ -1096,7 +1096,7 @@ return { jinja_inline = { install_info = { location = 'tree-sitter-jinja_inline', - revision = '258d7fb22fa6cd2dc800f201cfdcbe05111a836c', + revision = '251101981d86ccb2901741eddf3e7cf21567a66d', url = 'https://github.com/cathaysia/tree-sitter-jinja', }, maintainers = { '@cathaysia' }, @@ -1272,7 +1272,7 @@ return { }, liquidsoap = { install_info = { - revision = '8e51fa63ddb93ac179d4e34a311d3d3f03780b42', + revision = '68e6b247c880d1521f7b454663fb3735609eacf2', url = 'https://github.com/savonet/tree-sitter-liquidsoap', }, maintainers = { '@toots' }, @@ -1430,7 +1430,7 @@ return { }, nim = { install_info = { - revision = '897e5d346f0b59ed62b517cfb0f1a845ad8f0ab7', + revision = '9ed4696d7f76e4937e2b63512a249a3ead7a0399', url = 'https://github.com/alaviss/tree-sitter-nim', }, maintainers = { '@aMOPel' }, @@ -1471,7 +1471,7 @@ return { }, nu = { install_info = { - revision = 'b64f0d1c93a76d167fabb01271905f0d18c5f10c', + revision = 'd62bb4a0c78e9476a6dd0081761444f6870252ed', url = 'https://github.com/nushell/tree-sitter-nu', }, maintainers = { '@abhisheksingh0x558' }, @@ -1619,7 +1619,7 @@ return { }, poe_filter = { install_info = { - revision = '2902dc45439125b9386812c1089a8e9b5f71c4ab', + revision = 'e449216700449f1bccaebbd3820cce794d6fd687', url = 'https://github.com/tree-sitter-grammars/tree-sitter-poe-filter', }, maintainers = { '@ObserverOfTime' }, @@ -1798,7 +1798,7 @@ return { }, r = { install_info = { - revision = '95aff097aa927a66bb357f715b58cde821be8867', + revision = '7b4eb04dfcc86e6705cade825f8c1edbd46584b2', url = 'https://github.com/r-lib/tree-sitter-r', }, maintainers = { '@ribru17' }, @@ -2118,7 +2118,7 @@ return { }, ssh_config = { install_info = { - revision = '0dd3c7e9f301758f6c69a6efde43d3048deb4d8a', + revision = '2d620d0ad636705800cf0ddb92c30afe703cd84f', url = 'https://github.com/tree-sitter-grammars/tree-sitter-ssh-config', }, maintainers = { '@ObserverOfTime' }, @@ -2217,7 +2217,7 @@ return { }, systemverilog = { install_info = { - revision = 'a412f4a00a6e56c65f519117969c926c35e80ce4', + revision = '3089b3fe310dd6cf9531e5e45f123202053a29a1', url = 'https://github.com/gmlarumbe/tree-sitter-systemverilog', }, maintainers = { '@zhangwwpeng' }, @@ -2459,7 +2459,7 @@ return { v = { install_info = { location = 'tree_sitter_v', - revision = '0f963ca4c0cc888252f5a31f37c974d5e2527d06', + revision = '5720fd00538ed069b43917fe377ca3fc21c89cb3', url = 'https://github.com/vlang/v-analyzer', }, maintainers = { '@kkharji', '@amaanq' }, From 4b2e9b049c288754dcc27fadccce97a1b16c0a53 Mon Sep 17 00:00:00 2001 From: przepompownia Date: Sun, 29 Jun 2025 14:42:16 +0200 Subject: [PATCH 2203/2494] feat(php): fold array_creation_expression --- runtime/queries/php_only/folds.scm | 1 + 1 file changed, 1 insertion(+) diff --git a/runtime/queries/php_only/folds.scm b/runtime/queries/php_only/folds.scm index 43453b174..0c744f88a 100644 --- a/runtime/queries/php_only/folds.scm +++ b/runtime/queries/php_only/folds.scm @@ -14,4 +14,5 @@ (function_static_declaration) (method_declaration) (namespace_use_declaration)+ + (array_creation_expression) ] @fold From dbb63c8b7ae4789a128a4176d9f99bff2cdf1bdf Mon Sep 17 00:00:00 2001 From: przepompownia Date: Sun, 29 Jun 2025 15:37:58 +0200 Subject: [PATCH 2204/2494] feat(php): fold match_expression --- runtime/queries/php_only/folds.scm | 1 + 1 file changed, 1 insertion(+) diff --git a/runtime/queries/php_only/folds.scm b/runtime/queries/php_only/folds.scm index 0c744f88a..7724cea93 100644 --- a/runtime/queries/php_only/folds.scm +++ b/runtime/queries/php_only/folds.scm @@ -15,4 +15,5 @@ (method_declaration) (namespace_use_declaration)+ (array_creation_expression) + (match_expression) ] @fold From 1f069f1bc610493d38276023165075f7424ca7b4 Mon Sep 17 00:00:00 2001 From: Baruch Even Date: Sun, 29 Jun 2025 19:10:29 +0300 Subject: [PATCH 2205/2494] feat(D): highlight `(string)` etc. as `@keyword.type` (#7978) Co-authored-by: Baruch Even --- runtime/queries/d/highlights.scm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/runtime/queries/d/highlights.scm b/runtime/queries/d/highlights.scm index 11d08a1b7..50428d20c 100644 --- a/runtime/queries/d/highlights.scm +++ b/runtime/queries/d/highlights.scm @@ -265,6 +265,9 @@ (creal) (double) (cfloat) + (string) + (dstring) + (wstring) ] @type.builtin ; Functions From 04935dec426a366f097ec8ae78dab6cc02ddafa0 Mon Sep 17 00:00:00 2001 From: Riley Bruins Date: Thu, 3 Jul 2025 17:10:05 +0200 Subject: [PATCH 2206/2494] fix: remove import references to jsx/locals.scm There are no JSX locals (yet...?) --- runtime/queries/javascript/locals.scm | 2 +- runtime/queries/tsx/locals.scm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/queries/javascript/locals.scm b/runtime/queries/javascript/locals.scm index 6d6846fc7..f13db46bf 100644 --- a/runtime/queries/javascript/locals.scm +++ b/runtime/queries/javascript/locals.scm @@ -1,4 +1,4 @@ -; inherits: ecma,jsx +; inherits: ecma ; Both properties are matched here. ; diff --git a/runtime/queries/tsx/locals.scm b/runtime/queries/tsx/locals.scm index 07391231c..1b61e36da 100644 --- a/runtime/queries/tsx/locals.scm +++ b/runtime/queries/tsx/locals.scm @@ -1 +1 @@ -; inherits: typescript,jsx +; inherits: typescript From dafb3cb3cb066774526c1103f3d1d6b34578800b Mon Sep 17 00:00:00 2001 From: Igor Date: Thu, 3 Jul 2025 21:13:31 -0300 Subject: [PATCH 2207/2494] fix(http): prefer folding requests --- runtime/queries/http/folds.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/queries/http/folds.scm b/runtime/queries/http/folds.scm index f7108a551..bd45f8013 100644 --- a/runtime/queries/http/folds.scm +++ b/runtime/queries/http/folds.scm @@ -1,5 +1,5 @@ [ - (section) + (request) (json_body) (variable_declaration)+ ] @fold From 80281c19fd2dacce60958a3c29bab5ab6b721006 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sat, 5 Jul 2025 12:12:53 +0200 Subject: [PATCH 2208/2494] feat(parsers): update c3, cpp, d, faust, fsharp, javadoc, julia, liquidsoap, meson, mlir, nu, powershell, roc, swift, systemverilog, t32, v --- lua/nvim-treesitter/parsers.lua | 34 ++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 69ac17aa8..8f7ea231b 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -166,7 +166,7 @@ return { }, c3 = { install_info = { - revision = '6eb8acc275961d137b4b4dd7fe84a19a0680c893', + revision = '5abce05689bf46999c17bd0dcda2f75b8de61d0d', url = 'https://github.com/c3lang/tree-sitter-c3', }, maintainers = { '@cbuttner' }, @@ -278,7 +278,7 @@ return { }, cpp = { install_info = { - revision = '56455f4245baf4ea4e0881c5169de69d7edd5ae7', + revision = '2871652b9893ab19e621628da03e670227a5d9d0', url = 'https://github.com/tree-sitter/tree-sitter-cpp', }, maintainers = { '@theHamsta' }, @@ -330,7 +330,7 @@ return { }, d = { install_info = { - revision = '45e5f1e9d6de2c68591bc8e5ec662cf18e950b4a', + revision = 'fb028c8f14f4188286c2eef143f105def6fbf24f', url = 'https://github.com/gdamore/tree-sitter-d', }, maintainers = { '@amaanq' }, @@ -536,7 +536,7 @@ return { }, faust = { install_info = { - revision = 'aa033eb46c3b40e936db5847e0e91445ab606ee4', + revision = '122dd101919289ea809bad643712fcb483a1bed0', url = 'https://github.com/khiner/tree-sitter-faust', }, maintainers = { '@khiner' }, @@ -609,7 +609,7 @@ return { fsharp = { install_info = { location = 'fsharp', - revision = 'f29605148f24199cf4d9c4a203a5debc0cbcc648', + revision = '5141851c278a99958469eb1736c7afc4ec738e47', url = 'https://github.com/ionide/tree-sitter-fsharp', }, maintainers = { '@nsidorenco' }, @@ -1067,7 +1067,7 @@ return { }, javadoc = { install_info = { - revision = 'ac58d03fde1aaf7dbf499e57bfed9ce87e36188d', + revision = 'c5b7341f62498ea139d591a5d6f450dc879b53b0', url = 'https://github.com/rmuir/tree-sitter-javadoc', }, maintainers = { '@rmuir' }, @@ -1159,7 +1159,7 @@ return { }, julia = { install_info = { - revision = '18b739c1563c83fc816170a4241adfa4b69e5c47', + revision = '73d1539a51b8a202d6d2471cc594cf4d7c5e673f', url = 'https://github.com/tree-sitter/tree-sitter-julia', }, maintainers = { '@fredrikekre' }, @@ -1272,7 +1272,7 @@ return { }, liquidsoap = { install_info = { - revision = '68e6b247c880d1521f7b454663fb3735609eacf2', + revision = '05a5dbb23addd207a295b904e44dbdd321b3b332', url = 'https://github.com/savonet/tree-sitter-liquidsoap', }, maintainers = { '@toots' }, @@ -1382,7 +1382,7 @@ return { }, meson = { install_info = { - revision = '243aa33382d6ac7b8b66d962024d339cb3bae3f6', + revision = '280b6e59186f18528bab1567f5cc43b78b9cd881', url = 'https://github.com/tree-sitter-grammars/tree-sitter-meson', }, maintainers = { '@Decodetalkers' }, @@ -1391,7 +1391,7 @@ return { mlir = { install_info = { generate = true, - revision = 'eb78968fdb3728510f9260129a2dd57b7c04f761', + revision = 'ddd4cd2e274813b97624fd3f30803f1db2001474', url = 'https://github.com/artagnon/tree-sitter-mlir', }, maintainers = { '@artagnon' }, @@ -1471,7 +1471,7 @@ return { }, nu = { install_info = { - revision = 'd62bb4a0c78e9476a6dd0081761444f6870252ed', + revision = '436b3f94578974d6e0c89c201d4b99329ad0e944', url = 'https://github.com/nushell/tree-sitter-nu', }, maintainers = { '@abhisheksingh0x558' }, @@ -1637,7 +1637,7 @@ return { powershell = { filetype = 'ps1', install_info = { - revision = '01b67e81917482fb714409a40a8fea8fe21c42f6', + revision = '103a700af551ba8d3402fd68e6f3cd4bf45cbe80', url = 'https://github.com/airbus-cert/tree-sitter-powershell', }, maintainers = { '@L2jLiga' }, @@ -1918,7 +1918,7 @@ return { }, roc = { install_info = { - revision = '94634c7e882d3c55066aa074cab4911284326deb', + revision = '40e52f343f1b1f270d6ecb2ca898ca9b8cba6936', url = 'https://github.com/faldor20/tree-sitter-roc', }, maintainers = { '@nat-418' }, @@ -2193,7 +2193,7 @@ return { swift = { install_info = { generate = true, - revision = 'ebefe3134fba71f61c1103cbf27047f749f2b587', + revision = 'd8816ef1aae8d1e7cf23adff2ace9d556d4b369f', url = 'https://github.com/alex-pinkus/tree-sitter-swift', }, maintainers = { '@alex-pinkus' }, @@ -2217,7 +2217,7 @@ return { }, systemverilog = { install_info = { - revision = '3089b3fe310dd6cf9531e5e45f123202053a29a1', + revision = '0dc5d86af86120094d9f1268613b529142212ddd', url = 'https://github.com/gmlarumbe/tree-sitter-systemverilog', }, maintainers = { '@zhangwwpeng' }, @@ -2225,7 +2225,7 @@ return { }, t32 = { install_info = { - revision = '15f0032f3eadf95988293338e883c095fd5936f6', + revision = '412cf98b2784dfe9c95ce0d7de840605c6953417', url = 'https://gitlab.com/xasc/tree-sitter-t32', }, maintainers = { '@xasc' }, @@ -2459,7 +2459,7 @@ return { v = { install_info = { location = 'tree_sitter_v', - revision = '5720fd00538ed069b43917fe377ca3fc21c89cb3', + revision = '6c511fc884312720e30ef5d169c63fe5f3d0209f', url = 'https://github.com/vlang/v-analyzer', }, maintainers = { '@kkharji', '@amaanq' }, From 0d32ec3c3efd1c26daa47796287e31fdd3307148 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sat, 5 Jul 2025 14:47:35 +0200 Subject: [PATCH 2209/2494] feat(latex)!: update parser and queries Breaking change: `label_definition`, `label_text` patterns --- lua/nvim-treesitter/parsers.lua | 2 +- runtime/queries/latex/highlights.scm | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 8f7ea231b..cf9368840 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -1232,7 +1232,7 @@ return { latex = { install_info = { generate = true, - revision = '73c9b8992f72203386092ffd2a05f2dcba02d2cb', + revision = '9410012b3eba659da5de5a655b4041593b493cb7', url = 'https://github.com/latex-lsp/tree-sitter-latex', }, maintainers = { '@theHamsta', '@clason' }, diff --git a/runtime/queries/latex/highlights.scm b/runtime/queries/latex/highlights.scm index c39cd1b14..ec39afcf5 100644 --- a/runtime/queries/latex/highlights.scm +++ b/runtime/queries/latex/highlights.scm @@ -87,7 +87,7 @@ (label_definition command: _ @function.macro - name: (curly_group_text + name: (curly_group_label (_) @markup.link @nospell)) (label_reference_range @@ -99,7 +99,7 @@ (label_reference command: _ @function.macro - names: (curly_group_text_list + names: (curly_group_label_list (_) @markup.link)) (label_number From 4400990e7362e2769bb1ff96895f623deb0380fa Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Mon, 7 Jul 2025 12:17:33 +0200 Subject: [PATCH 2210/2494] feat(vim): highlight "trim" in script heredocs Allow the optional "trim", as documented in ":help :lua-heredoc". --- lua/nvim-treesitter/parsers.lua | 2 +- runtime/queries/vim/highlights.scm | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index cf9368840..c25daedaa 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -2499,7 +2499,7 @@ return { }, vim = { install_info = { - revision = 'ccc312e878aa84f32d180b8528a3585c7b86a545', + revision = 'a93e834bea0975ec0ccb3f6d18540e9bd8170a4d', url = 'https://github.com/tree-sitter-grammars/tree-sitter-vim', }, maintainers = { '@clason' }, diff --git a/runtime/queries/vim/highlights.scm b/runtime/queries/vim/highlights.scm index 20a044a60..c35986fa3 100644 --- a/runtime/queries/vim/highlights.scm +++ b/runtime/queries/vim/highlights.scm @@ -253,6 +253,9 @@ (heredoc (parameter) @keyword) +(script + (parameter) @keyword) + [ (marker_definition) (endmarker) From 3dc6834b30c96b0b11f467136d0a03bb100d868a Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 8 Jul 2025 16:53:58 +0200 Subject: [PATCH 2211/2494] feat(parsers): update blueprint, desktop, fortran, javadoc, llvm, mlir, nu, requirements, superhtml, swift, v, xresources --- lua/nvim-treesitter/parsers.lua | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index c25daedaa..cadffc13f 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -133,7 +133,7 @@ return { }, blueprint = { install_info = { - revision = '60ba73739c6083c693d86a1a7cf039c07eb4ed59', + revision = '355ef84ef8a958ac822117b652cf4d49bac16c79', url = 'https://gitlab.com/gabmus/tree-sitter-blueprint', }, maintainers = { '@gabmus' }, @@ -346,7 +346,7 @@ return { }, desktop = { install_info = { - revision = '5fc42b211b261d7c10f97f2c7fa9665cd0d3c8a0', + revision = '6096afc7b7a9e208036dff9103c71ddfe9580c54', url = 'https://github.com/ValdezFOmar/tree-sitter-desktop', }, maintainers = { '@ValdezFOmar' }, @@ -592,7 +592,7 @@ return { }, fortran = { install_info = { - revision = '1b08f4c65fb47c76d3532cd3f7432d03abb9ef69', + revision = '7021f9f0f44bbcb7c646b594b6ef8db3ed787f8e', url = 'https://github.com/stadelmanma/tree-sitter-fortran', }, maintainers = { '@amaanq' }, @@ -1067,7 +1067,7 @@ return { }, javadoc = { install_info = { - revision = 'c5b7341f62498ea139d591a5d6f450dc879b53b0', + revision = 'e3420bd8b3e6fa996348c4bbcf627b812a8c1422', url = 'https://github.com/rmuir/tree-sitter-javadoc', }, maintainers = { '@rmuir' }, @@ -1280,7 +1280,7 @@ return { }, llvm = { install_info = { - revision = '1ac83114e71839fa67f4cce2f864ebbbdf6e2a4f', + revision = 'badf46daedc7b469f5e849b53f2fb34e881962f1', url = 'https://github.com/benwilliamgraham/tree-sitter-llvm', }, maintainers = { '@benwilliamgraham' }, @@ -1391,7 +1391,7 @@ return { mlir = { install_info = { generate = true, - revision = 'ddd4cd2e274813b97624fd3f30803f1db2001474', + revision = '78eb123cab8bb0dfaacb6b1ee617ef3fcc29d8b1', url = 'https://github.com/artagnon/tree-sitter-mlir', }, maintainers = { '@artagnon' }, @@ -1471,7 +1471,7 @@ return { }, nu = { install_info = { - revision = '436b3f94578974d6e0c89c201d4b99329ad0e944', + revision = '6810930d133af12aed8fe4557935b635934ab61a', url = 'https://github.com/nushell/tree-sitter-nu', }, maintainers = { '@abhisheksingh0x558' }, @@ -1877,7 +1877,7 @@ return { }, requirements = { install_info = { - revision = '728910099ddea7f1f94ea95a35a70d1ea76a1639', + revision = 'caeb2ba854dea55931f76034978de1fd79362939', url = 'https://github.com/tree-sitter-grammars/tree-sitter-requirements', }, maintainers = { '@ObserverOfTime' }, @@ -2159,7 +2159,7 @@ return { superhtml = { install_info = { location = 'tree-sitter-superhtml', - revision = '13f5a2221cb748bbe50ad702e89362afd5b925a7', + revision = '0b9bd0e8fd6284c0cfca85f7997535fe7f051046', url = 'https://github.com/kristoff-it/superhtml', }, maintainers = { '@rockorager' }, @@ -2193,7 +2193,7 @@ return { swift = { install_info = { generate = true, - revision = 'd8816ef1aae8d1e7cf23adff2ace9d556d4b369f', + revision = '370a4261d702c51d5d830b06bd4c25e44677d01b', url = 'https://github.com/alex-pinkus/tree-sitter-swift', }, maintainers = { '@alex-pinkus' }, @@ -2459,7 +2459,7 @@ return { v = { install_info = { location = 'tree_sitter_v', - revision = '6c511fc884312720e30ef5d169c63fe5f3d0209f', + revision = '236d51bba1bccd57fd2950956fbffe5fe0248735', url = 'https://github.com/vlang/v-analyzer', }, maintainers = { '@kkharji', '@amaanq' }, @@ -2583,7 +2583,7 @@ return { }, xresources = { install_info = { - revision = '65d52b286af0b2dd7153e045869a566b33a28f44', + revision = 'db9bf1aeca3e54dd390ae1d3994c665ca7ef5fa2', url = 'https://github.com/ValdezFOmar/tree-sitter-xresources', }, maintainers = { '@ValdezFOmar' }, From 4eb12d7a1f82b6c8db9929bf2c4b38dc3177dd82 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 8 Jul 2025 17:01:38 +0200 Subject: [PATCH 2212/2494] feat(ziggy,ziggy-schema): update parser and queries Breaking change: ziggy-schema removed "map" node --- lua/nvim-treesitter/parsers.lua | 4 ++-- runtime/queries/ziggy_schema/highlights.scm | 12 +++++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index cadffc13f..91ab94f1f 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -2632,7 +2632,7 @@ return { ziggy = { install_info = { location = 'tree-sitter-ziggy', - revision = 'fe3bf9389e7ff213cf3548caaf9c6f3d4bb38647', + revision = 'eeb21acc0a369dca503167fe963f4f5a7eda2659', url = 'https://github.com/kristoff-it/ziggy', }, maintainers = { '@rockorager' }, @@ -2641,7 +2641,7 @@ return { ziggy_schema = { install_info = { location = 'tree-sitter-ziggy-schema', - revision = 'fe3bf9389e7ff213cf3548caaf9c6f3d4bb38647', + revision = 'eeb21acc0a369dca503167fe963f4f5a7eda2659', url = 'https://github.com/kristoff-it/ziggy', }, maintainers = { '@rockorager' }, diff --git a/runtime/queries/ziggy_schema/highlights.scm b/runtime/queries/ziggy_schema/highlights.scm index 4e1770127..8555c79cc 100644 --- a/runtime/queries/ziggy_schema/highlights.scm +++ b/runtime/queries/ziggy_schema/highlights.scm @@ -9,9 +9,18 @@ "struct" "root" "enum" - "map" + "null" ] @keyword +(string) @string + +(number) @number + +[ + "true" + "false" +] @boolean + (identifier) @type "?" @type @@ -27,6 +36,7 @@ [ "," + ":" "|" ] @punctuation.delimiter From c9e4edc127a90c3969e1bf5cdeab8892247e9c41 Mon Sep 17 00:00:00 2001 From: Caleb White Date: Thu, 19 Jun 2025 10:42:38 -0500 Subject: [PATCH 2213/2494] feat(blade): update blade parser and queries --- lua/nvim-treesitter/parsers.lua | 2 +- runtime/queries/blade/folds.scm | 3 +- runtime/queries/blade/highlights.scm | 21 ++++----- runtime/queries/blade/indents.scm | 16 ++++++- runtime/queries/blade/injections.scm | 66 ++++++++++++++++++++++++---- 5 files changed, 86 insertions(+), 22 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 91ab94f1f..8270b58a5 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -125,7 +125,7 @@ return { }, blade = { install_info = { - revision = 'fbe5f81b54f0f6153961824ce306ffc805134980', + revision = '5dd29dd50fa6c3de0bb5a2d24ec03f99ddb960bf', url = 'https://github.com/EmranMR/tree-sitter-blade', }, maintainers = { '@calebdw' }, diff --git a/runtime/queries/blade/folds.scm b/runtime/queries/blade/folds.scm index cc081a754..07c1fd86f 100644 --- a/runtime/queries/blade/folds.scm +++ b/runtime/queries/blade/folds.scm @@ -1,5 +1,6 @@ +; inherits: html + [ - (authorization) (conditional) (envoy) (fragment) diff --git a/runtime/queries/blade/highlights.scm b/runtime/queries/blade/highlights.scm index c05d2845f..b20999a5f 100644 --- a/runtime/queries/blade/highlights.scm +++ b/runtime/queries/blade/highlights.scm @@ -1,15 +1,16 @@ -([ +; inherits: html + +[ (directive) (directive_start) (directive_end) ] @tag - (#set! priority 101)) -([ - (bracket_start) - (bracket_end) -] @tag.delimiter - (#set! priority 101)) - -((comment) @comment @spell - (#set! priority 101)) +[ + "{{" + "}}" + "{!!" + "!!}" + "(" + ")" +] @punctuation.bracket diff --git a/runtime/queries/blade/indents.scm b/runtime/queries/blade/indents.scm index bd3e84d16..a52bb3697 100644 --- a/runtime/queries/blade/indents.scm +++ b/runtime/queries/blade/indents.scm @@ -1,3 +1,15 @@ -(directive_start) @indent.begin +; inherits: html -(directive_end) @indent.end +[ + (conditional) + (envoy) + (fragment) + (livewire) + (loop) + (once) + (php_statement) + (section) + (stack) + (switch) + (verbatim) +] @indent.begin diff --git a/runtime/queries/blade/injections.scm b/runtime/queries/blade/injections.scm index 12fa9f953..e8a0d708d 100644 --- a/runtime/queries/blade/injections.scm +++ b/runtime/queries/blade/injections.scm @@ -1,15 +1,65 @@ -((text) @injection.content - (#set! injection.combined) - (#set! injection.language html)) +; inherits: html + +((php_only) @injection.content + (#set! injection.language "php_only")) + +((parameter) @injection.content + (#set! injection.include-children) + (#set! injection.language "php_only")) ((text) @injection.content (#has-ancestor? @injection.content "envoy") (#set! injection.combined) (#set! injection.language bash)) -((php_only) @injection.content - (#set! injection.combined) - (#set! injection.language php_only)) +; Livewire attributes +;
+(attribute + (attribute_name) @_attr + (#any-of? @_attr "wire:model" "wire:click" "wire:stream" "wire:text" "wire:show") + (quoted_attribute_value + (attribute_value) @injection.content) + (#set! injection.language "javascript")) -((parameter) @injection.content - (#set! injection.language php_only)) +; AlpineJS attributes +;
+(attribute + (attribute_name) @_attr + (#lua-match? @_attr "^x%-%l+") + (#not-any-of? @_attr "x-teleport" "x-ref" "x-transition") + (quoted_attribute_value + (attribute_value) @injection.content) + (#set! injection.language "javascript")) + +(attribute + (attribute_name) @_attr + (#lua-match? @_attr "^[:@]%l+") + (quoted_attribute_value + (attribute_value) @injection.content) + (#set! injection.language "javascript")) + +; Blade escaped JS attributes +; +(element + (_ + (tag_name) @_tag + (#lua-match? @_tag "^x%-%l+") + (attribute + (attribute_name) @_attr + (#lua-match? @_attr "^::%l+") + (quoted_attribute_value + (attribute_value) @injection.content) + (#set! injection.language "javascript")))) + +; Blade PHP attributes +; +(element + (_ + (tag_name) @_tag + (#lua-match? @_tag "^x%-%l+") + (attribute + (attribute_name) @_attr + (#lua-match? @_attr "^:%l+") + (quoted_attribute_value + (attribute_value) @injection.content) + (#set! injection.language "php_only")))) From c3ecec599b09684d900f4dd888676589a195a719 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 13 Jul 2025 11:31:00 +0200 Subject: [PATCH 2214/2494] feat(parsers): update beancount, blade, cpp, desktop, gosum, javadoc, liquidsoap, mlir, nix, slint, systemverilog, t32, vim, xresources --- lua/nvim-treesitter/parsers.lua | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 8270b58a5..4bd000d80 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -93,7 +93,7 @@ return { }, beancount = { install_info = { - revision = '9bc460a05b5f096d69568b5fb36105032ff4ff97', + revision = '97b46e5f37aa9030e9701c816e20760760ab4907', url = 'https://github.com/polarmutex/tree-sitter-beancount', }, maintainers = { '@polarmutex' }, @@ -125,7 +125,7 @@ return { }, blade = { install_info = { - revision = '5dd29dd50fa6c3de0bb5a2d24ec03f99ddb960bf', + revision = '59ce5b68e288002e3aee6cf5a379bbef21adbe6c', url = 'https://github.com/EmranMR/tree-sitter-blade', }, maintainers = { '@calebdw' }, @@ -278,7 +278,7 @@ return { }, cpp = { install_info = { - revision = '2871652b9893ab19e621628da03e670227a5d9d0', + revision = '5cb9b693cfd7bfacab1d9ff4acac1a4150700609', url = 'https://github.com/tree-sitter/tree-sitter-cpp', }, maintainers = { '@theHamsta' }, @@ -346,7 +346,7 @@ return { }, desktop = { install_info = { - revision = '6096afc7b7a9e208036dff9103c71ddfe9580c54', + revision = 'deb91f587c97814058aea2cbd790e0b85c9bb361', url = 'https://github.com/ValdezFOmar/tree-sitter-desktop', }, maintainers = { '@ValdezFOmar' }, @@ -803,7 +803,7 @@ return { }, gosum = { install_info = { - revision = 'e2ac513b2240c7ff1069ae33b2df29ce90777c11', + revision = '27816eb6b7315746ae9fcf711e4e1396dc1cf237', url = 'https://github.com/tree-sitter-grammars/tree-sitter-go-sum', }, maintainers = { '@amaanq' }, @@ -1067,7 +1067,7 @@ return { }, javadoc = { install_info = { - revision = 'e3420bd8b3e6fa996348c4bbcf627b812a8c1422', + revision = '1a55fc4c0f9c24cf927a84cb7d382665523d45c5', url = 'https://github.com/rmuir/tree-sitter-javadoc', }, maintainers = { '@rmuir' }, @@ -1272,7 +1272,7 @@ return { }, liquidsoap = { install_info = { - revision = '05a5dbb23addd207a295b904e44dbdd321b3b332', + revision = '4de01f44de2c051c33832ce523cf44690561320d', url = 'https://github.com/savonet/tree-sitter-liquidsoap', }, maintainers = { '@toots' }, @@ -1391,7 +1391,7 @@ return { mlir = { install_info = { generate = true, - revision = '78eb123cab8bb0dfaacb6b1ee617ef3fcc29d8b1', + revision = '36f08b4c39997ee7b864ddeff1c64e5507be438e', url = 'https://github.com/artagnon/tree-sitter-mlir', }, maintainers = { '@artagnon' }, @@ -1455,7 +1455,7 @@ return { }, nix = { install_info = { - revision = 'cfc53fd287d23ab7281440a8526c73542984669b', + revision = 'cd4f6594508c820dca196d931c6bd4d21ef18520', url = 'https://github.com/cstrahan/tree-sitter-nix', }, maintainers = { '@leo60228' }, @@ -2027,7 +2027,7 @@ return { }, slint = { install_info = { - revision = '03f24aa22d6712f79004286df6dd416ca6d2a91d', + revision = '6ee7d053feabfff5d401491043a7286e30ffd7a8', url = 'https://github.com/slint-ui/tree-sitter-slint', }, maintainers = { '@hunger' }, @@ -2217,7 +2217,7 @@ return { }, systemverilog = { install_info = { - revision = '0dc5d86af86120094d9f1268613b529142212ddd', + revision = '48dfe3c2579b851e1ef38a326b0aee9900afb9ae', url = 'https://github.com/gmlarumbe/tree-sitter-systemverilog', }, maintainers = { '@zhangwwpeng' }, @@ -2225,7 +2225,7 @@ return { }, t32 = { install_info = { - revision = '412cf98b2784dfe9c95ce0d7de840605c6953417', + revision = '55b387ceead98ceaf38878ecc88f280e7f56f64c', url = 'https://gitlab.com/xasc/tree-sitter-t32', }, maintainers = { '@xasc' }, @@ -2499,7 +2499,7 @@ return { }, vim = { install_info = { - revision = 'a93e834bea0975ec0ccb3f6d18540e9bd8170a4d', + revision = '3dd4747082d1b717b8978211c06ef7b6cd16125b', url = 'https://github.com/tree-sitter-grammars/tree-sitter-vim', }, maintainers = { '@clason' }, @@ -2583,7 +2583,7 @@ return { }, xresources = { install_info = { - revision = 'db9bf1aeca3e54dd390ae1d3994c665ca7ef5fa2', + revision = '9901f4f25f656a58bc7129098371d99279717efe', url = 'https://github.com/ValdezFOmar/tree-sitter-xresources', }, maintainers = { '@ValdezFOmar' }, From 6c2234f7ba98ee8fec3b079939449a2d3e5c16b6 Mon Sep 17 00:00:00 2001 From: Riley Bruins Date: Mon, 14 Jul 2025 17:48:23 -0700 Subject: [PATCH 2215/2494] feat(c_sharp): highlight `::` (#8002) --- runtime/queries/c_sharp/highlights.scm | 1 + 1 file changed, 1 insertion(+) diff --git a/runtime/queries/c_sharp/highlights.scm b/runtime/queries/c_sharp/highlights.scm index f23d7ec65..5055990b0 100644 --- a/runtime/queries/c_sharp/highlights.scm +++ b/runtime/queries/c_sharp/highlights.scm @@ -439,6 +439,7 @@ "." "," ":" + "::" ] @punctuation.delimiter (conditional_expression From 96f51adf716c2e289e88b9e291faa393c03f85c9 Mon Sep 17 00:00:00 2001 From: Riley Bruins Date: Mon, 14 Jul 2025 17:55:29 -0700 Subject: [PATCH 2216/2494] fix(c_sharp): "<", ">" in type param lists are brackets (#8003) --- runtime/queries/c_sharp/highlights.scm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/runtime/queries/c_sharp/highlights.scm b/runtime/queries/c_sharp/highlights.scm index 5055990b0..ce9911151 100644 --- a/runtime/queries/c_sharp/highlights.scm +++ b/runtime/queries/c_sharp/highlights.scm @@ -459,6 +459,12 @@ (interpolation_brace) @punctuation.special +(type_parameter_list + [ + "<" + ">" + ] @punctuation.bracket) + (type_argument_list [ "<" From 8d8ca0996c79348cd59cf31065954f40fcf1679f Mon Sep 17 00:00:00 2001 From: Riley Bruins Date: Sun, 29 Jun 2025 19:53:33 +0200 Subject: [PATCH 2217/2494] docs: specify fold dos and don'ts --- CONTRIBUTING.md | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f665ce1ed..f376ed802 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -345,12 +345,35 @@ The valid captures are: ### Folds -You can define folds for a given language by adding a `folds.scm` query. This is implemented in Neovim. The only valid capture is +You can define folds for a given language by adding a `folds.scm` query. This is implemented in Neovim. The only valid capture is `@fold`: ```query -@fold ; fold this node +(function_definition) @fold ; fold this node ``` +Folds should be given to nodes with defined start and end delimiters/patterns, or to consecutive nodes which are part of the same conceptual "grouping", such as consecutive line comments or import statements. The following items are valid fold candidates: + +- Function/method definitions +- Class/interface/trait definitions +- Switch/match statements, and individual match arms +- Execution blocks (such as those found in conditional statements or loops) +- Parameter/argument lists +- Array/object/string expressions +- Consecutive import statements, consecutive line comments + +The following items would *not* be valid fold candidates: + +- Multiline assignment statements +- Multiline property access expressions + +As a rule of thumb, these highlight captures usually reside in or around objects which should be folded: + +- `@function`, `@function.method` +- `@keyword.import`, `@keyword.conditional`, `@keyword.repeat` +- `@comment`, `@comment.documentation` +- `@string`, `@string.documentation` +- `@markup.heading.x`, `@markup.list` + ### Indents >[!WARNING] From 992e9ef3d09c3a52adf847c426b52e32bafad519 Mon Sep 17 00:00:00 2001 From: Riley Bruins Date: Tue, 15 Jul 2025 09:37:41 -0700 Subject: [PATCH 2218/2494] ci: ensure parsers have a supported ABI version --- .tsqueryrc.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.tsqueryrc.json b/.tsqueryrc.json index 6d020e987..e8e7fd920 100644 --- a/.tsqueryrc.json +++ b/.tsqueryrc.json @@ -1,6 +1,10 @@ { "$schema": "https://raw.githubusercontent.com/ribru17/ts_query_ls/refs/heads/master/schemas/config.json", "parser_install_directories": ["${HOME}/.local/share/nvim/site/parser"], + "supported_abi_versions": { + "start": 13, + "end": 15 + }, "parser_aliases": { "html_tags": "html", "ecma": "javascript", From a5edb0a274d0881dcb4670e2f9e06d2a146f74dd Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Thu, 17 Jul 2025 11:37:40 +0200 Subject: [PATCH 2219/2494] feat(parsers): update arduino, editorconfig, gdscript, idl, javadoc, koto, matlab, mlir, nix, nu, powershell, printf, properties, slint, superhtml, systemverilog, t32, tera, twig, xcompose, xresources, ziggy, ziggy_schema --- lua/nvim-treesitter/parsers.lua | 46 ++++++++++++++++----------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 4bd000d80..ba034d42b 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -36,7 +36,7 @@ return { }, arduino = { install_info = { - revision = '017696bdf47ca2b10948c5a511f9ab387722d0f3', + revision = '1b1fd5dbd196e80342cf79f6fc5de154232c2829', url = 'https://github.com/tree-sitter-grammars/tree-sitter-arduino', }, maintainers = { '@ObserverOfTime' }, @@ -449,7 +449,7 @@ return { }, editorconfig = { install_info = { - revision = '9281e7d8522cc0d06b61f97920e27936fa12be11', + revision = '8ed36589b5d0b3ebfdba45e1fd0ebefa01aafaea', url = 'https://github.com/ValdezFOmar/tree-sitter-editorconfig', }, maintainers = { '@ValdezFOmar' }, @@ -652,7 +652,7 @@ return { }, gdscript = { install_info = { - revision = '2ed3ef9e30a7998a98eea4dfbcd308678f93b88f', + revision = 'cfe20d13767bdede420a6349077fc7dca11c9ad1', url = 'https://github.com/PrestonKnopp/tree-sitter-gdscript', }, maintainers = { '@PrestonKnopp' }, @@ -1011,7 +1011,7 @@ return { }, idl = { install_info = { - revision = 'da50751d826030fcf8b1424de9f56cec2a274b38', + revision = 'd5d7f57dd303b35169bd38c3a2268a24d3d76e38', url = 'https://github.com/cathaysia/tree-sitter-idl', }, maintainers = { '@cathaysia' }, @@ -1067,7 +1067,7 @@ return { }, javadoc = { install_info = { - revision = '1a55fc4c0f9c24cf927a84cb7d382665523d45c5', + revision = '51cbb3daa9b8a5ba9d6467db40ef45682a06811f', url = 'https://github.com/rmuir/tree-sitter-javadoc', }, maintainers = { '@rmuir' }, @@ -1207,7 +1207,7 @@ return { }, koto = { install_info = { - revision = '620ff8a32143f24f6f8e157bd1836183599d334d', + revision = 'c379c2c0fdc68e56bb1efe0d933b8fcdf9ff203c', url = 'https://github.com/koto-lang/tree-sitter-koto', }, maintainers = { '@irh' }, @@ -1359,7 +1359,7 @@ return { }, matlab = { install_info = { - revision = 'd5fd97c7aec0881d3429642a240ad536c74582b9', + revision = 'c9abaedbc342e6c421fd37d8aa4d43389da0834a', url = 'https://github.com/acristoffers/tree-sitter-matlab', }, maintainers = { '@acristoffers' }, @@ -1391,7 +1391,7 @@ return { mlir = { install_info = { generate = true, - revision = '36f08b4c39997ee7b864ddeff1c64e5507be438e', + revision = '98b7d2c6d69c0c83e44386a40ede09924e658189', url = 'https://github.com/artagnon/tree-sitter-mlir', }, maintainers = { '@artagnon' }, @@ -1455,7 +1455,7 @@ return { }, nix = { install_info = { - revision = 'cd4f6594508c820dca196d931c6bd4d21ef18520', + revision = 'bae4c4fb39a4cc87a838817c5e2da7effac75183', url = 'https://github.com/cstrahan/tree-sitter-nix', }, maintainers = { '@leo60228' }, @@ -1471,7 +1471,7 @@ return { }, nu = { install_info = { - revision = '6810930d133af12aed8fe4557935b635934ab61a', + revision = '6544c4383643cf8608d50def2247a7af8314e148', url = 'https://github.com/nushell/tree-sitter-nu', }, maintainers = { '@abhisheksingh0x558' }, @@ -1637,7 +1637,7 @@ return { powershell = { filetype = 'ps1', install_info = { - revision = '103a700af551ba8d3402fd68e6f3cd4bf45cbe80', + revision = 'b59f9dd34f17998139877316995e796073faf84b', url = 'https://github.com/airbus-cert/tree-sitter-powershell', }, maintainers = { '@L2jLiga' }, @@ -1645,7 +1645,7 @@ return { }, printf = { install_info = { - revision = 'df6b69967db7d74ab338a86a9ab45c0966c5ee3c', + revision = 'ec4e5674573d5554fccb87a887c97d4aec489da7', url = 'https://github.com/tree-sitter-grammars/tree-sitter-printf', }, maintainers = { '@ObserverOfTime' }, @@ -1688,7 +1688,7 @@ return { }, properties = { install_info = { - revision = '579b62f5ad8d96c2bb331f07d1408c92767531d9', + revision = '6310671b24d4e04b803577b1c675d765cbd5773b', url = 'https://github.com/tree-sitter-grammars/tree-sitter-properties', }, maintainers = { '@ObserverOfTime' }, @@ -2027,7 +2027,7 @@ return { }, slint = { install_info = { - revision = '6ee7d053feabfff5d401491043a7286e30ffd7a8', + revision = '96bc969d20ff347030519184ea2467f4046a524d', url = 'https://github.com/slint-ui/tree-sitter-slint', }, maintainers = { '@hunger' }, @@ -2159,7 +2159,7 @@ return { superhtml = { install_info = { location = 'tree-sitter-superhtml', - revision = '0b9bd0e8fd6284c0cfca85f7997535fe7f051046', + revision = 'a67317fb81afe76cc04e6d92124cfc20a903cee7', url = 'https://github.com/kristoff-it/superhtml', }, maintainers = { '@rockorager' }, @@ -2217,7 +2217,7 @@ return { }, systemverilog = { install_info = { - revision = '48dfe3c2579b851e1ef38a326b0aee9900afb9ae', + revision = 'e5a589a76ce480db5a939ad4a4393c398eed35e9', url = 'https://github.com/gmlarumbe/tree-sitter-systemverilog', }, maintainers = { '@zhangwwpeng' }, @@ -2225,7 +2225,7 @@ return { }, t32 = { install_info = { - revision = '55b387ceead98ceaf38878ecc88f280e7f56f64c', + revision = '2fcca1fd8d84c582478f1aebca7c8379346f3a04', url = 'https://gitlab.com/xasc/tree-sitter-t32', }, maintainers = { '@xasc' }, @@ -2274,7 +2274,7 @@ return { }, tera = { install_info = { - revision = '53ca9100f231b72474225d98c9e53d1a4275046d', + revision = 'c0a0ebcd70a0e6a9f9ec1157308e4e0ea18b446e', url = 'https://github.com/uncenter/tree-sitter-tera', }, maintainers = { '@uncenter' }, @@ -2375,7 +2375,7 @@ return { }, twig = { install_info = { - revision = '085648e01d1422163a1702a44e72303b4e2a0bd1', + revision = '7195ee573ab5c3b3bb0e91b042e6f83ac1b11104', url = 'https://github.com/gbprod/tree-sitter-twig', }, maintainers = { '@gbprod' }, @@ -2565,7 +2565,7 @@ return { }, xcompose = { install_info = { - revision = 'fff3e72242aa110ebba6441946ea4d12d200fa68', + revision = 'a51d6366f041dbefec4da39a7eb3168a9b1cbc0e', url = 'https://github.com/tree-sitter-grammars/tree-sitter-xcompose', }, maintainers = { '@ObserverOfTime' }, @@ -2583,7 +2583,7 @@ return { }, xresources = { install_info = { - revision = '9901f4f25f656a58bc7129098371d99279717efe', + revision = 'b0822f2ea47600c6e11ee64b2dec8353c9684e8d', url = 'https://github.com/ValdezFOmar/tree-sitter-xresources', }, maintainers = { '@ValdezFOmar' }, @@ -2632,7 +2632,7 @@ return { ziggy = { install_info = { location = 'tree-sitter-ziggy', - revision = 'eeb21acc0a369dca503167fe963f4f5a7eda2659', + revision = 'de703372b2da6fd2c25a8a3c424663ff6bece4ac', url = 'https://github.com/kristoff-it/ziggy', }, maintainers = { '@rockorager' }, @@ -2641,7 +2641,7 @@ return { ziggy_schema = { install_info = { location = 'tree-sitter-ziggy-schema', - revision = 'eeb21acc0a369dca503167fe963f4f5a7eda2659', + revision = 'de703372b2da6fd2c25a8a3c424663ff6bece4ac', url = 'https://github.com/kristoff-it/ziggy', }, maintainers = { '@rockorager' }, From 61ec748ef7624b1962f392191aad61b91c0f9829 Mon Sep 17 00:00:00 2001 From: Alan Russell Date: Fri, 18 Jul 2025 17:04:42 +0100 Subject: [PATCH 2220/2494] feat(groq): add parser and queries (#8008) --- SUPPORTED_LANGUAGES.md | 1 + lua/nvim-treesitter/parsers.lua | 8 +++ runtime/queries/ecma/injections.scm | 11 +++ runtime/queries/groq/folds.scm | 5 ++ runtime/queries/groq/highlights.scm | 104 ++++++++++++++++++++++++++++ runtime/queries/groq/indents.scm | 11 +++ runtime/queries/groq/injections.scm | 2 + 7 files changed, 142 insertions(+) create mode 100644 runtime/queries/groq/folds.scm create mode 100644 runtime/queries/groq/highlights.scm create mode 100644 runtime/queries/groq/indents.scm create mode 100644 runtime/queries/groq/injections.scm diff --git a/SUPPORTED_LANGUAGES.md b/SUPPORTED_LANGUAGES.md index a3aabea78..ded6c7a66 100644 --- a/SUPPORTED_LANGUAGES.md +++ b/SUPPORTED_LANGUAGES.md @@ -117,6 +117,7 @@ ecma (queries only)[^ecma] | unstable | `HFIJL` | | @steelsojka [graphql](https://github.com/bkegley/tree-sitter-graphql) | unstable | `H IJ ` | | @bkegley [gren](https://github.com/MaeBrooks/tree-sitter-gren) | unstable | `H  J ` | | @MaeBrooks [groovy](https://github.com/murtaza64/tree-sitter-groovy) | unstable | `HFIJL` | | @murtaza64 +[groq](https://github.com/ajrussellaudio/tree-sitter-groq) | unstable | `HFIJ ` | | @ajrussellaudio [gstlaunch](https://github.com/tree-sitter-grammars/tree-sitter-gstlaunch) | unstable | `H    ` | | @theHamsta [hack](https://github.com/slackhq/tree-sitter-hack) | unstable | `H  J ` | | [hare](https://github.com/tree-sitter-grammars/tree-sitter-hare) | unstable | `HFIJL` | | @amaanq diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index ba034d42b..ef84595de 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -857,6 +857,14 @@ return { maintainers = { '@murtaza64' }, tier = 2, }, + groq = { + install_info = { + revision = '9959049ddeb4416101653a071ee923ba9f7a5cb1', + url = 'https://github.com/ajrussellaudio/tree-sitter-groq', + }, + maintainers = { '@ajrussellaudio' }, + tier = 2, + }, gstlaunch = { install_info = { revision = '549aef253fd38a53995cda1bf55c501174372bf7', diff --git a/runtime/queries/ecma/injections.scm b/runtime/queries/ecma/injections.scm index 04abafcde..669c75671 100644 --- a/runtime/queries/ecma/injections.scm +++ b/runtime/queries/ecma/injections.scm @@ -48,6 +48,17 @@ (#offset! @injection.content 0 1 0 -1) (#set! injection.include-children)) +; Sanity CMS GROQ query +; defineQuery(`...`) +(call_expression + function: (identifier) @_name + (#eq? @_name "defineQuery") + arguments: (arguments + (template_string) @injection.content) + (#offset! @injection.content 0 1 0 -1) + (#set! injection.include-children) + (#set! injection.language "groq")) + (call_expression function: (identifier) @_name (#eq? @_name "gql") diff --git a/runtime/queries/groq/folds.scm b/runtime/queries/groq/folds.scm new file mode 100644 index 000000000..1eb05837d --- /dev/null +++ b/runtime/queries/groq/folds.scm @@ -0,0 +1,5 @@ +[ + (object) + (projection) + (array) +] @fold diff --git a/runtime/queries/groq/highlights.scm b/runtime/queries/groq/highlights.scm new file mode 100644 index 000000000..e320e42c3 --- /dev/null +++ b/runtime/queries/groq/highlights.scm @@ -0,0 +1,104 @@ +; Keywords +[ + "select" + "asc" + "desc" +] @keyword + +[ + "in" + "match" +] @keyword.operator + +; Operators +[ + "==" + "!=" + ">" + ">=" + "<" + "<=" + "&&" + "||" + "!" + "+" + "-" + "*" + "/" + "%" + "**" + ".." + "..." + "=>" + "->" + "|" +] @operator + +; Punctuation +[ + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket + +[ + "," + ":" + "." +] @punctuation.delimiter + +; Literals +(string) @string + +(number) @number + +[ + (true) + (false) +] @boolean + +; Special references +[ + (null) + (star) + (parent) + (this) +] @constant.builtin + +; Identifiers +(identifier) @variable + +; Parameters +(parameter + "$" @variable.parameter + (identifier) @variable.parameter) + +; Function calls +(function_call + (identifier) @function) + +(order_function + "order" @function.builtin) + +; Comments +(comment) @comment @spell + +; String keys in projections/objects +(pair + (literal + (string) @property)) + +; Highlight field names in projections +(projection + (identifier) @property) + +; Built-in functions (essential GROQ functions) +(function_call + (identifier) @function.builtin + (#any-of? @function.builtin + "count" "length" "defined" "references" "now" "dateTime" "coalesce" "unique" "max" "min" "sum" + "avg" "round" "floor" "ceil" "abs" "sqrt" "upper" "lower" "string" "number" "boolean" "array" + "object" "type" "global" "sanity" "path" "delta" "after" "before")) diff --git a/runtime/queries/groq/indents.scm b/runtime/queries/groq/indents.scm new file mode 100644 index 000000000..b8ce9713d --- /dev/null +++ b/runtime/queries/groq/indents.scm @@ -0,0 +1,11 @@ +[ + (object) + (projection) +] @indent.begin + +[ + "{" + "}" +] @indent.branch + +"}" @indent.end diff --git a/runtime/queries/groq/injections.scm b/runtime/queries/groq/injections.scm new file mode 100644 index 000000000..2f0e58eb6 --- /dev/null +++ b/runtime/queries/groq/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) From fba060b623f32c6d2e72a2d2954beb87433aecea Mon Sep 17 00:00:00 2001 From: Riley Bruins Date: Sat, 19 Jul 2025 02:36:38 -0700 Subject: [PATCH 2221/2494] feat(pkl): add parser and queries (#8011) --- SUPPORTED_LANGUAGES.md | 1 + lua/nvim-treesitter/parsers.lua | 8 ++ runtime/queries/pkl/folds.scm | 6 + runtime/queries/pkl/highlights.scm | 203 +++++++++++++++++++++++++++++ runtime/queries/pkl/injections.scm | 6 + 5 files changed, 224 insertions(+) create mode 100644 runtime/queries/pkl/folds.scm create mode 100644 runtime/queries/pkl/highlights.scm create mode 100644 runtime/queries/pkl/injections.scm diff --git a/SUPPORTED_LANGUAGES.md b/SUPPORTED_LANGUAGES.md index ded6c7a66..764b96e3c 100644 --- a/SUPPORTED_LANGUAGES.md +++ b/SUPPORTED_LANGUAGES.md @@ -208,6 +208,7 @@ jsx (queries only)[^jsx] | unstable | `HFIJ ` | | @steelsojka [php_only](https://github.com/tree-sitter/tree-sitter-php)[^php_only] | unstable | `HFIJL` | | @tk-shirasaka, @calebdw [phpdoc](https://github.com/claytonrcarter/tree-sitter-phpdoc) | unstable | `H    ` | | @mikehaertl [pioasm](https://github.com/leo60228/tree-sitter-pioasm) | unstable | `H  J ` | | @leo60228 +[pkl](https://github.com/apple/tree-sitter-pkl) | unstable | `HF J ` | | @ribru17 [po](https://github.com/tree-sitter-grammars/tree-sitter-po) | unstable | `HF J ` | | @amaanq [pod](https://github.com/tree-sitter-perl/tree-sitter-pod) | unstable | `H    ` | | @RabbiVeesh, @LeoNerd [poe_filter](https://github.com/tree-sitter-grammars/tree-sitter-poe-filter)[^poe_filter] | unstable | `HFIJ ` | | @ObserverOfTime diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index ef84595de..5c611a3f8 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -1608,6 +1608,14 @@ return { maintainers = { '@leo60228' }, tier = 2, }, + pkl = { + install_info = { + revision = '4fc94a102c25ea383d70397dac7e677ca3731f1e', + url = 'https://github.com/apple/tree-sitter-pkl', + }, + maintainers = { '@ribru17' }, + tier = 2, + }, po = { install_info = { revision = 'bd860a0f57f697162bf28e576674be9c1500db5e', diff --git a/runtime/queries/pkl/folds.scm b/runtime/queries/pkl/folds.scm new file mode 100644 index 000000000..385c4ceb9 --- /dev/null +++ b/runtime/queries/pkl/folds.scm @@ -0,0 +1,6 @@ +[ + (clazz) + (objectBody) +] @fold + +(importClause)+ @fold diff --git a/runtime/queries/pkl/highlights.scm b/runtime/queries/pkl/highlights.scm new file mode 100644 index 000000000..bc7e72757 --- /dev/null +++ b/runtime/queries/pkl/highlights.scm @@ -0,0 +1,203 @@ +(identifier) @variable + +(qualifiedAccessExpr + (identifier) @function.method.call + . + (argumentList)) + +(qualifiedAccessExpr + (identifier) @variable.member .) + +; Operators +[ + "??" + "@" + "=" + "<" + ">" + "!" + "==" + "!=" + "<=" + ">=" + "&&" + "||" + "+" + "-" + "**" + "*" + "/" + "~/" + "%" + "|>" + "..." + "|" + "->" +] @operator + +[ + "," + ":" + "." + "?." +] @punctuation.delimiter + +[ + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket + +; Types +(clazz + (identifier) @type.definition) + +(typeAlias + (identifier) @type.definition) + +((identifier) @type + (#lua-match? @type "^[A-Z]")) + +(typeArgumentList + [ + "<" + ">" + ] @punctuation.bracket) + +; Method definitions +(classMethod + (methodHeader + (identifier) @function.method)) + +(objectMethod + (methodHeader + (identifier) @function.method)) + +; Identifiers +(classProperty + (identifier) @property) + +(objectProperty + (identifier) @property) + +(parameterList + (typedIdentifier + (identifier) @variable.parameter)) + +(objectBodyParameters + (typedIdentifier + (identifier) @variable.parameter)) + +; Literals +[ + (stringConstant) + (slStringLiteralExpr) + (mlStringLiteralExpr) +] @string + +(escapeSequence) @string.escape + +(intLiteralExpr) @number + +(floatLiteralExpr) @number.float + +(stringInterpolation + [ + "\\(" + "\\#(" + "\\##(" + "\\###(" + "\\####(" + "\\#####(" + "\\######(" + ] @punctuation.special + ")" @punctuation.special) + +(nullableType + "?" @punctuation.special) + +[ + (lineComment) + (blockComment) +] @comment @spell + +(docComment) @comment.documentation @spell + +(shebangComment) @keyword.directive + +; Keywords +[ + "abstract" + "external" + "for" + "is" + "let" + "new" + "out" +] @keyword + +"function" @keyword.function + +[ + "as" + "in" +] @keyword.operator + +[ + "typealias" + "class" + "module" +] @keyword.type + +[ + "import" + "import*" + "amends" + "extends" +] @keyword.import + +[ + "when" + "if" + "else" +] @keyword.conditional + +(modifier) @keyword.modifier + +(importExpr + [ + "import" + "import*" + ] @function.builtin) + +(moduleExpr + "module" @type.builtin) + +[ + (outerExpr) + "super" + (thisExpr) +] @variable.builtin + +[ + "read" + "read?" + "read*" + "throw" + "trace" +] @function.builtin + +(nullLiteralExpr) @constant.builtin + +[ + (falseLiteralExpr) + (trueLiteralExpr) +] @boolean + +(newExpr + (declaredType + (qualifiedIdentifier + (identifier) @constructor .))) diff --git a/runtime/queries/pkl/injections.scm b/runtime/queries/pkl/injections.scm new file mode 100644 index 000000000..9d563b440 --- /dev/null +++ b/runtime/queries/pkl/injections.scm @@ -0,0 +1,6 @@ +([ + (lineComment) + (blockComment) + (docComment) +] @injection.content + (#set! injection.language "comment")) From a98e67ad40e4ac97deee8ea97ce2d1c8c27352cc Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sat, 19 Jul 2025 15:00:01 +0200 Subject: [PATCH 2222/2494] fix(wit): update repo url --- SUPPORTED_LANGUAGES.md | 2 +- lua/nvim-treesitter/parsers.lua | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/SUPPORTED_LANGUAGES.md b/SUPPORTED_LANGUAGES.md index 764b96e3c..8c6cd3ace 100644 --- a/SUPPORTED_LANGUAGES.md +++ b/SUPPORTED_LANGUAGES.md @@ -324,7 +324,7 @@ jsx (queries only)[^jsx] | unstable | `HFIJ ` | | @steelsojka [wgsl](https://github.com/szebniok/tree-sitter-wgsl) | unstable | `HFIJ ` | | @szebniok [wgsl_bevy](https://github.com/tree-sitter-grammars/tree-sitter-wgsl-bevy) | unstable | `HFI  ` | | @theHamsta [wing](https://github.com/winglang/tree-sitter-wing) | unstable | `HF JL` | | @gshpychka, @MarkMcCulloh -[wit](https://github.com/liamwh/tree-sitter-wit) | unmaintained | `HF J ` | | @liamwh +[wit](https://github.com/bytecodealliance/tree-sitter-wit) | unstable | `HF J ` | | @liamwh [xcompose](https://github.com/tree-sitter-grammars/tree-sitter-xcompose) | unstable | `H  JL` | | @ObserverOfTime [xml](https://github.com/tree-sitter-grammars/tree-sitter-xml) | unstable | `HFIJL` | | @ObserverOfTime [xresources](https://github.com/ValdezFOmar/tree-sitter-xresources) | unstable | `HF JL` | | @ValdezFOmar diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 5c611a3f8..b1d21fbd5 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -2574,10 +2574,10 @@ return { wit = { install_info = { revision = '37bf43c7f11d2b4af7a78d98a19e6d5c2cf04ad2', - url = 'https://github.com/liamwh/tree-sitter-wit', + url = 'https://github.com/bytecodealliance/tree-sitter-wit', }, maintainers = { '@liamwh' }, - tier = 3, + tier = 2, }, xcompose = { install_info = { From 1e3b7562c2497ec5a9adfa8a2f036cb3da46ec3a Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sat, 19 Jul 2025 15:15:04 +0200 Subject: [PATCH 2223/2494] feat(wit)!: update parser and queries --- SUPPORTED_LANGUAGES.md | 2 +- lua/nvim-treesitter/parsers.lua | 4 ++-- runtime/queries/wit/folds.scm | 9 ++------- runtime/queries/wit/highlights.scm | 23 ++++++++++++++--------- runtime/queries/wit/injections.scm | 5 ++++- 5 files changed, 23 insertions(+), 20 deletions(-) diff --git a/SUPPORTED_LANGUAGES.md b/SUPPORTED_LANGUAGES.md index 8c6cd3ace..cd6846f25 100644 --- a/SUPPORTED_LANGUAGES.md +++ b/SUPPORTED_LANGUAGES.md @@ -324,7 +324,7 @@ jsx (queries only)[^jsx] | unstable | `HFIJ ` | | @steelsojka [wgsl](https://github.com/szebniok/tree-sitter-wgsl) | unstable | `HFIJ ` | | @szebniok [wgsl_bevy](https://github.com/tree-sitter-grammars/tree-sitter-wgsl-bevy) | unstable | `HFI  ` | | @theHamsta [wing](https://github.com/winglang/tree-sitter-wing) | unstable | `HF JL` | | @gshpychka, @MarkMcCulloh -[wit](https://github.com/bytecodealliance/tree-sitter-wit) | unstable | `HF J ` | | @liamwh +[wit](https://github.com/bytecodealliance/tree-sitter-wit) | unstable | `HF J ` | | @mkatychev [xcompose](https://github.com/tree-sitter-grammars/tree-sitter-xcompose) | unstable | `H  JL` | | @ObserverOfTime [xml](https://github.com/tree-sitter-grammars/tree-sitter-xml) | unstable | `HFIJL` | | @ObserverOfTime [xresources](https://github.com/ValdezFOmar/tree-sitter-xresources) | unstable | `HF JL` | | @ValdezFOmar diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index b1d21fbd5..aa9009430 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -2573,10 +2573,10 @@ return { }, wit = { install_info = { - revision = '37bf43c7f11d2b4af7a78d98a19e6d5c2cf04ad2', + revision = 'a0fd28afe24511160f0601ab45044690c1cb7d92', url = 'https://github.com/bytecodealliance/tree-sitter-wit', }, - maintainers = { '@liamwh' }, + maintainers = { '@mkatychev' }, tier = 2, }, xcompose = { diff --git a/runtime/queries/wit/folds.scm b/runtime/queries/wit/folds.scm index 7f84ddd2e..d2a12f122 100644 --- a/runtime/queries/wit/folds.scm +++ b/runtime/queries/wit/folds.scm @@ -1,11 +1,6 @@ -[ - (world_items) - (world_body) - (interface_items) - (interface_body) -] @fold +(body) @fold -(world_items +(body [ (use_item) (import_item) diff --git a/runtime/queries/wit/highlights.scm b/runtime/queries/wit/highlights.scm index 1f4b01cce..6bccf5ba0 100644 --- a/runtime/queries/wit/highlights.scm +++ b/runtime/queries/wit/highlights.scm @@ -1,12 +1,10 @@ -(comment) @comment @spell - (ty (id)) @type (package_decl (id) @module) -(valid_semver) @string.special +(version) @string.special (world_item name: (id) @module) @@ -17,7 +15,7 @@ (import_item name: (id) @module (extern_type - (interface_body))) + (body))) (import_item name: (id) @function @@ -27,7 +25,7 @@ (export_item name: (id) @module (extern_type - (interface_body))) + (body))) (export_item name: (id) @function @@ -55,7 +53,7 @@ (flags_items name: (id) @type) -(flags_body +(body (id) @variable.member) (variant_items @@ -128,8 +126,6 @@ "s64" "f32" "f64" - "float32" ; deprecated - "float64" ; deprecated "char" "bool" "string" @@ -163,4 +159,13 @@ "<" ] @punctuation.bracket -"=" @operator +[ + (line_comment) + (block_comment) +] @comment @spell + +(line_comment + (doc_comment)) @comment.documentation + +(block_comment + (doc_comment)) @comment.documentation diff --git a/runtime/queries/wit/injections.scm b/runtime/queries/wit/injections.scm index 2f0e58eb6..3cd6aac8e 100644 --- a/runtime/queries/wit/injections.scm +++ b/runtime/queries/wit/injections.scm @@ -1,2 +1,5 @@ -((comment) @injection.content +([ + (line_comment) + (block_comment) +] @injection.content (#set! injection.language "comment")) From 20d77c2e5ba71315dee7dcf47456557413b1481e Mon Sep 17 00:00:00 2001 From: Robert Muir Date: Thu, 17 Jul 2025 22:12:23 -0400 Subject: [PATCH 2224/2494] fix(jinja): assign highlights to all variables and functions The majority of jinja variables aren't assigned any highlights at all. Assign @variable to all identifiers. Jinja filters without parameters are not highlighted as functions: add a query for these. Refine the existing @variable.member to only capture identifiers instead of broader nodes. --- runtime/queries/jinja_inline/highlights.scm | 30 ++++++++++++++++---- tests/query/highlights/jinja/filters.jinja | 19 +++++++++++++ tests/query/highlights/jinja/tests.jinja | 13 +++++++++ tests/query/highlights/jinja/variables.jinja | 21 ++++++++++++++ 4 files changed, 77 insertions(+), 6 deletions(-) create mode 100644 tests/query/highlights/jinja/filters.jinja create mode 100644 tests/query/highlights/jinja/tests.jinja create mode 100644 tests/query/highlights/jinja/variables.jinja diff --git a/runtime/queries/jinja_inline/highlights.scm b/runtime/queries/jinja_inline/highlights.scm index 69dba77b3..3a9660471 100644 --- a/runtime/queries/jinja_inline/highlights.scm +++ b/runtime/queries/jinja_inline/highlights.scm @@ -71,11 +71,7 @@ "as" ] @keyword.import -(import_statement - (identifier) @variable) - -(import_as - (identifier) @variable) +(identifier) @variable [ "if" @@ -109,12 +105,34 @@ (expression "." - (expression)+ @variable.member) + (expression + (binary_expression + . + (unary_expression + (primary_expression + (identifier) @variable.member))))) + +(expression + "." + (expression + (binary_expression + (binary_expression + (unary_expression + (primary_expression + (identifier) @variable.member)))))) (assignment_expression "." (identifier)+ @variable.member) +; jinja filters +(binary_expression + (binary_operator + "|") + (unary_expression + (primary_expression + (identifier) @function.call))) + (inline_trans "_" @function.builtin) diff --git a/tests/query/highlights/jinja/filters.jinja b/tests/query/highlights/jinja/filters.jinja new file mode 100644 index 000000000..a084cdc1a --- /dev/null +++ b/tests/query/highlights/jinja/filters.jinja @@ -0,0 +1,19 @@ +{{ name|striptags|title }} +{# ^^^^ @variable #} +{# ^^^^^ @function.call #} +{# ^^^^^ @function.call #} + +{{ listx|join(', ') }} +{# ^^^^^ @variable #} +{# ^^^^ @function.call #} +{# ^^^^ @string #} + +{{ listx|join(str) }} +{# ^^^^^ @variable #} +{# ^^^^ @function.call #} +{# ^^^ @variable.parameter #} + +{{ foo.bar|random }} +{# ^^^ @variable #} +{# ^^^ @variable.member #} +{# ^^^^^^ @function.call #} diff --git a/tests/query/highlights/jinja/tests.jinja b/tests/query/highlights/jinja/tests.jinja new file mode 100644 index 000000000..0a138fb80 --- /dev/null +++ b/tests/query/highlights/jinja/tests.jinja @@ -0,0 +1,13 @@ +{% if loop.index is divisibleby 3 %} +{# ^^^^ @variable #} +{# ^^^^^ @variable.member #} +{# ^^^^^^^^^^ @keyword.operator #} + +{% if loop.index is divisibleby(3) %} +{# ^^^^ @variable #} +{# ^^^^^ @variable.member #} + +{% if foo.bar.baz is divisibleby 3 %} +{# ^^^ @variable #} +{# ^^^ @variable.member #} +{# ^^^ @variable.member #} diff --git a/tests/query/highlights/jinja/variables.jinja b/tests/query/highlights/jinja/variables.jinja new file mode 100644 index 000000000..1ab78c35a --- /dev/null +++ b/tests/query/highlights/jinja/variables.jinja @@ -0,0 +1,21 @@ +{{ foo }} +{# ^^^ @variable #} + +{{ foo.bar }} +{# ^^^ @variable #} +{# ^^^ @variable.member #} + +{{ foo['bar'] }} +{# ^^^ @variable #} +{# ^^^^^ @string #} + +{{ foo.bar.baz }} +{# ^^^ @variable #} +{# ^^^ @variable.member #} +{# ^^^ @variable.member #} + +{{ foo.bar + baz.qux }} +{# ^^^ @variable #} +{# ^^^ @variable.member #} +{# ^^^ @variable #} +{# ^^^ @variable.member #} From d6bce02b89eb8f0d7ef4b128238d03a87aaf584b Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 20 Jul 2025 11:38:50 +0200 Subject: [PATCH 2225/2494] feat(parsers): update beancount, brightscript, enforce, gdscript, gpg, groq, matlab, mlir, nix, pem, pymanifest, t32, udev, vhdl --- lua/nvim-treesitter/parsers.lua | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index aa9009430..3710da058 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -93,7 +93,7 @@ return { }, beancount = { install_info = { - revision = '97b46e5f37aa9030e9701c816e20760760ab4907', + revision = 'b8309e6856fe207f0425efa4f7a1d1f27890f8e8', url = 'https://github.com/polarmutex/tree-sitter-beancount', }, maintainers = { '@polarmutex' }, @@ -150,7 +150,7 @@ return { }, brightscript = { install_info = { - revision = '48ce1687125c6dfefcc7a1bef19fa0f0f00426cc', + revision = '55168264ea174085d2e91377a33f216190df2f51', url = 'https://github.com/ajdelcimmuto/tree-sitter-brightscript', }, maintainers = { '@ajdelcimmuto' }, @@ -512,7 +512,7 @@ return { }, enforce = { install_info = { - revision = '8e4c84144153deaf2b8461def43126cea6790020', + revision = 'a194046e64bdec2c9e2e1a7caa35326387f78b95', url = 'https://github.com/simonvic/tree-sitter-enforce', }, maintainers = { '@simonvic' }, @@ -652,7 +652,7 @@ return { }, gdscript = { install_info = { - revision = 'cfe20d13767bdede420a6349077fc7dca11c9ad1', + revision = 'c370d711dc9ead679d40bb7e9364ceed0b3bfc28', url = 'https://github.com/PrestonKnopp/tree-sitter-gdscript', }, maintainers = { '@PrestonKnopp' }, @@ -827,7 +827,7 @@ return { }, gpg = { install_info = { - revision = '63e80cfe1302da9f9c7ee8d9df295f47d7d181bf', + revision = '50482a322cf1fa00dfe327ef8b00e4607eeeaa1d', url = 'https://github.com/tree-sitter-grammars/tree-sitter-gpg-config', }, maintainers = { '@ObserverOfTime' }, @@ -859,7 +859,7 @@ return { }, groq = { install_info = { - revision = '9959049ddeb4416101653a071ee923ba9f7a5cb1', + revision = '1fa1ab0eb391a270957e8ad8c731b492e3645649', url = 'https://github.com/ajrussellaudio/tree-sitter-groq', }, maintainers = { '@ajrussellaudio' }, @@ -1367,7 +1367,7 @@ return { }, matlab = { install_info = { - revision = 'c9abaedbc342e6c421fd37d8aa4d43389da0834a', + revision = 'dfed7b4bc548f2c036837c3e7e09cae7d1835289', url = 'https://github.com/acristoffers/tree-sitter-matlab', }, maintainers = { '@acristoffers' }, @@ -1399,7 +1399,7 @@ return { mlir = { install_info = { generate = true, - revision = '98b7d2c6d69c0c83e44386a40ede09924e658189', + revision = 'e2818d616fc43cbbba316723cbd68a53c66a2704', url = 'https://github.com/artagnon/tree-sitter-mlir', }, maintainers = { '@artagnon' }, @@ -1463,7 +1463,7 @@ return { }, nix = { install_info = { - revision = 'bae4c4fb39a4cc87a838817c5e2da7effac75183', + revision = 'ea1d87f7996be1329ef6555dcacfa63a69bd55c6', url = 'https://github.com/cstrahan/tree-sitter-nix', }, maintainers = { '@leo60228' }, @@ -1556,7 +1556,7 @@ return { }, pem = { install_info = { - revision = '1d16b8e063fdf4385e389096c4bc4999eaaef05f', + revision = '7374eab76f2caae02396721850f87af437b66c06', url = 'https://github.com/tree-sitter-grammars/tree-sitter-pem', }, maintainers = { '@ObserverOfTime' }, @@ -1763,7 +1763,7 @@ return { }, pymanifest = { install_info = { - revision = 'be062582956165019d3253794b4d712f66dfeaaa', + revision = 'debbdb83fe6356adc7261c41c69b45ba49c97294', url = 'https://github.com/tree-sitter-grammars/tree-sitter-pymanifest', }, maintainers = { '@ObserverOfTime' }, @@ -2241,7 +2241,7 @@ return { }, t32 = { install_info = { - revision = '2fcca1fd8d84c582478f1aebca7c8379346f3a04', + revision = '335e5533de72a4ac8c6763958df1befbdc855a30', url = 'https://gitlab.com/xasc/tree-sitter-t32', }, maintainers = { '@xasc' }, @@ -2433,7 +2433,7 @@ return { }, udev = { install_info = { - revision = '18a1d183c4c0cc40438bae2ebf8191aaf2dee8dc', + revision = '2fcb563a4d56a6b8e8c129252325fc6335e4acbf', url = 'https://github.com/tree-sitter-grammars/tree-sitter-udev', }, maintainers = { '@ObserverOfTime' }, @@ -2499,7 +2499,7 @@ return { }, vhdl = { install_info = { - revision = 'eacafa5d612fdea1d12332fe0f83e089e5571cf3', + revision = 'edf824ba11b445b7e43827587e83716b34b30fe5', url = 'https://github.com/jpt13653903/tree-sitter-vhdl', }, maintainers = { '@jpt13653903' }, From afe267b50e72ce2f79d8ae9f7693b8290e8a15ef Mon Sep 17 00:00:00 2001 From: Jonas Chevalier Date: Sun, 20 Jul 2025 11:50:56 +0200 Subject: [PATCH 2226/2494] chore(nix): update url and maintainers --- SUPPORTED_LANGUAGES.md | 2 +- lua/nvim-treesitter/parsers.lua | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/SUPPORTED_LANGUAGES.md b/SUPPORTED_LANGUAGES.md index cd6846f25..a6ff7cd52 100644 --- a/SUPPORTED_LANGUAGES.md +++ b/SUPPORTED_LANGUAGES.md @@ -191,7 +191,7 @@ jsx (queries only)[^jsx] | unstable | `HFIJ ` | | @steelsojka [nim](https://github.com/alaviss/tree-sitter-nim) | unstable | `HF JL` | | @aMOPel [nim_format_string](https://github.com/aMOPel/tree-sitter-nim-format-string) | unstable | `H  J ` | | @aMOPel [ninja](https://github.com/alemuller/tree-sitter-ninja) | unstable | `HFIJ ` | | @alemuller -[nix](https://github.com/cstrahan/tree-sitter-nix) | unstable | `HFIJL` | | @leo60228 +[nix](https://github.com/nix-community/tree-sitter-nix) | unstable | `HFIJL` | | @leo60228, @zimbatm [nqc](https://github.com/tree-sitter-grammars/tree-sitter-nqc) | unstable | `HFIJL` | | @amaanq [nu](https://github.com/nushell/tree-sitter-nu) | unstable | `HFIJ ` | | @abhisheksingh0x558 [objc](https://github.com/tree-sitter-grammars/tree-sitter-objc) | unstable | `HFIJL` | | @amaanq diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 3710da058..7680de928 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -1464,9 +1464,9 @@ return { nix = { install_info = { revision = 'ea1d87f7996be1329ef6555dcacfa63a69bd55c6', - url = 'https://github.com/cstrahan/tree-sitter-nix', + url = 'https://github.com/nix-community/tree-sitter-nix', }, - maintainers = { '@leo60228' }, + maintainers = { '@leo60228', '@zimbatm' }, tier = 2, }, nqc = { From f14b356d548eafb6e0270aad904907424e16f9cd Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 20 Jul 2025 11:47:34 +0200 Subject: [PATCH 2227/2494] feat(chatito)!: update parser and queries node `(eq)` is replaced by field `eq: _` --- lua/nvim-treesitter/parsers.lua | 2 +- runtime/queries/chatito/highlights.scm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 7680de928..034a59a7e 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -206,7 +206,7 @@ return { }, chatito = { install_info = { - revision = 'b4cbe9ab7672d5106e9550d8413835395a1be362', + revision = '433a7a150da013f380d2bd435e0c4373f7f4481c', url = 'https://github.com/tree-sitter-grammars/tree-sitter-chatito', }, maintainers = { '@ObserverOfTime' }, diff --git a/runtime/queries/chatito/highlights.scm b/runtime/queries/chatito/highlights.scm index 47113f2cf..e756064b3 100644 --- a/runtime/queries/chatito/highlights.scm +++ b/runtime/queries/chatito/highlights.scm @@ -11,7 +11,7 @@ "," @punctuation.delimiter -(eq) @operator +eq: _ @operator ([ "\"" From d116118addd7444e7bd1b65a50de2d25bec32d28 Mon Sep 17 00:00:00 2001 From: MeanderingProgrammer Date: Wed, 9 Jul 2025 15:39:16 -0700 Subject: [PATCH 2228/2494] fix(install): don't make "installed" status persistent Problem: Setting `install_status` to "installed" skips any future install or update operation (even if forced). In particular, this breaks `:TSUpdate` when calling `install()` in config files. Solution: Don't set "installed" when skipping install and clear status on successful operations. --- lua/nvim-treesitter/install.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lua/nvim-treesitter/install.lua b/lua/nvim-treesitter/install.lua index c179600b6..233ea83fe 100644 --- a/lua/nvim-treesitter/install.lua +++ b/lua/nvim-treesitter/install.lua @@ -456,7 +456,6 @@ local install_status = {} ---@type table ---@return InstallStatus status local function install_lang(lang, cache_dir, install_dir, force, generate) if not force and vim.list_contains(config.get_installed(), lang) then - install_status[lang] = 'installed' return 'installed' end @@ -475,6 +474,7 @@ local function install_lang(lang, cache_dir, install_dir, force, generate) local status = install_status[lang] assert(status and status ~= 'installing') + install_status[lang] = nil return status end @@ -570,7 +570,6 @@ end) ---@return string? err local function uninstall_lang(logger, lang, parser, queries) logger:debug('Uninstalling ' .. lang) - install_status[lang] = nil if fn.filereadable(parser) == 1 then logger:debug('Unlinking ' .. parser) From 3650b4ef6a0c2eff49d59db6d30b2549557447a4 Mon Sep 17 00:00:00 2001 From: MeanderingProgrammer Date: Sun, 20 Jul 2025 15:36:06 -0700 Subject: [PATCH 2229/2494] refactor(install): replace status enum with boolean --- lua/nvim-treesitter/install.lua | 40 +++++++++++---------------------- 1 file changed, 13 insertions(+), 27 deletions(-) diff --git a/lua/nvim-treesitter/install.lua b/lua/nvim-treesitter/install.lua index 233ea83fe..6d672908a 100644 --- a/lua/nvim-treesitter/install.lua +++ b/lua/nvim-treesitter/install.lua @@ -439,13 +439,7 @@ local function try_install_lang(lang, cache_dir, install_dir, generate) logger:info('Language installed') end ----@alias InstallStatus ---- | 'installing' ---- | 'installed' ---- | 'failed' ---- | 'timeout' - -local install_status = {} ---@type table +local installing = {} ---@type table ---@async ---@param lang string @@ -453,29 +447,21 @@ local install_status = {} ---@type table ---@param install_dir string ---@param force? boolean ---@param generate? boolean ----@return InstallStatus status +---@return boolean success local function install_lang(lang, cache_dir, install_dir, force, generate) if not force and vim.list_contains(config.get_installed(), lang) then - return 'installed' - end - - if install_status[lang] then - if install_status[lang] == 'installing' then - vim.wait(INSTALL_TIMEOUT, function() - return install_status[lang] ~= 'installing' - end) - install_status[lang] = 'timeout' - end + return true + elseif installing[lang] then + local success = vim.wait(INSTALL_TIMEOUT, function() + return not installing[lang] + end) + return success else - install_status[lang] = 'installing' + installing[lang] = true local err = try_install_lang(lang, cache_dir, install_dir, generate) - install_status[lang] = err and 'failed' or 'installed' + installing[lang] = nil + return not err end - - local status = install_status[lang] - assert(status and status ~= 'installing') - install_status[lang] = nil - return status end --- Reload the parser table and user modifications in case of update @@ -511,8 +497,8 @@ local function install(languages, options) for _, lang in ipairs(languages) do tasks[#tasks + 1] = a.async(--[[@async]] function() a.schedule() - local status = install_lang(lang, cache_dir, install_dir, options.force, options.generate) - if status ~= 'failed' then + local success = install_lang(lang, cache_dir, install_dir, options.force, options.generate) + if success then done = done + 1 end end) From 6b3bf164b207a8d1e80dffa9c5b64f8ddbd7d585 Mon Sep 17 00:00:00 2001 From: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com> Date: Mon, 21 Jul 2025 03:40:37 -0400 Subject: [PATCH 2230/2494] feat(glimmer): add fold queries (#8020) --- SUPPORTED_LANGUAGES.md | 4 ++-- runtime/queries/glimmer_javascript/folds.scm | 1 + runtime/queries/glimmer_typescript/folds.scm | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 runtime/queries/glimmer_javascript/folds.scm create mode 100644 runtime/queries/glimmer_typescript/folds.scm diff --git a/SUPPORTED_LANGUAGES.md b/SUPPORTED_LANGUAGES.md index a6ff7cd52..7a7f23505 100644 --- a/SUPPORTED_LANGUAGES.md +++ b/SUPPORTED_LANGUAGES.md @@ -101,8 +101,8 @@ ecma (queries only)[^ecma] | unstable | `HFIJL` | | @steelsojka [gitignore](https://github.com/shunsambongi/tree-sitter-gitignore) | unstable | `H  J ` | | @theHamsta [gleam](https://github.com/gleam-lang/tree-sitter-gleam) | unstable | `HFIJL` | | @amaanq [glimmer](https://github.com/ember-tooling/tree-sitter-glimmer)[^glimmer] | unstable | `HFIJL` | | @NullVoxPopuli -[glimmer_javascript](https://github.com/NullVoxPopuli/tree-sitter-glimmer-javascript) | unstable | `H IJL` | | @NullVoxPopuli -[glimmer_typescript](https://github.com/NullVoxPopuli/tree-sitter-glimmer-typescript) | unstable | `H IJ ` | | @NullVoxPopuli +[glimmer_javascript](https://github.com/NullVoxPopuli/tree-sitter-glimmer-javascript) | unstable | `HFIJL` | | @NullVoxPopuli +[glimmer_typescript](https://github.com/NullVoxPopuli/tree-sitter-glimmer-typescript) | unstable | `HFIJ ` | | @NullVoxPopuli [glsl](https://github.com/tree-sitter-grammars/tree-sitter-glsl) | unstable | `HFIJL` | | @theHamsta [gn](https://github.com/tree-sitter-grammars/tree-sitter-gn) | unstable | `HFIJL` | | @amaanq [gnuplot](https://github.com/dpezto/tree-sitter-gnuplot) | unstable | `H  J ` | | @dpezto diff --git a/runtime/queries/glimmer_javascript/folds.scm b/runtime/queries/glimmer_javascript/folds.scm new file mode 100644 index 000000000..04328f099 --- /dev/null +++ b/runtime/queries/glimmer_javascript/folds.scm @@ -0,0 +1 @@ +; inherits: ecma diff --git a/runtime/queries/glimmer_typescript/folds.scm b/runtime/queries/glimmer_typescript/folds.scm new file mode 100644 index 000000000..1b61e36da --- /dev/null +++ b/runtime/queries/glimmer_typescript/folds.scm @@ -0,0 +1 @@ +; inherits: typescript From 8c8742871a1489afd7878bfee4bc40465f4a116a Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Mon, 21 Jul 2025 11:00:40 +0200 Subject: [PATCH 2231/2494] fix(jinja): remove crashing pattern https://github.com/cathaysia/tree-sitter-jinja/issues/37 --- runtime/queries/jinja_inline/highlights.scm | 16 ++++++++-------- tests/query/highlights/jinja/filters.jinja | 19 ------------------- 2 files changed, 8 insertions(+), 27 deletions(-) delete mode 100644 tests/query/highlights/jinja/filters.jinja diff --git a/runtime/queries/jinja_inline/highlights.scm b/runtime/queries/jinja_inline/highlights.scm index 3a9660471..c072eea66 100644 --- a/runtime/queries/jinja_inline/highlights.scm +++ b/runtime/queries/jinja_inline/highlights.scm @@ -125,14 +125,14 @@ "." (identifier)+ @variable.member) -; jinja filters -(binary_expression - (binary_operator - "|") - (unary_expression - (primary_expression - (identifier) @function.call))) - +; crashes parser: https://github.com/cathaysia/tree-sitter-jinja/issues/37 +; ; jinja filters +; (binary_expression +; (binary_operator +; "|") +; (unary_expression +; (primary_expression +; (identifier) @function.call))) (inline_trans "_" @function.builtin) diff --git a/tests/query/highlights/jinja/filters.jinja b/tests/query/highlights/jinja/filters.jinja deleted file mode 100644 index a084cdc1a..000000000 --- a/tests/query/highlights/jinja/filters.jinja +++ /dev/null @@ -1,19 +0,0 @@ -{{ name|striptags|title }} -{# ^^^^ @variable #} -{# ^^^^^ @function.call #} -{# ^^^^^ @function.call #} - -{{ listx|join(', ') }} -{# ^^^^^ @variable #} -{# ^^^^ @function.call #} -{# ^^^^ @string #} - -{{ listx|join(str) }} -{# ^^^^^ @variable #} -{# ^^^^ @function.call #} -{# ^^^ @variable.parameter #} - -{{ foo.bar|random }} -{# ^^^ @variable #} -{# ^^^ @variable.member #} -{# ^^^^^^ @function.call #} From 40cca05b40438ddd74125132b0cec58c9afdccb2 Mon Sep 17 00:00:00 2001 From: Riley Bruins Date: Mon, 21 Jul 2025 19:09:00 -0700 Subject: [PATCH 2232/2494] fix(c, ecma): remove invalid predicate parameters These are not valid named nodes in their respective languages. --- runtime/queries/c/highlights.scm | 2 +- runtime/queries/ecma/indents.scm | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/runtime/queries/c/highlights.scm b/runtime/queries/c/highlights.scm index ea65075f2..442343abf 100644 --- a/runtime/queries/c/highlights.scm +++ b/runtime/queries/c/highlights.scm @@ -149,7 +149,7 @@ ((field_expression (field_identifier) @property) @_parent - (#not-has-parent? @_parent template_method function_declarator call_expression)) + (#not-has-parent? @_parent function_declarator call_expression)) (field_designator) @property diff --git a/runtime/queries/ecma/indents.scm b/runtime/queries/ecma/indents.scm index d56741670..b613426ee 100644 --- a/runtime/queries/ecma/indents.scm +++ b/runtime/queries/ecma/indents.scm @@ -33,11 +33,11 @@ (assignment_expression right: (_) @_right - (#not-kind-eq? @_right "arrow_function" "function")) @indent.begin + (#not-kind-eq? @_right "arrow_function")) @indent.begin (variable_declarator value: (_) @_value - (#not-kind-eq? @_value "arrow_function" "call_expression" "function")) @indent.begin + (#not-kind-eq? @_value "arrow_function" "call_expression")) @indent.begin (arguments ")" @indent.end) From 5d539943c6a8b7e4aa7c77c7b79517f07be5454f Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Wed, 23 Jul 2025 13:30:47 +0200 Subject: [PATCH 2233/2494] feat(parsers): update angular, beancount, fennel, gleam, idl, javadoc, jinja, jinja_inline, koto, llvm, swift, systemverilog, tera, vhdl --- lua/nvim-treesitter/parsers.lua | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 034a59a7e..8e55982ec 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -18,7 +18,7 @@ return { }, angular = { install_info = { - revision = '93bb92f1289b7fe765da6cc747c82ccdc0afeb8d', + revision = 'd1f24a8890462cb740909ff62a3a079cded288bc', url = 'https://github.com/dlvandenberg/tree-sitter-angular', }, maintainers = { '@dlvandenberg' }, @@ -93,7 +93,7 @@ return { }, beancount = { install_info = { - revision = 'b8309e6856fe207f0425efa4f7a1d1f27890f8e8', + revision = 'b7a2557e6c8cf1dc70a52cece1861522ad3903fc', url = 'https://github.com/polarmutex/tree-sitter-beancount', }, maintainers = { '@polarmutex' }, @@ -544,7 +544,7 @@ return { }, fennel = { install_info = { - revision = 'de06b9ad366f0186080056109a8c3be980129538', + revision = 'cf7c000d934f2ff0a282a2c276b1f72e7fb2a099', url = 'https://github.com/alexmozaidze/tree-sitter-fennel', }, maintainers = { '@alexmozaidze' }, @@ -709,7 +709,7 @@ return { }, gleam = { install_info = { - revision = '21e0e7ba6f4f60ee80934cb368aa13c00d370734', + revision = 'dae1551a9911b24f41d876c23f2ab05ece0a9d4c', url = 'https://github.com/gleam-lang/tree-sitter-gleam', }, maintainers = { '@amaanq' }, @@ -1019,7 +1019,7 @@ return { }, idl = { install_info = { - revision = 'd5d7f57dd303b35169bd38c3a2268a24d3d76e38', + revision = 'fb1bd480b84a5b75a0c7a44a8fed45c4fe2d9247', url = 'https://github.com/cathaysia/tree-sitter-idl', }, maintainers = { '@cathaysia' }, @@ -1075,7 +1075,7 @@ return { }, javadoc = { install_info = { - revision = '51cbb3daa9b8a5ba9d6467db40ef45682a06811f', + revision = 'de50fbed2cc4c83e5fa2ec2d4231496e06d55e32', url = 'https://github.com/rmuir/tree-sitter-javadoc', }, maintainers = { '@rmuir' }, @@ -1093,7 +1093,7 @@ return { jinja = { install_info = { location = 'tree-sitter-jinja', - revision = '251101981d86ccb2901741eddf3e7cf21567a66d', + revision = '129184fb7bbc2d3e29967002432a869ac3758f2e', url = 'https://github.com/cathaysia/tree-sitter-jinja', }, maintainers = { '@cathaysia' }, @@ -1104,7 +1104,7 @@ return { jinja_inline = { install_info = { location = 'tree-sitter-jinja_inline', - revision = '251101981d86ccb2901741eddf3e7cf21567a66d', + revision = '129184fb7bbc2d3e29967002432a869ac3758f2e', url = 'https://github.com/cathaysia/tree-sitter-jinja', }, maintainers = { '@cathaysia' }, @@ -1215,7 +1215,7 @@ return { }, koto = { install_info = { - revision = 'c379c2c0fdc68e56bb1efe0d933b8fcdf9ff203c', + revision = '2ffc77c14f0ac1674384ff629bfc207b9c57ed89', url = 'https://github.com/koto-lang/tree-sitter-koto', }, maintainers = { '@irh' }, @@ -1288,7 +1288,7 @@ return { }, llvm = { install_info = { - revision = 'badf46daedc7b469f5e849b53f2fb34e881962f1', + revision = '00c5389a4598e1dce66fbc3b3d34733d308f2751', url = 'https://github.com/benwilliamgraham/tree-sitter-llvm', }, maintainers = { '@benwilliamgraham' }, @@ -2209,7 +2209,7 @@ return { swift = { install_info = { generate = true, - revision = '370a4261d702c51d5d830b06bd4c25e44677d01b', + revision = 'fc65dc2cc87047c3a45f1d26cce79ab9062a4881', url = 'https://github.com/alex-pinkus/tree-sitter-swift', }, maintainers = { '@alex-pinkus' }, @@ -2233,7 +2233,7 @@ return { }, systemverilog = { install_info = { - revision = 'e5a589a76ce480db5a939ad4a4393c398eed35e9', + revision = '140a6d96aa753f550d01c0d6c95dbf7c0cfae3fb', url = 'https://github.com/gmlarumbe/tree-sitter-systemverilog', }, maintainers = { '@zhangwwpeng' }, @@ -2290,7 +2290,7 @@ return { }, tera = { install_info = { - revision = 'c0a0ebcd70a0e6a9f9ec1157308e4e0ea18b446e', + revision = '692937d52c8dfd91ce0dde722b9b4febbc9bc712', url = 'https://github.com/uncenter/tree-sitter-tera', }, maintainers = { '@uncenter' }, @@ -2499,7 +2499,7 @@ return { }, vhdl = { install_info = { - revision = 'edf824ba11b445b7e43827587e83716b34b30fe5', + revision = '73ff9d3e7bc42b8cc123bf5f0b2db12a900ee9b7', url = 'https://github.com/jpt13653903/tree-sitter-vhdl', }, maintainers = { '@jpt13653903' }, From 57aa15d4cc6f6459f7f8d864d16f970eb801faff Mon Sep 17 00:00:00 2001 From: MeanderingProgrammer Date: Thu, 24 Jul 2025 14:41:44 -0700 Subject: [PATCH 2234/2494] fix(install): skip duplicate dependencies --- lua/nvim-treesitter/config.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/nvim-treesitter/config.lua b/lua/nvim-treesitter/config.lua index 9a586b7b5..09ea2b7dc 100644 --- a/lua/nvim-treesitter/config.lua +++ b/lua/nvim-treesitter/config.lua @@ -164,7 +164,8 @@ function M.norm_languages(languages, skip) end end - return languages + table.sort(languages) + return vim.fn.uniq(languages) --[=[@as string[]]=] end return M From 12be0e9f245398b51d85927e6ed514222132aa0a Mon Sep 17 00:00:00 2001 From: Igor Date: Thu, 24 Jul 2025 18:59:16 -0300 Subject: [PATCH 2235/2494] fix(ini): register dosini and confini filetypes --- plugin/filetypes.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/plugin/filetypes.lua b/plugin/filetypes.lua index ecddea292..a7bb3bcc0 100644 --- a/plugin/filetypes.lua +++ b/plugin/filetypes.lua @@ -21,6 +21,7 @@ local filetypes = { haskell = { 'hs' }, haskell_persistent = { 'haskellpersistent' }, idris = { 'idris2' }, + ini = { 'confini', 'dosini' }, janet_simple = { 'janet' }, javascript = { 'javascriptreact', 'ecma', 'ecmascript', 'jsx', 'js' }, javascript_glimmer = { 'javascript.glimmer' }, From b26b4258294c742c2613a7d98fe53014d1c8fe49 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sat, 26 Jul 2025 17:30:10 +0200 Subject: [PATCH 2236/2494] feat(parsers): update gdscript, javadoc, lua, solidity, superhtml, systemverilog, zig, ziggy, ziggy_schema --- lua/nvim-treesitter/parsers.lua | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 8e55982ec..97d8c00f0 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -652,7 +652,7 @@ return { }, gdscript = { install_info = { - revision = 'c370d711dc9ead679d40bb7e9364ceed0b3bfc28', + revision = '8d30b8dbb84a5f786b93726dca158ae8ea3c413f', url = 'https://github.com/PrestonKnopp/tree-sitter-gdscript', }, maintainers = { '@PrestonKnopp' }, @@ -1075,7 +1075,7 @@ return { }, javadoc = { install_info = { - revision = 'de50fbed2cc4c83e5fa2ec2d4231496e06d55e32', + revision = 'c0d918967afc2f4d3e2276a75722e1b268730855', url = 'https://github.com/rmuir/tree-sitter-javadoc', }, maintainers = { '@rmuir' }, @@ -1296,7 +1296,7 @@ return { }, lua = { install_info = { - revision = 'e5e406935ff3e36529545955e2972646ed97f9e2', + revision = 'd76023017f7485eae629cb60d406c7a1ca0f40c9', url = 'https://github.com/tree-sitter-grammars/tree-sitter-lua', }, maintainers = { '@muniftanjim' }, @@ -2075,7 +2075,7 @@ return { }, solidity = { install_info = { - revision = 'd38dcd0b58b223c43e3f9265914fb3167dc624c6', + revision = '322a3ddffca3ed96e559003fd03fa9881d7b4e20', url = 'https://github.com/JoranHonig/tree-sitter-solidity', }, maintainers = { '@amaanq' }, @@ -2175,7 +2175,7 @@ return { superhtml = { install_info = { location = 'tree-sitter-superhtml', - revision = 'a67317fb81afe76cc04e6d92124cfc20a903cee7', + revision = '8bb212b1044b4740c14bc73b649adab58a0cb481', url = 'https://github.com/kristoff-it/superhtml', }, maintainers = { '@rockorager' }, @@ -2233,7 +2233,7 @@ return { }, systemverilog = { install_info = { - revision = '140a6d96aa753f550d01c0d6c95dbf7c0cfae3fb', + revision = 'b2c95d30954fbd3cf9be6d96a3ad82e023c2fa12', url = 'https://github.com/gmlarumbe/tree-sitter-systemverilog', }, maintainers = { '@zhangwwpeng' }, @@ -2639,7 +2639,7 @@ return { }, zig = { install_info = { - revision = 'b670c8df85a1568f498aa5c8cae42f51a90473c0', + revision = 'b71affffdb4222ff2d2dea6e164f76603b0be6bc', url = 'https://github.com/tree-sitter-grammars/tree-sitter-zig', }, maintainers = { '@amaanq' }, @@ -2648,7 +2648,7 @@ return { ziggy = { install_info = { location = 'tree-sitter-ziggy', - revision = 'de703372b2da6fd2c25a8a3c424663ff6bece4ac', + revision = 'e95c85cb58773c43e9d94c0b9422ae84697e68a1', url = 'https://github.com/kristoff-it/ziggy', }, maintainers = { '@rockorager' }, @@ -2657,7 +2657,7 @@ return { ziggy_schema = { install_info = { location = 'tree-sitter-ziggy-schema', - revision = 'de703372b2da6fd2c25a8a3c424663ff6bece4ac', + revision = 'e95c85cb58773c43e9d94c0b9422ae84697e68a1', url = 'https://github.com/kristoff-it/ziggy', }, maintainers = { '@rockorager' }, From 3561e1fb19bcd9f03ba074d769a8a78d01717b19 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 1 Aug 2025 18:01:39 +0200 Subject: [PATCH 2237/2494] feat(parsers): update ada, fortran, idl, javadoc, matlab, nim, powershell, slang, superhtml, swift, templ --- lua/nvim-treesitter/parsers.lua | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 97d8c00f0..6a2ac8f4c 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -2,7 +2,7 @@ return { ada = { install_info = { - revision = 'e8e2515465cc2d7c444498e68bdb9f1d86767f95', + revision = '0a4c27dc1308a9d2742de22e5fcfc0c137b3d3f3', url = 'https://github.com/briot/tree-sitter-ada', }, maintainers = { '@briot' }, @@ -592,7 +592,7 @@ return { }, fortran = { install_info = { - revision = '7021f9f0f44bbcb7c646b594b6ef8db3ed787f8e', + revision = '8334abca785db3a041292e3b3b818a82a55b238f', url = 'https://github.com/stadelmanma/tree-sitter-fortran', }, maintainers = { '@amaanq' }, @@ -1019,7 +1019,7 @@ return { }, idl = { install_info = { - revision = 'fb1bd480b84a5b75a0c7a44a8fed45c4fe2d9247', + revision = '777b39538f9dc4ece1d891733bb4c91fc0627b16', url = 'https://github.com/cathaysia/tree-sitter-idl', }, maintainers = { '@cathaysia' }, @@ -1075,7 +1075,7 @@ return { }, javadoc = { install_info = { - revision = 'c0d918967afc2f4d3e2276a75722e1b268730855', + revision = '26ef3becea1ff51f0025a8e0c38a6b3a39c09341', url = 'https://github.com/rmuir/tree-sitter-javadoc', }, maintainers = { '@rmuir' }, @@ -1367,7 +1367,7 @@ return { }, matlab = { install_info = { - revision = 'dfed7b4bc548f2c036837c3e7e09cae7d1835289', + revision = '2d30fdbb8fc7ec55d2fbf05172437ff0299878a5', url = 'https://github.com/acristoffers/tree-sitter-matlab', }, maintainers = { '@acristoffers' }, @@ -1438,7 +1438,7 @@ return { }, nim = { install_info = { - revision = '9ed4696d7f76e4937e2b63512a249a3ead7a0399', + revision = '4ad352773688deb84a95eeaa9872acda5b466439', url = 'https://github.com/alaviss/tree-sitter-nim', }, maintainers = { '@aMOPel' }, @@ -1653,7 +1653,7 @@ return { powershell = { filetype = 'ps1', install_info = { - revision = 'b59f9dd34f17998139877316995e796073faf84b', + revision = '96ab1da05cfb55b52ee7000b4be8a4b6fad232f5', url = 'https://github.com/airbus-cert/tree-sitter-powershell', }, maintainers = { '@L2jLiga' }, @@ -2026,7 +2026,7 @@ return { }, slang = { install_info = { - revision = 'a4454e3004a9e8fea2df7fd2535fbaa05500da21', + revision = '5b0adf65710c3a7c265f0451ed6b4789410cbe63', url = 'https://github.com/tree-sitter-grammars/tree-sitter-slang', }, maintainers = { '@theHamsta' }, @@ -2175,7 +2175,7 @@ return { superhtml = { install_info = { location = 'tree-sitter-superhtml', - revision = '8bb212b1044b4740c14bc73b649adab58a0cb481', + revision = 'c6111e7134c64b69a2934ccbba83460cb532d442', url = 'https://github.com/kristoff-it/superhtml', }, maintainers = { '@rockorager' }, @@ -2209,7 +2209,7 @@ return { swift = { install_info = { generate = true, - revision = 'fc65dc2cc87047c3a45f1d26cce79ab9062a4881', + revision = '78d84ef82c387fceeb6094038da28717ea052e39', url = 'https://github.com/alex-pinkus/tree-sitter-swift', }, maintainers = { '@alex-pinkus' }, @@ -2282,7 +2282,7 @@ return { }, templ = { install_info = { - revision = 'a35a02cb608291ac8c12082dcbd2b5f34a7ad45f', + revision = '47594c5cbef941e6a3ccf4ddb934a68cf4c68075', url = 'https://github.com/vrischmann/tree-sitter-templ', }, maintainers = { '@vrischmann' }, From 05f29103552dcdd7faa77ce7c5152759c733f988 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 1 Aug 2025 18:15:49 +0200 Subject: [PATCH 2238/2494] feat(systemverilog)!: update parser and queries Breaking changes: 1. `(comment)` node split into `(one_line_comment)` and `(block_comment)` 2. named `(directive_foo)` nodes replaced by anonymous `"'foo"` (with backtick!) nodes -- but not consistently --- lua/nvim-treesitter/parsers.lua | 2 +- runtime/queries/systemverilog/highlights.scm | 32 ++++++++++---------- runtime/queries/systemverilog/injections.scm | 5 ++- 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 6a2ac8f4c..a79361c15 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -2233,7 +2233,7 @@ return { }, systemverilog = { install_info = { - revision = 'b2c95d30954fbd3cf9be6d96a3ad82e023c2fa12', + revision = '3bd2c5d2f60ed7b07c2177b34e2976ad9a87c659', url = 'https://github.com/gmlarumbe/tree-sitter-systemverilog', }, maintainers = { '@zhangwwpeng' }, diff --git a/runtime/queries/systemverilog/highlights.scm b/runtime/queries/systemverilog/highlights.scm index 1e004ef76..21542941f 100644 --- a/runtime/queries/systemverilog/highlights.scm +++ b/runtime/queries/systemverilog/highlights.scm @@ -234,10 +234,13 @@ [ "include" "import" - "directive_include" + "`include" ] @keyword.import -(comment) @comment @spell +[ + (one_line_comment) + (block_comment) +] @comment @spell [ "@" @@ -300,9 +303,6 @@ port_name: (simple_identifier) @variable (net_decl_assignment (simple_identifier) @variable) -(ERROR - (simple_identifier) @variable) - ; variable.member (hierarchical_identifier (simple_identifier) @@ -570,17 +570,17 @@ c_name: (c_identifier) @function ; directive [ - "directive_define" - "directive_default_nettype" - "directive_resetall" - "directive_timescale" - "directive_undef" - "directive_undefineall" - "directive_ifdef" - "directive_ifndef" - "directive_elsif" - "directive_endif" - "directive_else" + "`define" + "`default_nettype" + (resetall_compiler_directive) + "`timescale" + "`undef" + (undefineall_compiler_directive) + "`ifdef" + "`ifndef" + "`elsif" + "`endif" + "`else" ] @keyword.directive.define (include_compiler_directive diff --git a/runtime/queries/systemverilog/injections.scm b/runtime/queries/systemverilog/injections.scm index 05aa24d8f..a6f3ca45e 100644 --- a/runtime/queries/systemverilog/injections.scm +++ b/runtime/queries/systemverilog/injections.scm @@ -1,4 +1,7 @@ -((comment) @injection.content +([ + (one_line_comment) + (block_comment) +] @injection.content (#set! injection.language "comment")) ((macro_text) @injection.content From a4fa3e2d187ad98eb74d27c566ab3c330397ed75 Mon Sep 17 00:00:00 2001 From: Robert Muir Date: Mon, 21 Jul 2025 11:49:54 -0400 Subject: [PATCH 2239/2494] Revert "fix(jinja): remove crashing pattern" This reverts commit 8c8742871a1489afd7878bfee4bc40465f4a116a. --- runtime/queries/jinja_inline/highlights.scm | 16 ++++++++-------- tests/query/highlights/jinja/filters.jinja | 19 +++++++++++++++++++ 2 files changed, 27 insertions(+), 8 deletions(-) create mode 100644 tests/query/highlights/jinja/filters.jinja diff --git a/runtime/queries/jinja_inline/highlights.scm b/runtime/queries/jinja_inline/highlights.scm index c072eea66..3a9660471 100644 --- a/runtime/queries/jinja_inline/highlights.scm +++ b/runtime/queries/jinja_inline/highlights.scm @@ -125,14 +125,14 @@ "." (identifier)+ @variable.member) -; crashes parser: https://github.com/cathaysia/tree-sitter-jinja/issues/37 -; ; jinja filters -; (binary_expression -; (binary_operator -; "|") -; (unary_expression -; (primary_expression -; (identifier) @function.call))) +; jinja filters +(binary_expression + (binary_operator + "|") + (unary_expression + (primary_expression + (identifier) @function.call))) + (inline_trans "_" @function.builtin) diff --git a/tests/query/highlights/jinja/filters.jinja b/tests/query/highlights/jinja/filters.jinja new file mode 100644 index 000000000..a084cdc1a --- /dev/null +++ b/tests/query/highlights/jinja/filters.jinja @@ -0,0 +1,19 @@ +{{ name|striptags|title }} +{# ^^^^ @variable #} +{# ^^^^^ @function.call #} +{# ^^^^^ @function.call #} + +{{ listx|join(', ') }} +{# ^^^^^ @variable #} +{# ^^^^ @function.call #} +{# ^^^^ @string #} + +{{ listx|join(str) }} +{# ^^^^^ @variable #} +{# ^^^^ @function.call #} +{# ^^^ @variable.parameter #} + +{{ foo.bar|random }} +{# ^^^ @variable #} +{# ^^^ @variable.member #} +{# ^^^^^^ @function.call #} From 4d9916e477e5d4e3b245845dfd285edf429f3252 Mon Sep 17 00:00:00 2001 From: Robert Muir Date: Mon, 21 Jul 2025 11:53:16 -0400 Subject: [PATCH 2240/2494] fix(jinja_inline): fix crashing query pattern If jinja_inline parser is regenerated, then this pattern hits an "impossible" assert in tree-sitter query processing. --- runtime/queries/jinja_inline/highlights.scm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/runtime/queries/jinja_inline/highlights.scm b/runtime/queries/jinja_inline/highlights.scm index 3a9660471..b66d7fb2e 100644 --- a/runtime/queries/jinja_inline/highlights.scm +++ b/runtime/queries/jinja_inline/highlights.scm @@ -127,11 +127,11 @@ ; jinja filters (binary_expression - (binary_operator - "|") + (binary_operator) @_operator (unary_expression (primary_expression - (identifier) @function.call))) + (identifier) @function.call)) + (#eq? @_operator "|")) (inline_trans "_" @function.builtin) From 37bcfdc6eba87334b58f43a19528751d3fe12f4e Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Wed, 6 Aug 2025 13:16:08 +0200 Subject: [PATCH 2241/2494] refactor(config): prefer `vim.list.unique` for normalization Also fix some emmyluals warnings --- lua/nvim-treesitter/config.lua | 11 ++++++++--- lua/nvim-treesitter/indent.lua | 3 ++- lua/nvim-treesitter/install.lua | 2 ++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/lua/nvim-treesitter/config.lua b/lua/nvim-treesitter/config.lua index 09ea2b7dc..8150ad8a8 100644 --- a/lua/nvim-treesitter/config.lua +++ b/lua/nvim-treesitter/config.lua @@ -69,7 +69,7 @@ function M.get_available(tier) languages = vim.tbl_filter( --- @param p string function(p) - return parsers[p].tier == tier + return parsers[p] ~= nil and parsers[p].tier == tier end, languages ) @@ -164,8 +164,13 @@ function M.norm_languages(languages, skip) end end - table.sort(languages) - return vim.fn.uniq(languages) --[=[@as string[]]=] + -- TODO(clason): remove Nvim 0.11 compat + if vim.list then + return vim.list.unique(languages) + else + table.sort(languages) + return vim.fn.uniq(languages) --[=[@as string[] ]=] + end end return M diff --git a/lua/nvim-treesitter/indent.lua b/lua/nvim-treesitter/indent.lua index 13f7b2740..6f8e4d8ff 100644 --- a/lua/nvim-treesitter/indent.lua +++ b/lua/nvim-treesitter/indent.lua @@ -52,7 +52,8 @@ local function find_delimiter(bufnr, node, delimiter) local end_char = { child:end_() } local trimmed_after_delim local escaped_delimiter = delimiter:gsub('[%-%.%+%[%]%(%)%$%^%%%?%*]', '%%%1') - trimmed_after_delim = line:sub(end_char[2] + 1):gsub('[%s' .. escaped_delimiter .. ']*', '') + trimmed_after_delim = + assert(line):sub(end_char[2] + 1):gsub('[%s' .. escaped_delimiter .. ']*', '') return child, #trimmed_after_delim == 0 end end diff --git a/lua/nvim-treesitter/install.lua b/lua/nvim-treesitter/install.lua index 6d672908a..29c91356c 100644 --- a/lua/nvim-treesitter/install.lua +++ b/lua/nvim-treesitter/install.lua @@ -40,6 +40,7 @@ end ---@async ---@param path string +---@return string? err local function rmpath(path) local stat = uv.fs_lstat(path) if not stat then @@ -482,6 +483,7 @@ end ---@async ---@param languages string[] ---@param options? InstallOptions +---@return boolean true if installation successful local function install(languages, options) options = options or {} From 4eb35c03443742a4c3b2db13d36da9cddb6268c3 Mon Sep 17 00:00:00 2001 From: Riley Bruins Date: Wed, 6 Aug 2025 09:44:56 -0700 Subject: [PATCH 2242/2494] feat(gdscript): misc operators, semicolon highlight --- runtime/queries/gdscript/highlights.scm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/runtime/queries/gdscript/highlights.scm b/runtime/queries/gdscript/highlights.scm index d7d3a648c..f3fd3b62f 100644 --- a/runtime/queries/gdscript/highlights.scm +++ b/runtime/queries/gdscript/highlights.scm @@ -148,6 +148,7 @@ "," "." ":" + ";" ] @punctuation.delimiter [ @@ -171,6 +172,7 @@ "~" "-" "*" + "**" "/" "%" "+" @@ -193,10 +195,13 @@ "+=" "-=" "*=" + "**=" "/=" "%=" "&=" "|=" + "<<=" + ">>=" "->" ] @operator From 9866036ec3c5db40700a9178494e0cfdcfe6ecfd Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 8 Aug 2025 10:09:54 +0200 Subject: [PATCH 2243/2494] feat(parsers): update c3, c_sharp, desktop, editorconfig, fennel, gdshader, javadoc, llvm, matlab, nix, perl, scala, solidity, superhtml, xresource --- lua/nvim-treesitter/parsers.lua | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index a79361c15..2cb92ef3b 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -166,7 +166,7 @@ return { }, c3 = { install_info = { - revision = '5abce05689bf46999c17bd0dcda2f75b8de61d0d', + revision = 'be8c7fcfb424a93f541ebd21d23611b92dff0444', url = 'https://github.com/c3lang/tree-sitter-c3', }, maintainers = { '@cbuttner' }, @@ -174,7 +174,7 @@ return { }, c_sharp = { install_info = { - revision = 'b5eb5742f6a7e9438bee22ce8026d6b927be2cd7', + revision = '3431444351c871dffb32654f1299a00019280f2f', url = 'https://github.com/tree-sitter/tree-sitter-c-sharp', }, maintainers = { '@amaanq' }, @@ -346,7 +346,7 @@ return { }, desktop = { install_info = { - revision = 'deb91f587c97814058aea2cbd790e0b85c9bb361', + revision = '8d6931b05ccc70eb4f88b384524ea5dd3d795958', url = 'https://github.com/ValdezFOmar/tree-sitter-desktop', }, maintainers = { '@ValdezFOmar' }, @@ -449,7 +449,7 @@ return { }, editorconfig = { install_info = { - revision = '8ed36589b5d0b3ebfdba45e1fd0ebefa01aafaea', + revision = '2d92f8bb8304d0b56883bb9df8f17cb351a07cc3', url = 'https://github.com/ValdezFOmar/tree-sitter-editorconfig', }, maintainers = { '@ValdezFOmar' }, @@ -544,7 +544,7 @@ return { }, fennel = { install_info = { - revision = 'cf7c000d934f2ff0a282a2c276b1f72e7fb2a099', + revision = '653c8abc72d1415cb85e032108d39022feb460be', url = 'https://github.com/alexmozaidze/tree-sitter-fennel', }, maintainers = { '@alexmozaidze' }, @@ -661,7 +661,7 @@ return { }, gdshader = { install_info = { - revision = 'ffd9f958df13cae04593781d7d2562295a872455', + revision = '14e834063e136fa69b6d91f711f4f1981acf424b', url = 'https://github.com/GodOfAvacyn/tree-sitter-gdshader', }, maintainers = { '@godofavacyn' }, @@ -1075,7 +1075,7 @@ return { }, javadoc = { install_info = { - revision = '26ef3becea1ff51f0025a8e0c38a6b3a39c09341', + revision = '76ed31dff40686b350c994ceb4da90ad7f3a7f44', url = 'https://github.com/rmuir/tree-sitter-javadoc', }, maintainers = { '@rmuir' }, @@ -1288,7 +1288,7 @@ return { }, llvm = { install_info = { - revision = '00c5389a4598e1dce66fbc3b3d34733d308f2751', + revision = 'be4864bec38412aa2987b6dad01d1e389e9e9ca9', url = 'https://github.com/benwilliamgraham/tree-sitter-llvm', }, maintainers = { '@benwilliamgraham' }, @@ -1367,7 +1367,7 @@ return { }, matlab = { install_info = { - revision = '2d30fdbb8fc7ec55d2fbf05172437ff0299878a5', + revision = '37941b272862ba52983f44cb6ec7b0eec6972c95', url = 'https://github.com/acristoffers/tree-sitter-matlab', }, maintainers = { '@acristoffers' }, @@ -1463,7 +1463,7 @@ return { }, nix = { install_info = { - revision = 'ea1d87f7996be1329ef6555dcacfa63a69bd55c6', + revision = '42d2e0e2996dec99ea7eb82d64a138e12a7ba006', url = 'https://github.com/nix-community/tree-sitter-nix', }, maintainers = { '@leo60228', '@zimbatm' }, @@ -1565,7 +1565,7 @@ return { perl = { install_info = { branch = 'release', - revision = 'a2d8e5a32a63019d25bb7452455f4d646d11cce5', + revision = 'e95676fa54559c71f15ad73e871c1e44db8a9b05', url = 'https://github.com/tree-sitter-perl/tree-sitter-perl', }, maintainers = { '@RabbiVeesh', '@LeoNerd' }, @@ -1982,7 +1982,7 @@ return { }, scala = { install_info = { - revision = '2d55e74b0485fe05058ffe5e8155506c9710c767', + revision = '97aead18d97708190a51d4f551ea9b05b60641c9', url = 'https://github.com/tree-sitter/tree-sitter-scala', }, maintainers = { '@stevanmilic' }, @@ -2075,7 +2075,7 @@ return { }, solidity = { install_info = { - revision = '322a3ddffca3ed96e559003fd03fa9881d7b4e20', + revision = '4e938a46c7030dd001bc99e1ac0f0c750ac98254', url = 'https://github.com/JoranHonig/tree-sitter-solidity', }, maintainers = { '@amaanq' }, @@ -2175,7 +2175,7 @@ return { superhtml = { install_info = { location = 'tree-sitter-superhtml', - revision = 'c6111e7134c64b69a2934ccbba83460cb532d442', + revision = '6ce62c9f0683f909de7e1601bc866f1db9cf92c9', url = 'https://github.com/kristoff-it/superhtml', }, maintainers = { '@rockorager' }, @@ -2599,7 +2599,7 @@ return { }, xresources = { install_info = { - revision = 'b0822f2ea47600c6e11ee64b2dec8353c9684e8d', + revision = '3b1445a48e5ce26b43e37b51dec5abb3bf1fb3e4', url = 'https://github.com/ValdezFOmar/tree-sitter-xresources', }, maintainers = { '@ValdezFOmar' }, From 13e3ce3bf41521551b8d1daf401d31938f62e7ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B6=B5=E6=9B=A6?= Date: Mon, 11 Aug 2025 15:21:23 +0800 Subject: [PATCH 2244/2494] feat(sproto): add parser --- SUPPORTED_LANGUAGES.md | 1 + lua/nvim-treesitter/parsers.lua | 8 +++++ runtime/queries/sproto/folds.scm | 6 ++++ runtime/queries/sproto/highlights.scm | 47 +++++++++++++++++++++++++++ runtime/queries/sproto/indents.scm | 10 ++++++ runtime/queries/sproto/injections.scm | 2 ++ 6 files changed, 74 insertions(+) create mode 100644 runtime/queries/sproto/folds.scm create mode 100644 runtime/queries/sproto/highlights.scm create mode 100644 runtime/queries/sproto/indents.scm create mode 100644 runtime/queries/sproto/injections.scm diff --git a/SUPPORTED_LANGUAGES.md b/SUPPORTED_LANGUAGES.md index 7a7f23505..ceb928e72 100644 --- a/SUPPORTED_LANGUAGES.md +++ b/SUPPORTED_LANGUAGES.md @@ -269,6 +269,7 @@ jsx (queries only)[^jsx] | unstable | `HFIJ ` | | @steelsojka [sosl](https://github.com/aheber/tree-sitter-sfapex) | unstable | `H    ` | | @aheber, @xixiafinland [sourcepawn](https://github.com/nilshelmig/tree-sitter-sourcepawn) | unstable | `H  JL` | | @Sarrus1 [sparql](https://github.com/GordianDziwis/tree-sitter-sparql) | unstable | `HFIJL` | | @GordianDziwis +[sproto](https://github.com/hanxi/tree-sitter-sproto) | unstable | `HFIJ ` | | @hanxi [sql](https://github.com/derekstride/tree-sitter-sql) | unstable | `HFIJ ` | | @derekstride [squirrel](https://github.com/tree-sitter-grammars/tree-sitter-squirrel) | unstable | `HFIJL` | | @amaanq [ssh_config](https://github.com/tree-sitter-grammars/tree-sitter-ssh-config) | unstable | `HFIJL` | | @ObserverOfTime diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 2cb92ef3b..98e9ef78a 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -2115,6 +2115,14 @@ return { maintainers = { '@GordianDziwis' }, tier = 2, }, + sproto = { + install_info = { + revision = 'd554c1456e35e7b2690552d52921c987d0cf6799', + url = 'https://github.com/hanxi/tree-sitter-sproto', + }, + maintainers = { '@hanxi' }, + tier = 2, + }, sql = { install_info = { branch = 'gh-pages', diff --git a/runtime/queries/sproto/folds.scm b/runtime/queries/sproto/folds.scm new file mode 100644 index 000000000..03253d108 --- /dev/null +++ b/runtime/queries/sproto/folds.scm @@ -0,0 +1,6 @@ +[ + (type_definition) + (protocol_definition) + (request_block) + (response_block) +] @fold diff --git a/runtime/queries/sproto/highlights.scm b/runtime/queries/sproto/highlights.scm new file mode 100644 index 000000000..cd86ed22d --- /dev/null +++ b/runtime/queries/sproto/highlights.scm @@ -0,0 +1,47 @@ +(comment) @comment @spell + +[ + "." + ":" +] @punctuation.delimiter + +"*" @operator + +[ + "request" + "response" +] @keyword + +(type_definition + name: (identifier) @type) + +(nested_type_definition + name: (identifier) @type) + +(type_specifier) @type + +[ + "integer" + "boolean" + "string" + "binary" + "double" +] @type.builtin + +(protocol_definition + name: (identifier) @function) + +(field_definition + name: (identifier) @property) + +(map_specifier + key: (identifier) @property) + +(integer) @number + +[ + "(" + ")" + "{" + "}" +] @punctuation.bracket diff --git a/runtime/queries/sproto/indents.scm b/runtime/queries/sproto/indents.scm new file mode 100644 index 000000000..33147d540 --- /dev/null +++ b/runtime/queries/sproto/indents.scm @@ -0,0 +1,10 @@ +[ + (type_definition) + (protocol_definition) + (request_block) + (response_block) +] @indent.begin + +"}" @indent.end @indent.branch + +(comment) @indent.auto diff --git a/runtime/queries/sproto/injections.scm b/runtime/queries/sproto/injections.scm new file mode 100644 index 000000000..2f0e58eb6 --- /dev/null +++ b/runtime/queries/sproto/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) From 42ea5392432253188c11c31af420a0b83bb111dc Mon Sep 17 00:00:00 2001 From: Caleb White Date: Mon, 16 Jun 2025 22:29:40 -0500 Subject: [PATCH 2245/2494] feat(php): update php and php_only parsers to v0.24.0 --- lua/nvim-treesitter/parsers.lua | 4 ++-- runtime/queries/php_only/highlights.scm | 17 +++++++++-------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 98e9ef78a..5802d3c4d 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -1574,7 +1574,7 @@ return { php = { install_info = { location = 'php', - revision = 'b2278dbac9d58b02653fe6a8530ccebc492e4ed4', + revision = '182f034cd19a2f41f751eee0d57378fbfc96ab3a', url = 'https://github.com/tree-sitter/tree-sitter-php', }, maintainers = { '@tk-shirasaka', '@calebdw' }, @@ -1585,7 +1585,7 @@ return { php_only = { install_info = { location = 'php_only', - revision = 'b2278dbac9d58b02653fe6a8530ccebc492e4ed4', + revision = '182f034cd19a2f41f751eee0d57378fbfc96ab3a', url = 'https://github.com/tree-sitter/tree-sitter-php', }, maintainers = { '@tk-shirasaka', '@calebdw' }, diff --git a/runtime/queries/php_only/highlights.scm b/runtime/queries/php_only/highlights.scm index 2d473dd0c..8258e29ad 100644 --- a/runtime/queries/php_only/highlights.scm +++ b/runtime/queries/php_only/highlights.scm @@ -44,21 +44,16 @@ "protected" "public" "readonly" - (static_modifier) + "static" ] @keyword.modifier -(function_static_declaration - "static" @keyword.modifier) - [ "return" "exit" "yield" + "yield from" ] @keyword.return -(yield_expression - "from" @keyword.return) - [ "case" "else" @@ -107,7 +102,7 @@ [ (php_tag) - "?>" + (php_end_tag) "(" ")" "[" @@ -477,3 +472,9 @@ (comment) @comment @spell (named_label_statement) @label + +(property_hook + (name) @label) + +(visibility_modifier + (operation) @label) From 21da8ac2510bc2d4e9239e866a341ab0abc24959 Mon Sep 17 00:00:00 2001 From: Alexei Mozaidze Date: Mon, 11 Aug 2025 01:10:03 +0400 Subject: [PATCH 2246/2494] fix(fennel): highlight $ in multi-symbol context properly Highlights the dollar symbol properly in multi-symbol contexts like `$.some.properties` --- runtime/queries/fennel/highlights.scm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/runtime/queries/fennel/highlights.scm b/runtime/queries/fennel/highlights.scm index 2f0b5f738..c02f7bd14 100644 --- a/runtime/queries/fennel/highlights.scm +++ b/runtime/queries/fennel/highlights.scm @@ -104,6 +104,9 @@ ((symbol) @variable.parameter (#any-of? @variable.parameter "$" "$...")) +((symbol_fragment) @variable.parameter + (#eq? @variable.parameter "$")) + ((symbol) @variable.parameter (#lua-match? @variable.parameter "^%$[1-9]$")) From 4d43480167512deb7eed798147355d7f09e56d5c Mon Sep 17 00:00:00 2001 From: Riley Bruins Date: Mon, 21 Jul 2025 18:44:11 -0700 Subject: [PATCH 2247/2494] ci: validate predicate/directive string parameters --- .tsqueryrc.json | 54 ++++++++++++++++++++++++++++++++++--------------- 1 file changed, 38 insertions(+), 16 deletions(-) diff --git a/.tsqueryrc.json b/.tsqueryrc.json index e8e7fd920..cd3a692d5 100644 --- a/.tsqueryrc.json +++ b/.tsqueryrc.json @@ -246,11 +246,13 @@ }, { "type": "string", - "arity": "required" + "arity": "required", + "constraint": "named_node" }, { "type": "string", - "arity": "variadic" + "arity": "variadic", + "constraint": "named_node" } ], "description": "match any of the given node types against all ancestors of a node" @@ -262,12 +264,14 @@ "arity": "required" }, { - "type": "any", - "arity": "required" + "type": "string", + "arity": "required", + "constraint": "named_node" }, { - "type": "any", - "arity": "variadic" + "type": "string", + "arity": "variadic", + "constraint": "named_node" } ], "description": "match any of the given node types against the direct ancestor of a node" @@ -280,11 +284,13 @@ }, { "type": "string", - "arity": "required" + "arity": "required", + "constraint": "named_node" }, { "type": "string", - "arity": "variadic" + "arity": "variadic", + "constraint": "named_node" } ], "description": "checks whether a capture corresponds to a given set of nodes" @@ -316,19 +322,23 @@ }, { "type": "string", - "arity": "required" + "arity": "required", + "constraint": "integer" }, { "type": "string", - "arity": "required" + "arity": "required", + "constraint": "integer" }, { "type": "string", - "arity": "required" + "arity": "required", + "constraint": "integer" }, { "type": "string", - "arity": "required" + "arity": "required", + "constraint": "integer" } ], "description": "Takes the range of the captured node and applies an offset. This will set a new range in the form of a list like { {start_row}, {start_col}, {end_row}, {end_col} } for the captured node with `capture_id` as `metadata[capture_id].range`." @@ -358,19 +368,31 @@ }, { "type": "string", - "arity": "optional" + "arity": "optional", + "constraint": { + "enum": ["0", "1"] + } }, { "type": "string", - "arity": "optional" + "arity": "optional", + "constraint": { + "enum": ["0", "1"] + } }, { "type": "string", - "arity": "optional" + "arity": "optional", + "constraint": { + "enum": ["0", "1"] + } }, { "type": "string", - "arity": "optional" + "arity": "optional", + "constraint": { + "enum": ["0", "1"] + } } ], "description": "Trims whitespace from the node. Sets a new `metadata[capture_id].range`. Takes a capture ID and, optionally, four integers to customize trimming behavior (`1` meaning trim, `0` meaning don't trim). When only given a capture ID, trims blank lines (lines that contain only whitespace, or are empty) from the end of the node (for backwards compatibility). Can trim all whitespace from both sides of the node if parameters are given." From bf0234010a49dc1df5de93390f197cfd0abcb9aa Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 12 Aug 2025 11:04:13 +0200 Subject: [PATCH 2248/2494] ci: bump actions/checkout to v5 --- .github/workflows/lint.yml | 6 +++--- .github/workflows/test-core.yml | 2 +- .github/workflows/update-parsers.yml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index cf9e9364f..27a75f8c0 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -14,7 +14,7 @@ jobs: name: Lint Lua files runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - name: Format run: | @@ -28,7 +28,7 @@ jobs: name: Lint query files runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - name: Format run: | @@ -42,7 +42,7 @@ jobs: name: Lint docs runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - name: Check SUPPORTED_LANGUAGES run: | diff --git a/.github/workflows/test-core.yml b/.github/workflows/test-core.yml index d91c1bb4c..f20f1939d 100644 --- a/.github/workflows/test-core.yml +++ b/.github/workflows/test-core.yml @@ -21,7 +21,7 @@ jobs: env: NVIM: ${{ matrix.os == 'windows-latest' && 'nvim-win64\\bin\\nvim.exe' || 'nvim' }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: tree-sitter/setup-action/cli@v1 - uses: ilammy/msvc-dev-cmd@v1 diff --git a/.github/workflows/update-parsers.yml b/.github/workflows/update-parsers.yml index 351beef67..533fc2ddd 100644 --- a/.github/workflows/update-parsers.yml +++ b/.github/workflows/update-parsers.yml @@ -17,7 +17,7 @@ jobs: name: Update parsers tier ${{ matrix.tier }} runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 with: ref: main From cabbd52bb8d461ca1e6858c0476933256917de62 Mon Sep 17 00:00:00 2001 From: hsi <53867065+hsi@users.noreply.github.com> Date: Mon, 11 Aug 2025 21:38:15 +0200 Subject: [PATCH 2249/2494] fix(health): highlights legend label --- lua/nvim-treesitter/health.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/nvim-treesitter/health.lua b/lua/nvim-treesitter/health.lua index b4d0c62d5..856e2183e 100644 --- a/lua/nvim-treesitter/health.lua +++ b/lua/nvim-treesitter/health.lua @@ -157,7 +157,7 @@ function M.check() end health.info(vim.fn.trim(out, ' ', 2)) end - health.start(' Legend: H[ighlight], L[ocals], F[olds], I[ndents], In[J]ections') + health.start(' Legend: H[ighlights], L[ocals], F[olds], I[ndents], In[J]ections') if #error_collection > 0 then health.start('The following errors have been detected in query files:') From 32cb9f9b9db71b0dc2454817727cd9a5d840658c Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sat, 16 Aug 2025 10:07:22 +0200 Subject: [PATCH 2250/2494] feat(parsers): update fennel, javadoc, llvm, matlab, mlir, nickel, nix, php, php_only, query, superhtml, vimdoc, wit --- lua/nvim-treesitter/parsers.lua | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 5802d3c4d..391a7ef74 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -544,7 +544,7 @@ return { }, fennel = { install_info = { - revision = '653c8abc72d1415cb85e032108d39022feb460be', + revision = 'fd4a24e349bcbac8a03a5a00d0dfa207baf53ca5', url = 'https://github.com/alexmozaidze/tree-sitter-fennel', }, maintainers = { '@alexmozaidze' }, @@ -1075,7 +1075,7 @@ return { }, javadoc = { install_info = { - revision = '76ed31dff40686b350c994ceb4da90ad7f3a7f44', + revision = '08f1977ad27b8d9a908193255ad0c94cc8742748', url = 'https://github.com/rmuir/tree-sitter-javadoc', }, maintainers = { '@rmuir' }, @@ -1288,7 +1288,7 @@ return { }, llvm = { install_info = { - revision = 'be4864bec38412aa2987b6dad01d1e389e9e9ca9', + revision = '470886ddd635e0ee48a4cb169e33d0c6d9bff32e', url = 'https://github.com/benwilliamgraham/tree-sitter-llvm', }, maintainers = { '@benwilliamgraham' }, @@ -1367,7 +1367,7 @@ return { }, matlab = { install_info = { - revision = '37941b272862ba52983f44cb6ec7b0eec6972c95', + revision = 'da410185c1fabf823ab92798590f9a6606e5699b', url = 'https://github.com/acristoffers/tree-sitter-matlab', }, maintainers = { '@acristoffers' }, @@ -1399,7 +1399,7 @@ return { mlir = { install_info = { generate = true, - revision = 'e2818d616fc43cbbba316723cbd68a53c66a2704', + revision = '04630ec19f198c3ac2a0b98a004eeae083990c96', url = 'https://github.com/artagnon/tree-sitter-mlir', }, maintainers = { '@artagnon' }, @@ -1431,7 +1431,7 @@ return { }, nickel = { install_info = { - revision = '9a05ab045c000cf37f02cff5c4de32b081444244', + revision = 'a0a5d98a6f0edb5d00a18e62e7d1d02a5607c391', url = 'https://github.com/nickel-lang/tree-sitter-nickel', }, tier = 2, @@ -1463,7 +1463,7 @@ return { }, nix = { install_info = { - revision = '42d2e0e2996dec99ea7eb82d64a138e12a7ba006', + revision = 'ff4e2b4c5a3598e8be3edf16bc69f6677af32145', url = 'https://github.com/nix-community/tree-sitter-nix', }, maintainers = { '@leo60228', '@zimbatm' }, @@ -1574,7 +1574,7 @@ return { php = { install_info = { location = 'php', - revision = '182f034cd19a2f41f751eee0d57378fbfc96ab3a', + revision = '1269143868747e3b8e50f221ca0a2e5a1a2f2b44', url = 'https://github.com/tree-sitter/tree-sitter-php', }, maintainers = { '@tk-shirasaka', '@calebdw' }, @@ -1585,7 +1585,7 @@ return { php_only = { install_info = { location = 'php_only', - revision = '182f034cd19a2f41f751eee0d57378fbfc96ab3a', + revision = '1269143868747e3b8e50f221ca0a2e5a1a2f2b44', url = 'https://github.com/tree-sitter/tree-sitter-php', }, maintainers = { '@tk-shirasaka', '@calebdw' }, @@ -1805,7 +1805,7 @@ return { }, query = { install_info = { - revision = '8a43889f89fd0667289936341bff3a77bafade17', + revision = '2668cc53024953224a40b1e6546d7b8ec5a11150', url = 'https://github.com/tree-sitter-grammars/tree-sitter-query', }, maintainers = { '@steelsojka' }, @@ -2183,7 +2183,7 @@ return { superhtml = { install_info = { location = 'tree-sitter-superhtml', - revision = '6ce62c9f0683f909de7e1601bc866f1db9cf92c9', + revision = '0daae5239bd9366dda0c28c7540d7503b0c104d4', url = 'https://github.com/kristoff-it/superhtml', }, maintainers = { '@rockorager' }, @@ -2531,7 +2531,7 @@ return { }, vimdoc = { install_info = { - revision = '9f6191a98702edc1084245abd5523279d4b681fb', + revision = 'ffa29e863738adfc1496717c4acb7aae92a80ed4', url = 'https://github.com/neovim/tree-sitter-vimdoc', }, maintainers = { '@clason' }, @@ -2581,7 +2581,7 @@ return { }, wit = { install_info = { - revision = 'a0fd28afe24511160f0601ab45044690c1cb7d92', + revision = '8fd7cfd90be29b363922b2e09bf6a7db50de04a8', url = 'https://github.com/bytecodealliance/tree-sitter-wit', }, maintainers = { '@mkatychev' }, From 2f28a14ed229bb534a9ef92591d1d17b392b0c0e Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 19 Aug 2025 11:46:44 +0200 Subject: [PATCH 2251/2494] feat(parsers): update arduino, chatito, desktop, editorconfig, gitattributes, gpg, idl, javadoc, mlir, pem, php, php_only, poe_filter, xresources --- lua/nvim-treesitter/parsers.lua | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 391a7ef74..a76195b55 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -36,7 +36,7 @@ return { }, arduino = { install_info = { - revision = '1b1fd5dbd196e80342cf79f6fc5de154232c2829', + revision = '3b5ddcdbcac43c6084358d3d14a30e10e2d36b88', url = 'https://github.com/tree-sitter-grammars/tree-sitter-arduino', }, maintainers = { '@ObserverOfTime' }, @@ -206,7 +206,7 @@ return { }, chatito = { install_info = { - revision = '433a7a150da013f380d2bd435e0c4373f7f4481c', + revision = 'c0ed82c665b732395073f635c74c300f09530a7f', url = 'https://github.com/tree-sitter-grammars/tree-sitter-chatito', }, maintainers = { '@ObserverOfTime' }, @@ -346,7 +346,7 @@ return { }, desktop = { install_info = { - revision = '8d6931b05ccc70eb4f88b384524ea5dd3d795958', + revision = '0169df0e69bd2844e0d8bb167d030a0e4c021846', url = 'https://github.com/ValdezFOmar/tree-sitter-desktop', }, maintainers = { '@ValdezFOmar' }, @@ -449,7 +449,7 @@ return { }, editorconfig = { install_info = { - revision = '2d92f8bb8304d0b56883bb9df8f17cb351a07cc3', + revision = '17be0e84ac012b6731626baf6920ff24e1865a03', url = 'https://github.com/ValdezFOmar/tree-sitter-editorconfig', }, maintainers = { '@ValdezFOmar' }, @@ -685,7 +685,7 @@ return { }, gitattributes = { install_info = { - revision = 'f23072a51e1c764d6c5bf461194a775c8a5c7a95', + revision = '1b7af09d45b579f9f288453b95ad555f1f431645', url = 'https://github.com/tree-sitter-grammars/tree-sitter-gitattributes', }, maintainers = { '@ObserverOfTime' }, @@ -827,7 +827,7 @@ return { }, gpg = { install_info = { - revision = '50482a322cf1fa00dfe327ef8b00e4607eeeaa1d', + revision = '4024eb268c59204280f8ac71ef146b8ff5e737f6', url = 'https://github.com/tree-sitter-grammars/tree-sitter-gpg-config', }, maintainers = { '@ObserverOfTime' }, @@ -1019,7 +1019,7 @@ return { }, idl = { install_info = { - revision = '777b39538f9dc4ece1d891733bb4c91fc0627b16', + revision = '6ab5582bd47b86df75afe90cdd8dc55d2d480ce1', url = 'https://github.com/cathaysia/tree-sitter-idl', }, maintainers = { '@cathaysia' }, @@ -1075,7 +1075,7 @@ return { }, javadoc = { install_info = { - revision = '08f1977ad27b8d9a908193255ad0c94cc8742748', + revision = '77afe93bc6fc10f2cf4935857b8e055b2a47bb94', url = 'https://github.com/rmuir/tree-sitter-javadoc', }, maintainers = { '@rmuir' }, @@ -1399,7 +1399,7 @@ return { mlir = { install_info = { generate = true, - revision = '04630ec19f198c3ac2a0b98a004eeae083990c96', + revision = 'b209a18d1a0f440acd3a85b6d633dac2660114e1', url = 'https://github.com/artagnon/tree-sitter-mlir', }, maintainers = { '@artagnon' }, @@ -1556,7 +1556,7 @@ return { }, pem = { install_info = { - revision = '7374eab76f2caae02396721850f87af437b66c06', + revision = 'e525b177a229b1154fd81bc0691f943028d9e685', url = 'https://github.com/tree-sitter-grammars/tree-sitter-pem', }, maintainers = { '@ObserverOfTime' }, @@ -1574,7 +1574,7 @@ return { php = { install_info = { location = 'php', - revision = '1269143868747e3b8e50f221ca0a2e5a1a2f2b44', + revision = '5b5627faaa290d89eb3d01b9bf47c3bb9e797dea', url = 'https://github.com/tree-sitter/tree-sitter-php', }, maintainers = { '@tk-shirasaka', '@calebdw' }, @@ -1585,7 +1585,7 @@ return { php_only = { install_info = { location = 'php_only', - revision = '1269143868747e3b8e50f221ca0a2e5a1a2f2b44', + revision = '5b5627faaa290d89eb3d01b9bf47c3bb9e797dea', url = 'https://github.com/tree-sitter/tree-sitter-php', }, maintainers = { '@tk-shirasaka', '@calebdw' }, @@ -1635,7 +1635,7 @@ return { }, poe_filter = { install_info = { - revision = 'e449216700449f1bccaebbd3820cce794d6fd687', + revision = '205a7d576984feb38a9fc2d8cfe729617f9e0548', url = 'https://github.com/tree-sitter-grammars/tree-sitter-poe-filter', }, maintainers = { '@ObserverOfTime' }, @@ -2607,7 +2607,7 @@ return { }, xresources = { install_info = { - revision = '3b1445a48e5ce26b43e37b51dec5abb3bf1fb3e4', + revision = '6113943ab0847a307f3f3c38ff91d9cdfce9d0d9', url = 'https://github.com/ValdezFOmar/tree-sitter-xresources', }, maintainers = { '@ValdezFOmar' }, From 6fd7117c1dc4e279f4153af70ae60bd4134b0f01 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 19 Aug 2025 11:52:35 +0200 Subject: [PATCH 2252/2494] feat(matlab)!: update parser and queries --- lua/nvim-treesitter/parsers.lua | 2 +- runtime/queries/matlab/highlights.scm | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index a76195b55..88732ab19 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -1367,7 +1367,7 @@ return { }, matlab = { install_info = { - revision = 'da410185c1fabf823ab92798590f9a6606e5699b', + revision = '93020b226bf341de02336cdf1c19a7ce0b509cf2', url = 'https://github.com/acristoffers/tree-sitter-matlab', }, maintainers = { '@acristoffers' }, diff --git a/runtime/queries/matlab/highlights.scm b/runtime/queries/matlab/highlights.scm index d2ab6053e..91fdae2a9 100644 --- a/runtime/queries/matlab/highlights.scm +++ b/runtime/queries/matlab/highlights.scm @@ -134,7 +134,8 @@ (identifier) @function) (validation_functions - (identifier) @function) + (property_name + (identifier) @function)) (command (command_name) @function.call) From 44e90ec66e44f7dbb60030f453a48282b3a1125a Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Thu, 21 Aug 2025 18:31:55 +0200 Subject: [PATCH 2253/2494] feat(inko): add support for array patterns This updates the version of the Inko parser to the latest version and includes indent support for the new array pattern node. --- lua/nvim-treesitter/parsers.lua | 2 +- runtime/queries/inko/indents.scm | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 88732ab19..d658b5d18 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -1042,7 +1042,7 @@ return { }, inko = { install_info = { - revision = 'f58a87ac4dc6a7955c64c9e4408fbd693e804686', + revision = '74cbd0f69053b4a9ad4fed8831dee983ec7e4990', url = 'https://github.com/inko-lang/tree-sitter-inko', }, maintainers = { '@yorickpeterse' }, diff --git a/runtime/queries/inko/indents.scm b/runtime/queries/inko/indents.scm index d2d9a5724..260249343 100644 --- a/runtime/queries/inko/indents.scm +++ b/runtime/queries/inko/indents.scm @@ -27,6 +27,7 @@ (trait) (tuple) (tuple_pattern) + (array_pattern) (type_arguments) ] @indent.begin From 9f15c2b050ef2fa66462636eb48674d6b6562989 Mon Sep 17 00:00:00 2001 From: Caleb White Date: Mon, 25 Aug 2025 08:29:26 -0500 Subject: [PATCH 2254/2494] fix(blade): fix highlighting of php tags --- runtime/queries/blade/highlights.scm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/runtime/queries/blade/highlights.scm b/runtime/queries/blade/highlights.scm index b20999a5f..dd8024bda 100644 --- a/runtime/queries/blade/highlights.scm +++ b/runtime/queries/blade/highlights.scm @@ -7,6 +7,8 @@ ] @tag [ + (php_tag) + (php_end_tag) "{{" "}}" "{!!" From 35a124cb608fb137814d9af95d43a8b980206d8a Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Mon, 25 Aug 2025 18:59:47 +0200 Subject: [PATCH 2255/2494] feat(parsers): update arduino, blade, desktop, elixir, javadoc, llvm, mlir, perl, superhtml, vhdl, xresources, ziggy, ziggy_schema --- lua/nvim-treesitter/parsers.lua | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index d658b5d18..9f14b2038 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -36,7 +36,7 @@ return { }, arduino = { install_info = { - revision = '3b5ddcdbcac43c6084358d3d14a30e10e2d36b88', + revision = '2f0c1223c50aa4b754136db544204c6fc99ffc77', url = 'https://github.com/tree-sitter-grammars/tree-sitter-arduino', }, maintainers = { '@ObserverOfTime' }, @@ -125,7 +125,7 @@ return { }, blade = { install_info = { - revision = '59ce5b68e288002e3aee6cf5a379bbef21adbe6c', + revision = 'cc764dadcbbceb3f259396fef66f970c72e94f96', url = 'https://github.com/EmranMR/tree-sitter-blade', }, maintainers = { '@calebdw' }, @@ -346,7 +346,7 @@ return { }, desktop = { install_info = { - revision = '0169df0e69bd2844e0d8bb167d030a0e4c021846', + revision = 'cbf82f2b3f75c4f2367d11ef85d34fbad89a974d', url = 'https://github.com/ValdezFOmar/tree-sitter-desktop', }, maintainers = { '@ValdezFOmar' }, @@ -473,7 +473,7 @@ return { }, elixir = { install_info = { - revision = 'b848e63e9f2a68accff0332392f07582c046295a', + revision = 'd24cecee673c4c770f797bac6f87ae4b6d7ddec5', url = 'https://github.com/elixir-lang/tree-sitter-elixir', }, maintainers = { '@connorlay' }, @@ -1075,7 +1075,7 @@ return { }, javadoc = { install_info = { - revision = '77afe93bc6fc10f2cf4935857b8e055b2a47bb94', + revision = '384952d91ebc176fcf8f1933dff93b9c32430911', url = 'https://github.com/rmuir/tree-sitter-javadoc', }, maintainers = { '@rmuir' }, @@ -1288,7 +1288,7 @@ return { }, llvm = { install_info = { - revision = '470886ddd635e0ee48a4cb169e33d0c6d9bff32e', + revision = '2914786ae6774d4c4e25a230f4afe16aa68fe1c1', url = 'https://github.com/benwilliamgraham/tree-sitter-llvm', }, maintainers = { '@benwilliamgraham' }, @@ -1399,7 +1399,7 @@ return { mlir = { install_info = { generate = true, - revision = 'b209a18d1a0f440acd3a85b6d633dac2660114e1', + revision = '09666cead2c001cbbfc82b395007f6d8158113a5', url = 'https://github.com/artagnon/tree-sitter-mlir', }, maintainers = { '@artagnon' }, @@ -1565,7 +1565,7 @@ return { perl = { install_info = { branch = 'release', - revision = 'e95676fa54559c71f15ad73e871c1e44db8a9b05', + revision = '0c24d001dd1921e418fb933d208a7bd7dd3f923a', url = 'https://github.com/tree-sitter-perl/tree-sitter-perl', }, maintainers = { '@RabbiVeesh', '@LeoNerd' }, @@ -2183,7 +2183,7 @@ return { superhtml = { install_info = { location = 'tree-sitter-superhtml', - revision = '0daae5239bd9366dda0c28c7540d7503b0c104d4', + revision = '8cb16babb0c66b6512d6aeb4cbc37ed90641d980', url = 'https://github.com/kristoff-it/superhtml', }, maintainers = { '@rockorager' }, @@ -2507,7 +2507,7 @@ return { }, vhdl = { install_info = { - revision = '73ff9d3e7bc42b8cc123bf5f0b2db12a900ee9b7', + revision = '02523d7fb0321344c19c1f3f4ec6b83424c7d6c8', url = 'https://github.com/jpt13653903/tree-sitter-vhdl', }, maintainers = { '@jpt13653903' }, @@ -2607,7 +2607,7 @@ return { }, xresources = { install_info = { - revision = '6113943ab0847a307f3f3c38ff91d9cdfce9d0d9', + revision = 'f40778ff42f2119aebacd46d4b6d785a4181a9ba', url = 'https://github.com/ValdezFOmar/tree-sitter-xresources', }, maintainers = { '@ValdezFOmar' }, @@ -2656,7 +2656,7 @@ return { ziggy = { install_info = { location = 'tree-sitter-ziggy', - revision = 'e95c85cb58773c43e9d94c0b9422ae84697e68a1', + revision = '4353b20ef2ac750e35c6d68e4eb2a07c2d7cf901', url = 'https://github.com/kristoff-it/ziggy', }, maintainers = { '@rockorager' }, @@ -2665,7 +2665,7 @@ return { ziggy_schema = { install_info = { location = 'tree-sitter-ziggy-schema', - revision = 'e95c85cb58773c43e9d94c0b9422ae84697e68a1', + revision = '4353b20ef2ac750e35c6d68e4eb2a07c2d7cf901', url = 'https://github.com/kristoff-it/ziggy', }, maintainers = { '@rockorager' }, From 37cec5ec59d09db15ef364e237f8593b48754539 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Mon, 25 Aug 2025 19:09:38 +0200 Subject: [PATCH 2256/2494] feat(gotmpl,helm)!: update parser and queries --- lua/nvim-treesitter/parsers.lua | 4 ++-- runtime/queries/gotmpl/highlights.scm | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 9f14b2038..cae9df413 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -811,7 +811,7 @@ return { }, gotmpl = { install_info = { - revision = '5f19a36bb1eebb30454e277b222b278ceafed0dd', + revision = '65f4f86c3aaa9dabab36e3482584e8a111cf7db1', url = 'https://github.com/ngalaiko/tree-sitter-go-template', }, maintainers = { '@qvalentin' }, @@ -923,7 +923,7 @@ return { helm = { install_info = { location = 'dialects/helm', - revision = '5f19a36bb1eebb30454e277b222b278ceafed0dd', + revision = '65f4f86c3aaa9dabab36e3482584e8a111cf7db1', url = 'https://github.com/ngalaiko/tree-sitter-go-template', }, maintainers = { '@qvalentin' }, diff --git a/runtime/queries/gotmpl/highlights.scm b/runtime/queries/gotmpl/highlights.scm index 4ee768c28..80c977717 100644 --- a/runtime/queries/gotmpl/highlights.scm +++ b/runtime/queries/gotmpl/highlights.scm @@ -59,7 +59,6 @@ [ "if" "else" - "else if" "end" ] @keyword.conditional (#set! priority 110)) @@ -98,6 +97,14 @@ ] @keyword.conditional (#set! priority 110)) +(continue_action + "continue" @keyword.repeat + (#set! priority 110)) + +(break_action + "break" @keyword.repeat + (#set! priority 110)) + ; Literals ([ (interpreted_string_literal) From 85ec015f3be42a3c2c04648ff99d617d9609e5f0 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Mon, 25 Aug 2025 19:19:32 +0200 Subject: [PATCH 2257/2494] feat(nu)!: update parser and queries --- lua/nvim-treesitter/parsers.lua | 2 +- runtime/queries/nu/highlights.scm | 52 +++++++++++++------------------ 2 files changed, 22 insertions(+), 32 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index cae9df413..ffa103213 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -1479,7 +1479,7 @@ return { }, nu = { install_info = { - revision = '6544c4383643cf8608d50def2247a7af8314e148', + revision = 'cc4624fbc6ec3563d98fbe8f215a8b8e10b16f32', url = 'https://github.com/nushell/tree-sitter-nu', }, maintainers = { '@abhisheksingh0x558' }, diff --git a/runtime/queries/nu/highlights.scm b/runtime/queries/nu/highlights.scm index f8342fab4..fc73d3483 100644 --- a/runtime/queries/nu/highlights.scm +++ b/runtime/queries/nu/highlights.scm @@ -2,13 +2,8 @@ ; keywords [ "let" - "let-env" "mut" "const" - "hide-env" - "source" - "source-env" - "overlay" ] @keyword [ @@ -20,16 +15,9 @@ [ "loop" "while" - "break" - "continue" ] @keyword.repeat -[ - "def" - "do" -] @keyword.function - -"return" @keyword.return +"def" @keyword.function [ "try" @@ -49,9 +37,6 @@ "extern" ] @keyword.modifier -(hide_mod - "hide" @keyword) - (decl_use module: (unquoted) @module) @@ -59,21 +44,6 @@ "for" @keyword "in" @keyword) -(overlay_list - "list" @keyword.import) - -(overlay_hide - "hide" @keyword.import) - -(overlay_new - "new" @keyword.import) - -(overlay_use - "as" @keyword) - -(ctrl_error - "make" @keyword.import) - ; --- ; literals (val_number) @number @@ -316,6 +286,26 @@ key: (identifier) @property "zip") ]) +(command + head: (cmd_identifier) @keyword + (#any-of? @keyword "do" "source" "source-env" "hide" "hide-env")) + +(command + head: (cmd_identifier) @keyword.repeat + (#any-of? @keyword.repeat "break" "continue" "return")) + +(command + head: (cmd_identifier) @keyword + . + arg_str: (val_string) @keyword.import + (#any-of? @keyword "overlay" "error")) + +(command + head: (cmd_identifier) @_cmd + arg_str: (val_string) @keyword + (#eq? @_cmd "overlay") + (#eq? @keyword "as")) + (command "^" @punctuation.delimiter head: (_) @function) From 8302d4f547ce8881f06ff1ec2cf1c9748a43cb12 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 29 Aug 2025 14:45:10 +0200 Subject: [PATCH 2258/2494] feat(parsers): update bash, c, clojure, cpp, embedded_template, gap, go, html, java, javascript, json, json5, pkl, rust, supercollider --- lua/nvim-treesitter/parsers.lua | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index ffa103213..ea48f3ad1 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -77,7 +77,7 @@ return { }, bash = { install_info = { - revision = '56b54c61fb48bce0c63e3dfa2240b5d274384763', + revision = 'b930fed16910a74c230e09ea5b97f671448d2116', url = 'https://github.com/tree-sitter/tree-sitter-bash', }, maintainers = { '@TravonteD' }, @@ -158,7 +158,7 @@ return { }, c = { install_info = { - revision = '7fa1be1b694b6e763686793d97da01f36a0e5c12', + revision = 'd8d0503aa0152119149ecad76685f37682c0d03f', url = 'https://github.com/tree-sitter/tree-sitter-c', }, maintainers = { '@amaanq' }, @@ -222,7 +222,7 @@ return { }, clojure = { install_info = { - revision = 'be514eec2c86d560c18fab146e9298e21b8eab62', + revision = 'e43eff80d17cf34852dcd92ca5e6986d23a7040f', url = 'https://github.com/sogaiu/tree-sitter-clojure', }, maintainers = { '@NoahTheDuke' }, @@ -278,7 +278,7 @@ return { }, cpp = { install_info = { - revision = '5cb9b693cfd7bfacab1d9ff4acac1a4150700609', + revision = '077f14ffd2de226ac95808596989c705f6dee289', url = 'https://github.com/tree-sitter/tree-sitter-cpp', }, maintainers = { '@theHamsta' }, @@ -505,7 +505,7 @@ return { }, embedded_template = { install_info = { - revision = '8495d106154741e6d35d37064f864758ece75de6', + revision = 'c70c1de07dedd532089c0c90835c8ed9fa694f5c', url = 'https://github.com/tree-sitter/tree-sitter-embedded-template', }, tier = 2, @@ -633,7 +633,7 @@ return { }, gap = { install_info = { - revision = '8dee53cfb962600dd35ca25432f005e7920e89f2', + revision = '2bac14863b76ad0ff6fd7204c50574732acd66df', url = 'https://github.com/gap-system/tree-sitter-gap', }, maintainers = { '@reiniscirpons' }, @@ -770,7 +770,7 @@ return { }, go = { install_info = { - revision = '5e73f476efafe5c768eda19bbe877f188ded6144', + revision = '1547678a9da59885853f5f5cc8a99cc203fa2e2c', url = 'https://github.com/tree-sitter/tree-sitter-go', }, maintainers = { '@theHamsta', '@WinWisely268' }, @@ -973,7 +973,7 @@ return { }, html = { install_info = { - revision = 'cbb91a0ff3621245e890d1c50cc811bffb77a26b', + revision = '9fc04b9ef21a92e3ea9258f5690e4461394d7811', url = 'https://github.com/tree-sitter/tree-sitter-html', }, maintainers = { '@TravonteD' }, @@ -1067,7 +1067,7 @@ return { }, java = { install_info = { - revision = 'a7db5227ec40fcfe94489559d8c9bc7c8181e25a', + revision = '968afb3c9be2d4dba4cd36f3580ee0b1a9c1c537', url = 'https://github.com/tree-sitter/tree-sitter-java', }, maintainers = { '@p00f' }, @@ -1083,7 +1083,7 @@ return { }, javascript = { install_info = { - revision = '6fbef40512dcd9f0a61ce03a4c9ae7597b36ab5c', + revision = 'b131ccbf414a720cce088610539241a1eb170054', url = 'https://github.com/tree-sitter/tree-sitter-javascript', }, maintainers = { '@steelsojka' }, @@ -1129,7 +1129,7 @@ return { }, json = { install_info = { - revision = '46aa487b3ade14b7b05ef92507fdaa3915a662a3', + revision = 'fd38547e2fe5738e5b173e5f40a27df261224bba', url = 'https://github.com/tree-sitter/tree-sitter-json', }, maintainers = { '@steelsojka' }, @@ -1137,7 +1137,7 @@ return { }, json5 = { install_info = { - revision = 'ab0ba8229d639ec4f3fa5f674c9133477f4b77bd', + revision = '5ebe24e210f0fbcd6180fd673ed184ed81f3bcc6', url = 'https://github.com/Joakker/tree-sitter-json5', }, maintainers = { '@Joakker' }, @@ -1610,7 +1610,7 @@ return { }, pkl = { install_info = { - revision = '4fc94a102c25ea383d70397dac7e677ca3731f1e', + revision = '97d0f3d32e8915a72fa6cf6b1832ba3884f8e82b', url = 'https://github.com/apple/tree-sitter-pkl', }, maintainers = { '@ribru17' }, @@ -1974,7 +1974,7 @@ return { }, rust = { install_info = { - revision = '3691201b01cacb2f96ffca4c632c4e938bfacd88', + revision = '3bfef41a01ab49a25ffdecf998823b4b82fcaf69', url = 'https://github.com/tree-sitter/tree-sitter-rust', }, maintainers = { '@amaanq' }, @@ -2174,7 +2174,7 @@ return { }, supercollider = { install_info = { - revision = '1a8ee0da9a4f2df5a8a22f4d637ac863623a78a7', + revision = 'fd7f3bd457c8ef13cb547c4e79588cf1d2569997', url = 'https://github.com/madskjeldgaard/tree-sitter-supercollider', }, maintainers = { '@madskjeldgaard' }, From 16da7ded58b41a4c320f32661264c6283ce8cd18 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 29 Aug 2025 14:50:43 +0200 Subject: [PATCH 2259/2494] feat(matlab)!: update parser and queries --- lua/nvim-treesitter/parsers.lua | 2 +- runtime/queries/matlab/highlights.scm | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index ea48f3ad1..3abe166a1 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -1367,7 +1367,7 @@ return { }, matlab = { install_info = { - revision = '93020b226bf341de02336cdf1c19a7ce0b509cf2', + revision = '96a3e8fb0a4ebd0db64db6b52043483937e9ca3a', url = 'https://github.com/acristoffers/tree-sitter-matlab', }, maintainers = { '@acristoffers' }, diff --git a/runtime/queries/matlab/highlights.scm b/runtime/queries/matlab/highlights.scm index 91fdae2a9..66ec69465 100644 --- a/runtime/queries/matlab/highlights.scm +++ b/runtime/queries/matlab/highlights.scm @@ -134,8 +134,7 @@ (identifier) @function) (validation_functions - (property_name - (identifier) @function)) + (identifier) @function) (command (command_name) @function.call) @@ -205,7 +204,11 @@ (number) @number -(boolean) @boolean +((identifier) @boolean + (#eq? @boolean "true")) + +((identifier) @boolean + (#eq? @boolean "false")) ; Comments [ From cd64fd3f448eb6cc529830c7f265f7584168572b Mon Sep 17 00:00:00 2001 From: BlockLune <39331194+BlockLune@users.noreply.github.com> Date: Sat, 30 Aug 2025 00:30:18 +0800 Subject: [PATCH 2260/2494] feat(wxml): add parser and queries --- SUPPORTED_LANGUAGES.md | 1 + lua/nvim-treesitter/parsers.lua | 8 ++++ runtime/queries/wxml/folds.scm | 7 +++ runtime/queries/wxml/highlights.scm | 66 +++++++++++++++++++++++++++++ runtime/queries/wxml/indents.scm | 32 ++++++++++++++ runtime/queries/wxml/injections.scm | 10 +++++ 6 files changed, 124 insertions(+) create mode 100644 runtime/queries/wxml/folds.scm create mode 100644 runtime/queries/wxml/highlights.scm create mode 100644 runtime/queries/wxml/indents.scm create mode 100644 runtime/queries/wxml/injections.scm diff --git a/SUPPORTED_LANGUAGES.md b/SUPPORTED_LANGUAGES.md index ceb928e72..25c5e1137 100644 --- a/SUPPORTED_LANGUAGES.md +++ b/SUPPORTED_LANGUAGES.md @@ -326,6 +326,7 @@ jsx (queries only)[^jsx] | unstable | `HFIJ ` | | @steelsojka [wgsl_bevy](https://github.com/tree-sitter-grammars/tree-sitter-wgsl-bevy) | unstable | `HFI  ` | | @theHamsta [wing](https://github.com/winglang/tree-sitter-wing) | unstable | `HF JL` | | @gshpychka, @MarkMcCulloh [wit](https://github.com/bytecodealliance/tree-sitter-wit) | unstable | `HF J ` | | @mkatychev +[wxml](https://github.com/BlockLune/tree-sitter-wxml) | unstable | `HFIJ ` | | @BlockLune [xcompose](https://github.com/tree-sitter-grammars/tree-sitter-xcompose) | unstable | `H  JL` | | @ObserverOfTime [xml](https://github.com/tree-sitter-grammars/tree-sitter-xml) | unstable | `HFIJL` | | @ObserverOfTime [xresources](https://github.com/ValdezFOmar/tree-sitter-xresources) | unstable | `HF JL` | | @ValdezFOmar diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 3abe166a1..027c8f745 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -2587,6 +2587,14 @@ return { maintainers = { '@mkatychev' }, tier = 2, }, + wxml = { + install_info = { + revision = '7b821c748dc410332f59496c0dea2632168c4e5a', + url = 'https://github.com/BlockLune/tree-sitter-wxml', + }, + maintainers = { '@BlockLune' }, + tier = 2, + }, xcompose = { install_info = { revision = 'a51d6366f041dbefec4da39a7eb3168a9b1cbc0e', diff --git a/runtime/queries/wxml/folds.scm b/runtime/queries/wxml/folds.scm new file mode 100644 index 000000000..df3eeeef7 --- /dev/null +++ b/runtime/queries/wxml/folds.scm @@ -0,0 +1,7 @@ +[ + (element) + (block_element) + (slot_element) + (template_element) + (wxs_element) +] @fold diff --git a/runtime/queries/wxml/highlights.scm b/runtime/queries/wxml/highlights.scm new file mode 100644 index 000000000..5bdbd5d50 --- /dev/null +++ b/runtime/queries/wxml/highlights.scm @@ -0,0 +1,66 @@ +; Comments +(comment) @comment @spell + +; Text +(text) @spell + +; Tag names +(tag_name) @tag + +((tag_name) @tag.builtin + (#any-of? @tag.builtin "wxs" "template" "import" "include" "slot" "block")) + +; Attributes +(attribute_name) @tag.attribute + +(attribute_value) @string + +(quoted_attribute_value) @string + +; WeChat specific attributes +((attribute_name) @keyword.directive + (#lua-match? @keyword.directive "^wx:")) + +((attribute_name) @keyword.conditional + (#any-of? @keyword.conditional "wx:if" "wx:elif" "wx:else")) + +((attribute_name) @keyword.repeat + (#any-of? @keyword.repeat "wx:for" "wx:for-index" "wx:for-item")) + +((attribute_name) @keyword + (#lua-match? @keyword "^bind")) + +((attribute_name) @keyword + (#lua-match? @keyword "^catch")) + +((attribute_name) @keyword + (#lua-match? @keyword "^mut%-bind")) + +((attribute_name) @keyword + (#lua-match? @keyword "^model:")) + +((attribute_name) @keyword + (#lua-match? @keyword "^data-")) + +((attribute + (attribute_name) @_attr + (quoted_attribute_value) @string.special.url) + (#any-of? @_attr "href" "src") + (#offset! @string.special.url 0 1 0 -1)) + +; Entity references +(entity) @character.special + +; Interpolation delimiters +(interpolation_start) @punctuation.special + +(interpolation_end) @punctuation.special + +[ + "<" + ">" + "" +] @tag.delimiter + +"=" @operator diff --git a/runtime/queries/wxml/indents.scm b/runtime/queries/wxml/indents.scm new file mode 100644 index 000000000..30172bb37 --- /dev/null +++ b/runtime/queries/wxml/indents.scm @@ -0,0 +1,32 @@ +; inherits: html_tags + +(block_element) @indent.begin + +(template_element) @indent.begin + +(wxs_element) @indent.begin + +(block_element + (block_end_tag + ">" @indent.end)) + +(template_element + (template_end_tag + ">" @indent.end)) + +(wxs_element + (wxs_end_tag + ">" @indent.end)) + +(block_element + (block_end_tag) @indent.branch) + +(template_element + (template_end_tag) @indent.branch) + +(wxs_element + (wxs_end_tag) @indent.branch) + +(import_statement) @indent.ignore + +(include_statement) @indent.ignore diff --git a/runtime/queries/wxml/injections.scm b/runtime/queries/wxml/injections.scm new file mode 100644 index 000000000..09f615d38 --- /dev/null +++ b/runtime/queries/wxml/injections.scm @@ -0,0 +1,10 @@ +((comment) @injection.content + (#set! injection.language "comment")) + +((raw_text) @injection.content + (#set! injection.language "javascript") + (#set! injection.include-children)) + +((expression) @injection.content + (#set! injection.language "javascript") + (#set! injection.include-children)) From 8fccdb3d493178994aca43ec1f6ff74740eed7ee Mon Sep 17 00:00:00 2001 From: Riley Bruins Date: Sat, 30 Aug 2025 20:39:35 -0700 Subject: [PATCH 2261/2494] feat(proto): more delimiter, property highlights --- runtime/queries/proto/highlights.scm | 18 +++++++ tests/query/highlights/proto/test.proto | 62 +++++++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 tests/query/highlights/proto/test.proto diff --git a/runtime/queries/proto/highlights.scm b/runtime/queries/proto/highlights.scm index 51f44a754..894686dd4 100644 --- a/runtime/queries/proto/highlights.scm +++ b/runtime/queries/proto/highlights.scm @@ -1,3 +1,19 @@ +(full_ident + (identifier) @variable) + +(full_ident + (identifier) + (identifier) @variable.member) + +(field + (identifier) @property) + +(field_option + (identifier) @property) + +(block_lit + (identifier) @property) + [ "extend" "extensions" @@ -77,6 +93,8 @@ [ ";" "," + "." + ":" ] @punctuation.delimiter "=" @operator diff --git a/tests/query/highlights/proto/test.proto b/tests/query/highlights/proto/test.proto new file mode 100644 index 000000000..fdc610782 --- /dev/null +++ b/tests/query/highlights/proto/test.proto @@ -0,0 +1,62 @@ +syntax = "proto2"; +// ^^^^^^^^ @string.special +package sls.asfd.asfd; +// ^^^ @variable +// ^ @punctuation.delimiter +// ^^^^ @variable.member +// ^ @punctuation.delimiter +// ^^^^ @variable.member +// ^ @punctuation.delimiter + +import "github.com/gogo/protobuf/gogoproto/gogo.proto"; +import "github.com/gogo/protobuf/gogoproto/gogo.proto"; +import "github.com/gogo/protobuf/gogoproto/gogo.proto"; +import "github.com/gogo/protobuf/gogoproto/gogo.proto"; +import "github.com/gogo/protobuf/gogoproto/gogo.proto"; +import "github.com/gogo/protobuf/gogoproto/gogo.proto"; +import "github.com/gogo/protobuf/gogoproto/gogo.proto"; +import "github.com/gogo/protobuf/gogoproto/gogo.proto"; +//<- @keyword.import + +option (gogoproto.sizer_all) = true; +option (gogoproto.marshaler_all) = true; +option (gogoproto.unmarshaler_all.foo) = true; +// ^^^^^^^^^ @variable +// ^^^^^^^^^^^^^^^ @variable.member +// ^ @punctuation.delimiter +// ^^^ @variable.member + +message LogContent +//<- @keyword.type +{ + required string Key = 1; +// ^^^^^^ @type +// ^^^ @property +// ^ @operator +// ^ @number + required string Value = 2; +// ^^^^^^ @type +// ^^^^^ @property + required CustomType Value = 2; +// ^^^^^^^^ @keyword.modifier +// ^^^^^^^^^^ @type + + optional string cgroup_pids_mount = 76 [default = "/sys/fs/cgroup/pids"]; + + optional JsonFormat json_format = 6 [ +// ^^^^^^^^ @keyword.modifier + retention = RETENTION_RUNTIME, +// ^^^^^^^^^^^^^^^^^ @variable +// ^ @punctuation.delimiter + targets = TARGET_TYPE_MESSAGE, +// ^^^^^^^ @property + targets = TARGET_TYPE_ENUM, + targets = TARGET_TYPE_FILE, + edition_defaults = { edition: "2023", value: "ALLOW" } +// ^^^^^^^ @property +// ^ @punctuation.delimiter +// ^ @punctuation.delimiter +// ^ @punctuation.bracket + ]; +} + From 802195d8f1980db25a7a39a55f9a25df21756c73 Mon Sep 17 00:00:00 2001 From: Riley Bruins Date: Sat, 30 Aug 2025 20:40:45 -0700 Subject: [PATCH 2262/2494] feat(proto): folds for import statements --- runtime/queries/proto/folds.scm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/runtime/queries/proto/folds.scm b/runtime/queries/proto/folds.scm index 645ac1819..76f688b7d 100644 --- a/runtime/queries/proto/folds.scm +++ b/runtime/queries/proto/folds.scm @@ -3,3 +3,5 @@ (message) (service) ] @fold + +(import)+ @fold From 9addcdd01568a7c80333d5169dea0164ede5dd3d Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sat, 6 Sep 2025 11:08:43 +0200 Subject: [PATCH 2263/2494] feat(parsers): update agda, c3, embedded_template, javadoc, javascript, jinja, jinja_inline, pkl, slang, supercollider, sway, systemverilog --- lua/nvim-treesitter/parsers.lua | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 027c8f745..b8e2493f5 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -10,7 +10,7 @@ return { }, agda = { install_info = { - revision = 'b9b32fa042c2952a7bfca86847ea325e44ccc897', + revision = 'e8d47a6987effe34d5595baf321d82d3519a8527', url = 'https://github.com/tree-sitter/tree-sitter-agda', }, maintainers = { '@Decodetalkers' }, @@ -166,7 +166,7 @@ return { }, c3 = { install_info = { - revision = 'be8c7fcfb424a93f541ebd21d23611b92dff0444', + revision = '057a75df0c866034d8edce989f701ee2cb0481d8', url = 'https://github.com/c3lang/tree-sitter-c3', }, maintainers = { '@cbuttner' }, @@ -505,7 +505,7 @@ return { }, embedded_template = { install_info = { - revision = 'c70c1de07dedd532089c0c90835c8ed9fa694f5c', + revision = '3499d85f0a0d937c507a4a65368f2f63772786e1', url = 'https://github.com/tree-sitter/tree-sitter-embedded-template', }, tier = 2, @@ -1075,7 +1075,7 @@ return { }, javadoc = { install_info = { - revision = '384952d91ebc176fcf8f1933dff93b9c32430911', + revision = 'fea74f50f5a6dcef575687703b82a96f9e6d1312', url = 'https://github.com/rmuir/tree-sitter-javadoc', }, maintainers = { '@rmuir' }, @@ -1083,7 +1083,7 @@ return { }, javascript = { install_info = { - revision = 'b131ccbf414a720cce088610539241a1eb170054', + revision = '44c892e0be055ac465d5eeddae6d3e194424e7de', url = 'https://github.com/tree-sitter/tree-sitter-javascript', }, maintainers = { '@steelsojka' }, @@ -1093,7 +1093,7 @@ return { jinja = { install_info = { location = 'tree-sitter-jinja', - revision = '129184fb7bbc2d3e29967002432a869ac3758f2e', + revision = 'e589222a1ad44361bc376d5abdccd08e1fecfee5', url = 'https://github.com/cathaysia/tree-sitter-jinja', }, maintainers = { '@cathaysia' }, @@ -1104,7 +1104,7 @@ return { jinja_inline = { install_info = { location = 'tree-sitter-jinja_inline', - revision = '129184fb7bbc2d3e29967002432a869ac3758f2e', + revision = 'e589222a1ad44361bc376d5abdccd08e1fecfee5', url = 'https://github.com/cathaysia/tree-sitter-jinja', }, maintainers = { '@cathaysia' }, @@ -1610,7 +1610,7 @@ return { }, pkl = { install_info = { - revision = '97d0f3d32e8915a72fa6cf6b1832ba3884f8e82b', + revision = 'd62e832b69a0aa3d4f87fc34ba62d931d6c23f55', url = 'https://github.com/apple/tree-sitter-pkl', }, maintainers = { '@ribru17' }, @@ -2026,7 +2026,7 @@ return { }, slang = { install_info = { - revision = '5b0adf65710c3a7c265f0451ed6b4789410cbe63', + revision = '1dbcc4abc7b3cdd663eb03d93031167d6ed19f56', url = 'https://github.com/tree-sitter-grammars/tree-sitter-slang', }, maintainers = { '@theHamsta' }, @@ -2174,7 +2174,7 @@ return { }, supercollider = { install_info = { - revision = 'fd7f3bd457c8ef13cb547c4e79588cf1d2569997', + revision = 'c6145cad24e19485f6ceb86e0a1be479d6537fb0', url = 'https://github.com/madskjeldgaard/tree-sitter-supercollider', }, maintainers = { '@madskjeldgaard' }, @@ -2208,7 +2208,7 @@ return { }, sway = { install_info = { - revision = '395006713db3bbb90d267ebdfcbf1881b399b05c', + revision = '9b7845ce06ecb38b040c3940970b4fd0adc331d1', url = 'https://github.com/FuelLabs/tree-sitter-sway.git', }, maintainers = { '@ribru17' }, @@ -2241,7 +2241,7 @@ return { }, systemverilog = { install_info = { - revision = '3bd2c5d2f60ed7b07c2177b34e2976ad9a87c659', + revision = '999e88565e199abec12d6fb7470419b5ae217386', url = 'https://github.com/gmlarumbe/tree-sitter-systemverilog', }, maintainers = { '@zhangwwpeng' }, From 939556333f7d160161e7d590736850aca554d59b Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 7 Sep 2025 11:27:17 +0200 Subject: [PATCH 2264/2494] feat(parsers): update arduino, desktop, hurl, mlir, query, slint, snakemake, xresources --- lua/nvim-treesitter/parsers.lua | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index b8e2493f5..822421bfe 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -36,7 +36,7 @@ return { }, arduino = { install_info = { - revision = '2f0c1223c50aa4b754136db544204c6fc99ffc77', + revision = '53eb391da4c6c5857f8defa2c583c46c2594f565', url = 'https://github.com/tree-sitter-grammars/tree-sitter-arduino', }, maintainers = { '@ObserverOfTime' }, @@ -346,7 +346,7 @@ return { }, desktop = { install_info = { - revision = 'cbf82f2b3f75c4f2367d11ef85d34fbad89a974d', + revision = 'ea5cff078ebd8abb42598e006e549e5cb75d4752', url = 'https://github.com/ValdezFOmar/tree-sitter-desktop', }, maintainers = { '@ValdezFOmar' }, @@ -1003,7 +1003,7 @@ return { }, hurl = { install_info = { - revision = 'ff07a42d9ec95443b5c1b57ed793414bf7b79be5', + revision = '1124058cd192e80d80914652a5850a5b1887cc10', url = 'https://github.com/pfeiferj/tree-sitter-hurl', }, maintainers = { '@pfeiferj' }, @@ -1399,7 +1399,7 @@ return { mlir = { install_info = { generate = true, - revision = '09666cead2c001cbbfc82b395007f6d8158113a5', + revision = '1f3bc2fd4d4e28361d1ff75cf5763e1d0c2b6348', url = 'https://github.com/artagnon/tree-sitter-mlir', }, maintainers = { '@artagnon' }, @@ -1805,7 +1805,7 @@ return { }, query = { install_info = { - revision = '2668cc53024953224a40b1e6546d7b8ec5a11150', + revision = '60e253d3c9d6b1131a0f75c85e4bdcc9a48d5b42', url = 'https://github.com/tree-sitter-grammars/tree-sitter-query', }, maintainers = { '@steelsojka' }, @@ -2043,7 +2043,7 @@ return { }, slint = { install_info = { - revision = '96bc969d20ff347030519184ea2467f4046a524d', + revision = 'ecd60078bbd546eeb4c7fbbe02226752517b847f', url = 'https://github.com/slint-ui/tree-sitter-slint', }, maintainers = { '@hunger' }, @@ -2067,7 +2067,7 @@ return { }, snakemake = { install_info = { - revision = 'f36c1587624d6d84376c82a357c20fc319cbf02c', + revision = '7731408e5e8095fe242fdd423c3d3ae886fbf9fd', url = 'https://github.com/osthomas/tree-sitter-snakemake', }, maintainers = { '@osthomas' }, @@ -2615,7 +2615,7 @@ return { }, xresources = { install_info = { - revision = 'f40778ff42f2119aebacd46d4b6d785a4181a9ba', + revision = '423597c9ee0cd9fd98691a9f9881ff4e6f7b047a', url = 'https://github.com/ValdezFOmar/tree-sitter-xresources', }, maintainers = { '@ValdezFOmar' }, From fee71c102c54146f90b14c89711ddbb8f95a1484 Mon Sep 17 00:00:00 2001 From: osthomas <8322329+osthomas@users.noreply.github.com> Date: Sun, 7 Sep 2025 13:58:28 +0200 Subject: [PATCH 2265/2494] feat(snakemake): update queries (#8106) also add indent tests --- runtime/queries/snakemake/highlights.scm | 8 +-- runtime/queries/snakemake/indents.scm | 40 +++++++++------ runtime/queries/snakemake/locals.scm | 36 ++++++++++++++ tests/indent/snakemake/blocks.smk | 22 +++++++++ .../indent/snakemake/directive_parameters.smk | 36 ++++++++++++++ tests/indent/snakemake_spec.lua | 49 +++++++++++++++++++ 6 files changed, 171 insertions(+), 20 deletions(-) create mode 100644 tests/indent/snakemake/blocks.smk create mode 100644 tests/indent/snakemake/directive_parameters.smk create mode 100644 tests/indent/snakemake_spec.lua diff --git a/runtime/queries/snakemake/highlights.scm b/runtime/queries/snakemake/highlights.scm index 8781b405c..59a180c44 100644 --- a/runtime/queries/snakemake/highlights.scm +++ b/runtime/queries/snakemake/highlights.scm @@ -63,20 +63,20 @@ body: (_ ; directive labels in wildcard context ((wildcard (identifier) @label) - (#any-of? @label "input" "log" "output" "params" "resources" "threads" "wildcards")) + (#any-of? @label "input" "jobid" "log" "output" "params" "resources" "rule" "threads" "wildcards")) ((wildcard (attribute object: (identifier) @label)) - (#any-of? @label "input" "log" "output" "params" "resources" "threads" "wildcards")) + (#any-of? @label "input" "jobid" "log" "output" "params" "resources" "rule" "threads" "wildcards")) ((wildcard (subscript value: (identifier) @label)) - (#any-of? @label "input" "log" "output" "params" "resources" "threads" "wildcards")) + (#any-of? @label "input" "jobid" "log" "output" "params" "resources" "rule" "threads" "wildcards")) ; directive labels in block context (eg. within 'run:') ((identifier) @label - (#any-of? @label "input" "log" "output" "params" "resources" "threads" "wildcards") + (#any-of? @label "input" "jobid" "log" "output" "params" "resources" "rule" "threads" "wildcards") (#has-ancestor? @label "directive") (#has-ancestor? @label "block")) diff --git a/runtime/queries/snakemake/indents.scm b/runtime/queries/snakemake/indents.scm index 140b7fb3c..d4ed63992 100644 --- a/runtime/queries/snakemake/indents.scm +++ b/runtime/queries/snakemake/indents.scm @@ -1,12 +1,12 @@ ; inherits: python -((rule_definition) @indent.begin - (#set! indent.immediate 1)) - -((checkpoint_definition) @indent.begin - (#set! indent.immediate 1)) - -((rule_inheritance) @indent.begin +([ + (rule_definition) + (checkpoint_definition) + (rule_inheritance) + (module_definition) + (directive) +] @indent.begin (#set! indent.immediate 1)) ((rule_import @@ -14,12 +14,20 @@ ":") @indent.begin (#set! indent.immediate 1)) -((module_definition) @indent.begin - (#set! indent.immediate 1)) - -((directive) @indent.begin - (#set! indent.immediate 1)) - -; end indentation after last parameter node (no following ',') -(directive_parameters - (_) @indent.end .) +; ; end indentation after last parameter node (no following ',') +; ; accommodate different levels of nesting +; ; see also queries/python/indents.scm: return_statement +(directive + (directive_parameters + [ + (_) @indent.dedent + (_ + [ + (_) + ")" + "}" + "]" + ] .) @indent.dedent + ] + . ; anchor at end: no subsequent ',' + )) diff --git a/runtime/queries/snakemake/locals.scm b/runtime/queries/snakemake/locals.scm index 219f23347..8b5e7c0b4 100644 --- a/runtime/queries/snakemake/locals.scm +++ b/runtime/queries/snakemake/locals.scm @@ -2,3 +2,39 @@ (rule_definition name: (identifier) @local.definition.type) @local.scope + +(rule_inheritance + alias: (as_pattern_target) @local.definition.type) @local.scope + +(checkpoint_definition + name: (identifier) @local.definition.type) @local.scope + +(module_definition + name: (identifier) @local.definition.type) @local.scope + +; use rule A from X +(rule_import + (rule_import_list + (identifier) @local.definition.import) + . + module_name: (identifier) .) @local.scope + +; use rule A from X as A_fromX +; use rule A from X as *_fromX +; use rule * from X as *_fromX +(rule_import + alias: (as_pattern_target) @local.definition.import .) @local.scope + +; use rule A from X with: +(rule_import + (rule_import_list + (identifier) @local.definition.type) + . + module_name: (identifier) + . + "with") @local.scope + +; use rule A from X as Y with: +(rule_import + alias: (as_pattern_target) @local.definition.type + "with") @local.scope diff --git a/tests/indent/snakemake/blocks.smk b/tests/indent/snakemake/blocks.smk new file mode 100644 index 000000000..fc10e7ae3 --- /dev/null +++ b/tests/indent/snakemake/blocks.smk @@ -0,0 +1,22 @@ +rule A: + """doc""" + +if True: + rule B: + """doc""" + +use rule other from somewhere + +use rule other2 from somewhere as other_alias + +use rule other3 from somewhere with: + input: 2 + +use rule other4 from somewhere as other_alias2 with: + input: 2 + +checkpoint C: + input: "1" + +module A: + snakefile: "x.smk" diff --git a/tests/indent/snakemake/directive_parameters.smk b/tests/indent/snakemake/directive_parameters.smk new file mode 100644 index 000000000..fa311bfb7 --- /dev/null +++ b/tests/indent/snakemake/directive_parameters.smk @@ -0,0 +1,36 @@ +rule A: + input: a + output: b + params: + a = 1, + b = 2, + c = 3 + shell: + """ + touch {output} + """ + +rule B: + input: a, + output: a, + b + params: + +rule C: + # test dedent after variably nested nodes + params: + 1 + params: + "1" + params: + a = 1 + params: + a = "1" + params: + a = call(1) + params: + a = call("1") + params: + a = config["a"] + params: + b = call(config["a"]) diff --git a/tests/indent/snakemake_spec.lua b/tests/indent/snakemake_spec.lua new file mode 100644 index 000000000..111d01113 --- /dev/null +++ b/tests/indent/snakemake_spec.lua @@ -0,0 +1,49 @@ +local Runner = require('tests.indent.common').Runner +local XFAIL = require('tests.indent.common').XFAIL + +local run = Runner:new(it, 'tests/indent/snakemake', { + tabstop = 4, + shiftwidth = 4, + softtabstop = 0, + expandtab = true, +}) + +describe('indent Snakemake:', function() + describe('whole file:', function() + run:whole_file('.', { + expected_failures = {}, + }) + end) + + describe('new line:', function() + run:new_line('blocks.smk', { on_line = 1, text = 'input: 1', indent = 4 }) + run:new_line('blocks.smk', { on_line = 2, text = 'input: 1', indent = 4 }) + run:new_line('blocks.smk', { on_line = 5, text = 'input: 1', indent = 8 }) + run:new_line('blocks.smk', { on_line = 6, text = 'input: 1', indent = 8 }) + run:new_line('blocks.smk', { on_line = 8, text = 'pass', indent = 0 }) + run:new_line('blocks.smk', { on_line = 10, text = 'pass', indent = 0 }) + run:new_line('blocks.smk', { on_line = 12, text = 'pass', indent = 4 }) + run:new_line('blocks.smk', { on_line = 15, text = 'pass', indent = 4 }) + run:new_line('directive_parameters.smk', { on_line = 4, text = 'before_a = 0,', indent = 8 }) + run:new_line('directive_parameters.smk', { on_line = 5, text = 'after_a = 1.1,', indent = 8 }) + run:new_line( + 'directive_parameters.smk', + { on_line = 7, text = '"""dedent_after_last_param"""', indent = 4 } + ) + run:new_line( + 'directive_parameters.smk', + { on_line = 14, text = 'b = "indent_after_param_with_comma"', indent = 8 } + ) + run:new_line( + 'directive_parameters.smk', + { on_line = 15, text = 'b = "indent_after_param_with_comma"', indent = 8 } + ) + run:new_line( + 'directive_parameters.smk', + { on_line = 17, text = 'b = "indent_after_opening"', indent = 8 } + ) + for _, line in ipairs({ 22, 24, 26, 28, 30, 32, 34, 36 }) do + run:new_line('directive_parameters.smk', { on_line = line, text = '"doc"', indent = 4 }) + end + end) +end) From 7f8dd2e48bc47227d8138a5b5b1fb5a6d6e42237 Mon Sep 17 00:00:00 2001 From: altermo <107814000+altermo@users.noreply.github.com> Date: Wed, 10 Sep 2025 09:29:48 +0200 Subject: [PATCH 2266/2494] fix(filetypes): correct glimmer_* mappings (#8110) --- plugin/filetypes.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin/filetypes.lua b/plugin/filetypes.lua index a7bb3bcc0..5e23adffd 100644 --- a/plugin/filetypes.lua +++ b/plugin/filetypes.lua @@ -24,7 +24,7 @@ local filetypes = { ini = { 'confini', 'dosini' }, janet_simple = { 'janet' }, javascript = { 'javascriptreact', 'ecma', 'ecmascript', 'jsx', 'js' }, - javascript_glimmer = { 'javascript.glimmer' }, + glimmer_javascript = { 'javascript.glimmer' }, latex = { 'tex' }, linkerscript = { 'ld' }, m68k = { 'asm68k' }, @@ -53,7 +53,7 @@ local filetypes = { tlaplus = { 'tla' }, tsx = { 'typescriptreact', 'typescript.tsx' }, typescript = { 'ts' }, - typescript_glimmer = { 'typescript.glimmer' }, + glimmer_typescript = { 'typescript.glimmer' }, typst = { 'typ' }, udev = { 'udevrules' }, uxntal = { 'tal', 'uxn' }, From f42378a959ffeaaf181b0b4793ee3cdb733324be Mon Sep 17 00:00:00 2001 From: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com> Date: Sat, 13 Sep 2025 04:24:44 -0400 Subject: [PATCH 2267/2494] feat(glimmer_*): add `glimmer_template` folds (#8115) --- runtime/queries/glimmer_javascript/folds.scm | 2 ++ runtime/queries/glimmer_typescript/folds.scm | 2 ++ 2 files changed, 4 insertions(+) diff --git a/runtime/queries/glimmer_javascript/folds.scm b/runtime/queries/glimmer_javascript/folds.scm index 04328f099..95accfece 100644 --- a/runtime/queries/glimmer_javascript/folds.scm +++ b/runtime/queries/glimmer_javascript/folds.scm @@ -1 +1,3 @@ ; inherits: ecma + +(glimmer_template) @fold diff --git a/runtime/queries/glimmer_typescript/folds.scm b/runtime/queries/glimmer_typescript/folds.scm index 1b61e36da..62d0b9e0c 100644 --- a/runtime/queries/glimmer_typescript/folds.scm +++ b/runtime/queries/glimmer_typescript/folds.scm @@ -1 +1,3 @@ ; inherits: typescript + +(glimmer_template) @fold From f6adaede57e68eadd20c15cd1511ad4eea042cb0 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sat, 13 Sep 2025 10:23:18 +0200 Subject: [PATCH 2268/2494] feat(parsers): update authzed, bash, cpp, cylc, editorconfig, foam, gdscript, go, html, hurl, idl, java, javadoc, javascript, jsdoc, json, mlir, php, php_only, powershell, regex, rust, supercollider, zig --- lua/nvim-treesitter/parsers.lua | 48 ++++++++++++++++----------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 822421bfe..c3804a45e 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -62,7 +62,7 @@ return { }, authzed = { install_info = { - revision = '1dec7e1af96c56924e3322cd85fdce15d0a31d00', + revision = '83e5c26a8687eb4688fe91d690c735cc3d21ad81', url = 'https://github.com/mleonidas/tree-sitter-authzed', }, maintainers = { '@mattpolzin' }, @@ -77,7 +77,7 @@ return { }, bash = { install_info = { - revision = 'b930fed16910a74c230e09ea5b97f671448d2116', + revision = 'cef0974919c6fc7647a24ed1d89b291264b5abca', url = 'https://github.com/tree-sitter/tree-sitter-bash', }, maintainers = { '@TravonteD' }, @@ -278,7 +278,7 @@ return { }, cpp = { install_info = { - revision = '077f14ffd2de226ac95808596989c705f6dee289', + revision = 'e89fbaf0a4d294526c58259c40d5b3c16401f4e9', url = 'https://github.com/tree-sitter/tree-sitter-cpp', }, maintainers = { '@theHamsta' }, @@ -322,7 +322,7 @@ return { }, cylc = { install_info = { - revision = '5517ecade85b1de85ed8e0cb742b81decc64183a', + revision = '6d1d81137112299324b526477ce1db989ab58fb8', url = 'https://github.com/elliotfontaine/tree-sitter-cylc', }, maintainers = { '@elliotfontaine' }, @@ -449,7 +449,7 @@ return { }, editorconfig = { install_info = { - revision = '17be0e84ac012b6731626baf6920ff24e1865a03', + revision = 'de41a82984170f3c1c4ff20f2e8b906e5a860e1d', url = 'https://github.com/ValdezFOmar/tree-sitter-editorconfig', }, maintainers = { '@ValdezFOmar' }, @@ -576,7 +576,7 @@ return { }, foam = { install_info = { - revision = 'f08bb76892b93e5b23c45ac3bd6b1eea5df323cc', + revision = '472c24f11a547820327fb1be565bcfff98ea96a4', url = 'https://github.com/FoamScience/tree-sitter-foam', }, maintainers = { '@FoamScience' }, @@ -652,7 +652,7 @@ return { }, gdscript = { install_info = { - revision = '8d30b8dbb84a5f786b93726dca158ae8ea3c413f', + revision = 'd28f24a9cc482a5274d77d41918b052e72cc18f4', url = 'https://github.com/PrestonKnopp/tree-sitter-gdscript', }, maintainers = { '@PrestonKnopp' }, @@ -770,7 +770,7 @@ return { }, go = { install_info = { - revision = '1547678a9da59885853f5f5cc8a99cc203fa2e2c', + revision = '9d780544a2226ccd1a2a57299903d51d0d8c8951', url = 'https://github.com/tree-sitter/tree-sitter-go', }, maintainers = { '@theHamsta', '@WinWisely268' }, @@ -973,7 +973,7 @@ return { }, html = { install_info = { - revision = '9fc04b9ef21a92e3ea9258f5690e4461394d7811', + revision = '281738071a38865c9c52b41cd3f42a626407ffa1', url = 'https://github.com/tree-sitter/tree-sitter-html', }, maintainers = { '@TravonteD' }, @@ -1003,7 +1003,7 @@ return { }, hurl = { install_info = { - revision = '1124058cd192e80d80914652a5850a5b1887cc10', + revision = '597efbd7ce9a814bb058f48eabd055b1d1e12145', url = 'https://github.com/pfeiferj/tree-sitter-hurl', }, maintainers = { '@pfeiferj' }, @@ -1019,7 +1019,7 @@ return { }, idl = { install_info = { - revision = '6ab5582bd47b86df75afe90cdd8dc55d2d480ce1', + revision = '914f1f9bea4458427351f20c25bf263288aaeb66', url = 'https://github.com/cathaysia/tree-sitter-idl', }, maintainers = { '@cathaysia' }, @@ -1067,7 +1067,7 @@ return { }, java = { install_info = { - revision = '968afb3c9be2d4dba4cd36f3580ee0b1a9c1c537', + revision = '12c4848bc6cf2660d80b435f8d8de1a9d4676d04', url = 'https://github.com/tree-sitter/tree-sitter-java', }, maintainers = { '@p00f' }, @@ -1075,7 +1075,7 @@ return { }, javadoc = { install_info = { - revision = 'fea74f50f5a6dcef575687703b82a96f9e6d1312', + revision = 'a1917ed4cbf5c9438abbeb0a9d02b2d87bfebf7c', url = 'https://github.com/rmuir/tree-sitter-javadoc', }, maintainers = { '@rmuir' }, @@ -1083,7 +1083,7 @@ return { }, javascript = { install_info = { - revision = '44c892e0be055ac465d5eeddae6d3e194424e7de', + revision = '22da14e17db59c35aae2b9da2728337c301ce741', url = 'https://github.com/tree-sitter/tree-sitter-javascript', }, maintainers = { '@steelsojka' }, @@ -1121,7 +1121,7 @@ return { }, jsdoc = { install_info = { - revision = 'a417db5dbdd869fccb6a8b75ec04459e1d4ccd2c', + revision = '658d18dcdddb75c760363faa4963427a7c6b52db', url = 'https://github.com/tree-sitter/tree-sitter-jsdoc', }, maintainers = { '@steelsojka' }, @@ -1129,7 +1129,7 @@ return { }, json = { install_info = { - revision = 'fd38547e2fe5738e5b173e5f40a27df261224bba', + revision = '532a34b9e5a64fdcd5a8748a917fd489aa06d6fb', url = 'https://github.com/tree-sitter/tree-sitter-json', }, maintainers = { '@steelsojka' }, @@ -1399,7 +1399,7 @@ return { mlir = { install_info = { generate = true, - revision = '1f3bc2fd4d4e28361d1ff75cf5763e1d0c2b6348', + revision = 'ef7a2efed65814aa394875e2b578ff6aeb272b41', url = 'https://github.com/artagnon/tree-sitter-mlir', }, maintainers = { '@artagnon' }, @@ -1574,7 +1574,7 @@ return { php = { install_info = { location = 'php', - revision = '5b5627faaa290d89eb3d01b9bf47c3bb9e797dea', + revision = '9d7d6f649297ee01639e759795793cc57698031b', url = 'https://github.com/tree-sitter/tree-sitter-php', }, maintainers = { '@tk-shirasaka', '@calebdw' }, @@ -1585,7 +1585,7 @@ return { php_only = { install_info = { location = 'php_only', - revision = '5b5627faaa290d89eb3d01b9bf47c3bb9e797dea', + revision = '9d7d6f649297ee01639e759795793cc57698031b', url = 'https://github.com/tree-sitter/tree-sitter-php', }, maintainers = { '@tk-shirasaka', '@calebdw' }, @@ -1653,7 +1653,7 @@ return { powershell = { filetype = 'ps1', install_info = { - revision = '96ab1da05cfb55b52ee7000b4be8a4b6fad232f5', + revision = 'f272e5ac9bc48d0f6df2429cab914d216e9413cd', url = 'https://github.com/airbus-cert/tree-sitter-powershell', }, maintainers = { '@L2jLiga' }, @@ -1877,7 +1877,7 @@ return { }, regex = { install_info = { - revision = 'b638d29335ef41215b86732dd51be34c701ef683', + revision = 'b2ac15e27fce703d2f37a79ccd94a5c0cbe9720b', url = 'https://github.com/tree-sitter/tree-sitter-regex', }, maintainers = { '@theHamsta' }, @@ -1974,7 +1974,7 @@ return { }, rust = { install_info = { - revision = '3bfef41a01ab49a25ffdecf998823b4b82fcaf69', + revision = '2a58b00ed44829eebcbe6f932604093b9396a43b', url = 'https://github.com/tree-sitter/tree-sitter-rust', }, maintainers = { '@amaanq' }, @@ -2174,7 +2174,7 @@ return { }, supercollider = { install_info = { - revision = 'c6145cad24e19485f6ceb86e0a1be479d6537fb0', + revision = '613bac2ddc30bff4f0a1d88b1aa7e5ec8ca37028', url = 'https://github.com/madskjeldgaard/tree-sitter-supercollider', }, maintainers = { '@madskjeldgaard' }, @@ -2655,7 +2655,7 @@ return { }, zig = { install_info = { - revision = 'b71affffdb4222ff2d2dea6e164f76603b0be6bc', + revision = '6479aa13f32f701c383083d8b28360ebd682fb7d', url = 'https://github.com/tree-sitter-grammars/tree-sitter-zig', }, maintainers = { '@amaanq' }, From 682d083292f01636622362cf9eb0e4b2f9de2b13 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sat, 13 Sep 2025 10:31:02 +0200 Subject: [PATCH 2269/2494] feat(python)!: update parser and queries Breaking change: anonymous node `"expect*"` was removed by the refactor. --- lua/nvim-treesitter/parsers.lua | 2 +- runtime/queries/python/highlights.scm | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index c3804a45e..f9f9620e4 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -1772,7 +1772,7 @@ return { }, python = { install_info = { - revision = '710796b8b877a970297106e5bbc8e2afa47f86ec', + revision = '293fdc02038ee2bf0e2e206711b69c90ac0d413f', url = 'https://github.com/tree-sitter/tree-sitter-python', }, maintainers = { '@stsewd', '@theHamsta' }, diff --git a/runtime/queries/python/highlights.scm b/runtime/queries/python/highlights.scm index 00250de1b..e5b9ac3aa 100644 --- a/runtime/queries/python/highlights.scm +++ b/runtime/queries/python/highlights.scm @@ -223,7 +223,6 @@ [ "try" "except" - "except*" "raise" "finally" ] @keyword.exception From 7aa24acae3a288e442e06928171f360bbdf75ba4 Mon Sep 17 00:00:00 2001 From: purarue <7804791+purarue@users.noreply.github.com> Date: Sun, 14 Sep 2025 08:53:21 +0000 Subject: [PATCH 2270/2494] feat(rifleconf): add parser and queries --- SUPPORTED_LANGUAGES.md | 1 + lua/nvim-treesitter/parsers.lua | 8 ++++++ runtime/queries/rifleconf/highlights.scm | 31 ++++++++++++++++++++++++ runtime/queries/rifleconf/injections.scm | 16 ++++++++++++ 4 files changed, 56 insertions(+) create mode 100644 runtime/queries/rifleconf/highlights.scm create mode 100644 runtime/queries/rifleconf/injections.scm diff --git a/SUPPORTED_LANGUAGES.md b/SUPPORTED_LANGUAGES.md index 25c5e1137..361585ab2 100644 --- a/SUPPORTED_LANGUAGES.md +++ b/SUPPORTED_LANGUAGES.md @@ -244,6 +244,7 @@ jsx (queries only)[^jsx] | unstable | `HFIJ ` | | @steelsojka [rego](https://github.com/FallenAngel97/tree-sitter-rego) | unstable | `H  J ` | | @FallenAngel97 [requirements](https://github.com/tree-sitter-grammars/tree-sitter-requirements) | unstable | `H  J ` | | @ObserverOfTime [rescript](https://github.com/rescript-lang/tree-sitter-rescript) | unstable | `HFIJL` | | @ribru17 +[rifleconf](https://github.com/purarue/tree-sitter-rifleconf) | unstable | `H  J ` | | @purarue [rnoweb](https://github.com/bamonroe/tree-sitter-rnoweb) | unstable | `HF J ` | | @bamonroe [robot](https://github.com/Hubro/tree-sitter-robot) | unstable | `HFIJ ` | | @Hubro [robots](https://github.com/opa-oz/tree-sitter-robots-txt) | unstable | `H  J ` | | @opa-oz diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index f9f9620e4..096d93599 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -1908,6 +1908,14 @@ return { maintainers = { '@ribru17' }, tier = 2, }, + rifleconf = { + install_info = { + url = 'https://github.com/purarue/tree-sitter-rifleconf', + revision = 'b215640ba72a9a8cac6f5d95dbc3d320cb546e13', + }, + maintainers = { '@purarue' }, + tier = 2, + }, rnoweb = { install_info = { revision = '1a74dc0ed731ad07db39f063e2c5a6fe528cae7f', diff --git a/runtime/queries/rifleconf/highlights.scm b/runtime/queries/rifleconf/highlights.scm new file mode 100644 index 000000000..2ac837a3e --- /dev/null +++ b/runtime/queries/rifleconf/highlights.scm @@ -0,0 +1,31 @@ +(comment) @comment @spell + +[ + "," + ";" +] @punctuation.delimiter + +[ + "=" + (condition_negation) +] @operator + +; mark the string values for items interpreted as regex as string.regexp +(binary_condition_expression + (binary_condition_identifier) @_keyword + (identifier) @string.regexp + (#any-of? @_keyword "match" "ext" "mime" "name" "path")) + +(binary_condition_identifier) @keyword + +(unary_condition_identifier) @keyword + +(condition_expression + (binary_condition_expression + (binary_condition_identifier) @keyword + (identifier) @number) + (#eq? @keyword "number")) + +(ask) @function.builtin + +(string) @string diff --git a/runtime/queries/rifleconf/injections.scm b/runtime/queries/rifleconf/injections.scm new file mode 100644 index 000000000..e0463982f --- /dev/null +++ b/runtime/queries/rifleconf/injections.scm @@ -0,0 +1,16 @@ +; These are all interpreted as regex when evaluated +; https://github.com/ranger/ranger/blob/38bb8901004b75a407ffee4b9e176bc0a436cb15/ranger/ext/rifle.py#L273-L282 +(binary_condition_expression + (binary_condition_identifier) @_keyword + (identifier) @injection.content + (#any-of? @_keyword "match" "ext" "mime" "name" "path") + (#set! injection.language "regex")) + +; highlight any commands using the bash tree-sitter parser +(command_list + (command) @injection.content + (#set! injection.include-children) + (#set! injection.language "bash")) + +((comment) @injection.content + (#set! injection.language "comment")) From 030e979b23a65a22f1c0a43396e6c7cf676c8735 Mon Sep 17 00:00:00 2001 From: "Sergio A. Vargas" Date: Wed, 17 Sep 2025 10:53:25 -0500 Subject: [PATCH 2271/2494] docs(README): clarify that `tree-sitter-cli` is required (#8124) Seems like most distros have split out the CLI package under this name and reserve `tree-sitter` for the library (and crates) only. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 921b11002..bdb9c1ddc 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ For details on these and how to help improving them, see [CONTRIBUTING.md](./CON - Neovim 0.11.0 or later (nightly) - `tar` and `curl` in your path -- [`tree-sitter`](https://github.com/tree-sitter/tree-sitter) CLI (0.25.0 or later) +- [`tree-sitter-cli`](https://github.com/tree-sitter/tree-sitter/blob/master/crates/cli/README.md) (0.25.0 or later) - a C compiler in your path (see ) - `Node` (23.0.0 or later) for some parsers (see the [list of supported languages](SUPPORTED_LANGUAGES.md)) From f4d22b96c58c799939b014e03eb4db1b5e5c82c9 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Wed, 17 Sep 2025 17:56:17 +0200 Subject: [PATCH 2272/2494] docs(health): consistent use of `tree-sitter-cli` --- lua/nvim-treesitter/health.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/nvim-treesitter/health.lua b/lua/nvim-treesitter/health.lua index 856e2183e..3da7f5415 100644 --- a/lua/nvim-treesitter/health.lua +++ b/lua/nvim-treesitter/health.lua @@ -54,14 +54,14 @@ local function install_health() local ts = check_exe('tree-sitter') if ts then if vim.version.ge(ts.version, TREE_SITTER_MIN_VER) then - health.ok(string.format('tree-sitter %s (%s)', ts.version, ts.path)) + health.ok(string.format('tree-sitter-cli %s (%s)', ts.version, ts.path)) else health.error( - string.format('tree-sitter CLI v%d.%d.%d is required', unpack(TREE_SITTER_MIN_VER)) + string.format('tree-sitter-cli v%d.%d.%d is required', unpack(TREE_SITTER_MIN_VER)) ) end else - health.error('tree-sitter CLI not found') + health.error('tree-sitter-cli not found') end end From 1c760c1888f5e7474d1ae222f0638cb3b731629b Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Wed, 17 Sep 2025 18:08:02 +0200 Subject: [PATCH 2273/2494] feat(parsers): update bash, c, cpp, desktop, djot, dtd, editorconfig, gdscript, go, html, idl, java, javadoc, javascript, json, markdown, markdown_inline, mlir, php, php_only, python, r, rust, scheme, ssh_config, supercollider, superhtml, systemverilog, templ, xml, xresources --- lua/nvim-treesitter/parsers.lua | 64 +++++++++++++-------------- runtime/queries/python/highlights.scm | 12 +++-- 2 files changed, 37 insertions(+), 39 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 096d93599..ff27ab5d9 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -77,7 +77,7 @@ return { }, bash = { install_info = { - revision = 'cef0974919c6fc7647a24ed1d89b291264b5abca', + revision = '20f55fb9663568f16ebceaac7673d2aa530add46', url = 'https://github.com/tree-sitter/tree-sitter-bash', }, maintainers = { '@TravonteD' }, @@ -158,7 +158,7 @@ return { }, c = { install_info = { - revision = 'd8d0503aa0152119149ecad76685f37682c0d03f', + revision = 'ae19b676b13bdcc13b7665397e6d9b14975473dd', url = 'https://github.com/tree-sitter/tree-sitter-c', }, maintainers = { '@amaanq' }, @@ -278,7 +278,7 @@ return { }, cpp = { install_info = { - revision = 'e89fbaf0a4d294526c58259c40d5b3c16401f4e9', + revision = '2a682d312b09eb737a08b4900ec786415574b6bf', url = 'https://github.com/tree-sitter/tree-sitter-cpp', }, maintainers = { '@theHamsta' }, @@ -346,7 +346,7 @@ return { }, desktop = { install_info = { - revision = 'ea5cff078ebd8abb42598e006e549e5cb75d4752', + revision = '4a0a5eec8644a7f3357f852d7a16d2550bb2cbc2', url = 'https://github.com/ValdezFOmar/tree-sitter-desktop', }, maintainers = { '@ValdezFOmar' }, @@ -386,7 +386,7 @@ return { }, djot = { install_info = { - revision = 'eb31845d59b9ee8c1b2098e78e9ca72004bd1579', + revision = '74fac1f53c6d52aeac104b6874e5506be6d0cfe6', url = 'https://github.com/treeman/tree-sitter-djot', }, maintainers = { '@NoahTheDuke' }, @@ -419,7 +419,7 @@ return { dtd = { install_info = { location = 'dtd', - revision = '87be254e12169240a0e0214dbee5e208df96fa75', + revision = '863dbc381f44f6c136a399e684383b977bb2beaa', url = 'https://github.com/tree-sitter-grammars/tree-sitter-xml', }, maintainers = { '@ObserverOfTime' }, @@ -449,7 +449,7 @@ return { }, editorconfig = { install_info = { - revision = 'de41a82984170f3c1c4ff20f2e8b906e5a860e1d', + revision = '947228fb880f838c6d71e8f11dbc0bfb82cd4c78', url = 'https://github.com/ValdezFOmar/tree-sitter-editorconfig', }, maintainers = { '@ValdezFOmar' }, @@ -652,7 +652,7 @@ return { }, gdscript = { install_info = { - revision = 'd28f24a9cc482a5274d77d41918b052e72cc18f4', + revision = 'e8f2cb84bfd61d025cbc39e95346ebc6b866daf1', url = 'https://github.com/PrestonKnopp/tree-sitter-gdscript', }, maintainers = { '@PrestonKnopp' }, @@ -770,7 +770,7 @@ return { }, go = { install_info = { - revision = '9d780544a2226ccd1a2a57299903d51d0d8c8951', + revision = '2346a3ab1bb3857b48b29d779a1ef9799a248cd7', url = 'https://github.com/tree-sitter/tree-sitter-go', }, maintainers = { '@theHamsta', '@WinWisely268' }, @@ -973,7 +973,7 @@ return { }, html = { install_info = { - revision = '281738071a38865c9c52b41cd3f42a626407ffa1', + revision = '73a3947324f6efddf9e17c0ea58d454843590cc0', url = 'https://github.com/tree-sitter/tree-sitter-html', }, maintainers = { '@TravonteD' }, @@ -1019,7 +1019,7 @@ return { }, idl = { install_info = { - revision = '914f1f9bea4458427351f20c25bf263288aaeb66', + revision = '3632e926ef4ba924b05993683111480af0d5c9e3', url = 'https://github.com/cathaysia/tree-sitter-idl', }, maintainers = { '@cathaysia' }, @@ -1067,7 +1067,7 @@ return { }, java = { install_info = { - revision = '12c4848bc6cf2660d80b435f8d8de1a9d4676d04', + revision = 'e10607b45ff745f5f876bfa3e94fbcc6b44bdc11', url = 'https://github.com/tree-sitter/tree-sitter-java', }, maintainers = { '@p00f' }, @@ -1075,7 +1075,7 @@ return { }, javadoc = { install_info = { - revision = 'a1917ed4cbf5c9438abbeb0a9d02b2d87bfebf7c', + revision = '85acd4655cbfaef414de6e3f87436e63ef5cb0da', url = 'https://github.com/rmuir/tree-sitter-javadoc', }, maintainers = { '@rmuir' }, @@ -1083,7 +1083,7 @@ return { }, javascript = { install_info = { - revision = '22da14e17db59c35aae2b9da2728337c301ce741', + revision = '58404d8cf191d69f2674a8fd507bd5776f46cb11', url = 'https://github.com/tree-sitter/tree-sitter-javascript', }, maintainers = { '@steelsojka' }, @@ -1129,7 +1129,7 @@ return { }, json = { install_info = { - revision = '532a34b9e5a64fdcd5a8748a917fd489aa06d6fb', + revision = '001c28d7a29832b06b0e831ec77845553c89b56d', url = 'https://github.com/tree-sitter/tree-sitter-json', }, maintainers = { '@steelsojka' }, @@ -1347,7 +1347,7 @@ return { markdown = { install_info = { location = 'tree-sitter-markdown', - revision = '7462bb66ac7e90312082269007fac2772fe5efd1', + revision = '2dfd57f547f06ca5631a80f601e129d73fc8e9f0', url = 'https://github.com/tree-sitter-grammars/tree-sitter-markdown', }, maintainers = { '@MDeiml' }, @@ -1358,7 +1358,7 @@ return { markdown_inline = { install_info = { location = 'tree-sitter-markdown-inline', - revision = '7462bb66ac7e90312082269007fac2772fe5efd1', + revision = '2dfd57f547f06ca5631a80f601e129d73fc8e9f0', url = 'https://github.com/tree-sitter-grammars/tree-sitter-markdown', }, maintainers = { '@MDeiml' }, @@ -1399,7 +1399,7 @@ return { mlir = { install_info = { generate = true, - revision = 'ef7a2efed65814aa394875e2b578ff6aeb272b41', + revision = 'fc6f378f2ce6ceee11ea31fbfc8d72955d9bbe27', url = 'https://github.com/artagnon/tree-sitter-mlir', }, maintainers = { '@artagnon' }, @@ -1574,7 +1574,7 @@ return { php = { install_info = { location = 'php', - revision = '9d7d6f649297ee01639e759795793cc57698031b', + revision = '9a85df21c63bdaf1695b7ac1430e29354cb5904f', url = 'https://github.com/tree-sitter/tree-sitter-php', }, maintainers = { '@tk-shirasaka', '@calebdw' }, @@ -1585,7 +1585,7 @@ return { php_only = { install_info = { location = 'php_only', - revision = '9d7d6f649297ee01639e759795793cc57698031b', + revision = '9a85df21c63bdaf1695b7ac1430e29354cb5904f', url = 'https://github.com/tree-sitter/tree-sitter-php', }, maintainers = { '@tk-shirasaka', '@calebdw' }, @@ -1772,7 +1772,7 @@ return { }, python = { install_info = { - revision = '293fdc02038ee2bf0e2e206711b69c90ac0d413f', + revision = '26855eabccb19c6abf499fbc5b8dc7cc9ab8bc64', url = 'https://github.com/tree-sitter/tree-sitter-python', }, maintainers = { '@stsewd', '@theHamsta' }, @@ -1814,7 +1814,7 @@ return { }, r = { install_info = { - revision = '7b4eb04dfcc86e6705cade825f8c1edbd46584b2', + revision = '0e6ef7741712c09dc3ee6e81c42e919820cc65ef', url = 'https://github.com/r-lib/tree-sitter-r', }, maintainers = { '@ribru17' }, @@ -1910,8 +1910,8 @@ return { }, rifleconf = { install_info = { - url = 'https://github.com/purarue/tree-sitter-rifleconf', revision = 'b215640ba72a9a8cac6f5d95dbc3d320cb546e13', + url = 'https://github.com/purarue/tree-sitter-rifleconf', }, maintainers = { '@purarue' }, tier = 2, @@ -1982,7 +1982,7 @@ return { }, rust = { install_info = { - revision = '2a58b00ed44829eebcbe6f932604093b9396a43b', + revision = '00d7cbc95f0b8ea2703129550fbd1853a13e0e29', url = 'https://github.com/tree-sitter/tree-sitter-rust', }, maintainers = { '@amaanq' }, @@ -2008,7 +2008,7 @@ return { }, scheme = { install_info = { - revision = 'e35b41a183164f4a12e10da3d0c430e837c3d75a', + revision = '67b5c8d6ce19fd5265f13204fec0a3efa9e095d9', url = 'https://github.com/6cdh/tree-sitter-scheme', }, tier = 2, @@ -2150,7 +2150,7 @@ return { }, ssh_config = { install_info = { - revision = '2d620d0ad636705800cf0ddb92c30afe703cd84f', + revision = '71d2693deadaca8cdc09e38ba41d2f6042da1616', url = 'https://github.com/tree-sitter-grammars/tree-sitter-ssh-config', }, maintainers = { '@ObserverOfTime' }, @@ -2182,7 +2182,7 @@ return { }, supercollider = { install_info = { - revision = '613bac2ddc30bff4f0a1d88b1aa7e5ec8ca37028', + revision = '18be2f121ea0a722dfdffcc4439687fc1d10a9ce', url = 'https://github.com/madskjeldgaard/tree-sitter-supercollider', }, maintainers = { '@madskjeldgaard' }, @@ -2191,7 +2191,7 @@ return { superhtml = { install_info = { location = 'tree-sitter-superhtml', - revision = '8cb16babb0c66b6512d6aeb4cbc37ed90641d980', + revision = '521458b2a61e607d07b794d85b5dcfcd10518745', url = 'https://github.com/kristoff-it/superhtml', }, maintainers = { '@rockorager' }, @@ -2249,7 +2249,7 @@ return { }, systemverilog = { install_info = { - revision = '999e88565e199abec12d6fb7470419b5ae217386', + revision = '9e06a0dddbef4e80a2091fd0a772cc93a55019f7', url = 'https://github.com/gmlarumbe/tree-sitter-systemverilog', }, maintainers = { '@zhangwwpeng' }, @@ -2298,7 +2298,7 @@ return { }, templ = { install_info = { - revision = '47594c5cbef941e6a3ccf4ddb934a68cf4c68075', + revision = '27a1fc62c8dd4c49669e03629491f66449c6c435', url = 'https://github.com/vrischmann/tree-sitter-templ', }, maintainers = { '@vrischmann' }, @@ -2614,7 +2614,7 @@ return { xml = { install_info = { location = 'xml', - revision = '87be254e12169240a0e0214dbee5e208df96fa75', + revision = '863dbc381f44f6c136a399e684383b977bb2beaa', url = 'https://github.com/tree-sitter-grammars/tree-sitter-xml', }, maintainers = { '@ObserverOfTime' }, @@ -2623,7 +2623,7 @@ return { }, xresources = { install_info = { - revision = '423597c9ee0cd9fd98691a9f9881ff4e6f7b047a', + revision = '64a07d24c34a8e7915360e6ab367e9b0ff991307', url = 'https://github.com/ValdezFOmar/tree-sitter-xresources', }, maintainers = { '@ValdezFOmar' }, diff --git a/runtime/queries/python/highlights.scm b/runtime/queries/python/highlights.scm index e5b9ac3aa..0cdc957d0 100644 --- a/runtime/queries/python/highlights.scm +++ b/runtime/queries/python/highlights.scm @@ -358,17 +358,15 @@ ((class_definition body: (block - (expression_statement - (assignment - left: (identifier) @variable.member)))) + (assignment + left: (identifier) @variable.member))) (#lua-match? @variable.member "^[%l_].*$")) ((class_definition body: (block - (expression_statement - (assignment - left: (_ - (identifier) @variable.member))))) + (assignment + left: (_ + (identifier) @variable.member)))) (#lua-match? @variable.member "^[%l_].*$")) ((class_definition From 8ab64a37ea56762dc0d1a6da2bba2d4af88e3594 Mon Sep 17 00:00:00 2001 From: sharpchen Date: Wed, 17 Sep 2025 22:48:13 +0800 Subject: [PATCH 2274/2494] fix(c_sharp): missing query for delegate name --- runtime/queries/c_sharp/highlights.scm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/runtime/queries/c_sharp/highlights.scm b/runtime/queries/c_sharp/highlights.scm index ce9911151..d8cf08388 100644 --- a/runtime/queries/c_sharp/highlights.scm +++ b/runtime/queries/c_sharp/highlights.scm @@ -190,6 +190,9 @@ (enum_declaration name: (identifier) @type) +(delegate_declaration + name: (identifier) @type) + (enum_member_declaration name: (identifier) @variable.member) From 317a77affcd887441d67c5f7f1d5beff5243989b Mon Sep 17 00:00:00 2001 From: sharpchen Date: Thu, 18 Sep 2025 23:02:03 +0800 Subject: [PATCH 2275/2494] fix(c_sharp): missing highlight for parameter modifier --- runtime/queries/c_sharp/highlights.scm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/runtime/queries/c_sharp/highlights.scm b/runtime/queries/c_sharp/highlights.scm index d8cf08388..0c9489506 100644 --- a/runtime/queries/c_sharp/highlights.scm +++ b/runtime/queries/c_sharp/highlights.scm @@ -90,6 +90,9 @@ (parameter name: (identifier) @variable.parameter) +(parameter + (modifier) @keyword.modifier) + (parameter_list name: (identifier) @variable.parameter) From 1b8622a830da30c348998f26fab6934ca0133392 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20de=20Vill=C3=A8le?= <25150288+Thibaulltt@users.noreply.github.com> Date: Fri, 5 Sep 2025 10:46:07 +0200 Subject: [PATCH 2276/2494] feat(latex)!: update parser and queries Breaking change: `(curly_group_label)` replaced by `(curly_group_text)` see latex-lsp/tree-sitter-latex#213 --- lua/nvim-treesitter/parsers.lua | 2 +- runtime/queries/latex/highlights.scm | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index ff27ab5d9..8ea842356 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -1240,7 +1240,7 @@ return { latex = { install_info = { generate = true, - revision = '9410012b3eba659da5de5a655b4041593b493cb7', + revision = '7af2bf3addcab5ada8843cf08b857daf1799dbd4', url = 'https://github.com/latex-lsp/tree-sitter-latex', }, maintainers = { '@theHamsta', '@clason' }, diff --git a/runtime/queries/latex/highlights.scm b/runtime/queries/latex/highlights.scm index ec39afcf5..30602c907 100644 --- a/runtime/queries/latex/highlights.scm +++ b/runtime/queries/latex/highlights.scm @@ -92,9 +92,9 @@ (label_reference_range command: _ @function.macro - from: (curly_group_text + from: (curly_group_label (_) @markup.link) - to: (curly_group_text + to: (curly_group_label (_) @markup.link)) (label_reference @@ -104,7 +104,7 @@ (label_number command: _ @function.macro - name: (curly_group_text + name: (curly_group_label (_) @markup.link) number: (_) @markup.link) From c41b3b9841588e956663345cf01842a232d5eece Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20de=20Vill=C3=A8le?= <25150288+Thibaulltt@users.noreply.github.com> Date: Fri, 5 Sep 2025 11:12:12 +0200 Subject: [PATCH 2277/2494] feat(latex): add counter nodes' highlight rules --- lua/nvim-treesitter/parsers.lua | 2 +- runtime/queries/latex/highlights.scm | 59 ++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 1 deletion(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 8ea842356..16d575512 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -1240,7 +1240,7 @@ return { latex = { install_info = { generate = true, - revision = '7af2bf3addcab5ada8843cf08b857daf1799dbd4', + revision = '7e0ecdc02926c7b9b2e0c76003d4fe7b0944f957', url = 'https://github.com/latex-lsp/tree-sitter-latex', }, maintainers = { '@theHamsta', '@clason' }, diff --git a/runtime/queries/latex/highlights.scm b/runtime/queries/latex/highlights.scm index 30602c907..3f195a13e 100644 --- a/runtime/queries/latex/highlights.scm +++ b/runtime/queries/latex/highlights.scm @@ -23,6 +23,9 @@ (curly_group_spec (text) @variable.parameter) +(curly_group_value + (value_literal) @constant) + (brack_group_argc) @variable.parameter [ @@ -85,6 +88,54 @@ declaration: (curly_group_command_name (_) @function)) +(counter_declaration + command: _ @function.macro @nospell + counter: (curly_group_word + (word) @variable) + supercounter: (brack_group_word + (word) @variable)?) + +(counter_within_declaration + command: _ @function.macro @nospell + counter: (curly_group_word + (word) @variable) + supercounter: (curly_group_word + (word) @variable)) + +(counter_without_declaration + command: _ @function.macro @nospell + counter: (curly_group_word + (word) @variable) + supercounter: (curly_group_word + (word) @variable)) + +(counter_value + command: _ @function.macro @nospell + counter: (curly_group_word + (word) @variable)) + +; The 'value' fields for the two following highlights +; are handled by counter_value and curly_group_value. +(counter_definition + command: _ @function.macro @nospell + counter: (curly_group_word + (word) @variable)) + +(counter_addition + command: _ @function.macro @nospell + counter: (curly_group_word + (word) @variable)) + +(counter_increment + command: _ @function.macro @nospell + counter: (curly_group_word + (word) @variable)) + +(counter_typesetting + command: _ @function.macro @nospell + counter: (curly_group_word + (word) @variable)) + (label_definition command: _ @function.macro name: (curly_group_label @@ -298,6 +349,14 @@ ; Turn spelling off for whole nodes [ + (counter_declaration) + (counter_within_declaration) + (counter_without_declaration) + (counter_value) + (counter_definition) + (counter_addition) + (counter_increment) + (counter_typesetting) (label_reference) (label_reference_range) (label_number) From 20fc6b1270dddff7e16220e0a51d17614d41fd43 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 19 Sep 2025 13:35:29 +0200 Subject: [PATCH 2278/2494] feat(python): revert breaking change This reverts the update in https://github.com/nvim-treesitter/nvim-treesitter/pull/8128 which turned out to have further breaking consequences. Pin the parser to the last release (tier 1) to avoid pulling in more breaking changes. --- SUPPORTED_LANGUAGES.md | 2 +- lua/nvim-treesitter/parsers.lua | 4 ++-- runtime/queries/python/highlights.scm | 12 +++++++----- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/SUPPORTED_LANGUAGES.md b/SUPPORTED_LANGUAGES.md index 361585ab2..61371d0e0 100644 --- a/SUPPORTED_LANGUAGES.md +++ b/SUPPORTED_LANGUAGES.md @@ -227,7 +227,7 @@ jsx (queries only)[^jsx] | unstable | `HFIJ ` | | @steelsojka [puppet](https://github.com/tree-sitter-grammars/tree-sitter-puppet) | unstable | `HFIJL` | | @amaanq [purescript](https://github.com/postsolar/tree-sitter-purescript) | unstable | `H  JL` | | @postsolar [pymanifest](https://github.com/tree-sitter-grammars/tree-sitter-pymanifest) | unstable | `H  J ` | | @ObserverOfTime -[python](https://github.com/tree-sitter/tree-sitter-python) | unstable | `HFIJL` | | @stsewd, @theHamsta +[python](https://github.com/tree-sitter/tree-sitter-python) | stable | `HFIJL` | | @stsewd, @theHamsta [ql](https://github.com/tree-sitter/tree-sitter-ql) | unstable | `HFIJL` | | @pwntester [qmldir](https://github.com/tree-sitter-grammars/tree-sitter-qmldir) | unstable | `H  J ` | | @amaanq [qmljs](https://github.com/yuja/tree-sitter-qmljs) | unstable | `HF J ` | | @Decodetalkers diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 16d575512..79fe3a6b6 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -1772,11 +1772,11 @@ return { }, python = { install_info = { - revision = '26855eabccb19c6abf499fbc5b8dc7cc9ab8bc64', + revision = 'v0.25.0', url = 'https://github.com/tree-sitter/tree-sitter-python', }, maintainers = { '@stsewd', '@theHamsta' }, - tier = 2, + tier = 1, }, ql = { install_info = { diff --git a/runtime/queries/python/highlights.scm b/runtime/queries/python/highlights.scm index 0cdc957d0..e5b9ac3aa 100644 --- a/runtime/queries/python/highlights.scm +++ b/runtime/queries/python/highlights.scm @@ -358,15 +358,17 @@ ((class_definition body: (block - (assignment - left: (identifier) @variable.member))) + (expression_statement + (assignment + left: (identifier) @variable.member)))) (#lua-match? @variable.member "^[%l_].*$")) ((class_definition body: (block - (assignment - left: (_ - (identifier) @variable.member)))) + (expression_statement + (assignment + left: (_ + (identifier) @variable.member))))) (#lua-match? @variable.member "^[%l_].*$")) ((class_definition From a1d3efbdf587a4c220d08249b1a4d8870c828d38 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 21 Sep 2025 10:32:52 +0200 Subject: [PATCH 2279/2494] feat(parsers): update ada, cuda, desktop, gdscript, json5, mlir, nu, slint, snakemake, supercollider, superhtml, vhdl, wgsl_bevy, xresources --- lua/nvim-treesitter/parsers.lua | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 79fe3a6b6..9e3a32e2e 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -2,7 +2,7 @@ return { ada = { install_info = { - revision = '0a4c27dc1308a9d2742de22e5fcfc0c137b3d3f3', + revision = '364d3f4aa8b382113bdd5d3ca6d82dc9c74ac738', url = 'https://github.com/briot/tree-sitter-ada', }, maintainers = { '@briot' }, @@ -305,7 +305,7 @@ return { }, cuda = { install_info = { - revision = '014628ae8d2df391b88ddb9fa0260fd97f770829', + revision = '48b066f334f4cf2174e05a50218ce2ed98b6fd01', url = 'https://github.com/tree-sitter-grammars/tree-sitter-cuda', }, maintainers = { '@theHamsta' }, @@ -346,7 +346,7 @@ return { }, desktop = { install_info = { - revision = '4a0a5eec8644a7f3357f852d7a16d2550bb2cbc2', + revision = 'b77dad972dcc96f9a7123fb08d8eb46308e31d9a', url = 'https://github.com/ValdezFOmar/tree-sitter-desktop', }, maintainers = { '@ValdezFOmar' }, @@ -652,7 +652,7 @@ return { }, gdscript = { install_info = { - revision = 'e8f2cb84bfd61d025cbc39e95346ebc6b866daf1', + revision = '9686853b696db07118ad110e440d6de0ca6498b4', url = 'https://github.com/PrestonKnopp/tree-sitter-gdscript', }, maintainers = { '@PrestonKnopp' }, @@ -1137,7 +1137,7 @@ return { }, json5 = { install_info = { - revision = '5ebe24e210f0fbcd6180fd673ed184ed81f3bcc6', + revision = '8cb4114a4d7e5bab75d74466422e032de31d83df', url = 'https://github.com/Joakker/tree-sitter-json5', }, maintainers = { '@Joakker' }, @@ -1399,7 +1399,7 @@ return { mlir = { install_info = { generate = true, - revision = 'fc6f378f2ce6ceee11ea31fbfc8d72955d9bbe27', + revision = '8f86b34b5e3dfe561e1e913df4a3d719ea1dcc5c', url = 'https://github.com/artagnon/tree-sitter-mlir', }, maintainers = { '@artagnon' }, @@ -1479,7 +1479,7 @@ return { }, nu = { install_info = { - revision = 'cc4624fbc6ec3563d98fbe8f215a8b8e10b16f32', + revision = '0e6c59c46db3c246eaf86ce5b325da1247e971a5', url = 'https://github.com/nushell/tree-sitter-nu', }, maintainers = { '@abhisheksingh0x558' }, @@ -2051,7 +2051,7 @@ return { }, slint = { install_info = { - revision = 'ecd60078bbd546eeb4c7fbbe02226752517b847f', + revision = '152ec7f6a2aa29fe222f741d91bec70153c487da', url = 'https://github.com/slint-ui/tree-sitter-slint', }, maintainers = { '@hunger' }, @@ -2075,7 +2075,7 @@ return { }, snakemake = { install_info = { - revision = '7731408e5e8095fe242fdd423c3d3ae886fbf9fd', + revision = '68010430c3e51c0e84c1ce21c6551df0e2469f51', url = 'https://github.com/osthomas/tree-sitter-snakemake', }, maintainers = { '@osthomas' }, @@ -2182,7 +2182,7 @@ return { }, supercollider = { install_info = { - revision = '18be2f121ea0a722dfdffcc4439687fc1d10a9ce', + revision = '76b3cab1773f08bb7d3a185420b0a44c6da8c294', url = 'https://github.com/madskjeldgaard/tree-sitter-supercollider', }, maintainers = { '@madskjeldgaard' }, @@ -2191,7 +2191,7 @@ return { superhtml = { install_info = { location = 'tree-sitter-superhtml', - revision = '521458b2a61e607d07b794d85b5dcfcd10518745', + revision = '574a7a000c6e6a8a922c11afa9da60dca84e5e1f', url = 'https://github.com/kristoff-it/superhtml', }, maintainers = { '@rockorager' }, @@ -2515,7 +2515,7 @@ return { }, vhdl = { install_info = { - revision = '02523d7fb0321344c19c1f3f4ec6b83424c7d6c8', + revision = '0c25aa064dc489ec5291e4879fa7ed41cf5fe680', url = 'https://github.com/jpt13653903/tree-sitter-vhdl', }, maintainers = { '@jpt13653903' }, @@ -2573,7 +2573,7 @@ return { }, wgsl_bevy = { install_info = { - revision = '47c1818d245a6156a488c4c4d06e9336714bae9b', + revision = 'd9306a798ede627001a8e5752f775858c8edd7e4', url = 'https://github.com/tree-sitter-grammars/tree-sitter-wgsl-bevy', }, maintainers = { '@theHamsta' }, @@ -2623,7 +2623,7 @@ return { }, xresources = { install_info = { - revision = '64a07d24c34a8e7915360e6ab367e9b0ff991307', + revision = '2259ae28ad0e139b726dab286f7fa9626a1c2256', url = 'https://github.com/ValdezFOmar/tree-sitter-xresources', }, maintainers = { '@ValdezFOmar' }, From bd99d6bd2bdd346c5da090db5e3956de0e0a2f3f Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 21 Sep 2025 10:38:22 +0200 Subject: [PATCH 2280/2494] feat(koto)!: update parser and queries Breaking changes: `call`, `index`, `lookup` fields removed --- lua/nvim-treesitter/parsers.lua | 2 +- runtime/queries/koto/highlights.scm | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 9e3a32e2e..0ddc29cd4 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -1215,7 +1215,7 @@ return { }, koto = { install_info = { - revision = '2ffc77c14f0ac1674384ff629bfc207b9c57ed89', + revision = '633744bca404ae4edb961a3c2d7bc947a987afa4', url = 'https://github.com/koto-lang/tree-sitter-koto', }, maintainers = { '@irh' }, diff --git a/runtime/queries/koto/highlights.scm b/runtime/queries/koto/highlights.scm index bd6ce8d0e..396d9bdc6 100644 --- a/runtime/queries/koto/highlights.scm +++ b/runtime/queries/koto/highlights.scm @@ -90,7 +90,8 @@ (identifier) @module) (chain - lookup: (identifier) @variable.member) + (lookup + (identifier)) @variable.member) (chain start: (identifier) @function.call) From 6ac9f2e51270cd6f57c4783a36c60cd03e4cfb94 Mon Sep 17 00:00:00 2001 From: Riley Bruins Date: Sun, 21 Sep 2025 16:59:47 -0700 Subject: [PATCH 2281/2494] fix: align line continuation highlights (#8146) These should be `@punctuation.special`. Added the highlight for python, cylc, and make. Corrected it for earthfile and matlab. --- runtime/queries/cylc/highlights.scm | 2 ++ runtime/queries/earthfile/highlights.scm | 2 +- runtime/queries/make/highlights.scm | 2 ++ runtime/queries/matlab/highlights.scm | 7 +++---- runtime/queries/python/highlights.scm | 2 ++ 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/runtime/queries/cylc/highlights.scm b/runtime/queries/cylc/highlights.scm index a744caa52..086caf788 100644 --- a/runtime/queries/cylc/highlights.scm +++ b/runtime/queries/cylc/highlights.scm @@ -32,6 +32,8 @@ (graph_parenthesis) ] @punctuation.bracket +(line_continuation) @punctuation.special + [ "\"" "\"\"\"" diff --git a/runtime/queries/earthfile/highlights.scm b/runtime/queries/earthfile/highlights.scm index cc7dce298..ee0e300b5 100644 --- a/runtime/queries/earthfile/highlights.scm +++ b/runtime/queries/earthfile/highlights.scm @@ -126,4 +126,4 @@ "=" @operator -(line_continuation) @operator +(line_continuation) @punctuation.special diff --git a/runtime/queries/make/highlights.scm b/runtime/queries/make/highlights.scm index afdfbe336..8d182c026 100644 --- a/runtime/queries/make/highlights.scm +++ b/runtime/queries/make/highlights.scm @@ -168,3 +168,5 @@ "file" "value" ] @function.builtin) + +"\\" @punctuation.special diff --git a/runtime/queries/matlab/highlights.scm b/runtime/queries/matlab/highlights.scm index 66ec69465..05713e05a 100644 --- a/runtime/queries/matlab/highlights.scm +++ b/runtime/queries/matlab/highlights.scm @@ -211,10 +211,9 @@ (#eq? @boolean "false")) ; Comments -[ - (comment) - (line_continuation) -] @comment @spell +(comment) @comment @spell + +(line_continuation) @punctuation.special ((comment) @keyword.directive (#lua-match? @keyword.directive "^%%%% ")) diff --git a/runtime/queries/python/highlights.scm b/runtime/queries/python/highlights.scm index e5b9ac3aa..3e777d08b 100644 --- a/runtime/queries/python/highlights.scm +++ b/runtime/queries/python/highlights.scm @@ -247,6 +247,8 @@ "{" @punctuation.special "}" @punctuation.special) +(line_continuation) @punctuation.special + (type_conversion) @function.macro [ From 53819acac287632ee2b62e0f7b63057904984906 Mon Sep 17 00:00:00 2001 From: Minijackson Date: Thu, 11 Sep 2025 15:27:19 +0200 Subject: [PATCH 2282/2494] feat(snl): add parser and queries --- SUPPORTED_LANGUAGES.md | 2 + lua/nvim-treesitter/parsers.lua | 9 ++ runtime/queries/snl/folds.scm | 21 +++ runtime/queries/snl/highlights.scm | 245 +++++++++++++++++++++++++++++ runtime/queries/snl/indents.scm | 61 +++++++ runtime/queries/snl/injections.scm | 117 ++++++++++++++ runtime/queries/snl/locals.scm | 65 ++++++++ 7 files changed, 520 insertions(+) create mode 100644 runtime/queries/snl/folds.scm create mode 100644 runtime/queries/snl/highlights.scm create mode 100644 runtime/queries/snl/indents.scm create mode 100644 runtime/queries/snl/injections.scm create mode 100644 runtime/queries/snl/locals.scm diff --git a/SUPPORTED_LANGUAGES.md b/SUPPORTED_LANGUAGES.md index 61371d0e0..2cc4bd6a9 100644 --- a/SUPPORTED_LANGUAGES.md +++ b/SUPPORTED_LANGUAGES.md @@ -265,6 +265,7 @@ jsx (queries only)[^jsx] | unstable | `HFIJ ` | | @steelsojka [smali](https://github.com/tree-sitter-grammars/tree-sitter-smali) | unstable | `HFIJL` | | @amaanq [smithy](https://github.com/indoorvivants/tree-sitter-smithy) | unstable | `H  J ` | | @amaanq, @keynmol [snakemake](https://github.com/osthomas/tree-sitter-snakemake) | unstable | `HFIJL` | | @osthomas +[snl](https://github.com/minijackson/tree-sitter-snl)[^snl] | unstable | `HFIJL` | | @minijackson [solidity](https://github.com/JoranHonig/tree-sitter-solidity) | unstable | `HF J ` | | @amaanq [soql](https://github.com/aheber/tree-sitter-sfapex) | unstable | `H    ` | | @aheber, @xixiafinland [sosl](https://github.com/aheber/tree-sitter-sfapex) | unstable | `H    ` | | @aheber, @xixiafinland @@ -359,4 +360,5 @@ jsx (queries only)[^jsx] | unstable | `HFIJ ` | | @steelsojka [^query]: Tree-sitter query language [^sflog]: Salesforce debug log [^slang]: Shader Slang +[^snl]: EPICS Sequencer's SNL files diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 0ddc29cd4..6a64739fa 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -2081,6 +2081,15 @@ return { maintainers = { '@osthomas' }, tier = 2, }, + snl = { + install_info = { + url = 'https://github.com/minijackson/tree-sitter-snl', + revision = '846e2d6809ac5863a15b5494f20fd267c21221c8', + }, + maintainers = { '@minijackson' }, + readme_note = "EPICS Sequencer's SNL files", + tier = 2, + }, solidity = { install_info = { revision = '4e938a46c7030dd001bc99e1ac0f0c750ac98254', diff --git a/runtime/queries/snl/folds.scm b/runtime/queries/snl/folds.scm new file mode 100644 index 000000000..65e50c62f --- /dev/null +++ b/runtime/queries/snl/folds.scm @@ -0,0 +1,21 @@ +[ + (for_statement) + (if_statement) + (while_statement) + (funcdef) + (structdef) + (comment) + (preproc_if) + (preproc_elif) + (preproc_else) + (preproc_ifdef) + (preproc_function_def) + (init_expr) + (entry) + (state_set) + (state) + (exit) +] @fold + +(initial_defn + (preproc_include))+ @fold diff --git a/runtime/queries/snl/highlights.scm b/runtime/queries/snl/highlights.scm new file mode 100644 index 000000000..423a7deb7 --- /dev/null +++ b/runtime/queries/snl/highlights.scm @@ -0,0 +1,245 @@ +(identifier) @variable + +[ + "enum" + "struct" + "union" +] @keyword.type + +[ + "assign" + "const" + "entry" + "exit" + "foreign" + "monitor" + "option" + "program" + "ss" + "state" + "sync" + "syncq" + "to" + "typename" +] @keyword + +"sizeof" @keyword.operator + +"return" @keyword.return + +[ + "while" + "for" + "continue" + "break" +] @keyword.repeat + +[ + "if" + "else" + "when" +] @keyword.conditional + +[ + "#elif" + "#else" + "#endif" + "#if" + "#ifdef" + "#ifndef" + (preproc_directive) + (line_marker) +] @keyword.directive + +"#define" @keyword.directive.define + +"#include" @keyword.import + +[ + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket + +[ + "." + "," + ";" +] @punctuation.delimiter + +[ + "%%" + "%{" + "}%" + "..." +] @punctuation.special + +[ + "+" + "-" + "*" + "&" + "!" + "~" + "++" + "--" + "=" + ">>" + "<<" + "/" + ">" + ">=" + "<" + "<=" + "==" + "!=" + "^" + "|" + "||" + "&&" + "%" + "*=" + "/=" + "%=" + "+=" + "-=" + "<<=" + ">>=" + "&=" + "^=" + "|=" +] @operator + +(comma_expr + "," @operator) + +[ + (true) + (false) +] @boolean + +(conditional_expression + [ + "?" + ":" + ] @keyword.conditional.ternary) + +[ + (string_literal) + (system_lib_string) +] @string + +(parameter_expansion + [ + "{" + "}" + ] @string.special) + +(parameter_expansion + (identifier) @constant) + +(escape_sequence) @string.escape + +(null) @constant.builtin + +[ + (number_literal) + (char_literal) +] @number + +((preproc_arg) @function.macro + (#set! "priority" 90)) + +(preproc_defined) @function.macro + +(call_expression + function: (identifier) @function.call) + +(call_expression + function: (field_expression + field: (identifier) @function.call)) + +(function_declarator + declarator: (identifier) @function) + +(preproc_function_def + name: (identifier) @function.macro) + +(field_expression + field: (identifier) @property) + +(type_qualifier) @keyword.modifier + +(structdef + name: (identifier) @type.definition) + +[ + (basetype) + (type_expr) +] @type + +(prim_type) @type.builtin + +(program + name: (identifier) @constant) + +(state_set + name: (identifier) @function) + +(state + name: (identifier) @function) + +(transition + name: (identifier) @function) + +(option + name: (identifier) @constant) + +((identifier) @constant + (#lua-match? @constant "^[A-Z][A-Z%d_]*$")) + +(preproc_def + name: (_) @constant.macro) + +(preproc_call + directive: (preproc_directive) @_u + argument: (_) @constant.macro + (#eq? @_u "#undef")) + +(comment) @comment @spell + +(param_decl + (declarator + (identifier) @variable.parameter)) + +((identifier) @variable.parameter + (#has-ancestor? @variable.parameter param_decl)) + +(param_decl + (declarator + (pointer_declarator) @variable.parameter)) + +(preproc_params + (identifier) @variable.parameter) + +((call_expression + function: (_) @function.builtin) + (#any-of? @function.builtin + "delay" "pvPut" "pvPutComplete" "pvArrayPutComplete" "pvPutCancel" "pvArrayPutCancel" "pvGet" + "pvGetComplete" "pvArrayGetComplete" "pvGetCancel" "pvArrayGetCancel" "pvGetQ" "pvFreeQ" + "pvFlushQ" "pvAssign" "pvAssignSubst" "pvMonitor" "pvArrayMonitor" "pvStopMonitor" + "pvArrayStopMonitor" "pvSync" "pvArraySync" "pvCount" "pvStatus" "pvSeverity" "pvMessage" + "pvTimeStamp" "pvAssigned" "pvConnected" "pvArrayConnected" "pvIndex" "pvFlush" "pvChannelCount" + "pvAssignCount" "pvConnectCount" "efSet" "efClear" "efTest" "efTestAndClear" "macValueGet" + "optGet")) + +((identifier) @constant.builtin + (#any-of? @constant.builtin + "pvStatOK" "pvStatERROR" "pvStatDISCONN" "pvStatREAD" "pvStatWRITE" "pvStatHIHI" "pvStatHIGH" + "pvStatLOLO" "pvStatLOW" "pvStatSTATE" "pvStatCOS" "pvStatCOMM" "pvStatTIMEOUT" "pvStatHW_LIMIT" + "pvStatCALC" "pvStatSCAN" "pvStatLINK" "pvStatSOFT" "pvStatBAD_SUB" "pvStatUDF" "pvStatDISABLE" + "pvStatSIMM" "pvStatREAD_ACCESS" "pvStatWRITE_ACCESS" "pvSevrOK" "pvSevrERROR" "pvSevrNONE" + "pvSevrMINOR" "pvSevrMAJOR" "pvSevrINVALID" "DEFAULT" "ASYNC" "SYNC" "NOEVFLAG")) diff --git a/runtime/queries/snl/indents.scm b/runtime/queries/snl/indents.scm new file mode 100644 index 000000000..0d6523615 --- /dev/null +++ b/runtime/queries/snl/indents.scm @@ -0,0 +1,61 @@ +[ + (field_declaration_list) + (state_set) + (state) + (block) + (member_decl) +] @indent.begin + +(block + "}" @indent.end) + +[ + "else" + "}" +] @indent.branch + +(call_expression) @indent.begin + +(call_expression + ")" @indent.end) + +(if_statement + condition: (_) @indent.begin) + +(if_statement + consequence: (_) @_consequence + (#not-kind-eq? @_consequence block)) @indent.begin + +(else_statement + consequence: (_) @_consequence + (#not-kind-eq? @_consequence block)) @indent.begin + +(while_statement + body: (statement + (_) @_body) + (#not-kind-eq? @_body block)) @indent.begin + +(for_statement + body: (statement + (_) @_body) + (#not-kind-eq? @_body block)) @indent.begin + +(init_declarator) @indent.begin + +(transition + condition: (_) @indent.begin) + +[ + "#define" + "#ifdef" + "#if" + "#else" + "#endif" +] @indent.zero + +[ + (preproc_arg) + (string_literal) +] @indent.ignore + +(comment) @indent.auto diff --git a/runtime/queries/snl/injections.scm b/runtime/queries/snl/injections.scm new file mode 100644 index 000000000..b595d8033 --- /dev/null +++ b/runtime/queries/snl/injections.scm @@ -0,0 +1,117 @@ +((comment) @injection.content + (#set! injection.language "comment")) + +((c_code) @injection.content + (#set! injection.language "c")) + +((preproc_arg) @injection.content + (#set! injection.self)) + +((call_expression + function: (identifier) @_function + (args + . + [ + (string_literal + (string_content) @injection.content) + (concatenated_string + (string_literal + (string_content) @injection.content)) + ])) + ; format-ignore + (#any-of? @_function + "printf" "printf_s" + "vprintf" "vprintf_s" + "scanf" "scanf_s" + "vscanf" "vscanf_s" + "wprintf" "wprintf_s" + "vwprintf" "vwprintf_s" + "wscanf" "wscanf_s" + "vwscanf" "vwscanf_s" + "cscanf" "_cscanf" + "printw" + "scanw") + (#set! injection.language "printf")) + +((call_expression + function: (identifier) @_function + (args + (_) + . + [ + (string_literal + (string_content) @injection.content) + (concatenated_string + (string_literal + (string_content) @injection.content)) + ])) + ; format-ignore + (#any-of? @_function + "fprintf" "fprintf_s" + "sprintf" + "dprintf" + "fscanf" "fscanf_s" + "sscanf" "sscanf_s" + "vsscanf" "vsscanf_s" + "vfprintf" "vfprintf_s" + "vsprintf" + "vdprintf" + "fwprintf" "fwprintf_s" + "vfwprintf" "vfwprintf_s" + "fwscanf" "fwscanf_s" + "swscanf" "swscanf_s" + "vswscanf" "vswscanf_s" + "vfscanf" "vfscanf_s" + "vfwscanf" "vfwscanf_s" + "wprintw" + "vw_printw" "vwprintw" + "wscanw" + "vw_scanw" "vwscanw") + (#set! injection.language "printf")) + +((call_expression + function: (identifier) @_function + (args + (_) + . + (_) + . + [ + (string_literal + (string_content) @injection.content) + (concatenated_string + (string_literal + (string_content) @injection.content)) + ])) + ; format-ignore + (#any-of? @_function + "sprintf_s" + "snprintf" "snprintf_s" + "vsprintf_s" + "vsnprintf" "vsnprintf_s" + "swprintf" "swprintf_s" + "snwprintf_s" + "vswprintf" "vswprintf_s" + "vsnwprintf_s" + "mvprintw" + "mvscanw") + (#set! injection.language "printf")) + +((call_expression + function: (identifier) @_function + (args + (_) + . + (_) + . + (_) + . + [ + (string_literal + (string_content) @injection.content) + (concatenated_string + (string_literal + (string_content) @injection.content)) + ])) + (#any-of? @_function "mvwprintw" "mvwscanw") + (#set! injection.language "printf")) diff --git a/runtime/queries/snl/locals.scm b/runtime/queries/snl/locals.scm new file mode 100644 index 000000000..35c8da5c9 --- /dev/null +++ b/runtime/queries/snl/locals.scm @@ -0,0 +1,65 @@ +; Functions definitions +(function_declarator + declarator: (identifier) @local.definition.function) + +(preproc_function_def + name: (identifier) @local.definition.macro) @local.scope + +(preproc_def + name: (identifier) @local.definition.macro) + +((identifier) @local.definition.parameter + (#has-ancestor? @local.definition.parameter param_decl)) + +(init_declarator + (declarator + (identifier)) @local.definition.var) + +(array_declarator + (identifier) @local.definition.var) + +; Struct +(member_decl + (declarator + (identifier)) @local.definition.field) + +(structdef + name: (identifier) @local.definition.type) + +; References +((field_expression + field: (identifier) @local.reference) + (#set! reference.kind "field")) + +((call_expression + function: (identifier) @local.reference) + (#set! reference.kind "call")) + +((basetype + (identifier) @local.reference) + (#set! reference.kind "type")) + +; SNL specific +(state_set + name: (identifier) @local.definition) + +(state + name: (identifier) @local.definition) + +(state_statement + name: (identifier) @local.reference) + +(transition + name: (identifier) @local.reference) + +(identifier) @local.reference + +[ + (for_statement) + (if_statement) + (while_statement) + (source_file) + (block) + (state_set) + (state_block) +] @local.scope From 5a70b1eb8cbdf6c7f0a59dfb7356ad198421b620 Mon Sep 17 00:00:00 2001 From: Omar Valdez Date: Mon, 22 Sep 2025 08:14:00 -0700 Subject: [PATCH 2283/2494] feat(hyprlang): highlight more exec keywords --- runtime/queries/hyprlang/highlights.scm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/runtime/queries/hyprlang/highlights.scm b/runtime/queries/hyprlang/highlights.scm index 5e3514125..340237fcc 100644 --- a/runtime/queries/hyprlang/highlights.scm +++ b/runtime/queries/hyprlang/highlights.scm @@ -3,7 +3,10 @@ [ "source" "exec" + "execr" "exec-once" + "execr-once" + "exec-shutdown" ] @keyword (keyword From 1df23c59d8c3142fc9fc130575fbc761d10e30e4 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 28 Sep 2025 11:55:09 +0200 Subject: [PATCH 2284/2494] feat(parsers): update ada, cpp, desktop, erlang, godot_resource, ini, javadoc, mlir, powershell, rifleconf, slint, sql, superhtml, t32, xresources --- lua/nvim-treesitter/parsers.lua | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 6a64739fa..ce96a62a6 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -2,7 +2,7 @@ return { ada = { install_info = { - revision = '364d3f4aa8b382113bdd5d3ca6d82dc9c74ac738', + revision = '9821c989184447f7f088f1096601eb23be35afc5', url = 'https://github.com/briot/tree-sitter-ada', }, maintainers = { '@briot' }, @@ -278,7 +278,7 @@ return { }, cpp = { install_info = { - revision = '2a682d312b09eb737a08b4900ec786415574b6bf', + revision = '12bd6f7e96080d2e70ec51d4068f2f66120dde35', url = 'https://github.com/tree-sitter/tree-sitter-cpp', }, maintainers = { '@theHamsta' }, @@ -346,7 +346,7 @@ return { }, desktop = { install_info = { - revision = 'b77dad972dcc96f9a7123fb08d8eb46308e31d9a', + revision = '73c3f1ec366061aa9b1f61d76fc3d37b86b5a9af', url = 'https://github.com/ValdezFOmar/tree-sitter-desktop', }, maintainers = { '@ValdezFOmar' }, @@ -520,7 +520,7 @@ return { }, erlang = { install_info = { - revision = '07dad1469ecb7df80f2b6d5178f79564d19d67e0', + revision = 'df268da05d8ed4837dd2a8e2af1906619c2f0aa0', url = 'https://github.com/WhatsApp/tree-sitter-erlang', }, maintainers = { '@filmor' }, @@ -786,7 +786,7 @@ return { }, godot_resource = { install_info = { - revision = '9bbb540e8a2734101c6857bd437f04baa974e03d', + revision = '302c1895f54bf74d53a08572f7b26a6614209adc', url = 'https://github.com/PrestonKnopp/tree-sitter-godot-resource', }, maintainers = { '@pierpo' }, @@ -1034,7 +1034,7 @@ return { }, ini = { install_info = { - revision = '31899dfa3b91622ea39e5c0bcddc88f45a9a3cfe', + revision = '0eaed8040513e62ee2e9e8db9f086cf630a524eb', url = 'https://github.com/justinmk/tree-sitter-ini', }, maintainers = { '@theHamsta' }, @@ -1075,7 +1075,7 @@ return { }, javadoc = { install_info = { - revision = '85acd4655cbfaef414de6e3f87436e63ef5cb0da', + revision = 'c39005f7da0218cc3ac2734bef049a8fa9ee0e72', url = 'https://github.com/rmuir/tree-sitter-javadoc', }, maintainers = { '@rmuir' }, @@ -1399,7 +1399,7 @@ return { mlir = { install_info = { generate = true, - revision = '8f86b34b5e3dfe561e1e913df4a3d719ea1dcc5c', + revision = '14152c1e580043865131bca80bcd8e8cb9132df7', url = 'https://github.com/artagnon/tree-sitter-mlir', }, maintainers = { '@artagnon' }, @@ -1653,7 +1653,7 @@ return { powershell = { filetype = 'ps1', install_info = { - revision = 'f272e5ac9bc48d0f6df2429cab914d216e9413cd', + revision = '497fe9ac43bdf090efbfe28fba65b7c0c7c6a7b3', url = 'https://github.com/airbus-cert/tree-sitter-powershell', }, maintainers = { '@L2jLiga' }, @@ -1910,7 +1910,7 @@ return { }, rifleconf = { install_info = { - revision = 'b215640ba72a9a8cac6f5d95dbc3d320cb546e13', + revision = 'fe10eab6cacff239ec61f4456e793bed15703aaf', url = 'https://github.com/purarue/tree-sitter-rifleconf', }, maintainers = { '@purarue' }, @@ -2051,7 +2051,7 @@ return { }, slint = { install_info = { - revision = '152ec7f6a2aa29fe222f741d91bec70153c487da', + revision = '927f3e2f0213d0eea7f12c978c81067c3dc4289d', url = 'https://github.com/slint-ui/tree-sitter-slint', }, maintainers = { '@hunger' }, @@ -2083,8 +2083,8 @@ return { }, snl = { install_info = { - url = 'https://github.com/minijackson/tree-sitter-snl', revision = '846e2d6809ac5863a15b5494f20fd267c21221c8', + url = 'https://github.com/minijackson/tree-sitter-snl', }, maintainers = { '@minijackson' }, readme_note = "EPICS Sequencer's SNL files", @@ -2143,7 +2143,7 @@ return { sql = { install_info = { branch = 'gh-pages', - revision = 'b1ec2aa5091624e4729f0a771a6d631afebf1ed4', + revision = '0a997b07c777b6504792d04357a0f655897f15a8', url = 'https://github.com/derekstride/tree-sitter-sql', }, maintainers = { '@derekstride' }, @@ -2200,7 +2200,7 @@ return { superhtml = { install_info = { location = 'tree-sitter-superhtml', - revision = '574a7a000c6e6a8a922c11afa9da60dca84e5e1f', + revision = '4b60dd98f5d3e158967c9feb839ae71321a625b9', url = 'https://github.com/kristoff-it/superhtml', }, maintainers = { '@rockorager' }, @@ -2266,7 +2266,7 @@ return { }, t32 = { install_info = { - revision = '335e5533de72a4ac8c6763958df1befbdc855a30', + revision = '5f20682355725d840611b07b2ce9681034cff3a6', url = 'https://gitlab.com/xasc/tree-sitter-t32', }, maintainers = { '@xasc' }, @@ -2632,7 +2632,7 @@ return { }, xresources = { install_info = { - revision = '2259ae28ad0e139b726dab286f7fa9626a1c2256', + revision = 'c6f240ab53c75edc0b122bc26c994ceb410d5b27', url = 'https://github.com/ValdezFOmar/tree-sitter-xresources', }, maintainers = { '@ValdezFOmar' }, From 9176343647ad99583becbcec7b17fc7fd5bd4782 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 28 Sep 2025 12:01:45 +0200 Subject: [PATCH 2285/2494] feat(inko)!: update parser and queries Breaking change: `(array_pattern)` rule and node was removed again. --- lua/nvim-treesitter/parsers.lua | 2 +- runtime/queries/inko/indents.scm | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index ce96a62a6..67a492baa 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -1042,7 +1042,7 @@ return { }, inko = { install_info = { - revision = '74cbd0f69053b4a9ad4fed8831dee983ec7e4990', + revision = '1fcbf8ca64b1a088525235662ad80aa803d97413', url = 'https://github.com/inko-lang/tree-sitter-inko', }, maintainers = { '@yorickpeterse' }, diff --git a/runtime/queries/inko/indents.scm b/runtime/queries/inko/indents.scm index 260249343..d2d9a5724 100644 --- a/runtime/queries/inko/indents.scm +++ b/runtime/queries/inko/indents.scm @@ -27,7 +27,6 @@ (trait) (tuple) (tuple_pattern) - (array_pattern) (type_arguments) ] @indent.begin From db50897909bfd77d816ef3958e392a2f7fccd057 Mon Sep 17 00:00:00 2001 From: Mouinul Hossain <122956967+OXY2DEV@users.noreply.github.com> Date: Mon, 29 Sep 2025 07:04:09 +0600 Subject: [PATCH 2286/2494] feat(parsers): add kitty (#8129) --- SUPPORTED_LANGUAGES.md | 1 + lua/nvim-treesitter/parsers.lua | 8 ++ runtime/queries/kitty/highlights.scm | 175 +++++++++++++++++++++++++++ runtime/queries/kitty/injections.scm | 31 +++++ 4 files changed, 215 insertions(+) create mode 100644 runtime/queries/kitty/highlights.scm create mode 100644 runtime/queries/kitty/injections.scm diff --git a/SUPPORTED_LANGUAGES.md b/SUPPORTED_LANGUAGES.md index 2cc4bd6a9..3386e6bf2 100644 --- a/SUPPORTED_LANGUAGES.md +++ b/SUPPORTED_LANGUAGES.md @@ -160,6 +160,7 @@ jsx (queries only)[^jsx] | unstable | `HFIJ ` | | @steelsojka [kcl](https://github.com/kcl-lang/tree-sitter-kcl) | unstable | `HF J ` | | @bertbaron [kconfig](https://github.com/tree-sitter-grammars/tree-sitter-kconfig) | unstable | `HFIJL` | | @amaanq [kdl](https://github.com/tree-sitter-grammars/tree-sitter-kdl) | unstable | `HFIJL` | | @amaanq +[kitty](https://github.com/OXY2DEV/tree-sitter-kitty) | unstable | `H  J ` | | @OXY2DEV [kotlin](https://github.com/fwcd/tree-sitter-kotlin) | unstable | `HF JL` | | @SalBakraa [koto](https://github.com/koto-lang/tree-sitter-koto) | unstable | `HF JL` | | @irh [kusto](https://github.com/Willem-J-an/tree-sitter-kusto) | unstable | `H  J ` | | @Willem-J-an diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 67a492baa..34a5aa04e 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -1205,6 +1205,14 @@ return { maintainers = { '@amaanq' }, tier = 2, }, + kitty = { + install_info = { + revision = '49f877cff80ab613808b34bde170ea477ec182fe', + url = 'https://github.com/OXY2DEV/tree-sitter-kitty', + }, + maintainers = { '@OXY2DEV' }, + tier = 2, + }, kotlin = { install_info = { revision = '57fb4560ba8641865bc0baa6b3f413b236112c4c', diff --git a/runtime/queries/kitty/highlights.scm b/runtime/queries/kitty/highlights.scm new file mode 100644 index 000000000..c6b5a5dfd --- /dev/null +++ b/runtime/queries/kitty/highlights.scm @@ -0,0 +1,175 @@ +(line_continuation) @comment + +(comment + (comment_content) @spell) @comment + +[ + (pixel) + (percentage) + (number) +] @number + +[ + "steps" + "cubic-bezier" +] @function.call + +(boolean) @boolean + +(color) @constant + +(string) @string + +[ + (ctrl) + (alt) + (shift) + (function) + (super) + (mouse_button) + (up) + (left) + (right) + (middle) + (down) +] @constant.builtin + +[ + "+" + ">" + ":" + "-" + (separator) + "=" + "," + "'" + ":" +] @punctuation.delimiter + +[ + "(" + ")" +] @punctuation.bracket + +(special) @variable.builtin + +(key) @character + +(path) @string.special.path + +(label) @label + +(constant) @constant + +(direction) @constant + +(pattern) @string.regexp + +(flag) @constant + +((string) @constant + (#lua-match? @constant "^-")) + +(generic_action) @function.call + +(action_name) @function.call + +[ + "pt" + "px" + "%" + "ratio" + (signal_name) + (clear_target) + (ligature_target) + (window_location) + (stdin_source) + (marker_type) + (window_state) + (logo_position) + (mouse_selection_type) + (window_layout) + (os_window) + "ignore-shell" + (detach_into) + "@selection" + (kitty_shell_open_as) + (mouse_event) + (font_modification_type) + (ease_step_position) + "c" + (filter_element_type) + "all" + (ligature_disabled) + (clipboard_action) + (shell_feature) + (source_strategy) + (notification_time) + (paste_action) + (pointer) + (layout) + (launch_type_value) + (os_window_class) + (layout_type) + (time_suffix) + (cursor) + (spacing_type) + (remote_action) + (font_feature) +] @type + +(kitten + target: (string) @type) + +[ + (color_option_name) + "map" + "mouse_map" + (option_name) +] @keyword + +(open_url + value: (string) @string.special.url) + +(handle_click_actions + _ @type) + +(title) @string.special + +(font_change_amount + sign: (font_change_sign) @operator) + +(aliased_action + name: (string) @function.call) + +(set_colors + "set_colors" @function.call) + +(include + environment_variable: (string) @variable.builtin) + +(key_focus_on + condition: (string) @string.special) + +(mouse_mode + [ + "grabbed" + "ungrabbed" + ] @variable.parameter) + +(font_property + name: (string) @variable.parameter) + +(url_excluded_characters + value: (string) @character) + +(transparent_color + "@" @punctuation.special + (alpha) @number) + +(env + variable: (string) @variable.builtin) + +(boolean_operator) @keyword.operator + +(notification_action) @function.call diff --git a/runtime/queries/kitty/injections.scm b/runtime/queries/kitty/injections.scm new file mode 100644 index 000000000..74fde7b76 --- /dev/null +++ b/runtime/queries/kitty/injections.scm @@ -0,0 +1,31 @@ +(launch_source_window + value: (string) @injection.content + (#set! injection.language "regex")) + +(launch_next_to + value: (string) @injection.content + (#set! injection.language "regex")) + +(marker_entry + (pattern) @injection.content + (#set! injection.language "regex")) + +(color_match + (pattern) @injection.content + (#set! injection.language "regex")) + +(color_match_tab + (pattern) @injection.content + (#set! injection.language "regex")) + +(include + glob: (pattern) @injection.content + (#set! injection.language "regex")) + +(filter_element + (pattern) @injection.content + (#set! injection.language "regex")) + +(comment + (comment_content) @injection.content + (#set! injection.language "comment")) From 77362027f7aa850c87419fd571151e76b0b342a6 Mon Sep 17 00:00:00 2001 From: Riley Bruins Date: Sun, 28 Sep 2025 18:39:09 -0700 Subject: [PATCH 2287/2494] fix: remove redundant alternants (#8159) --- runtime/queries/bitbake/highlights.scm | 1 - runtime/queries/circom/highlights.scm | 2 -- runtime/queries/d/highlights.scm | 1 - runtime/queries/enforce/highlights.scm | 1 - runtime/queries/fennel/locals.scm | 1 - runtime/queries/fsharp/highlights.scm | 1 - runtime/queries/gdscript/highlights.scm | 1 - runtime/queries/gleam/indents.scm | 2 -- runtime/queries/go/highlights.scm | 1 - runtime/queries/groovy/highlights.scm | 3 --- runtime/queries/hack/highlights.scm | 14 -------------- runtime/queries/inko/highlights.scm | 2 -- runtime/queries/jinja_inline/highlights.scm | 1 - runtime/queries/kitty/highlights.scm | 1 - runtime/queries/luadoc/highlights.scm | 1 - runtime/queries/matlab/highlights.scm | 1 - runtime/queries/mermaid/highlights.scm | 1 - runtime/queries/nu/highlights.scm | 2 -- runtime/queries/ocaml/highlights.scm | 1 - runtime/queries/ocaml_interface/highlights.scm | 1 - runtime/queries/pascal/folds.scm | 1 - runtime/queries/pascal/highlights.scm | 1 - runtime/queries/pony/highlights.scm | 1 - runtime/queries/prql/highlights.scm | 1 - runtime/queries/re2c/highlights.scm | 1 - runtime/queries/roc/indents.scm | 1 - runtime/queries/scala/highlights.scm | 1 - runtime/queries/solidity/highlights.scm | 3 --- runtime/queries/sway/highlights.scm | 2 -- runtime/queries/t32/highlights.scm | 5 ----- runtime/queries/vhdl/folds.scm | 1 - runtime/queries/zig/highlights.scm | 2 -- 32 files changed, 59 deletions(-) diff --git a/runtime/queries/bitbake/highlights.scm b/runtime/queries/bitbake/highlights.scm index c7316de6e..e10ae705b 100644 --- a/runtime/queries/bitbake/highlights.scm +++ b/runtime/queries/bitbake/highlights.scm @@ -281,7 +281,6 @@ "=." "-" "-=" - ":=" "!=" "*" "**" diff --git a/runtime/queries/circom/highlights.scm b/runtime/queries/circom/highlights.scm index c61925e7a..983df8703 100644 --- a/runtime/queries/circom/highlights.scm +++ b/runtime/queries/circom/highlights.scm @@ -119,8 +119,6 @@ ">" "!" "~" - "-" - "+" "++" "--" "<==" diff --git a/runtime/queries/d/highlights.scm b/runtime/queries/d/highlights.scm index 50428d20c..e08b83b45 100644 --- a/runtime/queries/d/highlights.scm +++ b/runtime/queries/d/highlights.scm @@ -263,7 +263,6 @@ (idouble) (ifloat) (creal) - (double) (cfloat) (string) (dstring) diff --git a/runtime/queries/enforce/highlights.scm b/runtime/queries/enforce/highlights.scm index aa8fb9b3e..35226202d 100644 --- a/runtime/queries/enforce/highlights.scm +++ b/runtime/queries/enforce/highlights.scm @@ -80,7 +80,6 @@ "<<" "&" "|" - "^" "~" ] @operator diff --git a/runtime/queries/fennel/locals.scm b/runtime/queries/fennel/locals.scm index be63e728f..320c93bb9 100644 --- a/runtime/queries/fennel/locals.scm +++ b/runtime/queries/fennel/locals.scm @@ -11,7 +11,6 @@ (collect_form) (icollect_form) (accumulate_form) - (for_form) (fcollect_form) (faccumulate_form) (case_form) diff --git a/runtime/queries/fsharp/highlights.scm b/runtime/queries/fsharp/highlights.scm index 72168528a..16b969fb6 100644 --- a/runtime/queries/fsharp/highlights.scm +++ b/runtime/queries/fsharp/highlights.scm @@ -246,7 +246,6 @@ "<-" "&" "&&" - "|" "||" ":>" ":?>" diff --git a/runtime/queries/gdscript/highlights.scm b/runtime/queries/gdscript/highlights.scm index f3fd3b62f..3885d0068 100644 --- a/runtime/queries/gdscript/highlights.scm +++ b/runtime/queries/gdscript/highlights.scm @@ -176,7 +176,6 @@ "/" "%" "+" - "-" "<<" ">>" "&" diff --git a/runtime/queries/gleam/indents.scm b/runtime/queries/gleam/indents.scm index 3a44ea4c0..a8fa961d5 100644 --- a/runtime/queries/gleam/indents.scm +++ b/runtime/queries/gleam/indents.scm @@ -9,8 +9,6 @@ (function) (let) (list) - (constant) - (function) (type_definition) (type_alias) (todo) diff --git a/runtime/queries/go/highlights.scm b/runtime/queries/go/highlights.scm index 7675cb790..91a9d4d76 100644 --- a/runtime/queries/go/highlights.scm +++ b/runtime/queries/go/highlights.scm @@ -61,7 +61,6 @@ "!=" "..." "*" - "*" "*=" "/" "/=" diff --git a/runtime/queries/groovy/highlights.scm b/runtime/queries/groovy/highlights.scm index 4504e16e2..69fcb6e1d 100644 --- a/runtime/queries/groovy/highlights.scm +++ b/runtime/queries/groovy/highlights.scm @@ -135,13 +135,10 @@ "&&" "||" "?:" - "+" - "*" ".&" ".@" "?." "*." - "*" "*:" "++" "--" diff --git a/runtime/queries/hack/highlights.scm b/runtime/queries/hack/highlights.scm index bb9d2a55c..f74233e23 100644 --- a/runtime/queries/hack/highlights.scm +++ b/runtime/queries/hack/highlights.scm @@ -169,20 +169,6 @@ "--" "!" "?:" - "=" - "??=" - ".=" - "|=" - "^=" - "&=" - "<<=" - ">>=" - "+=" - "-=" - "*=" - "/=" - "%=" - "**=" "=>" ; type modifiers "@" diff --git a/runtime/queries/inko/highlights.scm b/runtime/queries/inko/highlights.scm index 989bdb9e8..3b8ede262 100644 --- a/runtime/queries/inko/highlights.scm +++ b/runtime/queries/inko/highlights.scm @@ -35,11 +35,9 @@ "<<" "<<=" "<=" - "<=" "==" ">" ">=" - ">=" ">>" ">>=" ">>>" diff --git a/runtime/queries/jinja_inline/highlights.scm b/runtime/queries/jinja_inline/highlights.scm index b66d7fb2e..fd2030fa8 100644 --- a/runtime/queries/jinja_inline/highlights.scm +++ b/runtime/queries/jinja_inline/highlights.scm @@ -56,7 +56,6 @@ "endmacro" "endcall" "endset" - "endtrans" "endautoescape" ] @keyword diff --git a/runtime/queries/kitty/highlights.scm b/runtime/queries/kitty/highlights.scm index c6b5a5dfd..93e5d31a4 100644 --- a/runtime/queries/kitty/highlights.scm +++ b/runtime/queries/kitty/highlights.scm @@ -43,7 +43,6 @@ "=" "," "'" - ":" ] @punctuation.delimiter [ diff --git a/runtime/queries/luadoc/highlights.scm b/runtime/queries/luadoc/highlights.scm index 1649e5d9b..f1680d7b2 100644 --- a/runtime/queries/luadoc/highlights.scm +++ b/runtime/queries/luadoc/highlights.scm @@ -20,7 +20,6 @@ "@version" "@operator" "@nodiscard" - "@cast" "@overload" "@enum" "@language" diff --git a/runtime/queries/matlab/highlights.scm b/runtime/queries/matlab/highlights.scm index 05713e05a..7c7fd9a5f 100644 --- a/runtime/queries/matlab/highlights.scm +++ b/runtime/queries/matlab/highlights.scm @@ -170,7 +170,6 @@ "-" ".*" "*" - ".*" "/" "./" "\\" diff --git a/runtime/queries/mermaid/highlights.scm b/runtime/queries/mermaid/highlights.scm index 2b7b56374..8fa11dfef 100644 --- a/runtime/queries/mermaid/highlights.scm +++ b/runtime/queries/mermaid/highlights.scm @@ -42,7 +42,6 @@ "includes" "excludes" "todaymarker" - "title" "section" "direction" "subgraph" diff --git a/runtime/queries/nu/highlights.scm b/runtime/queries/nu/highlights.scm index fc73d3483..38ffbaa2e 100644 --- a/runtime/queries/nu/highlights.scm +++ b/runtime/queries/nu/highlights.scm @@ -123,12 +123,10 @@ file_path: (val_string) @variable.parameter "*=" "/=" "++=" - "-" ".." "..=" "..<" "=>" - "=" "|" "o>" "out>" diff --git a/runtime/queries/ocaml/highlights.scm b/runtime/queries/ocaml/highlights.scm index 891ff7bd5..82a74b7fb 100644 --- a/runtime/queries/ocaml/highlights.scm +++ b/runtime/queries/ocaml/highlights.scm @@ -294,7 +294,6 @@ (hash_operator) (indexing_operator) (let_operator) - (and_operator) (match_operator) ] @operator diff --git a/runtime/queries/ocaml_interface/highlights.scm b/runtime/queries/ocaml_interface/highlights.scm index b623e432b..2f7cdba85 100644 --- a/runtime/queries/ocaml_interface/highlights.scm +++ b/runtime/queries/ocaml_interface/highlights.scm @@ -294,7 +294,6 @@ (hash_operator) (indexing_operator) (let_operator) - (and_operator) (match_operator) ] @operator diff --git a/runtime/queries/pascal/folds.scm b/runtime/queries/pascal/folds.scm index 8fcde3ac0..ac527fbf0 100644 --- a/runtime/queries/pascal/folds.scm +++ b/runtime/queries/pascal/folds.scm @@ -19,7 +19,6 @@ (declEnum) (declProcRef) (declExports) - (declProcRef) (declType) (defProc) (declField) diff --git a/runtime/queries/pascal/highlights.scm b/runtime/queries/pascal/highlights.scm index d6014ee1d..b81c0c599 100644 --- a/runtime/queries/pascal/highlights.scm +++ b/runtime/queries/pascal/highlights.scm @@ -41,7 +41,6 @@ (kDestructor) (kOperator) (kReference) - (kInterface) (kImplementation) (kInitialization) (kFinalization) diff --git a/runtime/queries/pony/highlights.scm b/runtime/queries/pony/highlights.scm index f3d4b5dca..6ccb3d7ae 100644 --- a/runtime/queries/pony/highlights.scm +++ b/runtime/queries/pony/highlights.scm @@ -206,7 +206,6 @@ "<=" "<" "+~" - "-~" "*~" "/~" "%~" diff --git a/runtime/queries/prql/highlights.scm b/runtime/queries/prql/highlights.scm index d24777dc0..f49c887c8 100644 --- a/runtime/queries/prql/highlights.scm +++ b/runtime/queries/prql/highlights.scm @@ -85,7 +85,6 @@ alias: (identifier) @variable.member (keyword_avg) (keyword_sum) (keyword_stddev) - (keyword_count) (keyword_rank) ] @function diff --git a/runtime/queries/re2c/highlights.scm b/runtime/queries/re2c/highlights.scm index c89c30745..e15f97f82 100644 --- a/runtime/queries/re2c/highlights.scm +++ b/runtime/queries/re2c/highlights.scm @@ -1,6 +1,5 @@ ; Namespaces [ - "re2c" "re2c" "local" "rules" diff --git a/runtime/queries/roc/indents.scm b/runtime/queries/roc/indents.scm index 9a08f2074..b2cea9b77 100644 --- a/runtime/queries/roc/indents.scm +++ b/runtime/queries/roc/indents.scm @@ -22,7 +22,6 @@ ;types (record_type) (tags_type) - (record_expr) (implements_implementation) "{" "(" diff --git a/runtime/queries/scala/highlights.scm b/runtime/queries/scala/highlights.scm index f85c502a4..7e623aebc 100644 --- a/runtime/queries/scala/highlights.scm +++ b/runtime/queries/scala/highlights.scm @@ -186,7 +186,6 @@ "end" "implicit" "extension" - "with" ] @keyword [ diff --git a/runtime/queries/solidity/highlights.scm b/runtime/queries/solidity/highlights.scm index ca6988edb..ca1f65dd9 100644 --- a/runtime/queries/solidity/highlights.scm +++ b/runtime/queries/solidity/highlights.scm @@ -151,7 +151,6 @@ "modifier" "var" "let" - "emit" "error" "fallback" "receive" @@ -287,8 +286,6 @@ ">" "!" "~" - "-" - "+" "++" "--" ":=" diff --git a/runtime/queries/sway/highlights.scm b/runtime/queries/sway/highlights.scm index e408464fe..e1f72eb46 100644 --- a/runtime/queries/sway/highlights.scm +++ b/runtime/queries/sway/highlights.scm @@ -68,7 +68,6 @@ "||" "^" "^=" - "*" "*=" "-" "-=" @@ -86,7 +85,6 @@ "@" ".." "..=" - "'" "?" ] @operator diff --git a/runtime/queries/t32/highlights.scm b/runtime/queries/t32/highlights.scm index 9211a49d2..83e8e19dd 100644 --- a/runtime/queries/t32/highlights.scm +++ b/runtime/queries/t32/highlights.scm @@ -22,13 +22,10 @@ ".." "--" "++" - "+" - "-" "~" "!" "&" "->" - "*" "-=" "+=" "*=" @@ -39,8 +36,6 @@ "^=" ">>=" "<<=" - "--" - "++" ] @operator [ diff --git a/runtime/queries/vhdl/folds.scm b/runtime/queries/vhdl/folds.scm index 9fc6deafe..42a58c25f 100644 --- a/runtime/queries/vhdl/folds.scm +++ b/runtime/queries/vhdl/folds.scm @@ -27,7 +27,6 @@ (subprogram_definition) (subprogram_head) (procedure_specification) - (sequential_block) (loop_statement) (if_statement_block) (if_statement) diff --git a/runtime/queries/zig/highlights.scm b/runtime/queries/zig/highlights.scm index 1f9006781..a1dce6930 100644 --- a/runtime/queries/zig/highlights.scm +++ b/runtime/queries/zig/highlights.scm @@ -212,7 +212,6 @@ ">=" "<=" "<" - "&" "^" "|" "<<" @@ -221,7 +220,6 @@ "+" "++" "+%" - "-%" "+|" "-|" "*" From 99bd52ba56a4b7c9a8cc50a6140180755e76fac6 Mon Sep 17 00:00:00 2001 From: Riley Bruins Date: Wed, 1 Oct 2025 20:33:49 -0700 Subject: [PATCH 2288/2494] feat(java): highlight wildcards (#8165) --- runtime/queries/java/highlights.scm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/runtime/queries/java/highlights.scm b/runtime/queries/java/highlights.scm index df9ca14d4..641f1e3fd 100644 --- a/runtime/queries/java/highlights.scm +++ b/runtime/queries/java/highlights.scm @@ -235,6 +235,9 @@ ":" ] @keyword.conditional.ternary) +(wildcard + "?" @character.special) + ; Loops [ "for" From 4709d4276c9cef5e353790071aec046d9b089719 Mon Sep 17 00:00:00 2001 From: Omar Valdez Date: Fri, 3 Oct 2025 00:17:57 -0700 Subject: [PATCH 2289/2494] feat(python): highlight special brackets in `format_expression` --- runtime/queries/python/highlights.scm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/runtime/queries/python/highlights.scm b/runtime/queries/python/highlights.scm index 3e777d08b..70f6d9acc 100644 --- a/runtime/queries/python/highlights.scm +++ b/runtime/queries/python/highlights.scm @@ -247,6 +247,10 @@ "{" @punctuation.special "}" @punctuation.special) +(format_expression + "{" @punctuation.special + "}" @punctuation.special) + (line_continuation) @punctuation.special (type_conversion) @function.macro From b684696315a11e1b08564398bda778788eac92a9 Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Fri, 3 Oct 2025 15:13:45 +0200 Subject: [PATCH 2290/2494] feat(inko): update parser and highlights This commit includes syntax support for a few new syntax elements, and updates the highlights queries to highlight two new expression keywords. --- lua/nvim-treesitter/parsers.lua | 2 +- runtime/queries/inko/highlights.scm | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 34a5aa04e..af6814160 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -1042,7 +1042,7 @@ return { }, inko = { install_info = { - revision = '1fcbf8ca64b1a088525235662ad80aa803d97413', + revision = '080e957d94b330e3867f063b148a8050b0888f4e', url = 'https://github.com/inko-lang/tree-sitter-inko', }, maintainers = { '@yorickpeterse' }, diff --git a/runtime/queries/inko/highlights.scm b/runtime/queries/inko/highlights.scm index 3b8ede262..4bb9631f8 100644 --- a/runtime/queries/inko/highlights.scm +++ b/runtime/queries/inko/highlights.scm @@ -64,6 +64,11 @@ "uni" ] @keyword +[ + "async" + "await" +] @keyword.coroutine + "fn" @keyword.function "import" @keyword.import From b4888ed9e8c3af52320ba3b52a88eccc1c18d498 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sat, 4 Oct 2025 10:51:48 +0200 Subject: [PATCH 2291/2494] chore(gdscript): mark as unmaintained Significant upstream breaking changes are not adapted to. --- SUPPORTED_LANGUAGES.md | 2 +- lua/nvim-treesitter/parsers.lua | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/SUPPORTED_LANGUAGES.md b/SUPPORTED_LANGUAGES.md index 3386e6bf2..989187984 100644 --- a/SUPPORTED_LANGUAGES.md +++ b/SUPPORTED_LANGUAGES.md @@ -92,7 +92,7 @@ ecma (queries only)[^ecma] | unstable | `HFIJL` | | @steelsojka [fusion](https://gitlab.com/jirgn/tree-sitter-fusion) | unstable | `HFIJL` | | @jirgn [gap](https://github.com/gap-system/tree-sitter-gap)[^gap] | unstable | `HF JL` | | @reiniscirpons [gaptst](https://github.com/gap-system/tree-sitter-gaptst)[^gaptst] | unstable | `HF J ` | | @reiniscirpons -[gdscript](https://github.com/PrestonKnopp/tree-sitter-gdscript)[^gdscript] | unstable | `HFIJL` | | @PrestonKnopp +[gdscript](https://github.com/PrestonKnopp/tree-sitter-gdscript)[^gdscript] | unmaintained | `HFIJL` | | [gdshader](https://github.com/GodOfAvacyn/tree-sitter-gdshader) | unstable | `H  J ` | | @godofavacyn [git_config](https://github.com/the-mikedavis/tree-sitter-git-config) | unstable | `HF J ` | | @amaanq [git_rebase](https://github.com/the-mikedavis/tree-sitter-git-rebase) | unstable | `H  J ` | | @gbprod diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index af6814160..0ee85320a 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -655,9 +655,8 @@ return { revision = '9686853b696db07118ad110e440d6de0ca6498b4', url = 'https://github.com/PrestonKnopp/tree-sitter-gdscript', }, - maintainers = { '@PrestonKnopp' }, readme_note = 'Godot', - tier = 2, + tier = 3, }, gdshader = { install_info = { From c579a8c0cfc2d8d448aa72e8ba4f84e6a68f4533 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sat, 4 Oct 2025 11:02:11 +0200 Subject: [PATCH 2292/2494] feat(parsers): update ada, c_sharp, css, dart, editorconfig, enforce, javadoc, koto, prisma, rust, sql, superhtml, t32 --- lua/nvim-treesitter/parsers.lua | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 0ee85320a..c1e83d01f 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -2,7 +2,7 @@ return { ada = { install_info = { - revision = '9821c989184447f7f088f1096601eb23be35afc5', + revision = 'b23672d313b4c994ab96fd54f1b7ff15eac68a55', url = 'https://github.com/briot/tree-sitter-ada', }, maintainers = { '@briot' }, @@ -174,7 +174,7 @@ return { }, c_sharp = { install_info = { - revision = '3431444351c871dffb32654f1299a00019280f2f', + revision = '6563c3af3f03ec948d08f9325e4bbd072e4c6b99', url = 'https://github.com/tree-sitter/tree-sitter-c-sharp', }, maintainers = { '@amaanq' }, @@ -287,7 +287,7 @@ return { }, css = { install_info = { - revision = '6e327db434fec0ee90f006697782e43ec855adf5', + revision = 'dda5cfc5722c429eaba1c910ca32c2c0c5bb1a3f', url = 'https://github.com/tree-sitter/tree-sitter-css', }, maintainers = { '@TravonteD' }, @@ -338,7 +338,7 @@ return { }, dart = { install_info = { - revision = '80e23c07b64494f7e21090bb3450223ef0b192f4', + revision = 'c1222f5a65aba7e0175cc0cc6f88d198d9fe2b02', url = 'https://github.com/UserNobody14/tree-sitter-dart', }, maintainers = { '@akinsho' }, @@ -449,7 +449,7 @@ return { }, editorconfig = { install_info = { - revision = '947228fb880f838c6d71e8f11dbc0bfb82cd4c78', + revision = '911d7017566116b15c4b2c339e1dbe11fcf03f63', url = 'https://github.com/ValdezFOmar/tree-sitter-editorconfig', }, maintainers = { '@ValdezFOmar' }, @@ -512,7 +512,7 @@ return { }, enforce = { install_info = { - revision = 'a194046e64bdec2c9e2e1a7caa35326387f78b95', + revision = 'b695854665e749acdd16ce4a2a2e2f38f9ea9ca3', url = 'https://github.com/simonvic/tree-sitter-enforce', }, maintainers = { '@simonvic' }, @@ -1074,7 +1074,7 @@ return { }, javadoc = { install_info = { - revision = 'c39005f7da0218cc3ac2734bef049a8fa9ee0e72', + revision = '7d92cf188e4a3ed1b5068dd99af129f083c47e70', url = 'https://github.com/rmuir/tree-sitter-javadoc', }, maintainers = { '@rmuir' }, @@ -1222,7 +1222,7 @@ return { }, koto = { install_info = { - revision = '633744bca404ae4edb961a3c2d7bc947a987afa4', + revision = '7cba915fad6121f776f59e0d1787a3e36e4cfc4e', url = 'https://github.com/koto-lang/tree-sitter-koto', }, maintainers = { '@irh' }, @@ -1676,7 +1676,7 @@ return { }, prisma = { install_info = { - revision = '73f39a6d5401cfdcd143951e499336cf5ab2ffaa', + revision = '3556b2c1f20ec9ac91e92d32c43d9d2a0ca3cc49', url = 'https://github.com/victorhqc/tree-sitter-prisma', }, maintainers = { '@elianiva' }, @@ -1989,7 +1989,7 @@ return { }, rust = { install_info = { - revision = '00d7cbc95f0b8ea2703129550fbd1853a13e0e29', + revision = '946595d164e77b705fa28385654f9420f59262ef', url = 'https://github.com/tree-sitter/tree-sitter-rust', }, maintainers = { '@amaanq' }, @@ -2150,7 +2150,7 @@ return { sql = { install_info = { branch = 'gh-pages', - revision = '0a997b07c777b6504792d04357a0f655897f15a8', + revision = '4afe285bb142542cee0aa7b689fec00a71df4741', url = 'https://github.com/derekstride/tree-sitter-sql', }, maintainers = { '@derekstride' }, @@ -2207,7 +2207,7 @@ return { superhtml = { install_info = { location = 'tree-sitter-superhtml', - revision = '4b60dd98f5d3e158967c9feb839ae71321a625b9', + revision = 'c52790b328b73237bcd924f3d65c5a17e794e8b1', url = 'https://github.com/kristoff-it/superhtml', }, maintainers = { '@rockorager' }, @@ -2273,7 +2273,7 @@ return { }, t32 = { install_info = { - revision = '5f20682355725d840611b07b2ce9681034cff3a6', + revision = 'd4e26ab7a730cfbe0cf84dba6ea3647989064839', url = 'https://gitlab.com/xasc/tree-sitter-t32', }, maintainers = { '@xasc' }, From 01ced7499fb07f6c94abd316414ef198bd6e7058 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sat, 4 Oct 2025 11:08:09 +0200 Subject: [PATCH 2293/2494] feat(angular)!: update parser and queries Breaking change: node `(static_member_expression)` was removed --- lua/nvim-treesitter/parsers.lua | 2 +- runtime/queries/angular/highlights.scm | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index c1e83d01f..8245bf553 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -18,7 +18,7 @@ return { }, angular = { install_info = { - revision = 'd1f24a8890462cb740909ff62a3a079cded288bc', + revision = '15590fdaf2edbd33e5883b22c844eef545320fc5', url = 'https://github.com/dlvandenberg/tree-sitter-angular', }, maintainers = { '@dlvandenberg' }, diff --git a/runtime/queries/angular/highlights.scm b/runtime/queries/angular/highlights.scm index 271e352e5..4793745b4 100644 --- a/runtime/queries/angular/highlights.scm +++ b/runtime/queries/angular/highlights.scm @@ -4,10 +4,7 @@ (pipe_operator) @operator -[ - (string) - (static_member_expression) -] @string +(string) @string (number) @number From 0594d1ba65ddd6fc73411afb78f09ffc912f37b3 Mon Sep 17 00:00:00 2001 From: blindfs Date: Mon, 6 Oct 2025 21:24:58 +0800 Subject: [PATCH 2294/2494] feat(nu)!: update parser and queries --- lua/nvim-treesitter/parsers.lua | 2 +- runtime/queries/nu/highlights.scm | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 8245bf553..72d607836 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -1486,7 +1486,7 @@ return { }, nu = { install_info = { - revision = '0e6c59c46db3c246eaf86ce5b325da1247e971a5', + revision = 'e1509fc9f9aa6579430a65f167528617df56b107', url = 'https://github.com/nushell/tree-sitter-nu', }, maintainers = { '@abhisheksingh0x558' }, diff --git a/runtime/queries/nu/highlights.scm b/runtime/queries/nu/highlights.scm index 38ffbaa2e..e23a30fae 100644 --- a/runtime/queries/nu/highlights.scm +++ b/runtime/queries/nu/highlights.scm @@ -203,7 +203,7 @@ file_path: (val_string) @variable.parameter (param_value "=" @punctuation.delimiter) -(param_cmd +(param_completer "@" @punctuation.delimiter) (param_opt @@ -240,7 +240,7 @@ key: (identifier) @property (parameter param_name: (_) @variable.parameter) -(param_cmd +(param_completer (cmd_identifier) @string) (attribute From 3ab4f2d2d20be55874e2eb575145c6928d7d7d0e Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Tue, 7 Oct 2025 02:25:25 +0200 Subject: [PATCH 2295/2494] feat(inko): update parser for let pattern matching Commit 9d7ed4 of the Inko tree-sitter grammar introduces support for pattern matching in `let` expressions. This requires some corresponding changes to the "local" queries to correctly define local variables. This is done by simply defining locals for all "identifier_pattern" nodes, instead of only doing this for "define_variable" nodes. --- lua/nvim-treesitter/parsers.lua | 2 +- runtime/queries/inko/locals.scm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 72d607836..26f8ca2af 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -1041,7 +1041,7 @@ return { }, inko = { install_info = { - revision = '080e957d94b330e3867f063b148a8050b0888f4e', + revision = '9d7ed4f6c0ea2a8f846f3bb00e33ab21ec9ca379', url = 'https://github.com/inko-lang/tree-sitter-inko', }, maintainers = { '@yorickpeterse' }, diff --git a/runtime/queries/inko/locals.scm b/runtime/queries/inko/locals.scm index b69681cd1..2d61c2c5d 100644 --- a/runtime/queries/inko/locals.scm +++ b/runtime/queries/inko/locals.scm @@ -13,7 +13,7 @@ (argument name: _ @local.definition.parameter) -(define_variable +(identifier_pattern name: _ @local.definition.var) (define_constant From de003000a287c501a6650a1ddd3be80ee34278d4 Mon Sep 17 00:00:00 2001 From: Steven Xu Date: Fri, 10 Oct 2025 20:47:09 +1100 Subject: [PATCH 2296/2494] feat(tmux)!: update parser and highlights Breaking changes: - Node `(variable)` was renamed to `(expr_double_quotes)`. - Node `(variable_raw)` was renamed to `(expr_single_quotes)`. - Node `(string)` was renamed to `(str_double_quotes)`. - Node `(raw_string)` was renamed to `(str_single_quotes)`. - Node `(raw_string_quote)` was removed. --- SUPPORTED_LANGUAGES.md | 2 +- lua/nvim-treesitter/parsers.lua | 4 ++-- runtime/queries/tmux/highlights.scm | 26 ++++++++++++++++++++------ 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/SUPPORTED_LANGUAGES.md b/SUPPORTED_LANGUAGES.md index 989187984..90df4eb87 100644 --- a/SUPPORTED_LANGUAGES.md +++ b/SUPPORTED_LANGUAGES.md @@ -300,7 +300,7 @@ jsx (queries only)[^jsx] | unstable | `HFIJ ` | | @steelsojka [thrift](https://github.com/tree-sitter-grammars/tree-sitter-thrift) | unstable | `HFIJL` | | @amaanq, @duskmoon314 [tiger](https://github.com/ambroisie/tree-sitter-tiger) | unstable | `HFIJL` | | @ambroisie [tlaplus](https://github.com/tlaplus-community/tree-sitter-tlaplus) | unstable | `HF JL` | | @ahelwer, @susliko -[tmux](https://github.com/Freed-Wu/tree-sitter-tmux) | unstable | `H  J ` | | @Freed-Wu +[tmux](https://github.com/Freed-Wu/tree-sitter-tmux) | unstable | `H  J ` | | @Freed-Wu, @stevenxxiu [todotxt](https://github.com/arnarg/tree-sitter-todotxt) | unstable | `H    ` | | @arnarg [toml](https://github.com/tree-sitter-grammars/tree-sitter-toml) | unstable | `HFIJL` | | @tk-shirasaka [tsv](https://github.com/tree-sitter-grammars/tree-sitter-csv) | unstable | `H    ` | | @amaanq diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 26f8ca2af..aba7016a1 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -2372,10 +2372,10 @@ return { }, tmux = { install_info = { - revision = '0252ecd080016e45e6305ef1a943388f5ae2f4b4', + revision = 'a2936cb2579f7723b5744563c45bcefabc42fe47', url = 'https://github.com/Freed-Wu/tree-sitter-tmux', }, - maintainers = { '@Freed-Wu' }, + maintainers = { '@Freed-Wu', '@stevenxxiu' }, tier = 2, }, todotxt = { diff --git a/runtime/queries/tmux/highlights.scm b/runtime/queries/tmux/highlights.scm index 50da7d7d8..ea98dff06 100644 --- a/runtime/queries/tmux/highlights.scm +++ b/runtime/queries/tmux/highlights.scm @@ -1,19 +1,21 @@ -; Comments (comment) @comment @spell -; General [ - (string) - (raw_string) + "'" + (str_single_quotes) + (str_double_quotes) ] @string -(int) @number +(backslash_escape) @string.escape (path) @string.special.path +(int) @number + [ (option) (variable_name) + (variable_name_short) ] @variable (command_line_option) @variable.builtin @@ -21,7 +23,17 @@ ((option) @variable.builtin (#not-lua-match? @variable.builtin "^@")) -(command) @keyword +[ + (if_keyword) + (elif_keyword) + (else_keyword) + (endif_keyword) +] @keyword.conditional + +[ + (hidden_keyword) + (command) +] @keyword (source_file_directive (command) @keyword.import) @@ -33,6 +45,8 @@ "=" @operator [ + ";" + "';'" "," ":" ] @punctuation.delimiter From cbafde992598b8ee05b5b80e165905655578fb75 Mon Sep 17 00:00:00 2001 From: Steven Xu Date: Sat, 11 Oct 2025 17:23:17 +1100 Subject: [PATCH 2297/2494] feat(tmux)!: update parser and highlights Breaking changes: - Nodes `(variable_name)`, `(expr_variable_name)`, `(variable_name_short)`, are exposed as `(name)`. --- lua/nvim-treesitter/parsers.lua | 2 +- runtime/queries/tmux/highlights.scm | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index aba7016a1..936dc9592 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -2372,7 +2372,7 @@ return { }, tmux = { install_info = { - revision = 'a2936cb2579f7723b5744563c45bcefabc42fe47', + revision = '72b42cd0307bdfe471fd151a0282d0d38e889944', url = 'https://github.com/Freed-Wu/tree-sitter-tmux', }, maintainers = { '@Freed-Wu', '@stevenxxiu' }, diff --git a/runtime/queries/tmux/highlights.scm b/runtime/queries/tmux/highlights.scm index ea98dff06..33509d76e 100644 --- a/runtime/queries/tmux/highlights.scm +++ b/runtime/queries/tmux/highlights.scm @@ -14,8 +14,7 @@ [ (option) - (variable_name) - (variable_name_short) + (name) ] @variable (command_line_option) @variable.builtin From 763f1e650b91aa951495e709d61597d1222dba65 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sat, 11 Oct 2025 11:12:06 +0200 Subject: [PATCH 2298/2494] feat(parsers): update angular, comment, dart, desktop, enforce, erlang, gleam, gotmpl, hare, helm, javadoc, kitty, koto, mlir, racket, rust, scheme, superhtml, systemverilog, wit, xresources, yaml --- lua/nvim-treesitter/parsers.lua | 44 ++++++++++++++++----------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 936dc9592..238f66f67 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -18,7 +18,7 @@ return { }, angular = { install_info = { - revision = '15590fdaf2edbd33e5883b22c844eef545320fc5', + revision = 'c884ad6cce47da111584aee4b147cdf7dd3383e1', url = 'https://github.com/dlvandenberg/tree-sitter-angular', }, maintainers = { '@dlvandenberg' }, @@ -238,7 +238,7 @@ return { }, comment = { install_info = { - revision = '689be73775bd2dd57b938b8e12bf50fec35a6ca3', + revision = 'db922d7809637900089709e07e31b88c42354ec2', url = 'https://github.com/stsewd/tree-sitter-comment', }, maintainers = { '@stsewd' }, @@ -338,7 +338,7 @@ return { }, dart = { install_info = { - revision = 'c1222f5a65aba7e0175cc0cc6f88d198d9fe2b02', + revision = 'd4d8f3e337d8be23be27ffc35a0aef972343cd54', url = 'https://github.com/UserNobody14/tree-sitter-dart', }, maintainers = { '@akinsho' }, @@ -346,7 +346,7 @@ return { }, desktop = { install_info = { - revision = '73c3f1ec366061aa9b1f61d76fc3d37b86b5a9af', + revision = '73b9f3ac30ac8d01267a16b1c4f0880aecdb56b2', url = 'https://github.com/ValdezFOmar/tree-sitter-desktop', }, maintainers = { '@ValdezFOmar' }, @@ -512,7 +512,7 @@ return { }, enforce = { install_info = { - revision = 'b695854665e749acdd16ce4a2a2e2f38f9ea9ca3', + revision = 'eb2796871d966264cdb041b797416ef1757c8b4f', url = 'https://github.com/simonvic/tree-sitter-enforce', }, maintainers = { '@simonvic' }, @@ -520,7 +520,7 @@ return { }, erlang = { install_info = { - revision = 'df268da05d8ed4837dd2a8e2af1906619c2f0aa0', + revision = 'a260cb65eaa6e055289a34434f98c3aae6137ed5', url = 'https://github.com/WhatsApp/tree-sitter-erlang', }, maintainers = { '@filmor' }, @@ -708,7 +708,7 @@ return { }, gleam = { install_info = { - revision = 'dae1551a9911b24f41d876c23f2ab05ece0a9d4c', + revision = 'ec3c27c5eef20f48b17ee28152f521697df10312', url = 'https://github.com/gleam-lang/tree-sitter-gleam', }, maintainers = { '@amaanq' }, @@ -810,7 +810,7 @@ return { }, gotmpl = { install_info = { - revision = '65f4f86c3aaa9dabab36e3482584e8a111cf7db1', + revision = 'ca26229bafcd3f37698a2496c2a5efa2f07e86bc', url = 'https://github.com/ngalaiko/tree-sitter-go-template', }, maintainers = { '@qvalentin' }, @@ -881,7 +881,7 @@ return { }, hare = { install_info = { - revision = '4af5d82cf9ec39f67cb1db5b7a9269d337406592', + revision = 'eed7ddf6a66b596906aa8ca3d40521b8278adc6f', url = 'https://github.com/tree-sitter-grammars/tree-sitter-hare', }, maintainers = { '@amaanq' }, @@ -922,7 +922,7 @@ return { helm = { install_info = { location = 'dialects/helm', - revision = '65f4f86c3aaa9dabab36e3482584e8a111cf7db1', + revision = 'ca26229bafcd3f37698a2496c2a5efa2f07e86bc', url = 'https://github.com/ngalaiko/tree-sitter-go-template', }, maintainers = { '@qvalentin' }, @@ -1074,7 +1074,7 @@ return { }, javadoc = { install_info = { - revision = '7d92cf188e4a3ed1b5068dd99af129f083c47e70', + revision = '92f9d7115598c1b012f5931a84ee5d50d46c0eb7', url = 'https://github.com/rmuir/tree-sitter-javadoc', }, maintainers = { '@rmuir' }, @@ -1206,7 +1206,7 @@ return { }, kitty = { install_info = { - revision = '49f877cff80ab613808b34bde170ea477ec182fe', + revision = '064d1b4d8ae1b93244de0ff6bc9f0ee0cffee3b5', url = 'https://github.com/OXY2DEV/tree-sitter-kitty', }, maintainers = { '@OXY2DEV' }, @@ -1222,7 +1222,7 @@ return { }, koto = { install_info = { - revision = '7cba915fad6121f776f59e0d1787a3e36e4cfc4e', + revision = '172050b74825a38e29ecc94c85a4dcd10d733738', url = 'https://github.com/koto-lang/tree-sitter-koto', }, maintainers = { '@irh' }, @@ -1406,7 +1406,7 @@ return { mlir = { install_info = { generate = true, - revision = '14152c1e580043865131bca80bcd8e8cb9132df7', + revision = '7eadef0de98de1170cdffb68c0931e375fc1b046', url = 'https://github.com/artagnon/tree-sitter-mlir', }, maintainers = { '@artagnon' }, @@ -1829,7 +1829,7 @@ return { }, racket = { install_info = { - revision = '6d63a202602eb350e726b5e7814127ba22ed25fc', + revision = '130e76536bd3a45df7b7fd71cfa3d0df25fcfe8e', url = 'https://github.com/6cdh/tree-sitter-racket', }, tier = 2, @@ -1989,7 +1989,7 @@ return { }, rust = { install_info = { - revision = '946595d164e77b705fa28385654f9420f59262ef', + revision = '261b20226c04ef601adbdf185a800512a5f66291', url = 'https://github.com/tree-sitter/tree-sitter-rust', }, maintainers = { '@amaanq' }, @@ -2015,7 +2015,7 @@ return { }, scheme = { install_info = { - revision = '67b5c8d6ce19fd5265f13204fec0a3efa9e095d9', + revision = '591893b9a8b9ec85f5cef86e0cc1028012ad9f0e', url = 'https://github.com/6cdh/tree-sitter-scheme', }, tier = 2, @@ -2207,7 +2207,7 @@ return { superhtml = { install_info = { location = 'tree-sitter-superhtml', - revision = 'c52790b328b73237bcd924f3d65c5a17e794e8b1', + revision = 'aeaa0c7d9ef983453952a2ee4983476fef0168f3', url = 'https://github.com/kristoff-it/superhtml', }, maintainers = { '@rockorager' }, @@ -2265,7 +2265,7 @@ return { }, systemverilog = { install_info = { - revision = '9e06a0dddbef4e80a2091fd0a772cc93a55019f7', + revision = 'e88937e66adc3ee7be0bfe40b7e937eafe4212bb', url = 'https://github.com/gmlarumbe/tree-sitter-systemverilog', }, maintainers = { '@zhangwwpeng' }, @@ -2605,7 +2605,7 @@ return { }, wit = { install_info = { - revision = '8fd7cfd90be29b363922b2e09bf6a7db50de04a8', + revision = '230984dfaf803a0ff8f77da5034361a62c326577', url = 'https://github.com/bytecodealliance/tree-sitter-wit', }, maintainers = { '@mkatychev' }, @@ -2639,7 +2639,7 @@ return { }, xresources = { install_info = { - revision = 'c6f240ab53c75edc0b122bc26c994ceb410d5b27', + revision = 'fd546d43fe0a179b59dfdfb296082c584870e11b', url = 'https://github.com/ValdezFOmar/tree-sitter-xresources', }, maintainers = { '@ValdezFOmar' }, @@ -2647,7 +2647,7 @@ return { }, yaml = { install_info = { - revision = '3431ec21da1dde751bab55520963cf3a4f1121f3', + revision = '7708026449bed86239b1cd5bce6e3c34dbca6415', url = 'https://github.com/tree-sitter-grammars/tree-sitter-yaml', }, maintainers = { '@amaanq' }, From 09d50fd1576feeda21e85af56bcbfbdf8fccef76 Mon Sep 17 00:00:00 2001 From: Riley Bruins Date: Sat, 11 Oct 2025 08:45:31 -0700 Subject: [PATCH 2299/2494] fix(kitty): align line continuation highlights Changes them from `@comment` to `@punctuation.special`, which is how they are in other languages. --- runtime/queries/kitty/highlights.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/queries/kitty/highlights.scm b/runtime/queries/kitty/highlights.scm index 93e5d31a4..7fe0f214a 100644 --- a/runtime/queries/kitty/highlights.scm +++ b/runtime/queries/kitty/highlights.scm @@ -1,4 +1,4 @@ -(line_continuation) @comment +(line_continuation) @punctuation.special (comment (comment_content) @spell) @comment From 4b74045bbe6de587c36b1e96956fa22769b4cdf7 Mon Sep 17 00:00:00 2001 From: Riley Bruins Date: Sat, 11 Oct 2025 09:02:49 -0700 Subject: [PATCH 2300/2494] chore: ask for file extension in new language PR template This will really help me to search on github for diverse code samples. --- .github/PULL_REQUEST_TEMPLATE/new_language.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/PULL_REQUEST_TEMPLATE/new_language.md b/.github/PULL_REQUEST_TEMPLATE/new_language.md index 0f814f0f0..b35e84b3b 100644 --- a/.github/PULL_REQUEST_TEMPLATE/new_language.md +++ b/.github/PULL_REQUEST_TEMPLATE/new_language.md @@ -8,6 +8,8 @@ https://... +Language file extension, if applicable: (e.g. `.zu`) +
Representative code sample ``` From 0606c7a9dcaa5c5beee0b0f09043e9fdd1ba0a68 Mon Sep 17 00:00:00 2001 From: Riley Bruins Date: Sat, 11 Oct 2025 15:34:39 -0700 Subject: [PATCH 2301/2494] feat(vue): delimiter highlight touch-ups --- runtime/queries/vue/highlights.scm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/runtime/queries/vue/highlights.scm b/runtime/queries/vue/highlights.scm index 66b7ea61e..173908b5a 100644 --- a/runtime/queries/vue/highlights.scm +++ b/runtime/queries/vue/highlights.scm @@ -5,7 +5,15 @@ "]" ] @punctuation.bracket -(interpolation) @punctuation.special +[ + ":" + "." +] @punctuation.delimiter + +[ + (interpolation) + "@" +] @punctuation.special (interpolation (raw_text) @none) From 4968877bb2dceac45948e24ee14298b1006b4cbf Mon Sep 17 00:00:00 2001 From: Christoph Sax Date: Wed, 15 Oct 2025 21:16:29 +0200 Subject: [PATCH 2302/2494] fix(t32): update repo url Switches the grammar repository from GitLab to GitHub. --- SUPPORTED_LANGUAGES.md | 2 +- lua/nvim-treesitter/parsers.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/SUPPORTED_LANGUAGES.md b/SUPPORTED_LANGUAGES.md index 90df4eb87..59dcb4b41 100644 --- a/SUPPORTED_LANGUAGES.md +++ b/SUPPORTED_LANGUAGES.md @@ -288,7 +288,7 @@ jsx (queries only)[^jsx] | unstable | `HFIJ ` | | @steelsojka [sxhkdrc](https://github.com/RaafatTurki/tree-sitter-sxhkdrc) | unstable | `HF J ` | | @RaafatTurki [systemtap](https://github.com/ok-ryoko/tree-sitter-systemtap) | unstable | `HF JL` | | @ok-ryoko [systemverilog](https://github.com/gmlarumbe/tree-sitter-systemverilog) | unstable | `HF J ` | | @zhangwwpeng -[t32](https://gitlab.com/xasc/tree-sitter-t32) | unstable | `HFIJL` | | @xasc +[t32](https://github.com/xasc/tree-sitter-t32) | unstable | `HFIJL` | | @xasc [tablegen](https://github.com/tree-sitter-grammars/tree-sitter-tablegen) | unstable | `HFIJL` | | @amaanq [tact](https://github.com/tact-lang/tree-sitter-tact) | unstable | `HFIJL` | | @novusnota [tcl](https://github.com/tree-sitter-grammars/tree-sitter-tcl) | unstable | `HFIJ ` | | @lewis6991 diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 238f66f67..762717cd3 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -2274,7 +2274,7 @@ return { t32 = { install_info = { revision = 'd4e26ab7a730cfbe0cf84dba6ea3647989064839', - url = 'https://gitlab.com/xasc/tree-sitter-t32', + url = 'https://github.com/xasc/tree-sitter-t32', }, maintainers = { '@xasc' }, tier = 2, From 63fac0a576bc78a4790cbcce24646cca860bc8c1 Mon Sep 17 00:00:00 2001 From: Riley Bruins Date: Wed, 15 Oct 2025 23:17:41 -0700 Subject: [PATCH 2303/2494] fix(vue): `@character.special` highlights for `:`, `.` (#8200) --- runtime/queries/vue/highlights.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/queries/vue/highlights.scm b/runtime/queries/vue/highlights.scm index 173908b5a..70e4f405e 100644 --- a/runtime/queries/vue/highlights.scm +++ b/runtime/queries/vue/highlights.scm @@ -8,7 +8,7 @@ [ ":" "." -] @punctuation.delimiter +] @character.special [ (interpolation) From cdb5d5ef233cd5d3c558b4a48dc367943bd5c016 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 17 Oct 2025 14:19:37 +0200 Subject: [PATCH 2304/2494] docs(readme): remove wiki link --- README.md | 2 -- doc/nvim-treesitter.txt | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index bdb9c1ddc..71cf69e33 100644 --- a/README.md +++ b/README.md @@ -81,8 +81,6 @@ For `nvim-treesitter` to support a specific feature for a specific language requ A list of the currently supported languages can be found [on this page](SUPPORTED_LANGUAGES.md). If you wish to add a new language or improve the queries for an existing one, please see our [contributing guide](CONTRIBUTING.md). -For related information on the supported languages, including related plugins, see [this wiki page](https://github.com/nvim-treesitter/nvim-treesitter/wiki/Supported-Languages-Information). - # Supported features `nvim-treesitter` provides queries for the following features. **These are not automatically enabled.** diff --git a/doc/nvim-treesitter.txt b/doc/nvim-treesitter.txt index f77cb061b..3bb3f9356 100644 --- a/doc/nvim-treesitter.txt +++ b/doc/nvim-treesitter.txt @@ -57,7 +57,7 @@ COMMANDS *nvim-treesitter-commands* Install one or more treesitter parsers. {language} can be one or multiple parsers or tiers (`stable`, `unstable`, or `all` (not recommended)). This is a -no-op of the parser(s) are already installed. Installation is performed +no-op if the parser(s) are already installed. Installation is performed asynchronously. Use *:TSInstall!* to force installation even if a parser is already installed. From 846d51137b8cbc030ab94edf9dc33968ddcdb195 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 17 Oct 2025 15:54:28 +0200 Subject: [PATCH 2305/2494] feat(julia): update builtin functions and types (#8203) Update to Julia 1.12 (sync with upstream) --- runtime/queries/julia/highlights.scm | 31 +++++++++++++++------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/runtime/queries/julia/highlights.scm b/runtime/queries/julia/highlights.scm index 9a82c5d41..de32c67ed 100644 --- a/runtime/queries/julia/highlights.scm +++ b/runtime/queries/julia/highlights.scm @@ -45,12 +45,13 @@ (identifier) @function.macro))) ; Built-in functions -; filter(name -> Base.eval(Core, name) isa Core.Builtin, names(Core)) +; print.("\"", filter(name -> getglobal(Core, name) isa Core.Builtin, names(Core)), "\" ") ((identifier) @function.builtin (#any-of? @function.builtin - "applicable" "fieldtype" "getfield" "getglobal" "invoke" "isa" "isdefined" "modifyfield!" - "modifyglobal!" "nfields" "replacefield!" "replaceglobal!" "setfield!" "setfieldonce!" - "setglobal!" "setglobalonce!" "swapfield!" "swapglobal!" "throw" "tuple" "typeassert" "typeof")) + "applicable" "fieldtype" "getfield" "getglobal" "invoke" "isa" "isdefined" "isdefinedglobal" + "modifyfield!" "modifyglobal!" "nfields" "replacefield!" "replaceglobal!" "setfield!" + "setfieldonce!" "setglobal!" "setglobalonce!" "swapfield!" "swapglobal!" "throw" "tuple" + "typeassert" "typeof")) ; Type definitions (type_head @@ -91,19 +92,21 @@ (#any-of? @operator "<:" ">:")) ; Built-in types -; filter(name -> typeof(Base.eval(Core, name)) in [DataType, UnionAll], names(Core)) +; print.("\"", filter(name -> typeof(Base.eval(Core, name)) in [DataType, UnionAll], names(Core)), "\" ") ((identifier) @type.builtin (#any-of? @type.builtin "AbstractArray" "AbstractChar" "AbstractFloat" "AbstractString" "Any" "ArgumentError" "Array" - "AssertionError" "Bool" "BoundsError" "Char" "ConcurrencyViolationError" "Cvoid" "DataType" - "DenseArray" "DivideError" "DomainError" "ErrorException" "Exception" "Expr" "Float16" "Float32" - "Float64" "Function" "GlobalRef" "IO" "InexactError" "InitError" "Int" "Int128" "Int16" "Int32" - "Int64" "Int8" "Integer" "InterruptException" "LineNumberNode" "LoadError" "Method" - "MethodError" "Module" "NTuple" "NamedTuple" "Nothing" "Number" "OutOfMemoryError" - "OverflowError" "Pair" "Ptr" "QuoteNode" "ReadOnlyMemoryError" "Real" "Ref" "SegmentationFault" - "Signed" "StackOverflowError" "String" "Symbol" "Task" "Tuple" "Type" "TypeError" "TypeVar" - "UInt" "UInt128" "UInt16" "UInt32" "UInt64" "UInt8" "UndefInitializer" "UndefKeywordError" - "UndefRefError" "UndefVarError" "Union" "UnionAll" "Unsigned" "VecElement" "WeakRef")) + "AssertionError" "AtomicMemory" "AtomicMemoryRef" "Bool" "BoundsError" "Char" + "ConcurrencyViolationError" "Cvoid" "DataType" "DenseArray" "DivideError" "DomainError" + "ErrorException" "Exception" "Expr" "FieldError" "Float16" "Float32" "Float64" "Function" + "GenericMemory" "GenericMemoryRef" "GlobalRef" "IO" "InexactError" "InitError" "Int" "Int128" + "Int16" "Int32" "Int64" "Int8" "Integer" "InterruptException" "LineNumberNode" "LoadError" + "Memory" "MemoryRef" "Method" "MethodError" "Module" "NTuple" "NamedTuple" "Nothing" "Number" + "OutOfMemoryError" "OverflowError" "Pair" "Ptr" "QuoteNode" "ReadOnlyMemoryError" "Real" "Ref" + "SegmentationFault" "Signed" "StackOverflowError" "String" "Symbol" "Task" "Tuple" "Type" + "TypeError" "TypeVar" "UInt" "UInt128" "UInt16" "UInt32" "UInt64" "UInt8" "UndefInitializer" + "UndefKeywordError" "UndefRefError" "UndefVarError" "Union" "UnionAll" "Unsigned" "VecElement" + "WeakRef")) ; Keywords [ From 71bf1665f804d46f7e4b24ad7ffc11f6ea5b271a Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sun, 19 Oct 2025 11:29:49 +0200 Subject: [PATCH 2306/2494] feat(parsers): update ada, cmake, desktop, dot, mlir, nu, qmljs, sparql, sql, superhtml, systemverilog, t32, tmux, xresources --- lua/nvim-treesitter/parsers.lua | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 762717cd3..5cdbf3e43 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -2,7 +2,7 @@ return { ada = { install_info = { - revision = 'b23672d313b4c994ab96fd54f1b7ff15eac68a55', + revision = '6c26c4413965dc7bacbccfa66503bf6b8228e254', url = 'https://github.com/briot/tree-sitter-ada', }, maintainers = { '@briot' }, @@ -230,7 +230,7 @@ return { }, cmake = { install_info = { - revision = 'cf9799600b2ba5e6620fdabddec3b2db8306bc46', + revision = 'c7b2a71e7f8ecb167fad4c97227c838439280175', url = 'https://github.com/uyha/tree-sitter-cmake', }, maintainers = { '@uyha' }, @@ -346,7 +346,7 @@ return { }, desktop = { install_info = { - revision = '73b9f3ac30ac8d01267a16b1c4f0880aecdb56b2', + revision = 'de6482e226443a210f27627e0240c12aa25c2925', url = 'https://github.com/ValdezFOmar/tree-sitter-desktop', }, maintainers = { '@ValdezFOmar' }, @@ -402,7 +402,7 @@ return { }, dot = { install_info = { - revision = '9ab85550c896d8b294d9b9ca1e30698736f08cea', + revision = '71e2c5241eef9de920a4efedfefd1d527dd9a118', url = 'https://github.com/rydesun/tree-sitter-dot', }, maintainers = { '@rydesun' }, @@ -1406,7 +1406,7 @@ return { mlir = { install_info = { generate = true, - revision = '7eadef0de98de1170cdffb68c0931e375fc1b046', + revision = '47c3f2cf3b10016503f2577c2d99c15bb2053402', url = 'https://github.com/artagnon/tree-sitter-mlir', }, maintainers = { '@artagnon' }, @@ -1486,7 +1486,7 @@ return { }, nu = { install_info = { - revision = 'e1509fc9f9aa6579430a65f167528617df56b107', + revision = '4f4ac8667c1e7f80d0d9f9534845e63026210aaf', url = 'https://github.com/nushell/tree-sitter-nu', }, maintainers = { '@abhisheksingh0x558' }, @@ -1803,7 +1803,7 @@ return { }, qmljs = { install_info = { - revision = '0889da4632bba3ec6f39ef4102625654890c15c1', + revision = '0bec4359a7eb2f6c9220cd57372d87d236f66d59', url = 'https://github.com/yuja/tree-sitter-qmljs', }, maintainers = { '@Decodetalkers' }, @@ -2133,7 +2133,7 @@ return { }, sparql = { install_info = { - revision = 'd853661ca680d8ff7f8d800182d5782b61d0dd58', + revision = '1ef52d35a73a2a5f2e433ecfd1c751c1360a923b', url = 'https://github.com/GordianDziwis/tree-sitter-sparql', }, maintainers = { '@GordianDziwis' }, @@ -2150,7 +2150,7 @@ return { sql = { install_info = { branch = 'gh-pages', - revision = '4afe285bb142542cee0aa7b689fec00a71df4741', + revision = 'd71f2bd7f0e3dba84df7025fc9314738d180e71e', url = 'https://github.com/derekstride/tree-sitter-sql', }, maintainers = { '@derekstride' }, @@ -2207,7 +2207,7 @@ return { superhtml = { install_info = { location = 'tree-sitter-superhtml', - revision = 'aeaa0c7d9ef983453952a2ee4983476fef0168f3', + revision = '8b5bb272b269afdd38cdf641c4a707dd92fbe902', url = 'https://github.com/kristoff-it/superhtml', }, maintainers = { '@rockorager' }, @@ -2265,7 +2265,7 @@ return { }, systemverilog = { install_info = { - revision = 'e88937e66adc3ee7be0bfe40b7e937eafe4212bb', + revision = '7c4b01b7df2f6e7fa1f698c9d30ac8f93af18ed2', url = 'https://github.com/gmlarumbe/tree-sitter-systemverilog', }, maintainers = { '@zhangwwpeng' }, @@ -2273,7 +2273,7 @@ return { }, t32 = { install_info = { - revision = 'd4e26ab7a730cfbe0cf84dba6ea3647989064839', + revision = '2f604ad17a15c09d99648199da7f173eed8250dc', url = 'https://github.com/xasc/tree-sitter-t32', }, maintainers = { '@xasc' }, @@ -2372,7 +2372,7 @@ return { }, tmux = { install_info = { - revision = '72b42cd0307bdfe471fd151a0282d0d38e889944', + revision = '815f8fa5ac7aeb6246c14896d16082fecdf98b2b', url = 'https://github.com/Freed-Wu/tree-sitter-tmux', }, maintainers = { '@Freed-Wu', '@stevenxxiu' }, @@ -2639,7 +2639,7 @@ return { }, xresources = { install_info = { - revision = 'fd546d43fe0a179b59dfdfb296082c584870e11b', + revision = '321231f99e3704f1555de14cda5dca93ee14a95b', url = 'https://github.com/ValdezFOmar/tree-sitter-xresources', }, maintainers = { '@ValdezFOmar' }, From 30c466ad571b8b99fd06e3df8b2336e3ae63a53a Mon Sep 17 00:00:00 2001 From: zc he Date: Tue, 21 Oct 2025 15:10:18 +0800 Subject: [PATCH 2307/2494] fix(nu): separate patterns for `collection_type` --- runtime/queries/nu/highlights.scm | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/runtime/queries/nu/highlights.scm b/runtime/queries/nu/highlights.scm index e23a30fae..e008352d4 100644 --- a/runtime/queries/nu/highlights.scm +++ b/runtime/queries/nu/highlights.scm @@ -344,14 +344,19 @@ key: (identifier) @property [ "record" "table" - ] @type.builtin - "<" @punctuation.bracket - key: (_) @variable.parameter + ] @type.builtin) + +(collection_type + key: (_) @variable.parameter) + +(collection_type [ - "," - ":" - ] @punctuation.delimiter - ">" @punctuation.bracket) + "<" + ">" + ] @punctuation.bracket) + +(collection_type + ":" @punctuation.special) (shebang) @keyword.directive From 8fecb462580ec0794a803b1d6ff9e2c4896c3e6f Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Mon, 20 Oct 2025 19:19:17 +0200 Subject: [PATCH 2308/2494] feat(julia)!: switch to maintained fork breaking change: ABI 15, drop support for emoji identifiers --- SUPPORTED_LANGUAGES.md | 2 +- lua/nvim-treesitter/parsers.lua | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/SUPPORTED_LANGUAGES.md b/SUPPORTED_LANGUAGES.md index 59dcb4b41..f931a3590 100644 --- a/SUPPORTED_LANGUAGES.md +++ b/SUPPORTED_LANGUAGES.md @@ -155,7 +155,7 @@ html_tags (queries only)[^html_tags] | unstable | `H IJ ` | | @TravonteD [jsonc](https://gitlab.com/WhyNotHugo/tree-sitter-jsonc) | unstable | `HFIJL` | | @WhyNotHugo [jsonnet](https://github.com/sourcegraph/tree-sitter-jsonnet) | unstable | `HF JL` | | @nawordar jsx (queries only)[^jsx] | unstable | `HFIJ ` | | @steelsojka -[julia](https://github.com/tree-sitter/tree-sitter-julia) | unstable | `HFIJL` | | @fredrikekre +[julia](https://github.com/tree-sitter-grammars/tree-sitter-julia) | unstable | `HFIJL` | | @clason [just](https://github.com/IndianBoy42/tree-sitter-just) | unstable | `HFIJL` | | @Hubro [kcl](https://github.com/kcl-lang/tree-sitter-kcl) | unstable | `HF J ` | | @bertbaron [kconfig](https://github.com/tree-sitter-grammars/tree-sitter-kconfig) | unstable | `HFIJL` | | @amaanq diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 5cdbf3e43..62217fc33 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -1166,10 +1166,10 @@ return { }, julia = { install_info = { - revision = '73d1539a51b8a202d6d2471cc594cf4d7c5e673f', - url = 'https://github.com/tree-sitter/tree-sitter-julia', + revision = '8d11bcffb6eebcb08049436bd01bd98afa058dc4', + url = 'https://github.com/tree-sitter-grammars/tree-sitter-julia', }, - maintainers = { '@fredrikekre' }, + maintainers = { '@clason' }, tier = 2, }, just = { From eea5725822098255cc22233b053ba9d56aaf53b9 Mon Sep 17 00:00:00 2001 From: Isla Waters Date: Fri, 17 Oct 2025 10:06:14 -0400 Subject: [PATCH 2309/2494] feat(perl): Add language injection based on heredoc delimiter --- runtime/queries/perl/injections.scm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/runtime/queries/perl/injections.scm b/runtime/queries/perl/injections.scm index ec11e9013..a1327bd4b 100644 --- a/runtime/queries/perl/injections.scm +++ b/runtime/queries/perl/injections.scm @@ -13,3 +13,7 @@ (#not-lua-match? @_modifiers "e.*e") (#set! injection.language "perl") (#set! injection.include-children)) + +(heredoc_content + (heredoc_end) @injection.language) @injection.content + (#set! injection.include-children) From 4a9f57971ae455f07922800973f2d0eccc818e3a Mon Sep 17 00:00:00 2001 From: Isla Waters Date: Fri, 17 Oct 2025 10:35:00 -0400 Subject: [PATCH 2310/2494] Remove empty capture based on ts_query_ls output --- runtime/queries/perl/injections.scm | 1 - 1 file changed, 1 deletion(-) diff --git a/runtime/queries/perl/injections.scm b/runtime/queries/perl/injections.scm index a1327bd4b..56e9b14fa 100644 --- a/runtime/queries/perl/injections.scm +++ b/runtime/queries/perl/injections.scm @@ -16,4 +16,3 @@ (heredoc_content (heredoc_end) @injection.language) @injection.content - (#set! injection.include-children) From f2204e58dbb2031cb6783caa4541c4483edbb426 Mon Sep 17 00:00:00 2001 From: Riley Bruins Date: Fri, 24 Oct 2025 18:47:39 -0700 Subject: [PATCH 2311/2494] fix: use proper `; inherits` syntax in queries (#8226) Some queries don't add a colon after the `inherits` keyword, which nvim could handle but `ts_query_ls` could not, causing it to give incomplete diagnostics. --- runtime/queries/html/injections.scm | 3 ++- runtime/queries/starlark/injections.scm | 2 +- runtime/queries/vue/injections.scm | 3 ++- runtime/queries/wgsl_bevy/folds.scm | 3 ++- runtime/queries/wgsl_bevy/highlights.scm | 3 ++- runtime/queries/wgsl_bevy/indents.scm | 3 ++- 6 files changed, 11 insertions(+), 6 deletions(-) diff --git a/runtime/queries/html/injections.scm b/runtime/queries/html/injections.scm index adb067d15..6a9d3e89e 100644 --- a/runtime/queries/html/injections.scm +++ b/runtime/queries/html/injections.scm @@ -1,4 +1,5 @@ -; inherits html_tags +; inherits: html_tags + (element (start_tag (tag_name) @_py_script) diff --git a/runtime/queries/starlark/injections.scm b/runtime/queries/starlark/injections.scm index 2b60646e2..0b920cbf9 100644 --- a/runtime/queries/starlark/injections.scm +++ b/runtime/queries/starlark/injections.scm @@ -1 +1 @@ -; inherits python +; inherits: python diff --git a/runtime/queries/vue/injections.scm b/runtime/queries/vue/injections.scm index 586964011..d17bbb55f 100644 --- a/runtime/queries/vue/injections.scm +++ b/runtime/queries/vue/injections.scm @@ -1,4 +1,5 @@ -; inherits html_tags +; inherits: html_tags + ;