Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 673008a

Browse files
committed
Auto merge of rust-lang#14822 - Veykril:augmentsSyntaxTokens-vscode, r=Veykril
fix: Force disable augmentsSyntaxTokens capability on VSCode The default textmate grammar for rust in VSCode is pretty brittle, quite often coloring things very differently than we'd like to so we force full semantic highlighting by disabling that config.
2 parents c7b0349 + 0028e73 commit 673008a

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

editors/code/src/client.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,7 @@ export async function createClient(
366366

367367
// To turn on all proposed features use: client.registerProposedFeatures();
368368
client.registerFeature(new ExperimentalFeatures());
369+
client.registerFeature(new OverrideFeatures());
369370

370371
return client;
371372
}
@@ -401,6 +402,25 @@ class ExperimentalFeatures implements lc.StaticFeature {
401402
dispose(): void {}
402403
}
403404

405+
class OverrideFeatures implements lc.StaticFeature {
406+
getState(): lc.FeatureState {
407+
return { kind: "static" };
408+
}
409+
fillClientCapabilities(capabilities: lc.ClientCapabilities): void {
410+
// Force disable `augmentsSyntaxTokens`, VSCode's textmate grammar is somewhat incomplete
411+
// making the experience generally worse
412+
const caps = capabilities.textDocument?.semanticTokens;
413+
if (caps) {
414+
caps.augmentsSyntaxTokens = false;
415+
}
416+
}
417+
initialize(
418+
_capabilities: lc.ServerCapabilities,
419+
_documentSelector: lc.DocumentSelector | undefined
420+
): void {}
421+
dispose(): void {}
422+
}
423+
404424
function isCodeActionWithoutEditsAndCommands(value: any): boolean {
405425
const candidate: lc.CodeAction = value;
406426
return (

0 commit comments

Comments
 (0)