Skip to content

Commit 74747f6

Browse files
committed
fix: nested function call highlighting
1 parent 1407f3a commit 74747f6

File tree

2 files changed

+34
-4
lines changed

2 files changed

+34
-4
lines changed

syntaxes/source.tmLanguage.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,15 +209,17 @@ repository:
209209
function-call:
210210
patterns:
211211
- name: meta.function-call
212-
match: (\w+)\((.+)\)
212+
match: (\w+)(\()([^)]*)(\))
213213
captures:
214214
"1": { name: entity.name.function }
215-
"2": { patterns: [{ include: "#expression" }] }
215+
"2": { name: meta.brace.round }
216+
"3": { patterns: [{ include: "#expression" }] }
217+
"4": { name: meta.brace.round }
216218
- name: meta.function-call
217219
begin: (\w+)(\()
218220
beginCaptures:
219-
"0": { name: entity.name.function }
220-
"1": { name: meta.brace.round }
221+
"1": { name: entity.name.function }
222+
"2": { name: meta.brace.round }
221223
end: \)
222224
endCaptures:
223225
"0": { name: meta.brace.round }

tests/syntaxes/function-call.test

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// SYNTAX TEST "source.source" "function-call"
2+
3+
f()
4+
// <- entity.name.function
5+
// <~-- meta.brace.round
6+
7+
f(1)
8+
// <- entity.name.function
9+
// <~- meta.brace.round
10+
// <~~- constant.numeric.integer.decimal
11+
// ^ meta.brace.round
12+
13+
f(1, "hello")
14+
// <- entity.name.function
15+
// <~- meta.brace.round
16+
// <~~- constant.numeric.integer.decimal
17+
// ^^^^^^^ string.quoted.double
18+
// ^ meta.brace.round
19+
20+
f(
21+
// <~- meta.brace.round
22+
)
23+
// <- meta.brace.round
24+
25+
f(
26+
// <~- meta.brace.round
27+
g())
28+
// <~--- meta.brace.round

0 commit comments

Comments
 (0)