Skip to content

Commit 0ea5d87

Browse files
authored
queries(rust): Highlight tacit functions when we are 100% sure they are (#14350)
1 parent 6b73c3c commit 0ea5d87

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

runtime/queries/rust/highlights.scm

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,23 @@
305305
; Functions
306306
; -------
307307

308+
; highlight `baz` in `any_function(foo::bar::baz)` as function
309+
; This generically works for an unlimited number of path segments:
310+
;
311+
; - `f(foo::bar)`
312+
; - `f(foo::bar::baz)`
313+
; - `f(foo::bar::baz::quux)`
314+
;
315+
; We know that in the above examples, the last component of each path is a function
316+
; as the only other valid thing (following Rust naming conventions) would be a module at
317+
; that position, however you cannot pass modules as arguments
318+
(call_expression
319+
function: _
320+
arguments: (arguments
321+
(scoped_identifier
322+
path: _
323+
name: (identifier) @function)))
324+
308325
(call_expression
309326
function: [
310327
((identifier) @function)

0 commit comments

Comments
 (0)