Skip to content

Commit 6af9a0f

Browse files
ThoriumNsidorenco
authored andcommitted
fix: narrow function.call highlight to identifier in application expressions
The application_expression highlight query previously used a wildcard (_) @function.call that captured the entire first child node. For generic constructor calls like ResizeArray<string>(), this meant the typed_expression spanning 'ResizeArray<string>' was tagged as function.call, causing the '<' at column 19 to incorrectly receive the function.call highlight instead of a bracket highlight. Changes: - Replace the single broad application_expression query with four specific patterns that target only the identifier within long_identifier_or_op, dot_expression, and their typed_expression variants - Add typed_expression '>' @punctuation.bracket to highlight the closing angle bracket consistently with generic_type (the opening '<' uses the _tyapp_open external token which is anonymous and unmatchable in queries) - Update test expectations: remove assertions for '<' (unmatchable) and change '>' from operator to punctuation.bracket
1 parent b3866ac commit 6af9a0f

2 files changed

Lines changed: 34 additions & 6 deletions

File tree

‎queries/highlights.scm‎

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,35 @@
116116

117117
(application_expression
118118
.
119-
(_) @function.call
119+
(long_identifier_or_op
120+
(identifier) @function.call)
121+
.
122+
(_) @variable)
123+
124+
(application_expression
125+
.
126+
(dot_expression
127+
field: (long_identifier_or_op
128+
(identifier) @function.call))
129+
.
130+
(_) @variable)
131+
132+
(application_expression
133+
.
134+
(typed_expression
135+
(long_identifier_or_op
136+
(identifier) @function.call)
137+
(_))
138+
.
139+
(_) @variable)
140+
141+
(application_expression
142+
.
143+
(typed_expression
144+
(dot_expression
145+
field: (long_identifier_or_op
146+
(identifier) @function.call))
147+
(_))
120148
.
121149
(_) @variable)
122150

@@ -240,6 +268,9 @@
240268
">"
241269
] @punctuation.bracket)
242270

271+
(typed_expression
272+
">" @punctuation.bracket)
273+
243274
[
244275
"if"
245276
"then"

‎test/highlight/type_definitions.fsx‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,24 @@ let x = ResizeArray<string>()
1010
//<- keyword.function
1111
// ^ variable
1212
// ^ function.call
13-
// ^ operator
1413
// ^ type.builtin
15-
// ^ operator
14+
// ^ punctuation.bracket
1615
// ^ variable
1716
// ^ variable
1817

1918
let x = ResizeArray<A>()
2019
//<- keyword.function
2120
// ^ variable
2221
// ^ function.call
23-
// ^ operator
2422
// ^ type
25-
// ^ operator
23+
// ^ punctuation.bracket
2624
// ^ variable
2725
// ^ variable
2826

2927
let x = ResizeArray<{|word: string |}>()
3028
//<- keyword.function
3129
// ^ variable
3230
// ^ function.call
33-
// ^ operator
3431
// ^ punctuation.bracket
3532
// ^ punctuation.bracket
3633
// ^ property

0 commit comments

Comments
 (0)