on master help sign in
Add tree-sitter queries.
4e31d15Blaž Hrastnik
runtime/queries/bash/highlights.scmnew file+54
@@ -0,0 +1,54 @@
1+[
2+ (string)
3+ (raw_string)
4+ (heredoc_body)
5+ (heredoc_start)
6+] @string
7+
8+(command_name) @function
9+
10+(variable_name) @property
11+
12+[
13+ "case"
14+ "do"
15+ "done"
16+ "elif"
17+ "else"
18+ "esac"
19+ "export"
20+ "fi"
21+ "for"
22+ "function"
23+ "if"
24+ "in"
25+ "unset"
26+ "while"
27+ "then"
28+] @keyword
29+
30+(comment) @comment
31+
32+(function_definition name: (word) @function)
33+
34+(file_descriptor) @number
35+
36+[
37+ (command_substitution)
38+ (process_substitution)
39+ (expansion)
40+]@embedded
41+
42+[
43+ "$"
44+ "&&"
45+ ">"
46+ ">>"
47+ "<"
48+ "|"
49+] @operator
50+
51+(
52+ (command (_) @constant)
53+ (#match? @constant "^-")
54+)
runtime/queries/css/highlights.scmnew file+64
@@ -0,0 +1,64 @@
1+(comment) @comment
2+
3+(tag_name) @tag
4+(nesting_selector) @tag
5+(universal_selector) @tag
6+
7+"~" @operator
8+">" @operator
9+"+" @operator
10+"-" @operator
11+"*" @operator
12+"/" @operator
13+"=" @operator
14+"^=" @operator
15+"|=" @operator
16+"~=" @operator
17+"$=" @operator
18+"*=" @operator
19+
20+"and" @operator
21+"or" @operator
22+"not" @operator
23+"only" @operator
24+
25+(attribute_selector (plain_value) @string)
26+(pseudo_element_selector (tag_name) @attribute)
27+(pseudo_class_selector (class_name) @attribute)
28+
29+(class_name) @property
30+(id_name) @property
31+(namespace_name) @property
32+(property_name) @property
33+(feature_name) @property
34+
35+(attribute_name) @attribute
36+
37+(function_name) @function
38+
39+((property_name) @variable
40+ (#match? @variable "^--"))
41+((plain_value) @variable
42+ (#match? @variable "^--"))
43+
44+"@media" @keyword
45+"@import" @keyword
46+"@charset" @keyword
47+"@namespace" @keyword
48+"@supports" @keyword
49+"@keyframes" @keyword
50+(at_keyword) @keyword
51+(to) @keyword
52+(from) @keyword
53+(important) @keyword
54+
55+(string_value) @string
56+(color_value) @string.special
57+
58+(integer_value) @number
59+(float_value) @number
60+(unit) @type
61+
62+"#" @punctuation.delimiter
63+"," @punctuation.delimiter
64+":" @punctuation.delimiter
runtime/queries/go/highlights.scmnew file+117
@@ -0,0 +1,117 @@
1+; Function calls
2+
3+(call_expression
4+ function: (identifier) @function)
5+
6+(call_expression
7+ function: (selector_expression
8+ field: (field_identifier) @function.method))
9+
10+; Function definitions
11+
12+(function_declaration
13+ name: (identifier) @function)
14+
15+(method_declaration
16+ name: (field_identifier) @function.method)
17+
18+; Identifiers
19+
20+(type_identifier) @type
21+(field_identifier) @property
22+(identifier) @variable
23+
24+; Operators
25+
26+[
27+ "--"
28+ "-"
29+ "-="
30+ ":="
31+ "!"
32+ "!="
33+ "..."
34+ "*"
35+ "*"
36+ "*="
37+ "/"
38+ "/="
39+ "&"
40+ "&&"
41+ "&="
42+ "%"
43+ "%="
44+ "^"
45+ "^="
46+ "+"
47+ "++"
48+ "+="
49+ "<-"
50+ "<"
51+ "<<"
52+ "<<="
53+ "<="
54+ "="
55+ "=="
56+ ">"
57+ ">="
58+ ">>"
59+ ">>="
60+ "|"
61+ "|="
62+ "||"
63+] @operator
64+
65+; Keywords
66+
67+[
68+ "break"
69+ "case"
70+ "chan"
71+ "const"
72+ "continue"
73+ "default"
74+ "defer"
75+ "else"
76+ "fallthrough"
77+ "for"
78+ "func"
79+ "go"
80+ "goto"
81+ "if"
82+ "import"
83+ "interface"
84+ "map"
85+ "package"
86+ "range"
87+ "return"
88+ "select"
89+ "struct"
90+ "switch"
91+ "type"
92+ "var"
93+] @keyword
94+
95+; Literals
96+
97+[
98+ (interpreted_string_literal)
99+ (raw_string_literal)
100+ (rune_literal)
101+] @string
102+
103+(escape_sequence) @escape
104+
105+[
106+ (int_literal)
107+ (float_literal)
108+ (imaginary_literal)
109+] @number
110+
111+[
112+ (true)
113+ (false)
114+ (nil)
115+] @constant.builtin
116+
117+(comment) @comment
runtime/queries/go/tags.scmnew file+30
@@ -0,0 +1,30 @@
1+(
2+ (comment)* @doc
3+ .
4+ (function_declaration
5+ name: (identifier) @name) @definition.function
6+ (#strip! @doc "^//\\s*")
7+ (#set-adjacent! @doc @definition.function)
8+)
9+
10+(
11+ (comment)* @doc
12+ .
13+ (method_declaration
14+ name: (field_identifier) @name) @definition.method
15+ (#strip! @doc "^//\\s*")
16+ (#set-adjacent! @doc @definition.method)
17+)
18+
19+(call_expression
20+ function: [
21+ (identifier) @name
22+ (parenthesized_expression (identifier) @name)
23+ (selector_expression field: (field_identifier) @name)
24+ (parenthesized_expression (selector_expression field: (field_identifier) @name))
25+ ]) @reference.call
26+
27+(type_spec
28+ name: (type_identifier) @name) @definition.type
29+
30+(type_identifier) @name @reference.type
runtime/queries/html/highlights.scmnew file+12
@@ -0,0 +1,12 @@
1+(tag_name) @tag
2+(erroneous_end_tag_name) @tag.error
3+(doctype) @constant
4+(attribute_name) @attribute
5+(attribute_value) @string
6+(comment) @comment
7+
8+[
9+ "<"
10+ ">"
11+ "</"
12+] @punctuation.bracket
runtime/queries/html/injections.scmnew file+7
@@ -0,0 +1,7 @@
1+((script_element
2+ (raw_text) @injection.content)
3+ (#set! injection.language "javascript"))
4+
5+((style_element
6+ (raw_text) @injection.content)
7+ (#set! injection.language "css"))
runtime/queries/javascript/highlights-jsx.scmnew file+4
@@ -0,0 +1,4 @@
1+(jsx_opening_element (identifier) @tag)
2+(jsx_closing_element (identifier) @tag)
3+(jsx_self_closing_element (identifier) @tag)
4+(jsx_attribute (property_identifier) @attribute)
runtime/queries/javascript/highlights-params.scmnew file+12
@@ -0,0 +1,12 @@
1+(formal_parameters
2+ [
3+ (identifier) @variable.parameter
4+ (array_pattern
5+ (identifier) @variable.parameter)
6+ (object_pattern
7+ [
8+ (pair_pattern value: (identifier) @variable.parameter)
9+ (shorthand_property_identifier_pattern) @variable.parameter
10+ ])
11+ ]
12+)
runtime/queries/javascript/highlights.scmnew file+205
@@ -0,0 +1,205 @@
1+; Special identifiers
2+;--------------------
3+
4+([
5+ (identifier)
6+ (shorthand_property_identifier)
7+ (shorthand_property_identifier_pattern)
8+ ] @constant
9+ (#match? @constant "^[A-Z_][A-Z\\d_]+$"))
10+
11+
12+((identifier) @constructor
13+ (#match? @constructor "^[A-Z]"))
14+
15+((identifier) @variable.builtin
16+ (#match? @variable.builtin "^(arguments|module|console|window|document)$")
17+ (#is-not? local))
18+
19+((identifier) @function.builtin
20+ (#eq? @function.builtin "require")
21+ (#is-not? local))
22+
23+; Function and method definitions
24+;--------------------------------
25+
26+(function
27+ name: (identifier) @function)
28+(function_declaration
29+ name: (identifier) @function)
30+(method_definition
31+ name: (property_identifier) @function.method)
32+
33+(pair
34+ key: (property_identifier) @function.method
35+ value: [(function) (arrow_function)])
36+
37+(assignment_expression
38+ left: (member_expression
39+ property: (property_identifier) @function.method)
40+ right: [(function) (arrow_function)])
41+
42+(variable_declarator
43+ name: (identifier) @function
44+ value: [(function) (arrow_function)])
45+
46+(assignment_expression
47+ left: (identifier) @function
48+ right: [(function) (arrow_function)])
49+
50+; Function and method calls
51+;--------------------------
52+
53+(call_expression
54+ function: (identifier) @function)
55+
56+(call_expression
57+ function: (member_expression
58+ property: (property_identifier) @function.method))
59+
60+; Variables
61+;----------
62+
63+(identifier) @variable
64+
65+; Properties
66+;-----------
67+
68+(property_identifier) @property
69+
70+; Literals
71+;---------
72+
73+(this) @variable.builtin
74+(super) @variable.builtin
75+
76+[
77+ (true)
78+ (false)
79+ (null)
80+ (undefined)
81+] @constant.builtin
82+
83+(comment) @comment
84+
85+[
86+ (string)
87+ (template_string)
88+] @string
89+
90+(regex) @string.special
91+(number) @number
92+
93+; Tokens
94+;-------
95+
96+(template_substitution
97+ "${" @punctuation.special
98+ "}" @punctuation.special) @embedded
99+
100+[
101+ ";"
102+ "?."
103+ "."
104+ ","
105+] @punctuation.delimiter
106+
107+[
108+ "-"
109+ "--"
110+ "-="
111+ "+"
112+ "++"
113+ "+="
114+ "*"
115+ "*="
116+ "**"
117+ "**="
118+ "/"
119+ "/="
120+ "%"
121+ "%="
122+ "<"
123+ "<="
124+ "<<"
125+ "<<="
126+ "="
127+ "=="
128+ "==="
129+ "!"
130+ "!="
131+ "!=="
132+ "=>"
133+ ">"
134+ ">="
135+ ">>"
136+ ">>="
137+ ">>>"
138+ ">>>="
139+ "~"
140+ "^"
141+ "&"
142+ "|"
143+ "^="
144+ "&="
145+ "|="
146+ "&&"
147+ "||"
148+ "??"
149+ "&&="
150+ "||="
151+ "??="
152+] @operator
153+
154+[
155+ "("
156+ ")"
157+ "["
158+ "]"
159+ "{"
160+ "}"
161+] @punctuation.bracket
162+
163+[
164+ "as"
165+ "async"
166+ "await"
167+ "break"
168+ "case"
169+ "catch"
170+ "class"
171+ "const"
172+ "continue"
173+ "debugger"
174+ "default"
175+ "delete"
176+ "do"
177+ "else"
178+ "export"
179+ "extends"
180+ "finally"
181+ "for"
182+ "from"
183+ "function"
184+ "get"
185+ "if"
186+ "import"
187+ "in"
188+ "instanceof"
189+ "let"
190+ "new"
191+ "of"
192+ "return"
193+ "set"
194+ "static"
195+ "switch"
196+ "target"
197+ "throw"
198+ "try"
199+ "typeof"
200+ "var"
201+ "void"
202+ "while"
203+ "with"
204+ "yield"
205+] @keyword
runtime/queries/javascript/injections.scmnew file+20
@@ -0,0 +1,20 @@
1+; Parse the contents of tagged template literals using
2+; a language inferred from the tag.
3+
4+(call_expression
5+ function: [
6+ (identifier) @injection.language
7+ (member_expression
8+ property: (property_identifier) @injection.language)
9+ ]
10+ arguments: (template_string) @injection.content)
11+
12+; Parse regex syntax within regex literals
13+
14+((regex_pattern) @injection.content
15+ (#set! injection.language "regex"))
16+
17+ ; Parse JSDoc annotations in comments
18+
19+((comment) @injection.content
20+ (#set! injection.language "jsdoc"))
runtime/queries/javascript/locals.scmnew file+23
@@ -0,0 +1,23 @@
1+; Scopes
2+;-------
3+
4+[
5+ (statement_block)
6+ (function)
7+ (arrow_function)
8+ (function_declaration)
9+ (method_definition)
10+] @local.scope
11+
12+; Definitions
13+;------------
14+
15+(pattern/identifier)@local.definition
16+
17+(variable_declarator
18+ name: (identifier) @local.definition)
19+
20+; References
21+;------------
22+
23+(identifier) @local.reference
runtime/queries/javascript/tags.scmnew file+88
@@ -0,0 +1,88 @@
1+(
2+ (comment)* @doc
3+ .
4+ (method_definition
5+ name: (property_identifier) @name) @definition.method
6+ (#not-eq? @name "constructor")
7+ (#strip! @doc "^[\\s\\*/]+|^[\\s\\*/]$")
8+ (#select-adjacent! @doc @definition.method)
9+)
10+
11+(
12+ (comment)* @doc
13+ .
14+ [
15+ (class
16+ name: (_) @name)
17+ (class_declaration
18+ name: (_) @name)
19+ ] @definition.class
20+ (#strip! @doc "^[\\s\\*/]+|^[\\s\\*/]$")
21+ (#select-adjacent! @doc @definition.class)
22+)
23+
24+(
25+ (comment)* @doc
26+ .
27+ [
28+ (function
29+ name: (identifier) @name)
30+ (function_declaration
31+ name: (identifier) @name)
32+ (generator_function
33+ name: (identifier) @name)
34+ (generator_function_declaration
35+ name: (identifier) @name)
36+ ] @definition.function
37+ (#strip! @doc "^[\\s\\*/]+|^[\\s\\*/]$")
38+ (#select-adjacent! @doc @definition.function)
39+)
40+
41+(
42+ (comment)* @doc
43+ .
44+ (lexical_declaration
45+ (variable_declarator
46+ name: (identifier) @name
47+ value: [(arrow_function) (function)]) @definition.function)
48+ (#strip! @doc "^[\\s\\*/]+|^[\\s\\*/]$")
49+ (#select-adjacent! @doc @definition.function)
50+)
51+
52+(
53+ (comment)* @doc
54+ .
55+ (variable_declaration
56+ (variable_declarator
57+ name: (identifier) @name
58+ value: [(arrow_function) (function)]) @definition.function)
59+ (#strip! @doc "^[\\s\\*/]+|^[\\s\\*/]$")
60+ (#select-adjacent! @doc @definition.function)
61+)
62+
63+(assignment_expression
64+ left: [
65+ (identifier) @name
66+ (member_expression
67+ property: (property_identifier) @name)
68+ ]
69+ right: [(arrow_function) (function)]
70+) @definition.function
71+
72+(pair
73+ key: (property_identifier) @name
74+ value: [(arrow_function) (function)]) @definition.function
75+
76+(
77+ (call_expression
78+ function: (identifier) @name) @reference.call
79+ (#not-match? @name "^(require)$")
80+)
81+
82+(call_expression
83+ function: (member_expression
84+ property: (property_identifier) @name)
85+ arguments: (_) @reference.call)
86+
87+(new_expression
88+ constructor: (_) @name) @reference.class
runtime/queries/json/highlights.scmnew file+9
@@ -0,0 +1,9 @@
1+(pair
2+ key: (_) @keyword)
3+
4+(string) @string
5+
6+(object
7+ "{" @escape
8+ (_)
9+ "}" @escape)
runtime/queries/php/highlights.scmnew file+114
@@ -0,0 +1,114 @@
1+(php_tag) @tag
2+"?>" @tag
3+
4+; Types
5+
6+(primitive_type) @type.builtin
7+(cast_type) @type.builtin
8+(type_name (name) @type)
9+
10+; Functions
11+
12+(array_creation_expression "array" @function.builtin)
13+(list_literal "list" @function.builtin)
14+
15+(method_declaration
16+ name: (name) @function.method)
17+
18+(function_call_expression
19+ function: (qualified_name (name)) @function)
20+
21+(scoped_call_expression
22+ name: (name) @function)
23+
24+(member_call_expression
25+ name: (name) @function.method)
26+
27+(function_definition
28+ name: (name) @function)
29+
30+; Member
31+
32+(property_element
33+ (variable_name) @property)
34+
35+(member_access_expression
36+ name: (variable_name (name)) @property)
37+(member_access_expression
38+ name: (name) @property)
39+
40+; Variables
41+
42+(relative_scope) @variable.builtin
43+
44+((name) @constant
45+ (#match? @constant "^_?[A-Z][A-Z\d_]+$"))
46+
47+((name) @constructor
48+ (#match? @constructor "^[A-Z]"))
49+
50+((name) @variable.builtin
51+ (#eq? @variable.builtin "this"))
52+
53+(variable_name) @variable
54+
55+; Basic tokens
56+
57+(string) @string
58+(heredoc) @string
59+(boolean) @constant.builtin
60+(null) @constant.builtin
61+(integer) @number
62+(float) @number
63+(comment) @comment
64+
65+"$" @operator
66+
67+; Keywords
68+
69+"abstract" @keyword
70+"as" @keyword
71+"break" @keyword
72+"case" @keyword
73+"catch" @keyword
74+"class" @keyword
75+"const" @keyword
76+"continue" @keyword
77+"declare" @keyword
78+"default" @keyword
79+"do" @keyword
80+"echo" @keyword
81+"else" @keyword
82+"elseif" @keyword
83+"enddeclare" @keyword
84+"endforeach" @keyword
85+"endif" @keyword
86+"endswitch" @keyword
87+"endwhile" @keyword
88+"extends" @keyword
89+"final" @keyword
90+"finally" @keyword
91+"foreach" @keyword
92+"function" @keyword
93+"global" @keyword
94+"if" @keyword
95+"implements" @keyword
96+"include_once" @keyword
97+"include" @keyword
98+"insteadof" @keyword
99+"interface" @keyword
100+"namespace" @keyword
101+"new" @keyword
102+"private" @keyword
103+"protected" @keyword
104+"public" @keyword
105+"require_once" @keyword
106+"require" @keyword
107+"return" @keyword
108+"static" @keyword
109+"switch" @keyword
110+"throw" @keyword
111+"trait" @keyword
112+"try" @keyword
113+"use" @keyword
114+"while" @keyword
runtime/queries/php/injections.scmnew file+3
@@ -0,0 +1,3 @@
1+((text) @injection.content
2+ (#set! injection.language "html")
3+ (#set! injection.combined))
runtime/queries/php/tags.scmnew file+26
@@ -0,0 +1,26 @@
1+(class_declaration
2+ name: (name) @name) @definition.class
3+
4+(function_definition
5+ name: (name) @name) @definition.function
6+
7+(method_declaration
8+ name: (name) @name) @definition.function
9+
10+(object_creation_expression
11+ [
12+ (qualified_name (name) @name)
13+ (variable_name (name) @name)
14+ ]) @reference.class
15+
16+(function_call_expression
17+ function: [
18+ (qualified_name (name) @name)
19+ (variable_name (name)) @name
20+ ]) @reference.call
21+
22+(scoped_call_expression
23+ name: (name) @name) @reference.call
24+
25+(member_call_expression
26+ name: (name) @name) @reference.call
runtime/queries/python/highlights.scmnew file+124
@@ -0,0 +1,124 @@
1+; Identifier naming conventions
2+
3+((identifier) @constructor
4+ (#match? @constructor "^[A-Z]"))
5+
6+((identifier) @constant
7+ (#match? @constant "^[A-Z][A-Z_]*$"))
8+
9+; Builtin functions
10+
11+((call
12+ function: (identifier) @function.builtin)
13+ (#match?
14+ @function.builtin
15+ "^(abs|all|any|ascii|bin|bool|breakpoint|bytearray|bytes|callable|chr|classmethod|compile|complex|delattr|dict|dir|divmod|enumerate|eval|exec|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|isinstance|issubclass|iter|len|list|locals|map|max|memoryview|min|next|object|oct|open|ord|pow|print|property|range|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|vars|zip|__import__)$"))
16+
17+; Function calls
18+
19+(decorator) @function
20+
21+(call
22+ function: (attribute attribute: (identifier) @function.method))
23+(call
24+ function: (identifier) @function)
25+
26+; Function definitions
27+
28+(function_definition
29+ name: (identifier) @function)
30+
31+(identifier) @variable
32+(attribute attribute: (identifier) @property)
33+(type (identifier) @type)
34+
35+; Literals
36+
37+[
38+ (none)
39+ (true)
40+ (false)
41+] @constant.builtin
42+
43+[
44+ (integer)
45+ (float)
46+] @number
47+
48+(comment) @comment
49+(string) @string
50+(escape_sequence) @escape
51+
52+(interpolation
53+ "{" @punctuation.special
54+ "}" @punctuation.special) @embedded
55+
56+[
57+ "-"
58+ "-="
59+ "!="
60+ "*"
61+ "**"
62+ "**="
63+ "*="
64+ "/"
65+ "//"
66+ "//="
67+ "/="
68+ "&"
69+ "%"
70+ "%="
71+ "^"
72+ "+"
73+ "->"
74+ "+="
75+ "<"
76+ "<<"
77+ "<="
78+ "<>"
79+ "="
80+ ":="
81+ "=="
82+ ">"
83+ ">="
84+ ">>"
85+ "|"
86+ "~"
87+ "and"
88+ "in"
89+ "is"
90+ "not"
91+ "or"
92+] @operator
93+
94+[
95+ "as"
96+ "assert"
97+ "async"
98+ "await"
99+ "break"
100+ "class"
101+ "continue"
102+ "def"
103+ "del"
104+ "elif"
105+ "else"
106+ "except"
107+ "exec"
108+ "finally"
109+ "for"
110+ "from"
111+ "global"
112+ "if"
113+ "import"
114+ "lambda"
115+ "nonlocal"
116+ "pass"
117+ "print"
118+ "raise"
119+ "return"
120+ "try"
121+ "while"
122+ "with"
123+ "yield"
124+] @keyword
runtime/queries/python/tags.scmnew file+12
@@ -0,0 +1,12 @@
1+(class_definition
2+ name: (identifier) @name) @definition.class
3+
4+(function_definition
5+ name: (identifier) @name) @definition.function
6+
7+(call
8+ function: [
9+ (identifier) @name
10+ (attribute
11+ attribute: (identifier) @name)
12+ ]) @reference.call
runtime/queries/ruby/highlights.scmnew file+146
@@ -0,0 +1,146 @@
1+; Keywords
2+
3+[
4+ "alias"
5+ "and"
6+ "begin"
7+ "break"
8+ "case"
9+ "class"
10+ "def"
11+ "do"
12+ "else"
13+ "elsif"
14+ "end"
15+ "ensure"
16+ "for"
17+ "if"
18+ "in"
19+ "module"
20+ "next"
21+ "or"
22+ "rescue"
23+ "retry"
24+ "return"
25+ "then"
26+ "unless"
27+ "until"
28+ "when"
29+ "while"
30+ "yield"
31+] @keyword
32+
33+((identifier) @keyword
34+ (#match? @keyword "^(private|protected|public)$"))
35+
36+; Function calls
37+
38+((identifier) @function.method.builtin
39+ (#eq? @function.method.builtin "require"))
40+
41+"defined?" @function.method.builtin
42+
43+(call
44+ method: [(identifier) (constant)] @function.method)
45+
46+; Function definitions
47+
48+(alias (identifier) @function.method)
49+(setter (identifier) @function.method)
50+(method name: [(identifier) (constant)] @function.method)
51+(singleton_method name: [(identifier) (constant)] @function.method)
52+
53+; Identifiers
54+
55+[
56+ (class_variable)
57+ (instance_variable)
58+] @property
59+
60+((identifier) @constant.builtin
61+ (#match? @constant.builtin "^__(FILE|LINE|ENCODING)__$"))
62+
63+((constant) @constant
64+ (#match? @constant "^[A-Z\\d_]+$"))
65+
66+(constant) @constructor
67+
68+(self) @variable.builtin
69+(super) @variable.builtin
70+
71+(block_parameter (identifier) @variable.parameter)
72+(block_parameters (identifier) @variable.parameter)
73+(destructured_parameter (identifier) @variable.parameter)
74+(hash_splat_parameter (identifier) @variable.parameter)
75+(lambda_parameters (identifier) @variable.parameter)
76+(method_parameters (identifier) @variable.parameter)
77+(splat_parameter (identifier) @variable.parameter)
78+
79+(keyword_parameter name: (identifier) @variable.parameter)
80+(optional_parameter name: (identifier) @variable.parameter)
81+
82+((identifier) @function.method
83+ (#is-not? local))
84+(identifier) @variable
85+
86+; Literals
87+
88+[
89+ (string)
90+ (bare_string)
91+ (subshell)
92+ (heredoc_body)
93+ (heredoc_beginning)
94+] @string
95+
96+[
97+ (simple_symbol)
98+ (delimited_symbol)
99+ (hash_key_symbol)
100+ (bare_symbol)
101+] @string.special.symbol
102+
103+(regex) @string.special.regex
104+(escape_sequence) @escape
105+
106+[
107+ (integer)
108+ (float)
109+] @number
110+
111+[
112+ (nil)
113+ (true)
114+ (false)
115+]@constant.builtin
116+
117+(interpolation
118+ "#{" @punctuation.special
119+ "}" @punctuation.special) @embedded
120+
121+(comment) @comment
122+
123+; Operators
124+
125+[
126+"="
127+"=>"
128+"->"
129+] @operator
130+
131+[
132+ ","
133+ ";"
134+ "."
135+] @punctuation.delimiter
136+
137+[
138+ "("
139+ ")"
140+ "["
141+ "]"
142+ "{"
143+ "}"
144+ "%w("
145+ "%i("
146+] @punctuation.bracket
runtime/queries/ruby/locals.scmnew file+27
@@ -0,0 +1,27 @@
1+((method) @local.scope
2+ (#set! local.scope-inherits false))
3+
4+[
5+ (lambda)
6+ (block)
7+ (do_block)
8+] @local.scope
9+
10+(block_parameter (identifier) @local.definition)
11+(block_parameters (identifier) @local.definition)
12+(destructured_parameter (identifier) @local.definition)
13+(hash_splat_parameter (identifier) @local.definition)
14+(lambda_parameters (identifier) @local.definition)
15+(method_parameters (identifier) @local.definition)
16+(splat_parameter (identifier) @local.definition)
17+
18+(keyword_parameter name: (identifier) @local.definition)
19+(optional_parameter name: (identifier) @local.definition)
20+
21+(identifier) @local.reference
22+
23+(assignment left: (identifier) @local.definition)
24+(operator_assignment left: (identifier) @local.definition)
25+(left_assignment_list (identifier) @local.definition)
26+(rest_assignment (identifier) @local.definition)
27+(destructured_left_assignment (identifier) @local.definition)
runtime/queries/ruby/tags.scmnew file+64
@@ -0,0 +1,64 @@
1+; Method definitions
2+
3+(
4+ (comment)* @doc
5+ .
6+ [
7+ (method
8+ name: (_) @name) @definition.method
9+ (singleton_method
10+ name: (_) @name) @definition.method
11+ ]
12+ (#strip! @doc "^#\\s*")
13+ (#select-adjacent! @doc @definition.method)
14+)
15+
16+(alias
17+ name: (_) @name) @definition.method
18+
19+(setter
20+ (identifier) @ignore)
21+
22+; Class definitions
23+
24+(
25+ (comment)* @doc
26+ .
27+ [
28+ (class
29+ name: [
30+ (constant) @name
31+ (scope_resolution
32+ name: (_) @name)
33+ ]) @definition.class
34+ (singleton_class
35+ value: [
36+ (constant) @name
37+ (scope_resolution
38+ name: (_) @name)
39+ ]) @definition.class
40+ ]
41+ (#strip! @doc "^#\\s*")
42+ (#select-adjacent! @doc @definition.class)
43+)
44+
45+; Module definitions
46+
47+(
48+ (module
49+ name: [
50+ (constant) @name
51+ (scope_resolution
52+ name: (_) @name)
53+ ]) @definition.module
54+)
55+
56+; Calls
57+
58+(call method: (identifier) @name) @reference.call
59+
60+(
61+ [(identifier) (constant)] @name @reference.call
62+ (#is-not? local)
63+ (#not-match? @name "^(lambda|load|require|require_relative|__FILE__|__LINE__)$")
64+)
runtime/queries/toml/highlights.scmnew file+33
@@ -0,0 +1,33 @@
1+; Properties
2+;-----------
3+
4+(bare_key) @property
5+(quoted_key) @string
6+
7+; Literals
8+;---------
9+
10+(boolean) @constant.builtin
11+(comment) @comment
12+(string) @string
13+(integer) @number
14+(float) @number
15+(offset_date_time) @string.special
16+(local_date_time) @string.special
17+(local_date) @string.special
18+(local_time) @string.special
19+
20+; Punctuation
21+;------------
22+
23+"." @punctuation.delimiter
24+"," @punctuation.delimiter
25+
26+"=" @operator
27+
28+"[" @punctuation.bracket
29+"]" @punctuation.bracket
30+"[[" @punctuation.bracket
31+"]]" @punctuation.bracket
32+"{" @punctuation.bracket
33+"}" @punctuation.bracket