diff options
Diffstat (limited to 'editors/code/src/config.ts')
-rw-r--r-- | editors/code/src/config.ts | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts index e8abf8284..033b04b60 100644 --- a/editors/code/src/config.ts +++ b/editors/code/src/config.ts | |||
@@ -5,6 +5,8 @@ export type UpdatesChannel = "stable" | "nightly"; | |||
5 | 5 | ||
6 | export const NIGHTLY_TAG = "nightly"; | 6 | export const NIGHTLY_TAG = "nightly"; |
7 | 7 | ||
8 | export type RunnableEnvCfg = undefined | Record<string, string> | { mask?: string; env: Record<string, string> }[]; | ||
9 | |||
8 | export class Config { | 10 | export class Config { |
9 | readonly extensionId = "matklad.rust-analyzer"; | 11 | readonly extensionId = "matklad.rust-analyzer"; |
10 | 12 | ||
@@ -16,10 +18,8 @@ export class Config { | |||
16 | "files", | 18 | "files", |
17 | "highlighting", | 19 | "highlighting", |
18 | "updates.channel", | 20 | "updates.channel", |
19 | "lens.enable", | 21 | "lens", // works as lens.* |
20 | "lens.run", | 22 | "hoverActions", // works as hoverActions.* |
21 | "lens.debug", | ||
22 | "lens.implementations", | ||
23 | ] | 23 | ] |
24 | .map(opt => `${this.rootSection}.${opt}`); | 24 | .map(opt => `${this.rootSection}.${opt}`); |
25 | 25 | ||
@@ -39,10 +39,10 @@ export class Config { | |||
39 | 39 | ||
40 | private refreshLogging() { | 40 | private refreshLogging() { |
41 | log.setEnabled(this.traceExtension); | 41 | log.setEnabled(this.traceExtension); |
42 | log.debug( | 42 | log.info("Extension version:", this.package.version); |
43 | "Extension version:", this.package.version, | 43 | |
44 | "using configuration:", this.cfg | 44 | const cfg = Object.entries(this.cfg).filter(([_, val]) => !(val instanceof Function)); |
45 | ); | 45 | log.info("Using configuration", Object.fromEntries(cfg)); |
46 | } | 46 | } |
47 | 47 | ||
48 | private async onDidChangeConfiguration(event: vscode.ConfigurationChangeEvent) { | 48 | private async onDidChangeConfiguration(event: vscode.ConfigurationChangeEvent) { |
@@ -112,6 +112,14 @@ export class Config { | |||
112 | }; | 112 | }; |
113 | } | 113 | } |
114 | 114 | ||
115 | get cargoRunner() { | ||
116 | return this.get<string | undefined>("cargoRunner"); | ||
117 | } | ||
118 | |||
119 | get runnableEnv() { | ||
120 | return this.get<RunnableEnvCfg>("runnableEnv"); | ||
121 | } | ||
122 | |||
115 | get debug() { | 123 | get debug() { |
116 | // "/rustc/<id>" used by suggestions only. | 124 | // "/rustc/<id>" used by suggestions only. |
117 | const { ["/rustc/<id>"]: _, ...sourceFileMap } = this.get<Record<string, string>>("debug.sourceFileMap"); | 125 | const { ["/rustc/<id>"]: _, ...sourceFileMap } = this.get<Record<string, string>>("debug.sourceFileMap"); |
@@ -119,7 +127,7 @@ export class Config { | |||
119 | return { | 127 | return { |
120 | engine: this.get<string>("debug.engine"), | 128 | engine: this.get<string>("debug.engine"), |
121 | engineSettings: this.get<object>("debug.engineSettings"), | 129 | engineSettings: this.get<object>("debug.engineSettings"), |
122 | openUpDebugPane: this.get<boolean>("debug.openUpDebugPane"), | 130 | openDebugPane: this.get<boolean>("debug.openDebugPane"), |
123 | sourceFileMap: sourceFileMap | 131 | sourceFileMap: sourceFileMap |
124 | }; | 132 | }; |
125 | } | 133 | } |
@@ -132,4 +140,14 @@ export class Config { | |||
132 | implementations: this.get<boolean>("lens.implementations"), | 140 | implementations: this.get<boolean>("lens.implementations"), |
133 | }; | 141 | }; |
134 | } | 142 | } |
143 | |||
144 | get hoverActions() { | ||
145 | return { | ||
146 | enable: this.get<boolean>("hoverActions.enable"), | ||
147 | implementations: this.get<boolean>("hoverActions.implementations"), | ||
148 | run: this.get<boolean>("hoverActions.run"), | ||
149 | debug: this.get<boolean>("hoverActions.debug"), | ||
150 | gotoTypeDef: this.get<boolean>("hoverActions.gotoTypeDef"), | ||
151 | }; | ||
152 | } | ||
135 | } | 153 | } |