2018-10-07 20:59:02 +00:00
|
|
|
import * as vscode from 'vscode';
|
|
|
|
|
|
|
|
import { Server } from './server';
|
|
|
|
|
|
|
|
export class Config {
|
2018-10-08 21:38:33 +00:00
|
|
|
public highlightingOn = true;
|
2019-01-05 15:28:41 +00:00
|
|
|
public raLspServerPath = 'ra_lsp_server';
|
2018-10-07 20:59:02 +00:00
|
|
|
|
2018-10-08 21:38:33 +00:00
|
|
|
constructor() {
|
|
|
|
vscode.workspace.onDidChangeConfiguration(_ =>
|
|
|
|
this.userConfigChanged()
|
|
|
|
);
|
|
|
|
this.userConfigChanged();
|
2018-10-08 21:36:47 +00:00
|
|
|
}
|
2018-10-07 20:59:02 +00:00
|
|
|
|
2018-10-08 21:38:33 +00: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();
|
|
|
|
}
|
2019-01-05 15:28:41 +00:00
|
|
|
|
|
|
|
if (config.has('raLspServerPath')) {
|
|
|
|
this.raLspServerPath = config.get('raLspServerPath') as string;
|
|
|
|
}
|
2018-10-07 20:59:02 +00:00
|
|
|
}
|
|
|
|
}
|