diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-04-08 21:39:45 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-04-08 21:39:45 +0100 |
commit | 937fd557b09eb3a762319200796a0114a377e9c4 (patch) | |
tree | 74828e0f7fcc984487137f0b3534100f34810455 /editors/code/src | |
parent | 779555c1beac90f633c01a773558c4007c99c97f (diff) | |
parent | 6f0f86d2c57749000df2d6dc2932983173f948ee (diff) |
Merge #3899
3899: Enable the SemanticTokensFeature by default r=matklad a=kjeremy
This is covered under vscode's "editor.semanticHighlighting.enabled"
setting plus the user has to have a theme that has opted into highlighting.
Bumps required vscode stable to 1.44
Closes #3773
Co-authored-by: kjeremy <[email protected]>
Diffstat (limited to 'editors/code/src')
-rw-r--r-- | editors/code/src/client.ts | 16 | ||||
-rw-r--r-- | editors/code/src/config.ts | 1 | ||||
-rw-r--r-- | editors/code/src/ctx.ts | 2 |
3 files changed, 7 insertions, 12 deletions
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 @@ | |||
1 | import * as lc from 'vscode-languageclient'; | 1 | import * as lc from 'vscode-languageclient'; |
2 | import * as vscode from 'vscode'; | 2 | import * as vscode from 'vscode'; |
3 | 3 | ||
4 | import { Config } from './config'; | ||
5 | import { CallHierarchyFeature } from 'vscode-languageclient/lib/callHierarchy.proposed'; | 4 | import { CallHierarchyFeature } from 'vscode-languageclient/lib/callHierarchy.proposed'; |
6 | import { SemanticTokensFeature, DocumentSemanticsTokensSignature } from 'vscode-languageclient/lib/semanticTokens.proposed'; | 5 | import { SemanticTokensFeature, DocumentSemanticsTokensSignature } from 'vscode-languageclient/lib/semanticTokens.proposed'; |
7 | 6 | ||
8 | export async function createClient(config: Config, serverPath: string, cwd: string): Promise<lc.LanguageClient> { | 7 | export 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(); |