Skip to content

Commit 2ebe7a6

Browse files
committed
color annotations like decorators in TS
1 parent eae98df commit 2ebe7a6

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

analysis/examples/example-project/src/syntax/sample-highlighting.tsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,23 @@ namespace SomeModule {
4646
}
4747
}
4848

49+
// Decorators and classes
50+
function someDecorator() {
51+
return function (
52+
target: any,
53+
propertyKey: string,
54+
descriptor: PropertyDescriptor
55+
) {
56+
console.log("first(): called");
57+
};
58+
}
59+
60+
class SomeClass {
61+
@someDecorator() doStuff() {
62+
return 123;
63+
}
64+
}
65+
4966
// Strings
5067
let interpolated = `${numberBinding} ${"123"}`;
5168

@@ -70,3 +87,6 @@ let jsx = (
7087
{"Hello"}
7188
</div>
7289
);
90+
function Property() {
91+
throw new Error("Function not implemented.");
92+
}

grammars/rescript.tmLanguage.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@
308308
"match": "(%%?|@@?)([A-Za-z_][A-Za-z0-9_\\.]*)",
309309
"captures": {
310310
"1": {
311-
"name": "storage.modifier punctuation.definition.annotation"
311+
"name": "punctuation.decorator"
312312
},
313313
"2": {
314314
"patterns": [
@@ -327,13 +327,13 @@
327327
"name": "invalid.deprecated"
328328
},
329329
"2": {
330-
"name": "variable.annotation"
330+
"name": "entity.name.function"
331331
}
332332
}
333333
},
334334
{
335335
"match": "[A-Za-z_][A-Za-z0-9_\\.]*",
336-
"name": "variable.annotation"
336+
"name": "entity.name.function"
337337
}
338338
]
339339
}

0 commit comments

Comments
 (0)