Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'editors/code/src/config.ts')
-rw-r--r--editors/code/src/config.ts17
1 files changed, 13 insertions, 4 deletions
diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts
index 1dae603714..7540372547 100644
--- a/editors/code/src/config.ts
+++ b/editors/code/src/config.ts
@@ -34,6 +34,7 @@ export class Config {
constructor(ctx: vscode.ExtensionContext) {
this.globalStorageUri = ctx.globalStorageUri;
+ this.discoveredWorkspaces = [];
vscode.workspace.onDidChangeConfiguration(
this.onDidChangeConfiguration,
this,
@@ -55,6 +56,8 @@ export class Config {
log.info("Using configuration", Object.fromEntries(cfg));
}
+ public discoveredWorkspaces: JsonProject[];
+
private async onDidChangeConfiguration(event: vscode.ConfigurationChangeEvent) {
this.refreshLogging();
@@ -191,7 +194,7 @@ export class Config {
* So this getter handles this quirk by not requiring the caller to use postfix `!`
*/
private get<T>(path: string): T | undefined {
- return substituteVSCodeVariables(this.cfg.get<T>(path));
+ return prepareVSCodeConfig(this.cfg.get<T>(path));
}
get serverPath() {
@@ -284,18 +287,24 @@ export class Config {
}
}
-export function substituteVSCodeVariables<T>(resp: T): T {
+export function prepareVSCodeConfig<T>(
+ resp: T,
+ cb?: (key: Extract<keyof T, string>, res: { [key: string]: any }) => void
+): T {
if (Is.string(resp)) {
return substituteVSCodeVariableInString(resp) as T;
} else if (resp && Is.array<any>(resp)) {
return resp.map((val) => {
- return substituteVSCodeVariables(val);
+ return prepareVSCodeConfig(val);
}) as T;
} else if (resp && typeof resp === "object") {
const res: { [key: string]: any } = {};
for (const key in resp) {
const val = resp[key];
- res[key] = substituteVSCodeVariables(val);
+ res[key] = prepareVSCodeConfig(val);
+ if (cb) {
+ cb(key, res);
+ }
}
return res as T;
}