aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/events/change_active_text_editor.ts
blob: bbdd5309869ed6b034d2d154f818ab785f8f891c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import { TextEditor } from "vscode";
import { TextDocumentIdentifier } from "vscode-languageclient";

import { Server } from "../server";
import { Decoration } from "../highlighting";

export async function handle(editor: TextEditor | undefined) {
    if (!Server.config.highlightingOn || !editor || editor.document.languageId != 'rust') return
    let params: TextDocumentIdentifier = {
        uri: editor.document.uri.toString()
    }
    let decorations = await Server.client.sendRequest<Decoration[]>("m/decorationsRequest", params)
    Server.highlighter.setHighlights(editor, decorations)
}