Skip to content

Commit f923248

Browse files
[tree-sitter] Add some scopes to the C++ highlights.scm
1 parent d42bae7 commit f923248

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

packages/language-c/grammars/tree-sitter-cpp/highlights.scm

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,11 @@
124124
(function_declarator
125125
(identifier) @entity.name.function.cpp)
126126

127+
; The "foo" in `void Bar::foo () {`.
128+
(function_declarator
129+
declarator: (qualified_identifier
130+
name: (identifier) @entity.name.function.cpp))
131+
127132
(function_declarator
128133
(field_identifier) @entity.name.function.method.cpp)
129134

@@ -139,6 +144,12 @@
139144
field: (field_identifier) @support.other.function.cpp)
140145
(#set! capture.final true))
141146

147+
; The "foo" in `troz::foo(...)`.
148+
(call_expression
149+
function: (qualified_identifier
150+
name: (identifier) @support.other.function.cpp)
151+
(#set! capture.final true))
152+
142153
(call_expression
143154
(identifier) @support.other.function.cpp
144155
(#set! capture.final true))
@@ -206,6 +217,11 @@
206217
(assignment_expression
207218
left: (identifier) @variable.other.assignment.cpp)
208219

220+
; The "foo" in `bar.foo = "baz"`.
221+
(assignment_expression
222+
left: (field_expression
223+
field: (field_identifier) @variable.other.member.assignment.cpp))
224+
209225
(reference_declarator
210226
(identifier) @variable.declaration.cpp)
211227

0 commit comments

Comments
 (0)