mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-13 21:54:42 +00:00
Refactor config
This commit is contained in:
parent
76f283108b
commit
0849f7001c
2 changed files with 6 additions and 7 deletions
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue