diff options
Diffstat (limited to 'runtime')
40 files changed, 823 insertions, 123 deletions
diff --git a/runtime/queries/angular/highlights.scm b/runtime/queries/angular/highlights.scm index ad192329a..d248d2e4c 100644 --- a/runtime/queries/angular/highlights.scm +++ b/runtime/queries/angular/highlights.scm @@ -28,6 +28,12 @@ (binding_name (identifier) @keyword) +(class_binding + [ + (identifier) + (class_name) + ] @keyword) + (event_binding (binding_name (identifier) @keyword)) diff --git a/runtime/queries/bash/indents.scm b/runtime/queries/bash/indents.scm new file mode 100644 index 000000000..c0a4bed47 --- /dev/null +++ b/runtime/queries/bash/indents.scm @@ -0,0 +1,32 @@ +[ + (if_statement) + (for_statement) + (while_statement) + (case_statement) + (function_definition) + (compound_statement) + (subshell) + (command_substitution) + (do_group) + (case_item) +] @indent.begin + +[ + "fi" + "done" + "esac" + "}" + ")" + "then" + "do" + (elif_clause) + (else_clause) +] @indent.branch + +[ + "fi" + "done" + "esac" + "}" + ")" +] @indent.end diff --git a/runtime/queries/bpftrace/highlights.scm b/runtime/queries/bpftrace/highlights.scm new file mode 100644 index 000000000..19e568515 --- /dev/null +++ b/runtime/queries/bpftrace/highlights.scm @@ -0,0 +1,229 @@ +; Comments +[ + (line_comment) + (block_comment) +] @comment @spell + +; String and numeric literals +(string_literal) @string + +(escape_sequence) @string.escape + +(integer_literal) @number + +(boolean_literal) @boolean + +; Variables +(identifier) @variable + +(args_keyword) @variable.builtin + +(argn_identifier) @variable.builtin + +(retval_identifier) @variable.builtin + +(scratch_variable) @variable + +(map_variable) @variable + +(script_parameter) @variable.parameter + +; Macro +(macro_definition + (identifier) @function.macro) + +; Probes +; fentry/fexit, kprobe/kretprobe, rawtracepoint +(probe + provider: (_) @type.builtin + module: (wildcard_identifier) @module + function: (wildcard_identifier) @property) + +(probe + provider: (_) @type.builtin + function: (wildcard_identifier) @property) + +; uprobe/uretprobe +(probe + provider: (uprobe_uretprobe_provider) @type.builtin + binary: (file_identifier) @string.special.path + function: (identifier) @property) + +; tracepoint +(probe + provider: (_) @type.builtin + subsys: (wildcard_identifier) @module + event: (wildcard_identifier) @property) + +; software/hardware +(probe + provider: (_) @type.builtin + event: (identifier_with_dash) @property + count: (integer_literal) @number) + +(probe + provider: (_) @type.builtin + event: (identifier_with_dash) @property) + +; bench/test +(probe + provider: (bench_test_provider) @type.builtin + function: (identifier) @property) + +; profile/interval +(probe + provider: (profile_interval_provider) @type.builtin + unit: (time_unit) @string.special + count: (integer_literal) @property) + +(probe + provider: (profile_interval_provider) @type.builtin + count: (integer_literal) @number) + +; iter +(probe + provider: (iter_provider) @type.builtin + object: (identifier) @module + pin: (file_identifier) @property) + +(probe + provider: (iter_provider) @type.builtin + object: (identifier) @module) + +; ustd +(probe + provider: (ustd_provider) @type.builtin + binary: (file_identifier) @string.special.path + namespace: (identifier) @variable + function: (identifier) @property) + +(probe + provider: (ustd_provider) @type.builtin + binary: (file_identifier) @string.special.path + function: (identifier) @property) + +; watchpoint/asyncwatchpoint +(probe + provider: (watchpoint_provider) @type.builtin + address: (integer_literal) @number + length: (integer_literal) @number + mode: (watchpoint_mode) @property) + +; Types +(type_specifier) @type + +(integer_type) @type.builtin + +[ + "BEGIN" + "begin" + "END" + "end" +] @type.builtin + +; Keywords +(hashbang) @keyword.directive + +(return_statement) @keyword.return + +[ + "config" + "let" + "macro" + "offsetof" + "sizeof" +] @keyword + +[ + "if" + "else" +] @keyword.conditional + +[ + "for" + "unroll" + "while" + (break_statement) + (continue_statement) +] @keyword.repeat + +"import" @keyword.import + +(field_expression + field: (identifier) @property) + +(call_expression + function: (identifier) @function.call) + +; Punctuations +[ + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket + +[ + "," + ";" + ":" + "." +] @punctuation.delimiter + +; Operators +[ + ; Field access + "->" + ; Range + ".." + ; Assignment + "=" + "<<=" + ">>=" + "+=" + "-=" + "*=" + "/=" + "%=" + "&=" + "|=" + "^=" + ; Update + "--" + "++" + ; Arithmetic + "%" + "+" + "-" + "*" + "/" + ; Relational + "<=" + "<" + ">=" + ">" + "==" + "!=" + ; Bitwise + "&" + "^" + "|" + "~" + "<<" + ">>" + ; Logical + "&&" + "||" + "!" +] @operator + +(conditional_expression + [ + "?" + ":" + ] @keyword.conditional.ternary) + +(predicate + "/" @punctuation.delimiter) diff --git a/runtime/queries/bpftrace/injections.scm b/runtime/queries/bpftrace/injections.scm new file mode 100644 index 000000000..8907d9f84 --- /dev/null +++ b/runtime/queries/bpftrace/injections.scm @@ -0,0 +1,12 @@ +([ + (c_struct) + (c_preproc) + (c_preproc_block) +] @injection.content + (#set! injection.language "c")) + +([ + (line_comment) + (block_comment) +] @injection.content + (#set! injection.language "comment")) diff --git a/runtime/queries/c3/highlights.scm b/runtime/queries/c3/highlights.scm index 1f02496b8..f2aa46dea 100644 --- a/runtime/queries/c3/highlights.scm +++ b/runtime/queries/c3/highlights.scm @@ -106,6 +106,7 @@ "$if" "$include" "$is_const" + "$kindof" "$nameof" "$offsetof" "$qnameof" @@ -218,6 +219,8 @@ "&&&" "+++" "|||" + "???" + "+++=" ] @operator (range_expr @@ -232,6 +235,7 @@ (ternary_expr [ "?" + "???" ":" ] @keyword.conditional.ternary) @@ -268,8 +272,8 @@ (#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"))) + "kindof" "names" "nameof" "params" "paramsof" "parentof" "qnameof" "returns" "sizeof" "set" + "tagof" "has_tagof" "values" "typeid"))) ; Label [ @@ -285,7 +289,7 @@ (path_ident (ident) @module)) -(import_declaration +(import_path (path_ident (ident) @module)) @@ -298,6 +302,9 @@ (call_inline_attributes (at_ident) @attribute) +(type_suffix + (at_ident) @attribute) + (asm_block_stmt (at_ident) @attribute) diff --git a/runtime/queries/c_sharp/highlights.scm b/runtime/queries/c_sharp/highlights.scm index 0c9489506..75aa3f847 100644 --- a/runtime/queries/c_sharp/highlights.scm +++ b/runtime/queries/c_sharp/highlights.scm @@ -327,6 +327,9 @@ (lambda_expression type: (identifier) @type) +(lambda_expression + (modifier) @keyword.modifier) + (as_expression right: (identifier) @type) diff --git a/runtime/queries/ecma/injections.scm b/runtime/queries/ecma/injections.scm index 669c75671..69afb6d41 100644 --- a/runtime/queries/ecma/injections.scm +++ b/runtime/queries/ecma/injections.scm @@ -59,10 +59,15 @@ (#set! injection.include-children) (#set! injection.language "groq")) +; gql`...` or gql(`...`) (call_expression function: (identifier) @_name (#eq? @_name "gql") - arguments: (template_string) @injection.content + arguments: [ + (arguments + (template_string) @injection.content) + (template_string) @injection.content + ] (#offset! @injection.content 0 1 0 -1) (#set! injection.include-children) (#set! injection.language "graphql")) diff --git a/runtime/queries/ecma/locals.scm b/runtime/queries/ecma/locals.scm index adc58531d..97570e44a 100644 --- a/runtime/queries/ecma/locals.scm +++ b/runtime/queries/ecma/locals.scm @@ -25,6 +25,11 @@ name: (object_pattern (shorthand_property_identifier_pattern) @local.definition.var)) +(variable_declarator + (object_pattern + (pair_pattern + (identifier) @local.definition.var))) + (import_specifier (identifier) @local.definition.import) diff --git a/runtime/queries/editorconfig/highlights.scm b/runtime/queries/editorconfig/highlights.scm index feb0a524c..a1d686b36 100644 --- a/runtime/queries/editorconfig/highlights.scm +++ b/runtime/queries/editorconfig/highlights.scm @@ -1,14 +1,19 @@ (comment) @comment @spell -(section - (section_name) @string.special.path) +(property) @property -(character_choice - (character) @constant) +(string) @string -(character_range - start: (character) @constant - end: (character) @constant) +(header + (glob) @string.special.path) + +(character) @character + +(character_escape) @string.escape + +(wildcard) @character.special + +(integer) @number [ "[" @@ -20,36 +25,11 @@ [ "," ".." - (path_separator) + "/" + "-" ] @punctuation.delimiter [ - "-" "=" - (negation) + "!" ] @operator - -[ - (wildcard_characters) - (wildcard_any_characters) - (wildcard_single_character) -] @character.special - -(escaped_character) @string.escape - -(pair - key: (identifier) @property - value: (_) @string) - -(boolean) @boolean - -(integer) @number - -(unset) @constant.builtin - -[ - (spelling_language) - (indent_style) - (end_of_line) - (charset) -] @string.special diff --git a/runtime/queries/fish/highlights.scm b/runtime/queries/fish/highlights.scm index 549bceda0..da5c52a32 100644 --- a/runtime/queries/fish/highlights.scm +++ b/runtime/queries/fish/highlights.scm @@ -112,15 +112,16 @@ (command name: (word) @function.call) -; derived from builtin -n (fish 3.2.2) +; derived from builtin -n (fish 4.3.3) (command name: [ (word) @function.builtin (#any-of? @function.builtin "." ":" "_" "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") + "exit" "fg" "fish_indent" "fish_key_reader" "functions" "history" "isatty" "jobs" "math" + "path" "printf" "pwd" "random" "read" "realpath" "set" "set_color" "source" "status" "string" + "test" "time" "type" "ulimit" "wait") ]) ; Functions @@ -163,15 +164,15 @@ ; Reference: https://fishshell.com/docs/current/language.html#special-variables ((variable_name) @variable.builtin (#any-of? @variable.builtin - "PATH" "CDPATH" "LANG" "LC_ALL" "LC_COLLATE" "LC_CTYPE" "LC_MESSAGES" "LC_MONETARY" "LC_NUMERIC" - "LC_TIME" "fish_color_normal" "fish_color_command" "fish_color_keyword" "fish_color_keyword" - "fish_color_redirection" "fish_color_end" "fish_color_error" "fish_color_param" - "fish_color_valid_path" "fish_color_option" "fish_color_comment" "fish_color_selection" - "fish_color_operator" "fish_color_escape" "fish_color_autosuggestion" "fish_color_cwd" - "fish_color_cwd_root" "fish_color_user" "fish_color_host" "fish_color_host_remote" - "fish_color_status" "fish_color_cancel" "fish_color_search_match" "fish_color_history_current" - "fish_pager_color_progress" "fish_pager_color_background" "fish_pager_color_prefix" - "fish_pager_color_completion" "fish_pager_color_description" + "PATH" "CDPATH" "LANG" "LANGUAGE" "LC_ALL" "LC_COLLATE" "LC_CTYPE" "LC_MESSAGES" "LC_MONETARY" + "LC_NUMERIC" "LC_TIME" "fish_color_normal" "fish_color_command" "fish_color_keyword" + "fish_color_keyword" "fish_color_redirection" "fish_color_end" "fish_color_error" + "fish_color_param" "fish_color_valid_path" "fish_color_option" "fish_color_comment" + "fish_color_selection" "fish_color_operator" "fish_color_escape" "fish_color_autosuggestion" + "fish_color_cwd" "fish_color_cwd_root" "fish_color_user" "fish_color_host" + "fish_color_host_remote" "fish_color_status" "fish_color_cancel" "fish_color_search_match" + "fish_color_history_current" "fish_pager_color_progress" "fish_pager_color_background" + "fish_pager_color_prefix" "fish_pager_color_completion" "fish_pager_color_description" "fish_pager_color_selected_background" "fish_pager_color_selected_prefix" "fish_pager_color_selected_completion" "fish_pager_color_selected_description" "fish_pager_color_secondary_background" "fish_pager_color_secondary_prefix" @@ -183,8 +184,8 @@ "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")) + "fish_terminal_color_theme" "history" "HOME" "hostname" "IFS" "last_pid" "PWD" "pipestatus" + "SHLVL" "status" "status_generation" "TERM" "USER" "EUID" "version" "FISH_VERSION")) ; Nodes [ diff --git a/runtime/queries/glimmer/injections.scm b/runtime/queries/glimmer/injections.scm index 30b438682..9efa71f5e 100644 --- a/runtime/queries/glimmer/injections.scm +++ b/runtime/queries/glimmer/injections.scm @@ -3,19 +3,12 @@ (#set! injection.language "comment")) ; <style> tags -((element_node - (element_node_start - (tag_name) @_tag_name - (#eq? @_tag_name "style"))) @injection.content - (#offset! @injection.content 0 7 0 -8) - (#set! injection.language "css") - (#set! injection.include-children)) +((style_element + (raw_text) @injection.content) + (#set! injection.language "css")) ; <script> tags -((element_node - (element_node_start - (tag_name) @_tag_name - (#eq? @_tag_name "script"))) @injection.content - (#offset! @injection.content 0 8 0 -9) - (#set! injection.language "glimmer_javascript") +((script_element + (raw_text) @injection.content) + (#set! injection.language "javascript") (#set! injection.include-children)) diff --git a/runtime/queries/glimmer_typescript/indents.scm b/runtime/queries/glimmer_typescript/indents.scm index 237254d4c..ec026473f 100644 --- a/runtime/queries/glimmer_typescript/indents.scm +++ b/runtime/queries/glimmer_typescript/indents.scm @@ -1,3 +1,5 @@ +; inherits: typescript + (glimmer_opening_tag) @indent.begin (glimmer_closing_tag) @indent.end diff --git a/runtime/queries/haskell/highlights.scm b/runtime/queries/haskell/highlights.scm index de0eaf0a1..d0fdc17f6 100644 --- a/runtime/queries/haskell/highlights.scm +++ b/runtime/queries/haskell/highlights.scm @@ -9,7 +9,8 @@ (_) @variable.parameter)) (expression/lambda - (_)+ @variable.parameter + patterns: (patterns + (_) @variable.parameter) "->") (decl/function @@ -226,7 +227,8 @@ (qualified ((module) @module (variable) @function.call)) - ]) + ] + operator: (operator)) ; infix operators applied to variables ((expression/variable) @variable @@ -245,7 +247,7 @@ (function (infix left_operand: [ - (variable) @variable + (variable) @variable.parameter (qualified ((module) @module (variable) @variable)) diff --git a/runtime/queries/html_tags/highlights.scm b/runtime/queries/html_tags/highlights.scm index 9eaf813be..94a338aa7 100644 --- a/runtime/queries/html_tags/highlights.scm +++ b/runtime/queries/html_tags/highlights.scm @@ -1,9 +1,11 @@ -(tag_name) @tag +(tag_name) @tag @nospell ; (erroneous_end_tag_name) @error ; we do not lint syntax errors (comment) @comment @spell -(attribute_name) @tag.attribute +(attribute_name) @tag.attribute @nospell + +(attribute_value) @nospell ((attribute (quoted_attribute_value) @string) diff --git a/runtime/queries/kos/folds.scm b/runtime/queries/kos/folds.scm new file mode 100644 index 000000000..ca51a5406 --- /dev/null +++ b/runtime/queries/kos/folds.scm @@ -0,0 +1,19 @@ +[ + (function_decl) + (constructor_literal) + (function_literal) + (class_decl) + (class_literal) + (do_statement) + (if_statement) + (try_statement) + (defer_statement) + (with_statement) + (switch_statement) + (switch_case) + (default_case) + (loop_statement) + (repeat_statement) + (while_statement) + (for_statement) +] @fold diff --git a/runtime/queries/kos/highlights.scm b/runtime/queries/kos/highlights.scm new file mode 100644 index 000000000..07757d2e3 --- /dev/null +++ b/runtime/queries/kos/highlights.scm @@ -0,0 +1,156 @@ +(hash_bang) @keyword.directive + +(comment) @comment @spell + +(number) @number + +(float_number) @number.float + +(identifier) @variable + +(parameter + parameter: (identifier) @variable.parameter) + +(property_identifier) @property + +[ + (string_literal) + (string_literal_begin) + (string_literal_continuation) + (string_literal_end) +] @string + +[ + "case" + "default" + "else" + "if" + "switch" +] @keyword.conditional + +"import" @keyword.import + +[ + (break_statement) + (continue_statement) + "for" + "loop" + "repeat" + "while" +] @keyword.repeat + +(for_statement + "in" @keyword.repeat) + +"class" @keyword.type + +[ + "return" + "yield" +] @keyword.return + +[ + "catch" + "defer" + "throw" + "try" +] @keyword.exception + +[ + "constructor" + "fun" + "=>" +] @keyword.function + +"_" @character.special + +[ + (line) + "assert" + ;"async" + "const" + "do" + "extends" + (fallthrough_statement) + ;"get" + ;"match" + "public" + ;"set" + ;"static" + "var" + "with" +] @keyword + +[ + (this) + (super) +] @variable.builtin + +[ + (false) + (true) +] @boolean + +(void) @constant.builtin + +[ + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket + +(string_literal_begin + "\\(" @punctuation.special) + +(string_literal_continuation + "\\(" @punctuation.special) + +(formatted_string + ")" @punctuation.special) + +[ + ";" + ":" + "." + "," +] @punctuation.delimiter + +[ + (arithmetic_assignment_operator) + (comparison_operator) + (bitwise_operator) + (additive_operator) + (multiplicative_operator) + (logical_operator) + (unary_operator) + "->" + "..." + "=" + "?" +] @operator + +(conditional_expression + [ + "?" + ":" + ] @keyword.conditional.ternary) + +(class_member + (function_decl + name: (identifier) @function.method)) + +(function_decl + name: (identifier) @function) + +(class_decl + name: (identifier) @type) + +(invocation + (identifier) @function.call) + +(invocation + (refinement + property: (property_identifier) @function.method.call)) diff --git a/runtime/queries/kos/injections.scm b/runtime/queries/kos/injections.scm new file mode 100644 index 000000000..2677f272b --- /dev/null +++ b/runtime/queries/kos/injections.scm @@ -0,0 +1,6 @@ +(((comment) @_jsdoc_comment + (#lua-match? @_jsdoc_comment "^/[*][*][^*].*[*]/$")) @injection.content + (#set! injection.language "jsdoc")) + +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/runtime/queries/kos/locals.scm b/runtime/queries/kos/locals.scm new file mode 100644 index 000000000..37f14f4e6 --- /dev/null +++ b/runtime/queries/kos/locals.scm @@ -0,0 +1,41 @@ +; Scopes +;------- +(compound_statement) @local.scope + +(for_statement) @local.scope + +(function_decl) @local.scope + +(constructor_literal) @local.scope + +(function_literal) @local.scope + +(with_statement) @local.scope + +(catch_clause) @local.scope + +; Definitions +;------------ +(variable_decl + variable: (identifier) @local.definition.var) + +(parameter + parameter: (identifier) @local.definition.parameter) + +(import + module: (identifier) @local.definition.import) + +(import + symbol: (identifier) @local.definition.import) + +(function_decl + name: (identifier) @local.definition.function + (#set! definition.var.scope parent)) + +(class_decl + name: (identifier) @local.definition.type + (#set! definition.var.scope parent)) + +; References +;------------ +(identifier) @local.reference diff --git a/runtime/queries/kotlin/highlights.scm b/runtime/queries/kotlin/highlights.scm index 8eda6ef61..a45ab23d5 100644 --- a/runtime/queries/kotlin/highlights.scm +++ b/runtime/queries/kotlin/highlights.scm @@ -153,7 +153,7 @@ "charArrayOf" "emptyArray" "mapOf" "setOf" "listOf" "emptyMap" "emptySet" "emptyList" "mutableMapOf" "mutableSetOf" "mutableListOf" "print" "println" "error" "TODO" "run" "runCatching" "repeat" "lazy" "lazyOf" "enumValues" "enumValueOf" "assert" "check" - "checkNotNull" "require" "requireNotNull" "with" "suspend" "synchronized")) + "checkNotNull" "require" "requireNotNull" "with" "synchronized")) ; Literals [ @@ -343,12 +343,11 @@ "?:" "!!" "is" - "!is" "in" - "!in" "as" "as?" ".." + "..<" "->" ] @operator diff --git a/runtime/queries/lua/highlights.scm b/runtime/queries/lua/highlights.scm index 6e33a955c..0bfdda4e5 100644 --- a/runtime/queries/lua/highlights.scm +++ b/runtime/queries/lua/highlights.scm @@ -76,6 +76,8 @@ (unary_expression operator: _ @operator) +"=" @operator + [ "and" "not" diff --git a/runtime/queries/lua/injections.scm b/runtime/queries/lua/injections.scm index e76745f4f..8f371c9ed 100644 --- a/runtime/queries/lua/injections.scm +++ b/runtime/queries/lua/injections.scm @@ -34,10 +34,10 @@ (_) . (string - content: _ @_method) + content: (_) @_method) . (string - content: _ @injection.content))) + content: (_) @injection.content))) (#any-of? @_vimcmd_identifier "vim.rpcrequest" "vim.rpcnotify") (#eq? @_method "nvim_exec_lua") (#set! injection.language "lua")) diff --git a/runtime/queries/make/highlights.scm b/runtime/queries/make/highlights.scm index 8d182c026..b4ef14cb1 100644 --- a/runtime/queries/make/highlights.scm +++ b/runtime/queries/make/highlights.scm @@ -167,6 +167,7 @@ "eval" "file" "value" + "let" ] @function.builtin) "\\" @punctuation.special diff --git a/runtime/queries/nickel/highlights.scm b/runtime/queries/nickel/highlights.scm index c5ebfe166..2f563e9f8 100644 --- a/runtime/queries/nickel/highlights.scm +++ b/runtime/queries/nickel/highlights.scm @@ -1,5 +1,8 @@ (comment) @comment @spell +(annot_atom + doc: (static_string) @spell) + [ "forall" "in" @@ -7,6 +10,10 @@ "default" "doc" "rec" + "optional" + "priority" + "force" + "not_exported" ] @keyword "fun" @keyword.function @@ -23,20 +30,54 @@ (types) @type -"Array" @type.builtin +[ + "Array" + "Number" + "Dyn" + "Bool" + "String" +] @type.builtin ; BUILTIN Constants (bool) @boolean "null" @constant.builtin +(enum_tag) @constant + (num_literal) @number -(infix_op) @operator +[ + (infix_op) + "|>" + "=" + "&" + "&&" + "||" + "==" + "+" + "-" + "*" + "/" + "%" + "!" + "?" + "!=" + "<" + "<=" + ">" + ">=" + "@" + ".." + "=>" + "++" +] @operator + +"or" @keyword.operator (type_atom) @type -(enum_tag) @variable +(static_string) @string (chunk_literal_single) @string @@ -51,24 +92,60 @@ ")" "[|" "|]" + "[" + "]" ] @punctuation.bracket -(multstr_start) @punctuation.bracket - -(multstr_end) @punctuation.bracket +[ + "," + "." + ":" + ";" + "|" + "->" +] @punctuation.delimiter -(interpolation_start) @punctuation.bracket +(multstr_start) @string -(interpolation_end) @punctuation.bracket +(multstr_end) @string -(field_decl) @variable.member +[ + (interpolation_start) + (interpolation_end) +] @punctuation.special (builtin) @function.builtin +(builtin + "%" @function.builtin) + (fun_expr pats: (pattern_fun (ident) @variable.parameter)) +; application where the head terms is an identifier: function arg1 arg2 arg3 +(applicative + t1: (applicative + . + (record_operand + (atom + (ident))) @function)) + +; application where the head terms is a record field path: foo.bar.function arg1 arg2 arg3 (applicative t1: (applicative - (record_operand) @function)) + . + (record_operand + (record_operation_chain)) @function)) + +(str_chunks) @string + +(field_path_elem) @property + +(infix_expr + op: (infix_b_op_6) + t2: (infix_expr + (applicative + . + (record_operand + (record_operation_chain) @function)))) diff --git a/runtime/queries/nix/injections.scm b/runtime/queries/nix/injections.scm index 718a9c1c5..c1593b91f 100644 --- a/runtime/queries/nix/injections.scm +++ b/runtime/queries/nix/injections.scm @@ -48,7 +48,8 @@ ((string_fragment) @injection.content (#set! injection.language "bash"))) ] - (#lua-match? @_path "^%a+Phase$")) + (#lua-match? @_path "^%a+Phase$") + (#set! injection.combined)) (binding attrpath: (attrpath @@ -61,7 +62,8 @@ ((string_fragment) @injection.content (#set! injection.language "bash"))) ] - (#lua-match? @_path "^pre%a+$")) + (#lua-match? @_path "^pre%a+$") + (#set! injection.combined)) (binding attrpath: (attrpath @@ -74,7 +76,8 @@ ((string_fragment) @injection.content (#set! injection.language "bash"))) ] - (#lua-match? @_path "^post%a+$")) + (#lua-match? @_path "^post%a+$") + (#set! injection.combined)) (binding attrpath: (attrpath @@ -87,7 +90,8 @@ ((string_fragment) @injection.content (#set! injection.language "bash"))) ] - (#lua-match? @_path "^script$")) + (#lua-match? @_path "^script$") + (#set! injection.combined)) (apply_expression function: (_) @_func diff --git a/runtime/queries/proto/folds.scm b/runtime/queries/proto/folds.scm index 76f688b7d..87fe6d304 100644 --- a/runtime/queries/proto/folds.scm +++ b/runtime/queries/proto/folds.scm @@ -2,6 +2,8 @@ (enum) (message) (service) + (oneof) + (rpc) ] @fold (import)+ @fold diff --git a/runtime/queries/proto/highlights.scm b/runtime/queries/proto/highlights.scm index 894686dd4..22df9002f 100644 --- a/runtime/queries/proto/highlights.scm +++ b/runtime/queries/proto/highlights.scm @@ -11,6 +11,9 @@ (field_option (identifier) @property) +(enum_value_option + (identifier) @property) + (block_lit (identifier) @property) @@ -21,13 +24,17 @@ "option" "reserved" "syntax" + "edition" "to" + "max" ] @keyword [ "enum" + "group" "service" "message" + "map" ] @keyword.type "rpc" @keyword.function @@ -35,9 +42,14 @@ "returns" @keyword.return [ + "export" + "local" "optional" "repeated" "required" + "stream" + "weak" + "public" ] @keyword.modifier [ @@ -65,6 +77,8 @@ "\"proto2\"" ] @string.special +(escape_sequence) @string.escape + (int_lit) @number (float_lit) @number.float @@ -97,4 +111,8 @@ ":" ] @punctuation.delimiter -"=" @operator +[ + "=" + "-" + "+" +] @operator diff --git a/runtime/queries/robot/highlights.scm b/runtime/queries/robot/highlights.scm index a9c545b8a..ab30906c7 100644 --- a/runtime/queries/robot/highlights.scm +++ b/runtime/queries/robot/highlights.scm @@ -10,7 +10,13 @@ (test_case_setting) ] @keyword -(variable_definition +(scalar_variable + (variable_name) @variable) + +(list_variable + (variable_name) @variable) + +(dictionary_variable (variable_name) @variable) (keyword_definition diff --git a/runtime/queries/robots/highlights.scm b/runtime/queries/robots_txt/highlights.scm index a2c55c74f..a2c55c74f 100644 --- a/runtime/queries/robots/highlights.scm +++ b/runtime/queries/robots_txt/highlights.scm diff --git a/runtime/queries/robots/injections.scm b/runtime/queries/robots_txt/injections.scm index 2f0e58eb6..2f0e58eb6 100644 --- a/runtime/queries/robots/injections.scm +++ b/runtime/queries/robots_txt/injections.scm diff --git a/runtime/queries/ruby/highlights.scm b/runtime/queries/ruby/highlights.scm index 0472df092..5aa518a28 100644 --- a/runtime/queries/ruby/highlights.scm +++ b/runtime/queries/ruby/highlights.scm @@ -48,6 +48,9 @@ "then" ] @keyword.conditional +(in_clause + "in" @keyword.conditional) + (if "end" @keyword.conditional) @@ -61,6 +64,9 @@ "next" ] @keyword.repeat +(in + "in" @keyword.repeat) + (constant) @constant ((identifier) @keyword.modifier @@ -291,6 +297,9 @@ (pair ":" @punctuation.delimiter) +(keyword_pattern + ":" @punctuation.delimiter) + [ "(" ")" diff --git a/runtime/queries/rust/highlights.scm b/runtime/queries/rust/highlights.scm index de9d09684..2342dcfa3 100644 --- a/runtime/queries/rust/highlights.scm +++ b/runtime/queries/rust/highlights.scm @@ -476,9 +476,12 @@ [ (line_comment) (block_comment) +] @comment @spell + +[ (outer_doc_comment_marker) (inner_doc_comment_marker) -] @comment @spell +] @comment.documentation (line_comment (doc_comment)) @comment.documentation diff --git a/runtime/queries/rust/injections.scm b/runtime/queries/rust/injections.scm index 7bffd1fc9..b7d5b4bb6 100644 --- a/runtime/queries/rust/injections.scm +++ b/runtime/queries/rust/injections.scm @@ -5,7 +5,7 @@ (identifier) @_macro_name ] (token_tree) @injection.content - (#not-any-of? @_macro_name "slint" "html" "json") + (#not-any-of? @_macro_name "slint" "html" "json" "xml") (#set! injection.language "rust") (#set! injection.include-children)) @@ -16,7 +16,7 @@ (identifier) @injection.language ] (token_tree) @injection.content - (#any-of? @injection.language "slint" "html" "json") + (#any-of? @injection.language "slint" "html" "json" "xml") (#offset! @injection.content 0 1 0 -1) (#set! injection.include-children)) diff --git a/runtime/queries/supercollider/folds.scm b/runtime/queries/supercollider/folds.scm index 2f5f1043a..a62272b5c 100644 --- a/runtime/queries/supercollider/folds.scm +++ b/runtime/queries/supercollider/folds.scm @@ -2,5 +2,4 @@ (function_call) (code_block) (function_block) - (control_structure) ] @fold diff --git a/runtime/queries/supercollider/highlights.scm b/runtime/queries/supercollider/highlights.scm index c56bce69a..bef85ef45 100644 --- a/runtime/queries/supercollider/highlights.scm +++ b/runtime/queries/supercollider/highlights.scm @@ -1,6 +1,6 @@ ; highlights.scm ; See this for full list: https://github.com/nvim-treesitter/nvim-treesitter/blob/master/CONTRIBUTING.md -; comments +; Comments (line_comment) @comment @spell (block_comment) @comment @spell @@ -9,6 +9,12 @@ (argument name: (identifier) @variable.parameter) +"..." @variable.parameter ; variable argument + +; For function calls +(named_argument + name: (identifier) @variable.parameter) + ; Variables (local_var name: (identifier) @variable) @@ -18,31 +24,58 @@ (builtin_var) @constant.builtin -; (variable) @variable ; Functions (function_definition name: (variable) @function) -; For function calls -(named_argument - name: (identifier) @function.call) - ; Methods -(method_call - name: (method_name) @function.method.call) +(function_call + name: (_) @function.method.call) + +; Collections +(associative_item + (identifier) @property) ; Classes (class) @type +(parent_class) @type + +(instance_method_name) @function.method + +(class_method_name) @function.method + ; Literals +(bool) @boolean + (number) @number (float) @number.float (string) @string +(escape_sequence) @string.escape + (symbol) @string.special.symbol +; Conditionals +[ + "?" + "!?" + "??" +] @keyword.conditional + +((function_call + name: (_) @keyword.conditional) + (#any-of? @keyword.conditional "if" "while" "case" "switch" "try" "protect")) + +((function_call + name: (_) @keyword.repeat) + (#any-of? @keyword.repeat "for" "forBy")) + +; Duplication operator +"!" @keyword.repeat + ; Operators [ "&&" @@ -52,6 +85,8 @@ "^" "==" "!=" + "===" + "!==" "<" "<=" ">" @@ -64,6 +99,13 @@ "/" "%" "=" + "@" + "|@|" + "@@" + "@|@" + "++" + "+/+" + ".." ] @operator ; Keywords @@ -71,11 +113,13 @@ "arg" "classvar" "const" - ; "super" - ; "this" "var" ] @keyword +((local_var + name: (identifier) @variable.builtin) + (#any-of? @variable.builtin "this" "super")) + ; Brackets [ "(" @@ -92,12 +136,5 @@ ";" "." "," + ":" ] @punctuation.delimiter - -; control structure -(control_structure) @keyword.conditional - -(escape_sequence) @string.escape - -; SinOsc.ar()!2 -(duplicated_statement) @keyword.repeat diff --git a/runtime/queries/supercollider/indents.scm b/runtime/queries/supercollider/indents.scm index c0cffab3c..396721abf 100644 --- a/runtime/queries/supercollider/indents.scm +++ b/runtime/queries/supercollider/indents.scm @@ -12,21 +12,30 @@ (variable_definition) (variable_definition_sequence (variable_definition)) - (control_structure) (return_statement) ] @indent.begin [ (parameter_call_list - (argument_calls)) - "(" + (_)) ")" - "{" "}" - "[" "]" ] @indent.branch +; for auto-indent while typing +(ERROR + "{") @indent.begin + +(ERROR + "}") @indent.branch + +(ERROR + "[") @indent.begin + +(ERROR + "]") @indent.branch + [ (block_comment) (line_comment) diff --git a/runtime/queries/supercollider/locals.scm b/runtime/queries/supercollider/locals.scm index 066bbf9ab..b0a082131 100644 --- a/runtime/queries/supercollider/locals.scm +++ b/runtime/queries/supercollider/locals.scm @@ -3,7 +3,6 @@ (function_call) (code_block) (function_block) - (control_structure) ] @local.scope ; Definitions diff --git a/runtime/queries/typst/highlights.scm b/runtime/queries/typst/highlights.scm index a0dcc1b89..0ae538fe1 100644 --- a/runtime/queries/typst/highlights.scm +++ b/runtime/queries/typst/highlights.scm @@ -106,7 +106,17 @@ (emph) @markup.italic -(url) @markup.link.url +((url) @markup.link.url + (#set! @markup.link.url url @markup.link.url)) + +(call + item: (ident) @_link + (#eq? @_link "link") + (group + . + (string) @markup.link.url + (#offset! @markup.link.url 0 1 0 -1) + (#set! @markup.link.url url @markup.link.url))) ; code blocks (raw_span) @markup.raw diff --git a/runtime/queries/typst/indents.scm b/runtime/queries/typst/indents.scm index d43c586c1..424320fe4 100644 --- a/runtime/queries/typst/indents.scm +++ b/runtime/queries/typst/indents.scm @@ -3,10 +3,12 @@ (let) (show) (call) + (for) + (branch) ] @indent.begin [ "]" "}" ")" -] @indent.branch @indent.end +] @indent.end @indent.branch diff --git a/runtime/queries/usd/highlights.scm b/runtime/queries/usd/highlights.scm index d6c2a3668..98a7ff95c 100644 --- a/runtime/queries/usd/highlights.scm +++ b/runtime/queries/usd/highlights.scm @@ -52,12 +52,14 @@ "]" "{" "}" + "[]" ] @punctuation.bracket [ ":" ";" "." + "," ] @punctuation.delimiter "=" @operator diff --git a/runtime/queries/vento/highlights.scm b/runtime/queries/vento/highlights.scm index 9d35b2f66..ec31aae20 100644 --- a/runtime/queries/vento/highlights.scm +++ b/runtime/queries/vento/highlights.scm @@ -1,6 +1,26 @@ (comment) @comment @spell -(keyword) @keyword +[ + "if" + "/if" + "else" + "for" + "/for" + "layout" + "/layout" + "set" + "/set" + "import" + "export" + "/export" + "include" + "function" + "/function" + "fragment" + "/fragment" + "of" + "async" +] @keyword (tag [ |
