From b3c33b219c0c72a8a3e3a6b1f98da24828f6291b Mon Sep 17 00:00:00 2001 From: Cristiano Calcagno Date: Thu, 5 May 2022 10:37:51 +0200 Subject: [PATCH 1/3] Syntax highlighting: support more themes. Instead of semantic token `type` use `support.type` from the grammar. This is what TypeScript does too. For keywords from the grammar, use `storage.type` instead of `keyword`. Again this is taken from what TS does. This change is a no-op on the themes considered so far. But improves theme `Solarized Light`. There seems to be no way to fix `Mariana Pro (Warm)`, which completely disables semantic highlighting. Looks like TS has the same problem there. --- grammars/rescript.tmLanguage.json | 2 +- package.json | 3 ++- server/src/server.ts | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/grammars/rescript.tmLanguage.json b/grammars/rescript.tmLanguage.json index 1b2f0278f..5d36e5d53 100644 --- a/grammars/rescript.tmLanguage.json +++ b/grammars/rescript.tmLanguage.json @@ -38,7 +38,7 @@ "match": "\\b(false|true)\\b" }, "RE_KEYWORD": { - "name": "keyword", + "name": "storage.type", "match": "\\b(include|let|module|of|open|type)\\b" }, "commentLine": { diff --git a/package.json b/package.json index 17563d644..13c41a41d 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,8 @@ { "scopes": { "jsx-lowercase": ["entity.name.tag"], - "jsx-tag": ["punctuation.definition.tag"] + "jsx-tag": ["punctuation.definition.tag"], + "support-type": ["support.type"] } } ], diff --git a/server/src/server.ts b/server/src/server.ts index 1bd547988..50817f465 100644 --- a/server/src/server.ts +++ b/server/src/server.ts @@ -815,7 +815,7 @@ function onMessage(msg: m.Message) { tokenTypes: [ "operator", "variable", - "type", + "support-type", "jsx-tag", "class", "enumMember", From a456d0292dc97af7af5ce3b5927c57071b7545b4 Mon Sep 17 00:00:00 2001 From: Cristiano Calcagno Date: Thu, 5 May 2022 12:19:55 +0200 Subject: [PATCH 2/3] Make "One Dark Pro" theme happy. --- package.json | 2 +- server/src/server.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 13c41a41d..73a42a3f6 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "scopes": { "jsx-lowercase": ["entity.name.tag"], "jsx-tag": ["punctuation.definition.tag"], - "support-type": ["support.type"] + "support-type-primitive": ["support.type.primitive"] } } ], diff --git a/server/src/server.ts b/server/src/server.ts index 50817f465..4c1c7b544 100644 --- a/server/src/server.ts +++ b/server/src/server.ts @@ -815,7 +815,7 @@ function onMessage(msg: m.Message) { tokenTypes: [ "operator", "variable", - "support-type", + "support-type-primitive", "jsx-tag", "class", "enumMember", From ebbfae8a58a61d81d74c84cd86cab0897ccb1ac5 Mon Sep 17 00:00:00 2001 From: Cristiano Calcagno Date: Thu, 5 May 2022 12:20:08 +0200 Subject: [PATCH 3/3] Un-recommend Mariana Pro]. --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 5e6bf4c97..0535413a4 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,6 @@ Our highlighting works well with most popular VSCode themes, such as: - Monokai Dimmed - Tomorrow Night Blue - [One Dark Pro](https://marketplace.visualstudio.com/items?itemName=zhuangtongfa.Material-theme) -- [Mariana Pro](https://marketplace.visualstudio.com/items?itemName=rickynormandeau.mariana-pro) The only 2 themes we don't (and can't) support, due to their lack of coloring, are: