blob: 6be057245fa3df0de5ca5e2481a6649cbcb747c3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
import * as vscode from 'vscode';
import {
syntaxTreeUri,
TextDocumentContentProvider
} from '../commands/syntaxTree';
export function createHandler(
textDocumentContentProvider: TextDocumentContentProvider
) {
return (event: vscode.TextDocumentChangeEvent) => {
const doc = event.document;
if (doc.languageId !== 'rust') {
return;
}
afterLs(() => {
textDocumentContentProvider.eventEmitter.fire(syntaxTreeUri);
});
};
}
// We need to order this after LS updates, but there's no API for that.
// Hence, good old setTimeout.
function afterLs(f: () => any) {
setTimeout(f, 10);
}
|