diff options
Diffstat (limited to 'editors')
-rw-r--r-- | editors/code/src/client.ts | 31 | ||||
-rw-r--r-- | editors/code/src/ctx.ts | 2 |
2 files changed, 2 insertions, 31 deletions
diff --git a/editors/code/src/client.ts b/editors/code/src/client.ts index 0ad4b63ae..cffdcf11a 100644 --- a/editors/code/src/client.ts +++ b/editors/code/src/client.ts | |||
@@ -4,7 +4,7 @@ import * as vscode from 'vscode'; | |||
4 | import { CallHierarchyFeature } from 'vscode-languageclient/lib/callHierarchy.proposed'; | 4 | import { CallHierarchyFeature } from 'vscode-languageclient/lib/callHierarchy.proposed'; |
5 | import { SemanticTokensFeature, DocumentSemanticsTokensSignature } from 'vscode-languageclient/lib/semanticTokens.proposed'; | 5 | import { SemanticTokensFeature, DocumentSemanticsTokensSignature } from 'vscode-languageclient/lib/semanticTokens.proposed'; |
6 | 6 | ||
7 | export async function createClient(serverPath: string, cwd: string): Promise<lc.LanguageClient> { | 7 | export function createClient(serverPath: string, cwd: string): lc.LanguageClient { |
8 | // '.' Is the fallback if no folder is open | 8 | // '.' Is the fallback if no folder is open |
9 | // TODO?: Workspace folders support Uri's (eg: file://test.txt). | 9 | // TODO?: Workspace folders support Uri's (eg: file://test.txt). |
10 | // 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. |
@@ -42,35 +42,6 @@ export async function createClient(serverPath: string, cwd: string): Promise<lc. | |||
42 | clientOptions, | 42 | clientOptions, |
43 | ); | 43 | ); |
44 | 44 | ||
45 | // HACK: This is an awful way of filtering out the decorations notifications | ||
46 | // However, pending proper support, this is the most effecitve approach | ||
47 | // Proper support for this would entail a change to vscode-languageclient to allow not notifying on certain messages | ||
48 | // Or the ability to disable the serverside component of highlighting (but this means that to do tracing we need to disable hihlighting) | ||
49 | // This also requires considering our settings strategy, which is work which needs doing | ||
50 | // @ts-ignore The tracer is private to vscode-languageclient, but we need access to it to not log publishDecorations requests | ||
51 | res._tracer = { | ||
52 | log: (messageOrDataObject: string | unknown, data?: string) => { | ||
53 | if (typeof messageOrDataObject === 'string') { | ||
54 | if ( | ||
55 | messageOrDataObject.includes( | ||
56 | 'rust-analyzer/publishDecorations', | ||
57 | ) || | ||
58 | messageOrDataObject.includes( | ||
59 | 'rust-analyzer/decorationsRequest', | ||
60 | ) | ||
61 | ) { | ||
62 | // Don't log publish decorations requests | ||
63 | } else { | ||
64 | // @ts-ignore This is just a utility function | ||
65 | res.logTrace(messageOrDataObject, data); | ||
66 | } | ||
67 | } else { | ||
68 | // @ts-ignore | ||
69 | res.logObjectTrace(messageOrDataObject); | ||
70 | } | ||
71 | }, | ||
72 | }; | ||
73 | |||
74 | // To turn on all proposed features use: res.registerProposedFeatures(); | 45 | // To turn on all proposed features use: res.registerProposedFeatures(); |
75 | // Here we want to enable CallHierarchyFeature and SemanticTokensFeature | 46 | // Here we want to enable CallHierarchyFeature and SemanticTokensFeature |
76 | // since they are available on stable. | 47 | // since they are available on stable. |
diff --git a/editors/code/src/ctx.ts b/editors/code/src/ctx.ts index f7ed62d03..41df11991 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(serverPath, cwd); | 24 | const client = 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(); |