aboutsummaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
Diffstat (limited to 'editors')
-rw-r--r--editors/code/package.json7
-rw-r--r--editors/code/src/client.ts16
-rw-r--r--editors/code/src/config.ts1
-rw-r--r--editors/code/src/ctx.ts2
4 files changed, 8 insertions, 18 deletions
diff --git a/editors/code/package.json b/editors/code/package.json
index 94edc6eeb..0bf7b6ae6 100644
--- a/editors/code/package.json
+++ b/editors/code/package.json
@@ -21,7 +21,7 @@
21 "Programming Languages" 21 "Programming Languages"
22 ], 22 ],
23 "engines": { 23 "engines": {
24 "vscode": "^1.43.0" 24 "vscode": "^1.44.0"
25 }, 25 },
26 "enableProposedApi": true, 26 "enableProposedApi": true,
27 "scripts": { 27 "scripts": {
@@ -342,11 +342,6 @@
342 "default": true, 342 "default": true,
343 "description": "Show function name and docs in parameter hints" 343 "description": "Show function name and docs in parameter hints"
344 }, 344 },
345 "rust-analyzer.highlighting.semanticTokens": {
346 "type": "boolean",
347 "default": false,
348 "description": "Use proposed semantic tokens API for syntax highlighting"
349 },
350 "rust-analyzer.updates.channel": { 345 "rust-analyzer.updates.channel": {
351 "type": "string", 346 "type": "string",
352 "enum": [ 347 "enum": [
diff --git a/editors/code/src/client.ts b/editors/code/src/client.ts
index 3b1d00bca..0ad4b63ae 100644
--- a/editors/code/src/client.ts
+++ b/editors/code/src/client.ts
@@ -1,11 +1,10 @@
1import * as lc from 'vscode-languageclient'; 1import * as lc from 'vscode-languageclient';
2import * as vscode from 'vscode'; 2import * as vscode from 'vscode';
3 3
4import { Config } from './config';
5import { CallHierarchyFeature } from 'vscode-languageclient/lib/callHierarchy.proposed'; 4import { CallHierarchyFeature } from 'vscode-languageclient/lib/callHierarchy.proposed';
6import { SemanticTokensFeature, DocumentSemanticsTokensSignature } from 'vscode-languageclient/lib/semanticTokens.proposed'; 5import { SemanticTokensFeature, DocumentSemanticsTokensSignature } from 'vscode-languageclient/lib/semanticTokens.proposed';
7 6
8export async function createClient(config: Config, serverPath: string, cwd: string): Promise<lc.LanguageClient> { 7export async function createClient(serverPath: string, cwd: string): Promise<lc.LanguageClient> {
9 // '.' Is the fallback if no folder is open 8 // '.' Is the fallback if no folder is open
10 // TODO?: Workspace folders support Uri's (eg: file://test.txt). 9 // TODO?: Workspace folders support Uri's (eg: file://test.txt).
11 // It might be a good idea to test if the uri points to a file. 10 // It might be a good idea to test if the uri points to a file.
@@ -73,15 +72,12 @@ export async function createClient(config: Config, serverPath: string, cwd: stri
73 }; 72 };
74 73
75 // To turn on all proposed features use: res.registerProposedFeatures(); 74 // To turn on all proposed features use: res.registerProposedFeatures();
76 // Here we want to just enable CallHierarchyFeature since it is available on stable. 75 // Here we want to enable CallHierarchyFeature and SemanticTokensFeature
77 // Note that while the CallHierarchyFeature is stable the LSP protocol is not. 76 // since they are available on stable.
77 // Note that while these features are stable in vscode their LSP protocol
78 // implementations are still in the "proposed" category for 3.16.
78 res.registerFeature(new CallHierarchyFeature(res)); 79 res.registerFeature(new CallHierarchyFeature(res));
79 80 res.registerFeature(new SemanticTokensFeature(res));
80 if (config.package.enableProposedApi) {
81 if (config.highlightingSemanticTokens) {
82 res.registerFeature(new SemanticTokensFeature(res));
83 }
84 }
85 81
86 return res; 82 return res;
87} 83}
diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts
index 1f45f1de0..21c1c9f23 100644
--- a/editors/code/src/config.ts
+++ b/editors/code/src/config.ts
@@ -69,7 +69,6 @@ export class Config {
69 get serverPath() { return this.cfg.get<null | string>("serverPath")!; } 69 get serverPath() { return this.cfg.get<null | string>("serverPath")!; }
70 get channel() { return this.cfg.get<UpdatesChannel>("updates.channel")!; } 70 get channel() { return this.cfg.get<UpdatesChannel>("updates.channel")!; }
71 get askBeforeDownload() { return this.cfg.get<boolean>("updates.askBeforeDownload")!; } 71 get askBeforeDownload() { return this.cfg.get<boolean>("updates.askBeforeDownload")!; }
72 get highlightingSemanticTokens() { return this.cfg.get<boolean>("highlighting.semanticTokens")!; }
73 get traceExtension() { return this.cfg.get<boolean>("trace.extension")!; } 72 get traceExtension() { return this.cfg.get<boolean>("trace.extension")!; }
74 73
75 get inlayHints() { 74 get inlayHints() {
diff --git a/editors/code/src/ctx.ts b/editors/code/src/ctx.ts
index bd1c3de07..f7ed62d03 100644
--- a/editors/code/src/ctx.ts
+++ b/editors/code/src/ctx.ts
@@ -21,7 +21,7 @@ export class Ctx {
21 serverPath: string, 21 serverPath: string,
22 cwd: string, 22 cwd: string,
23 ): Promise<Ctx> { 23 ): Promise<Ctx> {
24 const client = await createClient(config, serverPath, cwd); 24 const client = await createClient(serverPath, cwd);
25 const res = new Ctx(config, extCtx, client, serverPath); 25 const res = new Ctx(config, extCtx, client, serverPath);
26 res.pushCleanup(client.start()); 26 res.pushCleanup(client.start());
27 await client.onReady(); 27 await client.onReady();