mirror of
https://github.com/microsoft/vscode.git
synced 2026-02-15 07:28:05 +00:00
config: fix nested config resolution strings not getting resolved sometimes
See https://github.com/microsoft/vscode/issues/245798#issuecomment-2871753176 Fixes #245798
This commit is contained in:
@@ -283,8 +283,8 @@ export class ConfigurationResolverExpression<T> implements IConfigurationResolve
|
||||
object[newKey] = value;
|
||||
this.parseString(object, newKey, data.value, true, path);
|
||||
} else {
|
||||
this.parseString(object, propertyName, data.value, false, path);
|
||||
object[propertyName] = object[propertyName].replaceAll(replacement.id, data.value);
|
||||
this.parseString(object, propertyName, data.value, false, path);
|
||||
}
|
||||
|
||||
path.pop();
|
||||
|
||||
@@ -1010,4 +1010,32 @@ suite('ConfigurationResolverExpression', () => {
|
||||
'key that is username: testuser': 'cool!'
|
||||
});
|
||||
});
|
||||
|
||||
test('resolves nested values 2 (#245798)', () => {
|
||||
const expr = ConfigurationResolverExpression.parse({
|
||||
env: {
|
||||
SITE: "${input:site}",
|
||||
TLD: "${input:tld}",
|
||||
HOST: "${input:host}",
|
||||
},
|
||||
});
|
||||
|
||||
for (const r of expr.unresolved()) {
|
||||
if (r.arg === 'site') {
|
||||
expr.resolve(r, 'example');
|
||||
} else if (r.arg === 'tld') {
|
||||
expr.resolve(r, 'com');
|
||||
} else if (r.arg === 'host') {
|
||||
expr.resolve(r, 'local.${input:site}.${input:tld}');
|
||||
}
|
||||
}
|
||||
|
||||
assert.deepStrictEqual(expr.toObject(), {
|
||||
env: {
|
||||
SITE: 'example',
|
||||
TLD: 'com',
|
||||
HOST: 'local.example.com'
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user