aboutsummaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-12-31 16:34:52 +0000
committerAleksey Kladov <[email protected]>2019-12-31 16:34:52 +0000
commit0849f7001cac6af93ce9e9356f8c21881bbe34c5 (patch)
tree1506aada153acfefc4f5059612439cfa9cedc2c5 /editors
parent76f283108b5fc7aeb105eee0e5d44cae2ffab173 (diff)
Refactor config
Diffstat (limited to 'editors')
-rw-r--r--editors/code/src/config.ts10
-rw-r--r--editors/code/src/ctx.ts3
2 files changed, 6 insertions, 7 deletions
diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts
index 9800b461f..ec2790b63 100644
--- a/editors/code/src/config.ts
+++ b/editors/code/src/config.ts
@@ -43,14 +43,12 @@ export class Config {
43 private prevEnhancedTyping: null | boolean = null; 43 private prevEnhancedTyping: null | boolean = null;
44 private prevCargoFeatures: null | CargoFeatures = null; 44 private prevCargoFeatures: null | CargoFeatures = null;
45 45
46 constructor() { 46 constructor(ctx: vscode.ExtensionContext) {
47 vscode.workspace.onDidChangeConfiguration(_ => 47 vscode.workspace.onDidChangeConfiguration(_ => this.refresh(), ctx.subscriptions);
48 this.userConfigChanged(), 48 this.refresh();
49 );
50 this.userConfigChanged();
51 } 49 }
52 50
53 userConfigChanged() { 51 private refresh() {
54 const config = vscode.workspace.getConfiguration('rust-analyzer'); 52 const config = vscode.workspace.getConfiguration('rust-analyzer');
55 53
56 let requireReloadMessage = null; 54 let requireReloadMessage = null;
diff --git a/editors/code/src/ctx.ts b/editors/code/src/ctx.ts
index d86fe5a87..393d6a602 100644
--- a/editors/code/src/ctx.ts
+++ b/editors/code/src/ctx.ts
@@ -4,10 +4,11 @@ import { Server } from './server';
4import { Config } from './config'; 4import { Config } from './config';
5 5
6export class Ctx { 6export class Ctx {
7 readonly config = new Config(); 7 readonly config: Config;
8 private extCtx: vscode.ExtensionContext; 8 private extCtx: vscode.ExtensionContext;
9 9
10 constructor(extCtx: vscode.ExtensionContext) { 10 constructor(extCtx: vscode.ExtensionContext) {
11 this.config = new Config(extCtx)
11 this.extCtx = extCtx; 12 this.extCtx = extCtx;
12 } 13 }
13 14