diff options
Diffstat (limited to 'editors/code/src/events/change_active_text_editor.ts')
-rw-r--r-- | editors/code/src/events/change_active_text_editor.ts | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/editors/code/src/events/change_active_text_editor.ts b/editors/code/src/events/change_active_text_editor.ts new file mode 100644 index 000000000..bbdd53098 --- /dev/null +++ b/editors/code/src/events/change_active_text_editor.ts | |||
@@ -0,0 +1,14 @@ | |||
1 | import { TextEditor } from "vscode"; | ||
2 | import { TextDocumentIdentifier } from "vscode-languageclient"; | ||
3 | |||
4 | import { Server } from "../server"; | ||
5 | import { Decoration } from "../highlighting"; | ||
6 | |||
7 | export async function handle(editor: TextEditor | undefined) { | ||
8 | if (!Server.config.highlightingOn || !editor || editor.document.languageId != 'rust') return | ||
9 | let params: TextDocumentIdentifier = { | ||
10 | uri: editor.document.uri.toString() | ||
11 | } | ||
12 | let decorations = await Server.client.sendRequest<Decoration[]>("m/decorationsRequest", params) | ||
13 | Server.highlighter.setHighlights(editor, decorations) | ||
14 | } \ No newline at end of file | ||