aboutsummaryrefslogtreecommitdiff
path: root/code/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-08-17 17:54:08 +0100
committerAleksey Kladov <[email protected]>2018-08-17 17:54:08 +0100
commited7ae78c6fd9e508f6e959c6a164cf8481f6b377 (patch)
tree556e8d4daffefa64dcdc5db8e75299514a0e85e4 /code/src
parent41570f60bf268c97223a864b8aa11a339929f55a (diff)
ServerWorld
Diffstat (limited to 'code/src')
-rw-r--r--code/src/extension.ts16
1 files changed, 11 insertions, 5 deletions
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) {
60 vscode.workspace.onDidChangeTextDocument((event: vscode.TextDocumentChangeEvent) => { 60 vscode.workspace.onDidChangeTextDocument((event: vscode.TextDocumentChangeEvent) => {
61 let doc = event.document 61 let doc = event.document
62 if (doc.languageId != "rust") return 62 if (doc.languageId != "rust") return
63 // We need to order this after LS updates, but there's no API for that. 63 afterLs(() => {
64 // Hence, good old setTimeout.
65 setTimeout(() => {
66 textDocumentContentProvider.eventEmitter.fire(uris.syntaxTree) 64 textDocumentContentProvider.eventEmitter.fire(uris.syntaxTree)
67 }, 10) 65 })
68 }, null, context.subscriptions) 66 }, null, context.subscriptions)
69} 67}
70 68
69// We need to order this after LS updates, but there's no API for that.
70// Hence, good old setTimeout.
71function afterLs(f) {
72 setTimeout(f, 10)
73}
74
71export function deactivate(): Thenable<void> { 75export function deactivate(): Thenable<void> {
72 if (!client) { 76 if (!client) {
73 return undefined; 77 return undefined;
@@ -118,7 +122,9 @@ function startServer() {
118 if (editor == null) return 122 if (editor == null) return
119 if (!editor.selection.isEmpty) return 123 if (!editor.selection.isEmpty) return
120 let position = client.protocol2CodeConverter.asPosition(params) 124 let position = client.protocol2CodeConverter.asPosition(params)
121 editor.selection = new vscode.Selection(position, position); 125 afterLs(() => {
126 editor.selection = new vscode.Selection(position, position)
127 })
122 } 128 }
123 ) 129 )
124 }) 130 })