rust/editors/code/src/config.ts

26 lines
638 B
TypeScript
Raw Normal View History

2018-10-07 15:59:02 -05:00
import * as vscode from 'vscode';
import { Server } from './server';
export class Config {
2018-10-08 16:38:33 -05:00
public highlightingOn = true;
2018-10-07 15:59:02 -05:00
2018-10-08 16:38:33 -05:00
constructor() {
vscode.workspace.onDidChangeConfiguration(_ =>
this.userConfigChanged()
);
this.userConfigChanged();
2018-10-08 16:36:47 -05:00
}
2018-10-07 15:59:02 -05:00
2018-10-08 16:38:33 -05:00
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();
}
2018-10-07 15:59:02 -05:00
}
}