From ed7ae78c6fd9e508f6e959c6a164cf8481f6b377 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 17 Aug 2018 19:54:08 +0300 Subject: ServerWorld --- code/src/extension.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'code') diff --git a/code/src/extension.ts b/code/src/extension.ts index 95305db2d..084a9d769 100644 --- a/code/src/extension.ts +++ b/code/src/extension.ts @@ -60,14 +60,18 @@ export function activate(context: vscode.ExtensionContext) { vscode.workspace.onDidChangeTextDocument((event: vscode.TextDocumentChangeEvent) => { let doc = event.document if (doc.languageId != "rust") return - // We need to order this after LS updates, but there's no API for that. - // Hence, good old setTimeout. - setTimeout(() => { + afterLs(() => { textDocumentContentProvider.eventEmitter.fire(uris.syntaxTree) - }, 10) + }) }, null, context.subscriptions) } +// We need to order this after LS updates, but there's no API for that. +// Hence, good old setTimeout. +function afterLs(f) { + setTimeout(f, 10) +} + export function deactivate(): Thenable { if (!client) { return undefined; @@ -118,7 +122,9 @@ function startServer() { if (editor == null) return if (!editor.selection.isEmpty) return let position = client.protocol2CodeConverter.asPosition(params) - editor.selection = new vscode.Selection(position, position); + afterLs(() => { + editor.selection = new vscode.Selection(position, position) + }) } ) }) -- cgit v1.2.3