From 087af54069d34eef5197e04d64ac322d9ee98085 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 31 Dec 2019 18:14:00 +0100 Subject: Refactor server lifecycle --- editors/code/src/source_change.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'editors/code/src/source_change.ts') diff --git a/editors/code/src/source_change.ts b/editors/code/src/source_change.ts index a4f9068b2..887191d9e 100644 --- a/editors/code/src/source_change.ts +++ b/editors/code/src/source_change.ts @@ -10,7 +10,10 @@ export interface SourceChange { } export async function applySourceChange(ctx: Ctx, change: SourceChange) { - const wsEdit = ctx.client.protocol2CodeConverter.asWorkspaceEdit( + const client = ctx.client; + if (!client) return + + const wsEdit = client.protocol2CodeConverter.asWorkspaceEdit( change.workspaceEdit, ); let created; @@ -32,10 +35,10 @@ export async function applySourceChange(ctx: Ctx, change: SourceChange) { const doc = await vscode.workspace.openTextDocument(toOpenUri); await vscode.window.showTextDocument(doc); } else if (toReveal) { - const uri = ctx.client.protocol2CodeConverter.asUri( + const uri = client.protocol2CodeConverter.asUri( toReveal.textDocument.uri, ); - const position = ctx.client.protocol2CodeConverter.asPosition( + const position = client.protocol2CodeConverter.asPosition( toReveal.position, ); const editor = vscode.window.activeTextEditor; -- cgit v1.2.3