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..3440aa0c3 --- /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 { Decoration } from '../highlighting'; | ||
5 | import { Server } from '../server'; | ||
6 | |||
7 | export async function handle(editor: TextEditor | undefined) { | ||
8 | if (!Server.config.highlightingOn || !editor || editor.document.languageId !== 'rust') { return; } | ||
9 | const params: TextDocumentIdentifier = { | ||
10 | uri: editor.document.uri.toString(), | ||
11 | }; | ||
12 | const decorations = await Server.client.sendRequest<Decoration[]>('m/decorationsRequest', params); | ||
13 | Server.highlighter.setHighlights(editor, decorations); | ||
14 | } | ||