diff options
Diffstat (limited to 'editors/code/src/events')
-rw-r--r-- | editors/code/src/events/change_active_text_editor.ts | 15 | ||||
-rw-r--r-- | editors/code/src/events/change_text_document.ts | 13 | ||||
-rw-r--r-- | editors/code/src/events/index.ts | 5 |
3 files changed, 23 insertions, 10 deletions
diff --git a/editors/code/src/events/change_active_text_editor.ts b/editors/code/src/events/change_active_text_editor.ts index 3440aa0c3..0b7ceb65d 100644 --- a/editors/code/src/events/change_active_text_editor.ts +++ b/editors/code/src/events/change_active_text_editor.ts | |||
@@ -5,10 +5,19 @@ import { Decoration } from '../highlighting'; | |||
5 | import { Server } from '../server'; | 5 | import { Server } from '../server'; |
6 | 6 | ||
7 | export async function handle(editor: TextEditor | undefined) { | 7 | export async function handle(editor: TextEditor | undefined) { |
8 | if (!Server.config.highlightingOn || !editor || editor.document.languageId !== 'rust') { return; } | 8 | if ( |
9 | !Server.config.highlightingOn || | ||
10 | !editor || | ||
11 | editor.document.languageId !== 'rust' | ||
12 | ) { | ||
13 | return; | ||
14 | } | ||
9 | const params: TextDocumentIdentifier = { | 15 | const params: TextDocumentIdentifier = { |
10 | uri: editor.document.uri.toString(), | 16 | uri: editor.document.uri.toString() |
11 | }; | 17 | }; |
12 | const decorations = await Server.client.sendRequest<Decoration[]>('m/decorationsRequest', params); | 18 | const decorations = await Server.client.sendRequest<Decoration[]>( |
19 | 'm/decorationsRequest', | ||
20 | params | ||
21 | ); | ||
13 | Server.highlighter.setHighlights(editor, decorations); | 22 | Server.highlighter.setHighlights(editor, decorations); |
14 | } | 23 | } |
diff --git a/editors/code/src/events/change_text_document.ts b/editors/code/src/events/change_text_document.ts index b3000e026..6be057245 100644 --- a/editors/code/src/events/change_text_document.ts +++ b/editors/code/src/events/change_text_document.ts | |||
@@ -1,11 +1,18 @@ | |||
1 | import * as vscode from 'vscode'; | 1 | import * as vscode from 'vscode'; |
2 | 2 | ||
3 | import { syntaxTreeUri, TextDocumentContentProvider } from '../commands/syntaxTree'; | 3 | import { |
4 | syntaxTreeUri, | ||
5 | TextDocumentContentProvider | ||
6 | } from '../commands/syntaxTree'; | ||
4 | 7 | ||
5 | export function createHandler(textDocumentContentProvider: TextDocumentContentProvider) { | 8 | export function createHandler( |
9 | textDocumentContentProvider: TextDocumentContentProvider | ||
10 | ) { | ||
6 | return (event: vscode.TextDocumentChangeEvent) => { | 11 | return (event: vscode.TextDocumentChangeEvent) => { |
7 | const doc = event.document; | 12 | const doc = event.document; |
8 | if (doc.languageId !== 'rust') { return; } | 13 | if (doc.languageId !== 'rust') { |
14 | return; | ||
15 | } | ||
9 | afterLs(() => { | 16 | afterLs(() => { |
10 | textDocumentContentProvider.eventEmitter.fire(syntaxTreeUri); | 17 | textDocumentContentProvider.eventEmitter.fire(syntaxTreeUri); |
11 | }); | 18 | }); |
diff --git a/editors/code/src/events/index.ts b/editors/code/src/events/index.ts index b570a7a92..4c154563f 100644 --- a/editors/code/src/events/index.ts +++ b/editors/code/src/events/index.ts | |||
@@ -1,7 +1,4 @@ | |||
1 | import * as changeActiveTextEditor from './change_active_text_editor'; | 1 | import * as changeActiveTextEditor from './change_active_text_editor'; |
2 | import * as changeTextDocument from './change_text_document'; | 2 | import * as changeTextDocument from './change_text_document'; |
3 | 3 | ||
4 | export { | 4 | export { changeActiveTextEditor, changeTextDocument }; |
5 | changeActiveTextEditor, | ||
6 | changeTextDocument, | ||
7 | }; | ||