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/v | |
| 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/v')
| -rw-r--r-- | queries/v/folds.scm | 14 | ||||
| -rw-r--r-- | queries/v/highlights.scm | 272 | ||||
| -rw-r--r-- | queries/v/indents.scm | 25 | ||||
| -rw-r--r-- | queries/v/injections.scm | 27 | ||||
| -rw-r--r-- | queries/v/locals.scm | 33 |
5 files changed, 97 insertions, 274 deletions
diff --git a/queries/v/folds.scm b/queries/v/folds.scm index 8bed31c52..952b6bbe9 100644 --- a/queries/v/folds.scm +++ b/queries/v/folds.scm @@ -1,6 +1,8 @@ -[(function_declaration) - (const_declaration) - (type_declaration) - (import_declaration) - (if_expression) - (struct_declaration)] @fold +[ + (function_declaration) + (const_declaration) + (type_declaration) + (import_declaration) + (if_expression) + (struct_declaration) +] @fold diff --git a/queries/v/highlights.scm b/queries/v/highlights.scm index 221b05028..821aef6be 100644 --- a/queries/v/highlights.scm +++ b/queries/v/highlights.scm @@ -1,12 +1,10 @@ ; Includes - [ "import" "module" ] @keyword.import ; Keywords - [ "asm" "assert" @@ -71,30 +69,29 @@ ] @keyword.coroutine ; Variables - (identifier) @variable ; Namespace - (module_clause - (identifier) @module) + (identifier) @module) (import_path - (import_name) @module) + (import_name) @module) (import_alias - (import_name) @module) + (import_name) @module) ; Literals - -[ (true) (false) ] @boolean +[ + (true) + (false) +] @boolean (interpreted_string_literal) @string (string_interpolation) @none ; Types - (struct_declaration name: (identifier) @type) @@ -107,15 +104,17 @@ (type_declaration name: (identifier) @type) -(type_reference_expression (identifier) @type) +(type_reference_expression + (identifier) @type) ; Labels - (label_reference) @label ; Fields - -(selector_expression field: (reference_expression (identifier) @variable.member)) +(selector_expression + field: + (reference_expression + (identifier) @variable.member)) (field_name) @variable.member @@ -123,7 +122,6 @@ name: (identifier) @variable.member) ; Parameters - (parameter_declaration name: (identifier) @variable.parameter) @@ -131,7 +129,6 @@ name: (identifier) @variable.parameter) ; Constants - ((identifier) @constant (#has-ancestor? @constant compile_time_if_expression)) @@ -148,11 +145,9 @@ (#any-of? @variable.builtin "err" "macos" "linux" "windows")) ; Attributes - (attribute) @attribute ; Functions - (function_declaration name: (identifier) @function) @@ -161,242 +156,38 @@ name: (identifier) @function.method) (call_expression - name: (selector_expression - field: (reference_expression) @function.method.call)) + name: + (selector_expression + field: (reference_expression) @function.method.call)) (call_expression - name: (reference_expression) @function.call) + name: (reference_expression) @function.call) ((identifier) @function.builtin - (#any-of? @function.builtin - "eprint" - "eprintln" - "error" - "exit" - "panic" - "print" - "println" - "after" - "after_char" - "all" - "all_after" - "all_after_last" - "all_before" - "all_before_last" - "any" - "ascii_str" - "before" - "bool" - "byte" - "byterune" - "bytes" - "bytestr" - "c_error_number_str" - "capitalize" - "clear" - "clone" - "clone_to_depth" - "close" - "code" - "compare" - "compare_strings" - "contains" - "contains_any" - "contains_any_substr" - "copy" - "count" - "cstring_to_vstring" - "delete" - "delete_last" - "delete_many" - "ends_with" - "eprint" - "eprintln" - "eq_epsilon" - "error" - "error_with_code" - "exit" - "f32" - "f32_abs" - "f32_max" - "f32_min" - "f64" - "f64_max" - "fields" - "filter" - "find_between" - "first" - "flush_stderr" - "flush_stdout" - "free" - "gc_check_leaks" - "get_str_intp_u32_format" - "get_str_intp_u64_format" - "grow_cap" - "grow_len" - "hash" - "hex" - "hex2" - "hex_full" - "i16" - "i64" - "i8" - "index" - "index_after" - "index_any" - "index_byte" - "insert" - "int" - "is_alnum" - "is_bin_digit" - "is_capital" - "is_digit" - "is_hex_digit" - "is_letter" - "is_lower" - "is_oct_digit" - "is_space" - "is_title" - "is_upper" - "isnil" - "join" - "join_lines" - "keys" - "last" - "last_index" - "last_index_byte" - "length_in_bytes" - "limit" - "malloc" - "malloc_noscan" - "map" - "match_glob" - "memdup" - "memdup_noscan" - "move" - "msg" - "panic" - "panic_error_number" - "panic_lasterr" - "panic_optional_not_set" - "parse_int" - "parse_uint" - "pointers" - "pop" - "prepend" - "print" - "print_backtrace" - "println" - "proc_pidpath" - "ptr_str" - "push_many" - "realloc_data" - "reduce" - "repeat" - "repeat_to_depth" - "replace" - "replace_each" - "replace_once" - "reverse" - "reverse_in_place" - "runes" - "sort" - "sort_by_len" - "sort_ignore_case" - "sort_with_compare" - "split" - "split_any" - "split_into_lines" - "split_nth" - "starts_with" - "starts_with_capital" - "str" - "str_escaped" - "str_intp" - "str_intp_g32" - "str_intp_g64" - "str_intp_rune" - "str_intp_sq" - "str_intp_sub" - "strg" - "string_from_wide" - "string_from_wide2" - "strip_margin" - "strip_margin_custom" - "strlong" - "strsci" - "substr" - "substr_ni" - "substr_with_check" - "title" - "to_lower" - "to_upper" - "to_wide" - "tos" - "tos2" - "tos3" - "tos4" - "tos5" - "tos_clone" - "trim" - "trim_left" - "trim_pr" - "try_pop" - "try_push" - "utf32_decode_to_buffer" - "utf32_to_str" - "utf32_to_str_no_malloc" - "utf8_char_len" - "utf8_getchar" - "utf8_str_len" - "utf8_str_visible_length" - "utf8_to_utf32" - "v_realloc" - "vbytes" - "vcalloc" - "vcalloc_noscan" - "vmemcmp" - "vmemcpy" - "vmemmove" - "vmemset" - "vstring" - "vstring_literal" - "vstring_literal_with_len" - "vstring_with_len" - "vstrlen" - "vstrlen_char" - "winapi_lasterr_str")) - + (#any-of? @function.builtin "eprint" "eprintln" "error" "exit" "panic" "print" "println" "after" "after_char" "all" "all_after" "all_after_last" "all_before" "all_before_last" "any" "ascii_str" "before" "bool" "byte" "byterune" "bytes" "bytestr" "c_error_number_str" "capitalize" "clear" "clone" "clone_to_depth" "close" "code" "compare" "compare_strings" "contains" "contains_any" "contains_any_substr" "copy" "count" "cstring_to_vstring" "delete" "delete_last" "delete_many" "ends_with" "eprint" "eprintln" "eq_epsilon" "error" "error_with_code" "exit" "f32" "f32_abs" "f32_max" "f32_min" "f64" "f64_max" "fields" "filter" "find_between" "first" "flush_stderr" "flush_stdout" "free" "gc_check_leaks" "get_str_intp_u32_format" "get_str_intp_u64_format" "grow_cap" "grow_len" "hash" "hex" "hex2" "hex_full" "i16" "i64" "i8" "index" "index_after" "index_any" "index_byte" "insert" "int" "is_alnum" "is_bin_digit" "is_capital" "is_digit" "is_hex_digit" "is_letter" "is_lower" "is_oct_digit" "is_space" "is_title" "is_upper" "isnil" "join" "join_lines" "keys" "last" "last_index" "last_index_byte" "length_in_bytes" "limit" "malloc" "malloc_noscan" "map" "match_glob" "memdup" "memdup_noscan" "move" "msg" "panic" "panic_error_number" "panic_lasterr" "panic_optional_not_set" "parse_int" "parse_uint" "pointers" "pop" "prepend" "print" "print_backtrace" "println" "proc_pidpath" "ptr_str" "push_many" "realloc_data" "reduce" "repeat" "repeat_to_depth" "replace" "replace_each" "replace_once" "reverse" "reverse_in_place" "runes" "sort" "sort_by_len" "sort_ignore_case" "sort_with_compare" "split" "split_any" "split_into_lines" "split_nth" "starts_with" "starts_with_capital" "str" "str_escaped" "str_intp" "str_intp_g32" "str_intp_g64" "str_intp_rune" "str_intp_sq" "str_intp_sub" "strg" "string_from_wide" "string_from_wide2" "strip_margin" "strip_margin_custom" "strlong" "strsci" "substr" "substr_ni" "substr_with_check" "title" "to_lower" "to_upper" "to_wide" "tos" "tos2" "tos3" "tos4" "tos5" "tos_clone" "trim" "trim_left" "trim_pr" "try_pop" "try_push" "utf32_decode_to_buffer" "utf32_to_str" "utf32_to_str_no_malloc" "utf8_char_len" "utf8_getchar" "utf8_str_len" "utf8_str_visible_length" "utf8_to_utf32" "v_realloc" "vbytes" "vcalloc" "vcalloc_noscan" "vmemcmp" "vmemcpy" "vmemmove" "vmemset" "vstring" "vstring_literal" "vstring_literal_with_len" "vstring_with_len" "vstrlen" "vstrlen_char" "winapi_lasterr_str")) ; Operators - [ "++" "--" - "+" "-" "*" "/" "%" - "~" "&" "|" "^" - "!" "&&" "||" "!=" - "<<" ">>" - "<" ">" "<=" ">=" - "+=" "-=" "*=" @@ -406,11 +197,9 @@ "^=" "<<=" ">>=" - "=" ":=" "==" - "?" "<-" "$" @@ -419,13 +208,23 @@ ] @operator ; Punctuation +[ + "." + "," + ":" + ";" +] @punctuation.delimiter -[ "." "," ":" ";" ] @punctuation.delimiter - -[ "(" ")" "{" "}" "[" "]" ] @punctuation.bracket +[ + "(" + ")" + "{" + "}" + "[" + "]" +] @punctuation.bracket ; Literals - (int_literal) @number (float_literal) @number.float @@ -455,9 +254,12 @@ (none) @variable.builtin ; Comments - (comment) @comment @spell (_ (comment)+ @comment.documentation - [(function_declaration) (type_declaration) (enum_declaration)]) + [ + (function_declaration) + (type_declaration) + (enum_declaration) + ]) diff --git a/queries/v/indents.scm b/queries/v/indents.scm index a806b35ed..752585127 100644 --- a/queries/v/indents.scm +++ b/queries/v/indents.scm @@ -1,16 +1,17 @@ -[(import_declaration) - (const_declaration) - (type_declaration) - (type_initializer) - (block) - (map_init_expression) - (call_expression) - (parameter_list)] -@indent.begin +[ + (import_declaration) + (const_declaration) + (type_declaration) + (type_initializer) + (block) + (map_init_expression) + (call_expression) + (parameter_list) +] @indent.begin -[ "}"] -@indent.branch +"}" @indent.branch -(parameter_list ")" @indent.branch) +(parameter_list + ")" @indent.branch) (comment) @indent.ignore diff --git a/queries/v/injections.scm b/queries/v/injections.scm index 9fa581377..f7c0f6608 100644 --- a/queries/v/injections.scm +++ b/queries/v/injections.scm @@ -1,17 +1,22 @@ ((comment) @injection.content - (#set! injection.language "comment")) -;; asm_statement if asm ever highlighted :) - -;; #include <...> + (#set! injection.language "comment")) +; asm_statement if asm ever highlighted :) +; #include <...> ((hash_statement) @injection.content - (#set! injection.language "c")) + (#set! injection.language "c")) -;; regex for the methods defined in `re` module +; regex for the methods defined in `re` module ((call_expression - name: (selector_expression - field: (reference_expression (identifier) @_re)) - arguments: (argument_list - (argument (literal (raw_string_literal) @injection.content - (#offset! @injection.content 0 2 0 -1))))) + name: + (selector_expression + field: + (reference_expression + (identifier) @_re)) + arguments: + (argument_list + (argument + (literal + (raw_string_literal) @injection.content + (#offset! @injection.content 0 2 0 -1))))) (#any-of? @_re "regex_base" "regex_opt" "compile_opt") (#set! injection.language "regex")) diff --git a/queries/v/locals.scm b/queries/v/locals.scm index 03623a717..524483b8e 100644 --- a/queries/v/locals.scm +++ b/queries/v/locals.scm @@ -1,28 +1,41 @@ ((function_declaration - name: (identifier) @local.definition.function)) ;@function + name: (identifier) @local.definition.function)) ;@function (var_declaration - var_list: (expression_list - (reference_expression - (identifier) @local.definition.var))) + var_list: + (expression_list + (reference_expression + (identifier) @local.definition.var))) ((function_declaration name: (identifier) @local.definition.function)) -(const_declaration (const_definition name: (identifier) @local.definition.var)) +(const_declaration + (const_definition + name: (identifier) @local.definition.var)) (identifier) @local.reference -((call_expression name: (reference_expression (identifier)) @local.reference) - (#set! reference.kind "call")) +((call_expression + name: + (reference_expression + (identifier)) @local.reference) + (#set! reference.kind "call")) ((call_expression - name: (selector_expression - field: (reference_expression (identifier) @local.definition.function))) - (#set! reference.kind "call")) + name: + (selector_expression + field: + (reference_expression + (identifier) @local.definition.function))) + (#set! reference.kind "call")) (source_file) @local.scope + (function_declaration) @local.scope + (if_expression) @local.scope + (block) @local.scope + (for_statement) @local.scope |
