Refactor server lifecycle

This commit is contained in:
Aleksey Kladov 2019-12-31 18:14:00 +01:00
parent 0849f7001c
commit 087af54069
12 changed files with 216 additions and 199 deletions

View file

@ -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;