diff options
| author | Pham Huy Hoang <hoangtun0810@gmail.com> | 2024-01-06 15:05:50 +0900 |
|---|---|---|
| committer | Christian Clason <c.clason@uni-graz.at> | 2024-01-19 16:58:37 +0100 |
| commit | 57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9 (patch) | |
| tree | 70bf645539882b88e6fa129cefd30986b89bbac3 /queries/hare | |
| parent | ci: add query lint job (diff) | |
| download | nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.gz nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.bz2 nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.lz nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.xz nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.zst nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.zip | |
chore: query formatting
Diffstat (limited to 'queries/hare')
| -rw-r--r-- | queries/hare/folds.scm | 3 | ||||
| -rw-r--r-- | queries/hare/highlights.scm | 114 | ||||
| -rw-r--r-- | queries/hare/indents.scm | 20 | ||||
| -rw-r--r-- | queries/hare/injections.scm | 18 | ||||
| -rw-r--r-- | queries/hare/locals.scm | 44 |
5 files changed, 123 insertions, 76 deletions
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 + ","?) |
