Skip to content

Commit 269e303

Browse files
committed
variable highlight fixes take 2
1 parent 8f35457 commit 269e303

File tree

1 file changed

+27
-7
lines changed

1 file changed

+27
-7
lines changed

public_grammars/cesium.tmGrammar.json

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
{ "include": "#keywords" },
1111
{ "include": "#function-declarations" },
1212
{ "include": "#struct-declarations" },
13+
{ "include": "#variable-declarations" },
1314
{ "include": "#types" },
1415
{ "include": "#strings" },
1516
{ "include": "#numbers" },
@@ -118,6 +119,25 @@
118119
}
119120
]
120121
},
122+
"variable-declarations": {
123+
"patterns": [
124+
{
125+
"name": "meta.variable.declaration.cesium",
126+
"match": "\\b([~#]?[a-zA-Z_][a-zA-Z0-9_]*(?:\\[[^\\]]*\\])?)\\s+([a-zA-Z_][a-zA-Z0-9_]*)(?=\\s*[=,;])",
127+
"captures": {
128+
"1": { "name": "storage.type.cesium" },
129+
"2": { "name": "variable.other.readwrite.cesium" }
130+
}
131+
},
132+
{
133+
"name": "meta.variable.assignment.cesium",
134+
"match": "\\b([a-zA-Z_][a-zA-Z0-9_]*)(?=\\s*=)",
135+
"captures": {
136+
"1": { "name": "variable.other.readwrite.cesium" }
137+
}
138+
}
139+
]
140+
},
121141
"struct-methods": {
122142
"patterns": [
123143
{
@@ -245,10 +265,14 @@
245265
"patterns": [
246266
{
247267
"name": "support.function.builtin.cesium",
248-
"match": "\\b(alloc|free|realloc|printf|debugf|assert|floor|ceil|trunc|round|trueround|abs|min|max|mean|norm)\\b"
268+
"match": "\\b(alloc|free|realloc|printf|debugf|assert|floor|ceil|trunc|round|trueround|abs|min|max|mean|norm)(?=\\s*\\()"
269+
},
270+
{
271+
"name": "support.function.method.cesium",
272+
"match": "(?<=\\.)[a-zA-Z_][a-zA-Z0-9_]*(?=\\s*\\()"
249273
},
250274
{
251-
"name": "entity.name.function.cesium",
275+
"name": "entity.name.function.call.cesium",
252276
"match": "\\b[a-zA-Z_][a-zA-Z0-9_]*(?=\\s*\\()"
253277
},
254278
{
@@ -261,11 +285,7 @@
261285
},
262286
{
263287
"name": "variable.other.property.cesium",
264-
"match": "\\b[a-zA-Z_][a-zA-Z0-9_]*(?=\\s*\\.[a-zA-Z_])"
265-
},
266-
{
267-
"name": "variable.other.property.cesium",
268-
"match": "(?<=\\.)[a-zA-Z_][a-zA-Z0-9_]*"
288+
"match": "(?<=\\.)[a-zA-Z_][a-zA-Z0-9_]*(?!\\s*\\()"
269289
},
270290
{
271291
"name": "variable.other.readwrite.cesium",

0 commit comments

Comments
 (0)