mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 21:09:43 +00:00
Merge pull request #128909 from 71/main
platform/configuration: fix empty keys being ignored by configuration parser
This commit is contained in:
commit
79156e629f
|
@ -270,7 +270,7 @@ export class ConfigurationModelParser {
|
|||
function onValue(value: any) {
|
||||
if (Array.isArray(currentParent)) {
|
||||
(<any[]>currentParent).push(value);
|
||||
} else if (currentProperty) {
|
||||
} else if (currentProperty !== null) {
|
||||
currentParent[currentProperty] = value;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -334,6 +334,16 @@ suite('CustomConfigurationModel', () => {
|
|||
assert.deepStrictEqual(testObject.configurationModel.keys, []);
|
||||
});
|
||||
|
||||
test('Test empty property is not ignored', () => {
|
||||
const testObject = new ConfigurationModelParser('test');
|
||||
testObject.parse(JSON.stringify({ '': 1 }));
|
||||
|
||||
// deepStrictEqual seems to ignore empty properties, fall back
|
||||
// to comparing the output of JSON.stringify
|
||||
assert.strictEqual(JSON.stringify(testObject.configurationModel.contents), JSON.stringify({ '': 1 }));
|
||||
assert.deepStrictEqual(testObject.configurationModel.keys, ['']);
|
||||
});
|
||||
|
||||
test('Test registering the same property again', () => {
|
||||
Registry.as<IConfigurationRegistry>(Extensions.Configuration).registerConfiguration({
|
||||
'id': 'a',
|
||||
|
|
Loading…
Reference in a new issue