Skip to content

Commit e0f9330

Browse files
committed
Highlight operators.
1 parent 027ca4b commit e0f9330

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

analysis/src/SemanticTokens.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module Token = struct
44
(* This needs to stay synced with the same legend in `server.ts` *)
55
(* See https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_semanticTokens *)
66
type tokenType =
7-
| Keyword
7+
| Operator
88
| Variable
99
| Type
1010
| JsxTag
@@ -16,7 +16,7 @@ module Token = struct
1616
type tokenModifiers = NoModifier
1717

1818
let tokenTypeToString = function
19-
| Keyword -> "0"
19+
| Operator -> "0"
2020
| Variable -> "1"
2121
| Type -> "2"
2222
| JsxTag -> "3"
@@ -26,7 +26,7 @@ module Token = struct
2626
| JsxLowercase -> "7"
2727

2828
let tokenTypeDebug = function
29-
| Keyword -> "Keyword"
29+
| Operator -> "Operator"
3030
| Variable -> "Variable"
3131
| Type -> "Type"
3232
| JsxTag -> "JsxTag"
@@ -298,7 +298,7 @@ let parser ~debug ~emitter ~path =
298298
},
299299
[_; _] ) ->
300300
if debug then Printf.printf "Binary operator %s %s\n" op (locToString loc);
301-
emitter |> emitFromLoc ~loc ~type_:Keyword;
301+
emitter |> emitFromLoc ~loc ~type_:Operator;
302302
Ast_mapper.default_mapper.expr mapper e
303303
| Pexp_record (cases, _) ->
304304
cases

grammars/rescript.tmLanguage.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@
255255
"patterns": [
256256
{
257257
"match": "->|\\|\\||&&|\\+\\+|\\*\\*|\\+\\.|\\+|-\\.|-|\\*\\.|\\*|/\\.|/|\\.\\.\\.|\\.\\.|===|==|\\^|:=|!|>=(?! *\\?)|<=|=",
258-
"name": "keyword.operator keyword"
258+
"name": "keyword.operator"
259259
},
260260
{
261261
"match": "\\|>",

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@
3232
{
3333
"scopes": {
3434
"jsx-lowercase": ["entity.name.tag"],
35-
"jsx-tag": ["punctuation.definition.tag"],
36-
"keyword-tag": ["keyword"]
35+
"jsx-tag": ["punctuation.definition.tag"]
3736
}
3837
}
3938
],

server/src/server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,7 @@ function onMessage(msg: m.Message) {
761761
semanticTokensProvider: {
762762
legend: {
763763
tokenTypes: [
764-
"keyword-tag",
764+
"operator",
765765
"variable",
766766
"type",
767767
"jsx-tag",

0 commit comments

Comments
 (0)