Refactor config

This commit is contained in:
Aleksey Kladov 2019-12-31 17:34:52 +01:00
parent 76f283108b
commit 0849f7001c
2 changed files with 6 additions and 7 deletions

View file

@ -43,14 +43,12 @@ export class Config {
private prevEnhancedTyping: null | boolean = null;
private prevCargoFeatures: null | CargoFeatures = null;
constructor() {
vscode.workspace.onDidChangeConfiguration(_ =>
this.userConfigChanged(),
);
this.userConfigChanged();
constructor(ctx: vscode.ExtensionContext) {
vscode.workspace.onDidChangeConfiguration(_ => this.refresh(), ctx.subscriptions);
this.refresh();
}
userConfigChanged() {
private refresh() {
const config = vscode.workspace.getConfiguration('rust-analyzer');
let requireReloadMessage = null;

View file

@ -4,10 +4,11 @@ import { Server } from './server';
import { Config } from './config';
export class Ctx {
readonly config = new Config();
readonly config: Config;
private extCtx: vscode.ExtensionContext;
constructor(extCtx: vscode.ExtensionContext) {
this.config = new Config(extCtx)
this.extCtx = extCtx;
}