Config to switch to semantic tokens
This commit is contained in:
@@ -27,7 +27,7 @@ export async function createClient(config: Config, serverPath: string): Promise<
|
||||
const clientOptions: lc.LanguageClientOptions = {
|
||||
documentSelector: [{ scheme: 'file', language: 'rust' }],
|
||||
initializationOptions: {
|
||||
publishDecorations: true,
|
||||
publishDecorations: !config.highlightingSemanticTokens,
|
||||
lruCapacity: config.lruCapacity,
|
||||
maxInlayHintLength: config.maxInlayHintLength,
|
||||
cargoWatchEnable: cargoWatchOpts.enable,
|
||||
@@ -84,7 +84,10 @@ export async function createClient(config: Config, serverPath: string): Promise<
|
||||
// Here we want to just enable CallHierarchyFeature since it is available on stable.
|
||||
// Note that while the CallHierarchyFeature is stable the LSP protocol is not.
|
||||
res.registerFeature(new CallHierarchyFeature(res));
|
||||
res.registerFeature(new SemanticTokensFeature(res));
|
||||
|
||||
if (config.highlightingSemanticTokens) {
|
||||
res.registerFeature(new SemanticTokensFeature(res));
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ export class Config {
|
||||
private static readonly requiresReloadOpts = [
|
||||
"cargoFeatures",
|
||||
"cargo-watch",
|
||||
"highlighting.semanticTokens"
|
||||
]
|
||||
.map(opt => `${Config.rootSection}.${opt}`);
|
||||
|
||||
@@ -143,6 +144,7 @@ export class Config {
|
||||
// We don't do runtime config validation here for simplicity. More on stackoverflow:
|
||||
// https://stackoverflow.com/questions/60135780/what-is-the-best-way-to-type-check-the-configuration-for-vscode-extension
|
||||
|
||||
get highlightingSemanticTokens() { return this.cfg.get("highlighting.semanticTokens") as boolean; }
|
||||
get highlightingOn() { return this.cfg.get("highlightingOn") as boolean; }
|
||||
get rainbowHighlightingOn() { return this.cfg.get("rainbowHighlightingOn") as boolean; }
|
||||
get lruCapacity() { return this.cfg.get("lruCapacity") as null | number; }
|
||||
|
||||
@@ -89,7 +89,9 @@ export async function activate(context: vscode.ExtensionContext) {
|
||||
|
||||
activateStatusDisplay(ctx);
|
||||
|
||||
activateHighlighting(ctx);
|
||||
if (!ctx.config.highlightingSemanticTokens) {
|
||||
activateHighlighting(ctx);
|
||||
}
|
||||
activateInlayHints(ctx);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user