diff options
| author | Phạm Huy Hoàng <hoangtun0810@gmail.com> | 2024-02-19 00:00:07 +0900 |
|---|---|---|
| committer | 再生花 <hoangtun0810@gmail.com> | 2024-02-29 23:05:30 +0900 |
| commit | 62b0bb4f24ad09f535efe44cc9d088f90dcd2498 (patch) | |
| tree | 6a59663a24fc71d67a7bf3df82c218851c69ffbc | |
| parent | Update parsers: angular, gitcommit, vimdoc, wing (diff) | |
| download | nvim-treesitter-62b0bb4f24ad09f535efe44cc9d088f90dcd2498.tar nvim-treesitter-62b0bb4f24ad09f535efe44cc9d088f90dcd2498.tar.gz nvim-treesitter-62b0bb4f24ad09f535efe44cc9d088f90dcd2498.tar.bz2 nvim-treesitter-62b0bb4f24ad09f535efe44cc9d088f90dcd2498.tar.lz nvim-treesitter-62b0bb4f24ad09f535efe44cc9d088f90dcd2498.tar.xz nvim-treesitter-62b0bb4f24ad09f535efe44cc9d088f90dcd2498.tar.zst nvim-treesitter-62b0bb4f24ad09f535efe44cc9d088f90dcd2498.zip | |
feat(format): extra newline after modeline
54 files changed, 69 insertions, 1 deletions
diff --git a/queries/angular/highlights.scm b/queries/angular/highlights.scm index 0fd97f848..af1c58e45 100644 --- a/queries/angular/highlights.scm +++ b/queries/angular/highlights.scm @@ -1,4 +1,5 @@ ; inherits: html_tags + (identifier) @variable (pipe_operator) @operator diff --git a/queries/apex/highlights.scm b/queries/apex/highlights.scm index 2d1859688..2d2f8819d 100644 --- a/queries/apex/highlights.scm +++ b/queries/apex/highlights.scm @@ -1,4 +1,5 @@ ; inherits: soql + ; Apex + SOQL [ "[" diff --git a/queries/arduino/highlights.scm b/queries/arduino/highlights.scm index d905c5eb3..e6bf14784 100644 --- a/queries/arduino/highlights.scm +++ b/queries/arduino/highlights.scm @@ -1,4 +1,5 @@ ; inherits: cpp + ((identifier) @function.builtin (#any-of? @function.builtin ; Digital I/O diff --git a/queries/astro/highlights.scm b/queries/astro/highlights.scm index 650a489e4..bdaf88e32 100644 --- a/queries/astro/highlights.scm +++ b/queries/astro/highlights.scm @@ -1,4 +1,5 @@ ; inherits: html + "---" @punctuation.delimiter [ diff --git a/queries/astro/injections.scm b/queries/astro/injections.scm index 9b1f285db..717712ad5 100644 --- a/queries/astro/injections.scm +++ b/queries/astro/injections.scm @@ -1,4 +1,5 @@ ; inherits: html_tags + (frontmatter (raw_text) @injection.content (#set! injection.language "typescript")) diff --git a/queries/cpp/folds.scm b/queries/cpp/folds.scm index 26a068a55..f5f566480 100644 --- a/queries/cpp/folds.scm +++ b/queries/cpp/folds.scm @@ -1,4 +1,5 @@ ; inherits: c + [ (for_range_loop) (class_specifier) diff --git a/queries/cpp/highlights.scm b/queries/cpp/highlights.scm index 883c26faa..786391e32 100644 --- a/queries/cpp/highlights.scm +++ b/queries/cpp/highlights.scm @@ -1,4 +1,5 @@ ; inherits: c + ((identifier) @variable.member (#lua-match? @variable.member "^m_.*$")) diff --git a/queries/cpp/indents.scm b/queries/cpp/indents.scm index be6826d6e..0782d226e 100644 --- a/queries/cpp/indents.scm +++ b/queries/cpp/indents.scm @@ -1,4 +1,5 @@ ; inherits: c + (condition_clause) @indent.begin ((field_initializer_list) @indent.begin diff --git a/queries/cpp/locals.scm b/queries/cpp/locals.scm index 863f9de7d..8b1d8dcc1 100644 --- a/queries/cpp/locals.scm +++ b/queries/cpp/locals.scm @@ -1,4 +1,5 @@ ; inherits: c + ; Parameters (variadic_parameter_declaration declarator: diff --git a/queries/csv/highlights.scm b/queries/csv/highlights.scm index 94abe21cc..de2213aa1 100644 --- a/queries/csv/highlights.scm +++ b/queries/csv/highlights.scm @@ -1,2 +1,3 @@ ; inherits: tsv + "," @punctuation.delimiter diff --git a/queries/cuda/highlights.scm b/queries/cuda/highlights.scm index 0b2a13e49..565daaa91 100644 --- a/queries/cuda/highlights.scm +++ b/queries/cuda/highlights.scm @@ -1,4 +1,5 @@ ; inherits: cpp + [ "<<<" ">>>" diff --git a/queries/glsl/highlights.scm b/queries/glsl/highlights.scm index dbf3ed07b..af037c160 100644 --- a/queries/glsl/highlights.scm +++ b/queries/glsl/highlights.scm @@ -1,4 +1,5 @@ ; inherits: c + [ "in" "out" diff --git a/queries/hjson/indents.scm b/queries/hjson/indents.scm index 350f670a0..3b01ca999 100644 --- a/queries/hjson/indents.scm +++ b/queries/hjson/indents.scm @@ -1,2 +1,3 @@ ; inherits: json + (comment) @indent.ignore diff --git a/queries/hlsl/highlights.scm b/queries/hlsl/highlights.scm index b85c1a7fd..d70a83790 100644 --- a/queries/hlsl/highlights.scm +++ b/queries/hlsl/highlights.scm @@ -1,4 +1,5 @@ ; inherits: cpp + [ "in" "out" diff --git a/queries/html/highlights.scm b/queries/html/highlights.scm index ae4e396c0..4e2371d64 100644 --- a/queries/html/highlights.scm +++ b/queries/html/highlights.scm @@ -1,4 +1,5 @@ ; inherits: html_tags + (doctype) @constant "<!" @tag.delimiter diff --git a/queries/ispc/folds.scm b/queries/ispc/folds.scm index 331c70345..45d0ba131 100644 --- a/queries/ispc/folds.scm +++ b/queries/ispc/folds.scm @@ -1,4 +1,5 @@ ; inherits: c + [ (foreach_statement) (foreach_instance_statement) diff --git a/queries/ispc/highlights.scm b/queries/ispc/highlights.scm index 7ac7d2966..45d7be584 100644 --- a/queries/ispc/highlights.scm +++ b/queries/ispc/highlights.scm @@ -1,4 +1,5 @@ ; inherits: c + [ "soa" "task" diff --git a/queries/ispc/indents.scm b/queries/ispc/indents.scm index bf64a963b..80723afb4 100644 --- a/queries/ispc/indents.scm +++ b/queries/ispc/indents.scm @@ -1,4 +1,5 @@ ; inherits: c + ((foreach_statement body: (_) @_body) @indent.begin (#not-has-type? @_body compound_statement)) diff --git a/queries/ispc/locals.scm b/queries/ispc/locals.scm index 54e328083..985b3c9e0 100644 --- a/queries/ispc/locals.scm +++ b/queries/ispc/locals.scm @@ -1,4 +1,5 @@ ; inherits: c + (reference_declarator (identifier) @local.definition.var) diff --git a/queries/javascript/highlights.scm b/queries/javascript/highlights.scm index 9b166d1fd..257a731ad 100644 --- a/queries/javascript/highlights.scm +++ b/queries/javascript/highlights.scm @@ -1,4 +1,5 @@ ; inherits: ecma,jsx + ; Parameters (formal_parameters (identifier) @variable.parameter) diff --git a/queries/javascript/locals.scm b/queries/javascript/locals.scm index 36c14db91..892901c26 100644 --- a/queries/javascript/locals.scm +++ b/queries/javascript/locals.scm @@ -1,4 +1,5 @@ ; inherits: ecma,jsx + ; Both properties are matched here. ; ; class Foo { diff --git a/queries/jsonc/highlights.scm b/queries/jsonc/highlights.scm index 763cd5998..e50112155 100644 --- a/queries/jsonc/highlights.scm +++ b/queries/jsonc/highlights.scm @@ -1,2 +1,3 @@ ; inherits: json + (comment) @comment @spell diff --git a/queries/jsonc/indents.scm b/queries/jsonc/indents.scm index 350f670a0..3b01ca999 100644 --- a/queries/jsonc/indents.scm +++ b/queries/jsonc/indents.scm @@ -1,2 +1,3 @@ ; inherits: json + (comment) @indent.ignore diff --git a/queries/luau/folds.scm b/queries/luau/folds.scm index c35ce1304..8ddaf9476 100644 --- a/queries/luau/folds.scm +++ b/queries/luau/folds.scm @@ -1,2 +1,3 @@ ; inherits: lua + (object_type) @fold diff --git a/queries/luau/indents.scm b/queries/luau/indents.scm index 03da6320b..f0af4dd33 100644 --- a/queries/luau/indents.scm +++ b/queries/luau/indents.scm @@ -1,2 +1,3 @@ ; inherits: lua + (object_type) @indent.begin diff --git a/queries/nqc/highlights.scm b/queries/nqc/highlights.scm index d1ff8de9c..215ffbc4d 100644 --- a/queries/nqc/highlights.scm +++ b/queries/nqc/highlights.scm @@ -1,4 +1,5 @@ ; inherits: c + [ "task" "sub" diff --git a/queries/objc/folds.scm b/queries/objc/folds.scm index 90469b9c3..b922f8bf8 100644 --- a/queries/objc/folds.scm +++ b/queries/objc/folds.scm @@ -1,4 +1,5 @@ ; inherits: c + [ (class_declaration) (class_interface) diff --git a/queries/objc/highlights.scm b/queries/objc/highlights.scm index 5c56625b8..7a83376c2 100644 --- a/queries/objc/highlights.scm +++ b/queries/objc/highlights.scm @@ -1,4 +1,5 @@ ; inherits: c + ; Preprocs (preproc_undef name: (_) @constant) @keyword.directive diff --git a/queries/objc/injections.scm b/queries/objc/injections.scm index f5d13f38e..359420d10 100644 --- a/queries/objc/injections.scm +++ b/queries/objc/injections.scm @@ -1,4 +1,5 @@ ; inherits: c + ; TODO(amaanq): uncomment/add when I add asm support ; (ms_asm_block "{" _ @asm "}") ; diff --git a/queries/php/injections.scm b/queries/php/injections.scm index 141f65eaa..3ccbb2bb4 100644 --- a/queries/php/injections.scm +++ b/queries/php/injections.scm @@ -1,4 +1,5 @@ ; inherits: php_only + ((text) @injection.content (#set! injection.language "html") (#set! injection.combined)) diff --git a/queries/psv/highlights.scm b/queries/psv/highlights.scm index 1e886a0a4..b7303fe0b 100644 --- a/queries/psv/highlights.scm +++ b/queries/psv/highlights.scm @@ -1,2 +1,3 @@ ; inherits: tsv + "|" @punctuation.delimiter diff --git a/queries/scss/highlights.scm b/queries/scss/highlights.scm index 7ca542c83..726256f8e 100644 --- a/queries/scss/highlights.scm +++ b/queries/scss/highlights.scm @@ -1,4 +1,5 @@ ; inherits: css + [ "@at-root" "@debug" diff --git a/queries/scss/indents.scm b/queries/scss/indents.scm index 94490879d..3d54a0467 100644 --- a/queries/scss/indents.scm +++ b/queries/scss/indents.scm @@ -1,4 +1,5 @@ ; inherits: css + [ (mixin_statement) (while_statement) diff --git a/queries/slang/folds.scm b/queries/slang/folds.scm index 9f2b933d1..e0ae6853e 100644 --- a/queries/slang/folds.scm +++ b/queries/slang/folds.scm @@ -1,4 +1,5 @@ ; inherits: hlsl + [ (interface_specifier) (extension_specifier) diff --git a/queries/slang/highlights.scm b/queries/slang/highlights.scm index f60fb0aae..5dcdc4c38 100644 --- a/queries/slang/highlights.scm +++ b/queries/slang/highlights.scm @@ -1,4 +1,5 @@ ; inherits: hlsl + [ "var" "let" diff --git a/queries/slang/indents.scm b/queries/slang/indents.scm index f07cb0562..6175ac5bc 100644 --- a/queries/slang/indents.scm +++ b/queries/slang/indents.scm @@ -1,4 +1,5 @@ ; inherits: hlsl + [ (interface_specifier) (extension_specifier) diff --git a/queries/snakemake/folds.scm b/queries/snakemake/folds.scm index 36ed2318b..99850bd9b 100644 --- a/queries/snakemake/folds.scm +++ b/queries/snakemake/folds.scm @@ -1,4 +1,5 @@ ; inherits: python + [ (rule_definition) (module_definition) diff --git a/queries/snakemake/highlights.scm b/queries/snakemake/highlights.scm index 65789ea96..b28117402 100644 --- a/queries/snakemake/highlights.scm +++ b/queries/snakemake/highlights.scm @@ -1,4 +1,5 @@ ; inherits: python + ; Compound directives [ "rule" diff --git a/queries/snakemake/injections.scm b/queries/snakemake/injections.scm index 82072f2ad..fa56daabb 100644 --- a/queries/snakemake/injections.scm +++ b/queries/snakemake/injections.scm @@ -1,4 +1,5 @@ ; inherits: python + (wildcard (constraint) @injection.content (#set! injection.language "regex")) diff --git a/queries/svelte/folds.scm b/queries/svelte/folds.scm index d46a81ec4..6440301af 100644 --- a/queries/svelte/folds.scm +++ b/queries/svelte/folds.scm @@ -1,4 +1,5 @@ ; inherits: html + [ (if_statement) (else_if_block) diff --git a/queries/svelte/highlights.scm b/queries/svelte/highlights.scm index 0746879e0..961a8ed5b 100644 --- a/queries/svelte/highlights.scm +++ b/queries/svelte/highlights.scm @@ -1,4 +1,5 @@ ; inherits: html + (raw_text) @none [ diff --git a/queries/svelte/indents.scm b/queries/svelte/indents.scm index 8e6124d75..0c67647d7 100644 --- a/queries/svelte/indents.scm +++ b/queries/svelte/indents.scm @@ -1,4 +1,5 @@ ; inherits: html + [ (if_statement) (each_statement) diff --git a/queries/svelte/injections.scm b/queries/svelte/injections.scm index a101fe668..d17849446 100644 --- a/queries/svelte/injections.scm +++ b/queries/svelte/injections.scm @@ -1,4 +1,5 @@ ; inherits: html_tags + ((style_element (start_tag (attribute diff --git a/queries/templ/highlights.scm b/queries/templ/highlights.scm index 628b5bf15..e24dbeba8 100644 --- a/queries/templ/highlights.scm +++ b/queries/templ/highlights.scm @@ -1,4 +1,5 @@ ; inherits: go + (component_declaration name: (component_identifier) @function) diff --git a/queries/templ/injections.scm b/queries/templ/injections.scm index df87ddc97..b9cf5a06a 100644 --- a/queries/templ/injections.scm +++ b/queries/templ/injections.scm @@ -1,4 +1,5 @@ ; inherits: go + ((element_comment) @injection.content (#set! injection.language "comment")) diff --git a/queries/terraform/highlights.scm b/queries/terraform/highlights.scm index 4050ce77a..1655af31d 100644 --- a/queries/terraform/highlights.scm +++ b/queries/terraform/highlights.scm @@ -1,4 +1,5 @@ ; inherits: hcl + ; Terraform specific references ; ; diff --git a/queries/typescript/folds.scm b/queries/typescript/folds.scm index 006ba857a..df0b8942a 100644 --- a/queries/typescript/folds.scm +++ b/queries/typescript/folds.scm @@ -1,4 +1,5 @@ ; inherits: ecma + [ (interface_declaration) (internal_module) diff --git a/queries/typescript/highlights.scm b/queries/typescript/highlights.scm index ce1fa886a..961ec99ec 100644 --- a/queries/typescript/highlights.scm +++ b/queries/typescript/highlights.scm @@ -1,4 +1,5 @@ ; inherits: ecma + "require" @keyword.import (import_require_clause diff --git a/queries/typescript/indents.scm b/queries/typescript/indents.scm index 23222051c..9a269ba75 100644 --- a/queries/typescript/indents.scm +++ b/queries/typescript/indents.scm @@ -1,4 +1,5 @@ ; inherits: ecma + [ (enum_declaration) (interface_declaration) diff --git a/queries/typescript/locals.scm b/queries/typescript/locals.scm index f1928484a..b89d9a0c0 100644 --- a/queries/typescript/locals.scm +++ b/queries/typescript/locals.scm @@ -1,4 +1,5 @@ ; inherits: ecma + (required_parameter (identifier) @local.definition) diff --git a/queries/vue/highlights.scm b/queries/vue/highlights.scm index 066586459..410dd0fff 100644 --- a/queries/vue/highlights.scm +++ b/queries/vue/highlights.scm @@ -1,4 +1,5 @@ ; inherits: html_tags + [ (directive_dynamic_argument) (directive_dynamic_argument_value) diff --git a/queries/vue/indents.scm b/queries/vue/indents.scm index 8c8091ab5..6b377f323 100644 --- a/queries/vue/indents.scm +++ b/queries/vue/indents.scm @@ -1,4 +1,5 @@ ; inherits: html_tags + (template_element) @indent.begin (template_element diff --git a/queries/xml/highlights.scm b/queries/xml/highlights.scm index 7881e0df0..4585d2ae3 100644 --- a/queries/xml/highlights.scm +++ b/queries/xml/highlights.scm @@ -1,4 +1,5 @@ ; inherits: dtd + ; XML declaration (XMLDecl "standalone" @tag.attribute) diff --git a/scripts/format-queries.lua b/scripts/format-queries.lua index ec2197956..1bc7532b8 100755 --- a/scripts/format-queries.lua +++ b/scripts/format-queries.lua @@ -61,6 +61,19 @@ local format_queries = [[ (comment) @format.prepend-newline (#not-is-start-of-line? @_comment) (#is-start-of-line? @format.prepend-newline)) +; Extra newline for modelines +(program + (comment) @_modeline + . + (_) @format.prepend-newline + (#is-start-of-line? @_modeline) + (#contains? @_modeline "^;+%s*inherits:")) +(program + (comment) @_modeline + . + (_) @format.prepend-newline + (#is-start-of-line? @_modeline) + (#contains? @_modeline "^;+%s*extends%s*$")) ;; }}} ;; Making sure all top-level patterns are separated (program @@ -88,7 +101,9 @@ local format_queries = [[ (field_definition) (comment) ] @format.cancel-prepend - (#is-start-of-line? @_comment)) + (#is-start-of-line? @_comment) + (#not-lua-match? @_comment "^;+%s*inherits:") + (#not-lua-match? @_comment "^;+%s*extends%s*$")) ;; }}} ;; delims |
