aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/config.ts
blob: 740b5be206a488c212ea91982990507ced871712 (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 * as vscode from 'vscode';

import { Server } from './server';

export class Config {
    public highlightingOn = true;

    constructor() {
        vscode.workspace.onDidChangeConfiguration((_) => this.userConfigChanged());
        this.userConfigChanged();
    }

    public userConfigChanged() {
        const config = vscode.workspace.getConfiguration('ra-lsp');
        if (config.has('highlightingOn')) {
            this.highlightingOn = config.get('highlightingOn') as boolean;
        }

        if (!this.highlightingOn && Server) {
            Server.highlighter.removeHighlights();
        }
    }
}