diff options
Diffstat (limited to 'editors/code/src')
-rw-r--r-- | editors/code/src/client.ts | 2 | ||||
-rw-r--r-- | editors/code/src/ctx.ts | 2 | ||||
-rw-r--r-- | editors/code/src/source_change.ts | 8 |
3 files changed, 7 insertions, 5 deletions
diff --git a/editors/code/src/client.ts b/editors/code/src/client.ts index 0ad4b63ae..97e794091 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. |
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(); |
diff --git a/editors/code/src/source_change.ts b/editors/code/src/source_change.ts index 399a150c6..af8f1df51 100644 --- a/editors/code/src/source_change.ts +++ b/editors/code/src/source_change.ts | |||
@@ -37,11 +37,13 @@ export async function applySourceChange(ctx: Ctx, change: ra.SourceChange) { | |||
37 | toReveal.position, | 37 | toReveal.position, |
38 | ); | 38 | ); |
39 | const editor = vscode.window.activeTextEditor; | 39 | const editor = vscode.window.activeTextEditor; |
40 | if (!editor || editor.document.uri.toString() !== uri.toString()) { | 40 | if (!editor || !editor.selection.isEmpty) { |
41 | return; | 41 | return; |
42 | } | 42 | } |
43 | if (!editor.selection.isEmpty) { | 43 | |
44 | return; | 44 | if (editor.document.uri !== uri) { |
45 | const doc = await vscode.workspace.openTextDocument(uri); | ||
46 | await vscode.window.showTextDocument(doc); | ||
45 | } | 47 | } |
46 | editor.selection = new vscode.Selection(position, position); | 48 | editor.selection = new vscode.Selection(position, position); |
47 | editor.revealRange( | 49 | editor.revealRange( |