aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src
diff options
context:
space:
mode:
Diffstat (limited to 'editors/code/src')
-rw-r--r--editors/code/src/client.ts8
-rw-r--r--editors/code/src/config.ts2
-rw-r--r--editors/code/src/main.ts4
3 files changed, 12 insertions, 2 deletions
diff --git a/editors/code/src/client.ts b/editors/code/src/client.ts
index aaf2ef40e..44bd04c21 100644
--- a/editors/code/src/client.ts
+++ b/editors/code/src/client.ts
@@ -3,6 +3,7 @@ import * as vscode from 'vscode';
3 3
4import { Config } from './config'; 4import { Config } from './config';
5import { CallHierarchyFeature } from 'vscode-languageclient/lib/callHierarchy.proposed'; 5import { CallHierarchyFeature } from 'vscode-languageclient/lib/callHierarchy.proposed';
6import { SemanticTokensFeature } from 'vscode-languageclient/lib/semanticTokens.proposed';
6 7
7export async function createClient(config: Config, serverPath: string): Promise<lc.LanguageClient> { 8export async function createClient(config: Config, serverPath: string): Promise<lc.LanguageClient> {
8 // '.' Is the fallback if no folder is open 9 // '.' Is the fallback if no folder is open
@@ -26,7 +27,7 @@ export async function createClient(config: Config, serverPath: string): Promise<
26 const clientOptions: lc.LanguageClientOptions = { 27 const clientOptions: lc.LanguageClientOptions = {
27 documentSelector: [{ scheme: 'file', language: 'rust' }], 28 documentSelector: [{ scheme: 'file', language: 'rust' }],
28 initializationOptions: { 29 initializationOptions: {
29 publishDecorations: true, 30 publishDecorations: !config.highlightingSemanticTokens,
30 lruCapacity: config.lruCapacity, 31 lruCapacity: config.lruCapacity,
31 maxInlayHintLength: config.maxInlayHintLength, 32 maxInlayHintLength: config.maxInlayHintLength,
32 cargoWatchEnable: cargoWatchOpts.enable, 33 cargoWatchEnable: cargoWatchOpts.enable,
@@ -83,5 +84,10 @@ export async function createClient(config: Config, serverPath: string): Promise<
83 // Here we want to just enable CallHierarchyFeature since it is available on stable. 84 // Here we want to just enable CallHierarchyFeature since it is available on stable.
84 // Note that while the CallHierarchyFeature is stable the LSP protocol is not. 85 // Note that while the CallHierarchyFeature is stable the LSP protocol is not.
85 res.registerFeature(new CallHierarchyFeature(res)); 86 res.registerFeature(new CallHierarchyFeature(res));
87
88 if (config.highlightingSemanticTokens) {
89 res.registerFeature(new SemanticTokensFeature(res));
90 }
91
86 return res; 92 return res;
87} 93}
diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts
index 47e8cd45d..bf915102c 100644
--- a/editors/code/src/config.ts
+++ b/editors/code/src/config.ts
@@ -22,6 +22,7 @@ export class Config {
22 private static readonly requiresReloadOpts = [ 22 private static readonly requiresReloadOpts = [
23 "cargoFeatures", 23 "cargoFeatures",
24 "cargo-watch", 24 "cargo-watch",
25 "highlighting.semanticTokens"
25 ] 26 ]
26 .map(opt => `${Config.rootSection}.${opt}`); 27 .map(opt => `${Config.rootSection}.${opt}`);
27 28
@@ -143,6 +144,7 @@ export class Config {
143 // We don't do runtime config validation here for simplicity. More on stackoverflow: 144 // We don't do runtime config validation here for simplicity. More on stackoverflow:
144 // https://stackoverflow.com/questions/60135780/what-is-the-best-way-to-type-check-the-configuration-for-vscode-extension 145 // https://stackoverflow.com/questions/60135780/what-is-the-best-way-to-type-check-the-configuration-for-vscode-extension
145 146
147 get highlightingSemanticTokens() { return this.cfg.get("highlighting.semanticTokens") as boolean; }
146 get highlightingOn() { return this.cfg.get("highlightingOn") as boolean; } 148 get highlightingOn() { return this.cfg.get("highlightingOn") as boolean; }
147 get rainbowHighlightingOn() { return this.cfg.get("rainbowHighlightingOn") as boolean; } 149 get rainbowHighlightingOn() { return this.cfg.get("rainbowHighlightingOn") as boolean; }
148 get lruCapacity() { return this.cfg.get("lruCapacity") as null | number; } 150 get lruCapacity() { return this.cfg.get("lruCapacity") as null | number; }
diff --git a/editors/code/src/main.ts b/editors/code/src/main.ts
index 424ff1ac3..ecf53cf77 100644
--- a/editors/code/src/main.ts
+++ b/editors/code/src/main.ts
@@ -89,7 +89,9 @@ export async function activate(context: vscode.ExtensionContext) {
89 89
90 activateStatusDisplay(ctx); 90 activateStatusDisplay(ctx);
91 91
92 activateHighlighting(ctx); 92 if (!ctx.config.highlightingSemanticTokens) {
93 activateHighlighting(ctx);
94 }
93 activateInlayHints(ctx); 95 activateInlayHints(ctx);
94} 96}
95 97