blob: af295b2ecba89d448e2c9dd2ed0f920d350c7876 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
import { TextEditor } from 'vscode';
import { TextDocumentIdentifier } from 'vscode-languageclient';
import { Decoration } from '../highlighting';
import { Server } from '../server';
export async function handle(editor: TextEditor | undefined) {
if (
!Server.config.highlightingOn ||
!editor ||
editor.document.languageId !== 'rust'
) {
return;
}
const params: TextDocumentIdentifier = {
uri: editor.document.uri.toString()
};
const decorations = await Server.client.sendRequest<Decoration[]>(
'rust-analyzer/decorationsRequest',
params
);
Server.highlighter.setHighlights(editor, decorations);
}
|