aboutsummaryrefslogtreecommitdiff
path: root/runtime/queries
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-11-06 15:28:19 +0000
committerBlaž Hrastnik2021-11-06 15:28:19 +0000
commitf2b709a3c3a9cc036bfea46734efd7e4100eb34b (patch)
treead5f921f13659e5ba395442e13389af317ee81b0 /runtime/queries
parentcde57dae356021c6ca8c2a2ed68777bd9d0bc0b2 (diff)
parentf979bdc442ab3150a369ff8bee0703e90e32e2a4 (diff)
Merge branch 'master' into debug
Diffstat (limited to 'runtime/queries')
-rw-r--r--runtime/queries/bash/highlights.scm4
-rw-r--r--runtime/queries/c-sharp/highlights.scm10
-rw-r--r--runtime/queries/c/highlights.scm6
-rw-r--r--runtime/queries/cmake/highlights.scm97
-rw-r--r--runtime/queries/cpp/highlights.scm9
-rw-r--r--runtime/queries/css/highlights.scm14
-rw-r--r--runtime/queries/elixir/highlights.scm323
-rw-r--r--runtime/queries/go/highlights.scm6
-rw-r--r--runtime/queries/go/textobjects.scm21
-rw-r--r--runtime/queries/haskell/highlights.scm6
-rw-r--r--runtime/queries/java/highlights.scm11
-rw-r--r--runtime/queries/javascript/highlights.scm4
-rw-r--r--runtime/queries/json/highlights.scm19
-rw-r--r--runtime/queries/julia/highlights.scm12
-rw-r--r--runtime/queries/ledger/highlights.scm4
-rw-r--r--runtime/queries/lua/highlights.scm6
-rw-r--r--runtime/queries/nix/highlights.scm12
-rw-r--r--runtime/queries/ocaml/highlights.scm8
-rw-r--r--runtime/queries/php/highlights.scm12
-rw-r--r--runtime/queries/php/indents.toml17
-rw-r--r--runtime/queries/protobuf/highlights.scm10
-rw-r--r--runtime/queries/python/highlights.scm11
-rw-r--r--runtime/queries/python/indents.toml39
-rw-r--r--runtime/queries/python/textobjects.scm14
-rw-r--r--runtime/queries/ruby/highlights.scm6
-rw-r--r--runtime/queries/rust/highlights.scm35
-rw-r--r--runtime/queries/rust/textobjects.scm26
-rw-r--r--runtime/queries/svelte/highlights.scm2
-rw-r--r--runtime/queries/toml/highlights.scm8
-rw-r--r--runtime/queries/tsq/highlights.scm4
-rw-r--r--runtime/queries/yaml/highlights.scm10
-rw-r--r--runtime/queries/zig/highlights.scm8
32 files changed, 544 insertions, 230 deletions
diff --git a/runtime/queries/bash/highlights.scm b/runtime/queries/bash/highlights.scm
index 754faeda..57898f27 100644
--- a/runtime/queries/bash/highlights.scm
+++ b/runtime/queries/bash/highlights.scm
@@ -7,7 +7,7 @@
(command_name) @function
-(variable_name) @property
+(variable_name) @variable.other.member
[
"case"
@@ -31,7 +31,7 @@
(function_definition name: (word) @function)
-(file_descriptor) @number
+(file_descriptor) @constant.numeric.integer
[
(command_substitution)
diff --git a/runtime/queries/c-sharp/highlights.scm b/runtime/queries/c-sharp/highlights.scm
index b76f4e60..6e84ad83 100644
--- a/runtime/queries/c-sharp/highlights.scm
+++ b/runtime/queries/c-sharp/highlights.scm
@@ -20,16 +20,16 @@
] @type.builtin
;; Enum
-(enum_member_declaration (identifier) @variable.property)
+(enum_member_declaration (identifier) @variable.other.member)
;; Literals
[
(real_literal)
(integer_literal)
-] @number
+] @constant.numeric.integer
+(character_literal) @constant.character
[
- (character_literal)
(string_literal)
(verbatim_string_literal)
(interpolated_string_text)
@@ -40,8 +40,8 @@
"$@\""
] @string
+(boolean_literal) @constant.builtin.boolean
[
- (boolean_literal)
(null_literal)
(void_keyword)
] @constant.builtin
@@ -98,7 +98,7 @@
;; Keywords
(modifier) @keyword
(this_expression) @keyword
-(escape_sequence) @keyword
+(escape_sequence) @constant.character.escape
[
"as"
diff --git a/runtime/queries/c/highlights.scm b/runtime/queries/c/highlights.scm
index 2c42710f..918f3f66 100644
--- a/runtime/queries/c/highlights.scm
+++ b/runtime/queries/c/highlights.scm
@@ -60,8 +60,8 @@
(system_lib_string) @string
(null) @constant
-(number_literal) @number
-(char_literal) @string
+(number_literal) @constant.numeric.integer
+(char_literal) @constant.character
(call_expression
function: (identifier) @function)
@@ -73,7 +73,7 @@
(preproc_function_def
name: (identifier) @function.special)
-(field_identifier) @property
+(field_identifier) @variable.other.member
(statement_identifier) @label
(type_identifier) @type
(primitive_type) @type
diff --git a/runtime/queries/cmake/highlights.scm b/runtime/queries/cmake/highlights.scm
new file mode 100644
index 00000000..71e9b5d9
--- /dev/null
+++ b/runtime/queries/cmake/highlights.scm
@@ -0,0 +1,97 @@
+[
+ (quoted_argument)
+ (bracket_argument)
+ ] @string
+
+(variable) @variable
+
+[
+ (bracket_comment)
+ (line_comment)
+ ] @comment
+
+(normal_command (identifier) @function)
+
+["ENV" "CACHE"] @string.special.symbol
+["$" "{" "}" "<" ">"] @punctuation
+["(" ")"] @punctuation.bracket
+
+[
+ (function)
+ (endfunction)
+ (macro)
+ (endmacro)
+ ] @keyword.function
+
+[
+ (if)
+ (elseif)
+ (else)
+ (endif)
+ ] @keyword.control.conditional
+
+[
+ (foreach)
+ (endforeach)
+ (while)
+ (endwhile)
+ ] @keyword.control.repeat
+
+(function_command
+ (function)
+ . (argument) @function
+ (argument)* @variable.parameter
+ )
+
+(macro_command
+ (macro)
+ . (argument) @function.macro
+ (argument)* @variable.parameter
+ )
+
+(normal_command
+ (identifier) @function.builtin
+ . (argument) @variable
+ (#match? @function.builtin "^(?i)(set)$"))
+
+(normal_command
+ (identifier) @function.builtin
+ . (argument)
+ (argument) @constant
+ (#match? @constant "^(?:PARENT_SCOPE|CACHE)$")
+ (#match? @function.builtin "^(?i)(unset)$"))
+
+(normal_command
+ (identifier) @function.builtin
+ . (argument)
+ . (argument)
+ (argument) @constant
+ (#match? @constant "^(?:PARENT_SCOPE|CACHE|FORCE)$")
+ (#match? @function.builtin "^(?i)(set)$")
+ )
+
+((argument) @constant.builtin.boolean
+ (#match? @constant.builtin.boolean "^(?i)(?:1|on|yes|true|y|0|off|no|false|n|ignore|notfound|.*-notfound)$")
+ )
+
+(if_command
+ (if)
+ (argument) @operator
+ (#match? @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)$")
+)
+
+(normal_command
+ (identifier) @function.builtin
+ . (argument)
+ (argument) @constant
+ (#match? @constant "^(?:ALL|COMMAND|DEPENDS|BYPRODUCTS|WORKING_DIRECTORY|COMMENT|JOB_POOL|VERBATIM|USES_TERMINAL|COMMAND_EXPAND_LISTS|SOURCES)$")
+ (#match? @function.builtin "^(?i)(add_custom_target)$")
+ )
+
+(normal_command
+ (identifier) @function.builtin
+ (argument) @constant
+ (#match? @constant "^(?:OUTPUT|COMMAND|MAIN_DEPENDENCY|DEPENDS|BYPRODUCTS|IMPLICIT_DEPENDS|WORKING_DIRECTORY|COMMENT|DEPFILE|JOB_POOL|VERBATIM|APPEND|USES_TERMINAL|COMMAND_EXPAND_LISTS)$")
+ (#match? @function.builtin "^(?i)(add_custom_command)$")
+ )
+
diff --git a/runtime/queries/cpp/highlights.scm b/runtime/queries/cpp/highlights.scm
index 3315fde0..3348ef3c 100644
--- a/runtime/queries/cpp/highlights.scm
+++ b/runtime/queries/cpp/highlights.scm
@@ -3,7 +3,7 @@
; Functions
(call_expression
- function: (scoped_identifier
+ function: (qualified_identifier
name: (identifier) @function))
(template_function
@@ -13,15 +13,14 @@
name: (field_identifier) @function)
(template_function
- name: (scoped_identifier
- name: (identifier) @function))
+ name: (identifier) @function)
(function_declarator
- declarator: (scoped_identifier
+ declarator: (qualified_identifier
name: (identifier) @function))
(function_declarator
- declarator: (scoped_identifier
+ declarator: (qualified_identifier
name: (identifier) @function))
(function_declarator
diff --git a/runtime/queries/css/highlights.scm b/runtime/queries/css/highlights.scm
index 763661af..4dfc0c66 100644
--- a/runtime/queries/css/highlights.scm
+++ b/runtime/queries/css/highlights.scm
@@ -26,11 +26,11 @@
(pseudo_element_selector (tag_name) @attribute)
(pseudo_class_selector (class_name) @attribute)
-(class_name) @property
-(id_name) @property
-(namespace_name) @property
-(property_name) @property
-(feature_name) @property
+(class_name) @variable.other.member
+(id_name) @variable.other.member
+(namespace_name) @variable.other.member
+(property_name) @variable.other.member
+(feature_name) @variable.other.member
(attribute_name) @attribute
@@ -55,8 +55,8 @@
(string_value) @string
(color_value) @string.special
-(integer_value) @number
-(float_value) @number
+(integer_value) @constant.numeric.integer
+(float_value) @constant.numeric.float
(unit) @type
"#" @punctuation.delimiter
diff --git a/runtime/queries/elixir/highlights.scm b/runtime/queries/elixir/highlights.scm
index 6bf93a21..76fd2af9 100644
--- a/runtime/queries/elixir/highlights.scm
+++ b/runtime/queries/elixir/highlights.scm
@@ -1,125 +1,210 @@
-["when" "and" "or" "not in" "not" "in" "fn" "do" "end" "catch" "rescue" "after" "else"] @keyword
-
-[(true) (false) (nil)] @constant.builtin
-
-(keyword
- [(keyword_literal)
- ":"] @tag)
-
-(keyword
- (keyword_string
- [(string_start)
- (string_content)
- (string_end)] @tag))
-
-[(atom_literal)
- (atom_start)
- (atom_content)
- (atom_end)] @tag
-
-[(comment)
- (unused_identifier)] @comment
-
-(escape_sequence) @escape
-
-(call function: (function_identifier) @keyword
- (#match? @keyword "^(defmodule|defexception|defp|def|with|case|cond|raise|import|require|use|defmacrop|defmacro|defguardp|defguard|defdelegate|defstruct|alias|defimpl|defprotocol|defoverridable|receive|if|for|try|throw|unless|reraise|super|quote|unquote|unquote_splicing)$"))
-
-(call function: (function_identifier) @keyword
- [(call
- function: (function_identifier) @function
- (arguments
- [(identifier) @variable.parameter
- (_ (identifier) @variable.parameter)
- (_ (_ (identifier) @variable.parameter))
- (_ (_ (_ (identifier) @variable.parameter)))
- (_ (_ (_ (_ (identifier) @variable.parameter))))
- (_ (_ (_ (_ (_ (identifier) @variable.parameter)))))]))
- (binary_op
- left:
- (call
- function: (function_identifier) @function
- (arguments
- [(identifier) @variable.parameter
- (_ (identifier) @variable.parameter)
- (_ (_ (identifier) @variable.parameter))
- (_ (_ (_ (identifier) @variable.parameter)))
- (_ (_ (_ (_ (identifier) @variable.parameter))))
- (_ (_ (_ (_ (_ (identifier) @variable.parameter)))))]))
+; The following code originates mostly from
+; https://github.com/elixir-lang/tree-sitter-elixir, with minor edits to
+; align the captures with helix. The following should be considered
+; Copyright 2021 The Elixir Team
+;
+; Licensed under the Apache License, Version 2.0 (the "License");
+; you may not use this file except in compliance with the License.
+; You may obtain a copy of the License at
+;
+; https://www.apache.org/licenses/LICENSE-2.0
+;
+; Unless required by applicable law or agreed to in writing, software
+; distributed under the License is distributed on an "AS IS" BASIS,
+; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+; See the License for the specific language governing permissions and
+; limitations under the License.
+
+; Reserved keywords
+
+["when" "and" "or" "not" "in" "not in" "fn" "do" "end" "catch" "rescue" "after" "else"] @keyword
+
+; Operators
+
+; * doc string
+(unary_operator
+ operator: "@" @comment.block.documentation
+ operand: (call
+ target: (identifier) @comment.block.documentation.__attribute__
+ (arguments
+ [
+ (string) @comment.block.documentation
+ (charlist) @comment.block.documentation
+ (sigil
+ quoted_start: _ @comment.block.documentation
+ quoted_end: _ @comment.block.documentation) @comment.block.documentation
+ (boolean) @comment.block.documentation
+ ]))
+ (#match? @comment.block.documentation.__attribute__ "^(moduledoc|typedoc|doc)$"))
+
+; * module attribute
+(unary_operator
+ operator: "@" @variable.other.member
+ operand: [
+ (identifier) @variable.other.member
+ (call
+ target: (identifier) @variable.other.member)
+ (boolean) @variable.other.member
+ (nil) @variable.other.member
+ ])
+
+; * capture operator
+(unary_operator
+ operator: "&"
+ operand: [
+ (integer) @operator
+ (binary_operator
+ left: [
+ (call target: (dot left: (_) right: (identifier) @function))
+ (identifier) @function
+ ] operator: "/" right: (integer) @operator)
+ ])
+
+(operator_identifier) @operator
+
+(unary_operator
+ operator: _ @operator)
+
+(binary_operator
+ operator: _ @operator)
+
+(dot
+ operator: _ @operator)
+
+(stab_clause
+ operator: _ @operator)
+
+; Literals
+
+(nil) @constant.builtin
+
+(boolean) @constant.builtin.boolean
+(integer) @constant.numeric.integer
+(float) @constant.numeric.float
+
+(alias) @type
+
+(call
+ target: (dot
+ left: (atom) @type))
+
+(char) @constant.character
+
+; Quoted content
+
+(interpolation "#{" @punctuation.special "}" @punctuation.special) @embedded
+
+(escape_sequence) @constant.character.escape
+
+[
+ (atom)
+ (quoted_atom)
+ (keyword)
+ (quoted_keyword)
+] @string.special.symbol
+
+[
+ (string)
+ (charlist)
+] @string
+
+; Note that we explicitly target sigil quoted start/end, so they are not overridden by delimiters
+
+(sigil
+ (sigil_name) @__name__
+ quoted_start: _ @string
+ quoted_end: _ @string
+ (#match? @__name__ "^[sS]$")) @string
+
+(sigil
+ (sigil_name) @__name__
+ quoted_start: _ @string.regexp
+ quoted_end: _ @string.regexp
+ (#match? @__name__ "^[rR]$")) @string.regexp
+
+(sigil
+ (sigil_name) @__name__
+ quoted_start: _ @string.special
+ quoted_end: _ @string.special) @string.special
+
+; Calls
+
+; * definition keyword
+(call
+ target: (identifier) @keyword
+ (#match? @keyword "^(def|defdelegate|defexception|defguard|defguardp|defimpl|defmacro|defmacrop|defmodule|defn|defnp|defoverridable|defp|defprotocol|defstruct)$"))
+
+; * kernel or special forms keyword
+(call
+ target: (identifier) @keyword
+ (#match? @keyword "^(alias|case|cond|else|for|if|import|quote|raise|receive|require|reraise|super|throw|try|unless|unquote|unquote_splicing|use|with)$"))
+
+; * function call
+(call
+ target: [
+ ; local
+ (identifier) @function
+ ; remote
+ (dot
+ right: (identifier) @function)
+ ])
+
+; * just identifier in function definition
+(call
+ target: (identifier) @keyword
+ (arguments
+ [
+ (identifier) @function
+ (binary_operator
+ left: (identifier) @function
operator: "when")
- (binary_op
- left: (identifier) @variable.parameter
- operator: _ @function
- right: (identifier) @variable.parameter)]
- (#match? @keyword "^(defp|def|defmacrop|defmacro|defguardp|defguard|defdelegate)$"))
-
-(call (function_identifier) @keyword
- [(call
- function: (function_identifier) @function)
- (identifier) @function
- (binary_op
- left:
- [(call
- function: (function_identifier) @function)
- (identifier) @function]
- operator: "when")]
- (#match? @keyword "^(defp|def|defmacrop|defmacro|defguardp|defguard|defdelegate)$"))
-
-(anonymous_function
- (stab_expression
- left: (bare_arguments
- [(identifier) @variable.parameter
- (_ (identifier) @variable.parameter)
- (_ (_ (identifier) @variable.parameter))
- (_ (_ (_ (identifier) @variable.parameter)))
- (_ (_ (_ (_ (identifier) @variable.parameter))))
- (_ (_ (_ (_ (_ (identifier) @variable.parameter)))))])))
-
-(unary_op
- operator: "@"
- (call (identifier) @attribute
- (heredoc
- [(heredoc_start)
- (heredoc_content)
- (heredoc_end)] @doc))
- (#match? @attribute "^(doc|moduledoc)$"))
-
-(module) @type
-
-(unary_op
- operator: "@" @attribute
- [(call
- function: (function_identifier) @attribute)
- (identifier) @attribute])
-
-(unary_op
- operator: _ @operator)
-
-(binary_op
- operator: _ @operator)
-
-(heredoc
- [(heredoc_start)
- (heredoc_content)
- (heredoc_end)] @string)
-
-(string
- [(string_start)
- (string_content)
- (string_end)] @string)
-
-(sigil_start) @string.special
-(sigil_content) @string
-(sigil_end) @string.special
-
-(interpolation
- "#{" @punctuation.special
- "}" @punctuation.special)
+ ])
+ (#match? @keyword "^(def|defdelegate|defguard|defguardp|defmacro|defmacrop|defn|defnp|defp)$"))
+
+; * pipe into identifier (definition)
+(call
+ target: (identifier) @keyword
+ (arguments
+ (binary_operator
+ operator: "|>"
+ right: (identifier) @variable))
+ (#match? @keyword "^(def|defdelegate|defguard|defguardp|defmacro|defmacrop|defn|defnp|defp)$"))
+
+; * pipe into identifier (function call)
+(binary_operator
+ operator: "|>"
+ right: (identifier) @function)
+
+; Identifiers
+
+; * special
+(
+ (identifier) @constant.builtin
+ (#match? @constant.builtin "^(__MODULE__|__DIR__|__ENV__|__CALLER__|__STACKTRACE__)$")
+)
+
+; * unused
+(
+ (identifier) @comment
+ (#match? @comment "^_")
+)
+
+; * regular
+(identifier) @variable
+
+; Comment
+
+(comment) @comment
+
+; Punctuation
+
+[
+ "%"
+] @punctuation
[
","
- "->"
- "."
+ ";"
] @punctuation.delimiter
[
@@ -133,6 +218,4 @@
">>"
] @punctuation.bracket
-(special_identifier) @function.special
-
(ERROR) @warning
diff --git a/runtime/queries/go/highlights.scm b/runtime/queries/go/highlights.scm
index 3129c4b2..56384d4d 100644
--- a/runtime/queries/go/highlights.scm
+++ b/runtime/queries/go/highlights.scm
@@ -25,7 +25,7 @@
(variadic_parameter_declaration (identifier) @variable.parameter)
(type_identifier) @type
-(field_identifier) @property
+(field_identifier) @variable.other.member
(identifier) @variable
(package_identifier) @variable
@@ -130,13 +130,13 @@
(rune_literal)
] @string
-(escape_sequence) @escape
+(escape_sequence) @constant.character.escape
[
(int_literal)
(float_literal)
(imaginary_literal)
-] @number
+] @constant.numeric.integer
[
(true)
diff --git a/runtime/queries/go/textobjects.scm b/runtime/queries/go/textobjects.scm
new file mode 100644
index 00000000..9bcfc690
--- /dev/null
+++ b/runtime/queries/go/textobjects.scm
@@ -0,0 +1,21 @@
+(function_declaration
+ body: (block)? @function.inside) @function.around
+
+(func_literal
+ (_)? @function.inside) @function.around
+
+(method_declaration
+ body: (block)? @function.inside) @function.around
+
+;; struct and interface declaration as class textobject?
+(type_declaration
+ (type_spec (type_identifier) (struct_type (field_declaration_list (_)?) @class.inside))) @class.around
+
+(type_declaration
+ (type_spec (type_identifier) (interface_type (method_spec_list (_)?) @class.inside))) @class.around
+
+(parameter_list
+ (_) @parameter.inside)
+
+(argument_list
+ (_) @parameter.inside)
diff --git a/runtime/queries/haskell/highlights.scm b/runtime/queries/haskell/highlights.scm
index dada80b6..72187876 100644
--- a/runtime/queries/haskell/highlights.scm
+++ b/runtime/queries/haskell/highlights.scm
@@ -13,9 +13,9 @@
(constraint class: (class_name (type)) @class)
(class (class_head class: (class_name (type)) @class))
(instance (instance_head class: (class_name (type)) @class))
-(integer) @number
-(exp_literal (float)) @number
-(char) @literal
+(integer) @constant.numeric.integer
+(exp_literal (float)) @constant.numeric.float
+(char) @constant.character
(con_unit) @literal
(con_list) @literal
(tycon_arrow) @operator
diff --git a/runtime/queries/java/highlights.scm b/runtime/queries/java/highlights.scm
index e7d793df..77902fce 100644
--- a/runtime/queries/java/highlights.scm
+++ b/runtime/queries/java/highlights.scm
@@ -59,14 +59,15 @@
(hex_integer_literal)
(decimal_integer_literal)
(octal_integer_literal)
+] @constant.numeric.integer
+
+[
(decimal_floating_point_literal)
(hex_floating_point_literal)
-] @number
+] @constant.numeric.float
-[
- (character_literal)
- (string_literal)
-] @string
+(character_literal) @constant.character
+(string_literal) @string
[
(true)
diff --git a/runtime/queries/javascript/highlights.scm b/runtime/queries/javascript/highlights.scm
index e29829bf..6163b680 100644
--- a/runtime/queries/javascript/highlights.scm
+++ b/runtime/queries/javascript/highlights.scm
@@ -65,7 +65,7 @@
; Properties
;-----------
-(property_identifier) @property
+(property_identifier) @variable.other.member
; Literals
;---------
@@ -88,7 +88,7 @@
] @string
(regex) @string.regexp
-(number) @number
+(number) @constant.numeric.integer
; Tokens
;-------
diff --git a/runtime/queries/json/highlights.scm b/runtime/queries/json/highlights.scm
index b08ea439..6df6c9eb 100644
--- a/runtime/queries/json/highlights.scm
+++ b/runtime/queries/json/highlights.scm
@@ -1,9 +1,20 @@
+[
+ (true)
+ (false)
+] @constant.builtin.boolean
+(null) @constant.builtin
+(number) @constant.numeric
(pair
key: (_) @keyword)
(string) @string
+(escape_sequence) @constant.character.escape
+(ERROR) @error
-(object
- "{" @escape
- (_)
- "}" @escape)
+"," @punctuation.delimiter
+[
+ "["
+ "]"
+ "{"
+ "}"
+] @punctuation.bracket
diff --git a/runtime/queries/julia/highlights.scm b/runtime/queries/julia/highlights.scm
index 7b7d426c..7c447985 100644
--- a/runtime/queries/julia/highlights.scm
+++ b/runtime/queries/julia/highlights.scm
@@ -15,7 +15,7 @@
(field_expression
(identifier)
- (identifier) @field .)
+ (identifier) @variable.other.member .)
(function_definition
name: (identifier) @function)
@@ -80,14 +80,14 @@
(struct_definition
name: (identifier) @type)
-(number) @number
+(number) @constant.numeric.integer
(range_expression
- (identifier) @number
- (eq? @number "end"))
+ (identifier) @constant.numeric.integer
+ (eq? @constant.numeric.integer "end"))
(range_expression
(_
- (identifier) @number
- (eq? @number "end")))
+ (identifier) @constant.numeric.integer
+ (eq? @constant.numeric.integer "end")))
(coefficient_expression
(number)
(identifier) @constant.builtin)
diff --git a/runtime/queries/ledger/highlights.scm b/runtime/queries/ledger/highlights.scm
index 86c609c2..bdf5f2db 100644
--- a/runtime/queries/ledger/highlights.scm
+++ b/runtime/queries/ledger/highlights.scm
@@ -7,9 +7,9 @@
(date)
(interval)
(quantity)
-] @number
+] @constant.numeric.integer
-((account) @field)
+((account) @variable.other.member)
((commodity) @text.literal)
"include" @include
diff --git a/runtime/queries/lua/highlights.scm b/runtime/queries/lua/highlights.scm
index 40c2be70..e73b32d6 100644
--- a/runtime/queries/lua/highlights.scm
+++ b/runtime/queries/lua/highlights.scm
@@ -150,14 +150,14 @@
(table ["{" "}"] @constructor)
(comment) @comment
(string) @string
-(number) @number
+(number) @constant.numeric.integer
(label_statement) @label
; A bit of a tricky one, this will only match field names
-(field . (identifier) @property (_))
+(field . (identifier) @variable.other.member (_))
(shebang) @comment
;; Property
-(property_identifier) @property
+(property_identifier) @variable.other.member
;; Variable
(identifier) @variable
diff --git a/runtime/queries/nix/highlights.scm b/runtime/queries/nix/highlights.scm
index 741b73b5..66719e87 100644
--- a/runtime/queries/nix/highlights.scm
+++ b/runtime/queries/nix/highlights.scm
@@ -33,16 +33,14 @@
(uri) @string.special.uri
-[
- (integer)
- (float)
-] @number
+(integer) @constant.numeric.integer
+(float) @constant.numeric.float
(interpolation
"${" @punctuation.special
"}" @punctuation.special) @embedded
-(escape_sequence) @escape
+(escape_sequence) @constant.character.escape
(function
universal: (identifier) @variable.parameter
@@ -66,8 +64,8 @@
(binary
operator: _ @operator)
-(attr_identifier) @property
-(inherit attrs: (attrs_inherited (identifier) @property) )
+(attr_identifier) @variable.other.member
+(inherit attrs: (attrs_inherited (identifier) @variable.other.member) )
[
";"
diff --git a/runtime/queries/ocaml/highlights.scm b/runtime/queries/ocaml/highlights.scm
index 160f2cb4..15f46cc1 100644
--- a/runtime/queries/ocaml/highlights.scm
+++ b/runtime/queries/ocaml/highlights.scm
@@ -51,14 +51,14 @@
; Properties
;-----------
-[(label_name) (field_name) (instance_variable_name)] @property
+[(label_name) (field_name) (instance_variable_name)] @variable.other.member
; Constants
;----------
[(boolean) (unit)] @constant
-[(number) (signed_number)] @number
+[(number) (signed_number)] @constant.numeric.integer
(character) @constant.character
@@ -66,7 +66,7 @@
(quoted_string "{" @string "}" @string) @string
-(escape_sequence) @string.escape
+(escape_sequence) @constant.character.escape
[
(conversion_specification)
@@ -145,7 +145,7 @@
; Attributes
;-----------
-(attribute_id) @property
+(attribute_id) @variable.other.member
; Comments
;---------
diff --git a/runtime/queries/php/highlights.scm b/runtime/queries/php/highlights.scm
index 02904555..46b5d26c 100644
--- a/runtime/queries/php/highlights.scm
+++ b/runtime/queries/php/highlights.scm
@@ -30,12 +30,12 @@
; Member
(property_element
- (variable_name) @property)
+ (variable_name) @variable.other.member)
(member_access_expression
- name: (variable_name (name)) @property)
+ name: (variable_name (name)) @variable.other.member)
(member_access_expression
- name: (name) @property)
+ name: (name) @variable.other.member)
; Variables
@@ -56,10 +56,10 @@
(string) @string
(heredoc) @string
-(boolean) @constant.builtin
+(boolean) @constant.builtin.boolean
(null) @constant.builtin
-(integer) @number
-(float) @number
+(integer) @constant.numeric.integer
+(float) @constant.numeric.float
(comment) @comment
"$" @operator
diff --git a/runtime/queries/php/indents.toml b/runtime/queries/php/indents.toml
new file mode 100644
index 00000000..85c104db
--- /dev/null
+++ b/runtime/queries/php/indents.toml
@@ -0,0 +1,17 @@
+indent = [
+ "array_creation_expression",
+ "arguments",
+ "formal_parameters",
+ "compound_statement",
+ "declaration_list",
+ "binary_expression",
+ "return_statement",
+ "expression_statement",
+ "switch_block",
+ "anonymous_function_use_clause",
+]
+
+oudent = [
+ "}",
+ ")",
+]
diff --git a/runtime/queries/protobuf/highlights.scm b/runtime/queries/protobuf/highlights.scm
index cd021be1..c35c430e 100644
--- a/runtime/queries/protobuf/highlights.scm
+++ b/runtime/queries/protobuf/highlights.scm
@@ -34,16 +34,14 @@
[
(fieldName)
(optionName)
-] @property
+] @variable.other.member
(enumVariantName) @type.enum.variant
(fullIdent) @namespace
-[
- (intLit)
- (floatLit)
-] @number
-(boolLit) @constant.builtin
+(intLit) @constant.numeric.integer
+(floatLit) @constant.numeric.float
+(boolLit) @constant.builtin.boolean
(strLit) @string
(constant) @constant
diff --git a/runtime/queries/python/highlights.scm b/runtime/queries/python/highlights.scm
index f64fecb2..9131acc5 100644
--- a/runtime/queries/python/highlights.scm
+++ b/runtime/queries/python/highlights.scm
@@ -29,7 +29,7 @@
name: (identifier) @function)
(identifier) @variable
-(attribute attribute: (identifier) @property)
+(attribute attribute: (identifier) @variable.other.member)
(type (identifier) @type)
; Literals
@@ -40,14 +40,11 @@
(false)
] @constant.builtin
-[
- (integer)
- (float)
-] @number
-
+(integer) @constant.numeric.integer
+(float) @constant.numeric.float
(comment) @comment
(string) @string
-(escape_sequence) @escape
+(escape_sequence) @constant.character.escape
(interpolation
"{" @punctuation.special
diff --git a/runtime/queries/python/indents.toml b/runtime/queries/python/indents.toml
new file mode 100644
index 00000000..6bc68486
--- /dev/null
+++ b/runtime/queries/python/indents.toml
@@ -0,0 +1,39 @@
+indent = [
+ "list",
+ "tuple",
+ "dictionary",
+ "set",
+
+ "if_statement",
+ "for_statement",
+ "while_statement",
+ "with_statement",
+ "try_statement",
+ "import_from_statement",
+
+ "parenthesized_expression",
+ "generator_expression",
+ "list_comprehension",
+ "set_comprehension",
+ "dictionary_comprehension",
+
+ "tuple_pattern",
+ "list_pattern",
+ "argument_list",
+ "parameters",
+ "binary_operator",
+
+ "function_definition",
+ "class_definition",
+]
+
+outdent = [
+ ")",
+ "]",
+ "}",
+ "return_statement",
+ "pass_statement",
+ "raise_statement",
+]
+
+ignore = ["string"]
diff --git a/runtime/queries/python/textobjects.scm b/runtime/queries/python/textobjects.scm
new file mode 100644
index 00000000..a52538af
--- /dev/null
+++ b/runtime/queries/python/textobjects.scm
@@ -0,0 +1,14 @@
+(function_definition
+ body: (block)? @function.inside) @function.around
+
+(class_definition
+ body: (block)? @class.inside) @class.around
+
+(parameters
+ (_) @parameter.inside)
+
+(lambda_parameters
+ (_) @parameter.inside)
+
+(argument_list
+ (_) @parameter.inside)
diff --git a/runtime/queries/ruby/highlights.scm b/runtime/queries/ruby/highlights.scm
index 8617d6f0..898f8f79 100644
--- a/runtime/queries/ruby/highlights.scm
+++ b/runtime/queries/ruby/highlights.scm
@@ -55,7 +55,7 @@
[
(class_variable)
(instance_variable)
-] @property
+] @variable.other.member
((identifier) @constant.builtin
(#match? @constant.builtin "^__(FILE|LINE|ENCODING)__$"))
@@ -101,12 +101,12 @@
] @string.special.symbol
(regex) @string.regexp
-(escape_sequence) @escape
+(escape_sequence) @constant.character.escape
[
(integer)
(float)
-] @number
+] @constant.numeric.integer
[
(nil)
diff --git a/runtime/queries/rust/highlights.scm b/runtime/queries/rust/highlights.scm
index 956a5dac..539d9550 100644
--- a/runtime/queries/rust/highlights.scm
+++ b/runtime/queries/rust/highlights.scm
@@ -15,15 +15,13 @@
; Primitives
; ---
-(escape_sequence) @escape
+(escape_sequence) @constant.character.escape
(primitive_type) @type.builtin
(boolean_literal) @constant.builtin.boolean
+(integer_literal) @constant.numeric.integer
+(float_literal) @constant.numeric.float
+(char_literal) @constant.character
[
- (integer_literal)
- (float_literal)
-] @number
-[
- (char_literal)
(string_literal)
(raw_string_literal)
] @string
@@ -40,10 +38,10 @@
(enum_variant (identifier) @type.enum.variant)
(field_initializer
- (field_identifier) @property)
+ (field_identifier) @variable.other.member)
(shorthand_field_initializer
- (identifier) @variable.property)
-(shorthand_field_identifier) @variable.property
+ (identifier) @variable.other.member)
+(shorthand_field_identifier) @variable.other.member
(lifetime
"'" @label
@@ -81,9 +79,24 @@
] @punctuation.bracket)
; ---
-; Parameters
+; Variables
; ---
+(let_declaration
+ pattern: [
+ ((identifier) @variable)
+ ((tuple_pattern
+ (identifier) @variable))
+ ])
+
+; It needs to be anonymous to not conflict with `call_expression` further below.
+(_
+ value: (field_expression
+ value: (identifier)? @variable
+ field: (field_identifier) @variable.other.member))
+
+(arguments
+ (identifier) @variable.parameter)
(parameter
pattern: (identifier) @variable.parameter)
(closure_parameters
@@ -336,4 +349,4 @@
(type_identifier) @type
(identifier) @variable
-(field_identifier) @property
+(field_identifier) @variable.other.member
diff --git a/runtime/queries/rust/textobjects.scm b/runtime/queries/rust/textobjects.scm
new file mode 100644
index 00000000..e3132687
--- /dev/null
+++ b/runtime/queries/rust/textobjects.scm
@@ -0,0 +1,26 @@
+(function_item
+ body: (_) @function.inside) @function.around
+
+(struct_item
+ body: (_) @class.inside) @class.around
+
+(enum_item
+ body: (_) @class.inside) @class.around
+
+(union_item
+ body: (_) @class.inside) @class.around
+
+(trait_item
+ body: (_) @class.inside) @class.around
+
+(impl_item
+ body: (_) @class.inside) @class.around
+
+(parameters
+ (_) @parameter.inside)
+
+(closure_parameters
+ (_) @parameter.inside)
+
+(arguments
+ (_) @parameter.inside)
diff --git a/runtime/queries/svelte/highlights.scm b/runtime/queries/svelte/highlights.scm
index 4c6f5f35..4fcdfd66 100644
--- a/runtime/queries/svelte/highlights.scm
+++ b/runtime/queries/svelte/highlights.scm
@@ -29,7 +29,7 @@
(#match? @_attr "^(href|src)$"))
(tag_name) @tag
-(attribute_name) @property
+(attribute_name) @variable.other.member
(erroneous_end_tag_name) @error
(comment) @comment
diff --git a/runtime/queries/toml/highlights.scm b/runtime/queries/toml/highlights.scm
index e4d6966f..2742b2be 100644
--- a/runtime/queries/toml/highlights.scm
+++ b/runtime/queries/toml/highlights.scm
@@ -1,17 +1,17 @@
; Properties
;-----------
-(bare_key) @property
+(bare_key) @variable.other.member
(quoted_key) @string
; Literals
;---------
-(boolean) @constant.builtin
+(boolean) @constant.builtin.boolean
(comment) @comment
(string) @string
-(integer) @number
-(float) @number
+(integer) @constant.numeric.integer
+(float) @constant.numeric.float
(offset_date_time) @string.special
(local_date_time) @string.special
(local_date) @string.special
diff --git a/runtime/queries/tsq/highlights.scm b/runtime/queries/tsq/highlights.scm
index 9ba5699a..549895c1 100644
--- a/runtime/queries/tsq/highlights.scm
+++ b/runtime/queries/tsq/highlights.scm
@@ -35,12 +35,12 @@
(comment) @comment
-(field_name) @property
+(field_name) @variable.other.member
(capture) @label
(predicate_name) @function
-(escape_sequence) @escape
+(escape_sequence) @constant.character.escape
(node_name) @variable
diff --git a/runtime/queries/yaml/highlights.scm b/runtime/queries/yaml/highlights.scm
index 2955a4ce..a7efb5e7 100644
--- a/runtime/queries/yaml/highlights.scm
+++ b/runtime/queries/yaml/highlights.scm
@@ -1,12 +1,12 @@
-(block_mapping_pair key: (_) @property)
-(flow_mapping (_ key: (_) @property))
+(block_mapping_pair key: (_) @variable.other.member)
+(flow_mapping (_ key: (_) @variable.other.member))
(boolean_scalar) @constant.builtin.boolean
(null_scalar) @constant.builtin
(double_quote_scalar) @string
(single_quote_scalar) @string
-(escape_sequence) @string.escape
-(integer_scalar) @number
-(float_scalar) @number
+(escape_sequence) @constant.character.escape
+(integer_scalar) @constant.numeric.integer
+(float_scalar) @constant.numeric.float
(comment) @comment
(anchor_name) @type
(alias_name) @type
diff --git a/runtime/queries/zig/highlights.scm b/runtime/queries/zig/highlights.scm
index 404a8682..34dbeacd 100644
--- a/runtime/queries/zig/highlights.scm
+++ b/runtime/queries/zig/highlights.scm
@@ -14,7 +14,7 @@ parameter: (IDENTIFIER) @variable.parameter
[
field_member: (IDENTIFIER)
field_access: (IDENTIFIER)
-] @variable.property
+] @variable.other.member
;; assume TitleCase is a type
(
@@ -75,9 +75,9 @@ field_constant: (IDENTIFIER) @constant
((BUILTINIDENTIFIER) @keyword.control.import
(#any-of? @keyword.control.import "@import" "@cImport"))
-(INTEGER) @number
+(INTEGER) @constant.numeric.integer
-(FLOAT) @number
+(FLOAT) @constant.numeric.float
[
(LINESTRING)
@@ -85,7 +85,7 @@ field_constant: (IDENTIFIER) @constant
] @string
(CHAR_LITERAL) @constant.character
-(EscapeSequence) @escape
+(EscapeSequence) @constant.character.escape
(FormatSequence) @string.special
[