提交 375605af 编写于 作者: S Sandeep Somavarapu

Fix #39192

上级 4e78a42a
......@@ -24,6 +24,7 @@ import { JSONEditingService } from 'vs/workbench/services/configuration/node/jso
import { WorkbenchState } from 'vs/platform/workspace/common/workspace';
import { ConfigurationScope } from 'vs/platform/configuration/common/configurationRegistry';
import { relative } from 'path';
import { equals } from 'vs/base/common/objects';
// node.hs helper functions
......@@ -189,10 +190,9 @@ export class FolderConfiguration extends Disposable {
}
reprocess(): ConfigurationModel {
const oldKeys = this.getUnsupportedKeys();
const oldContents = this._folderSettingsModelParser.folderSettingsModel.contents;
this._folderSettingsModelParser.reprocess();
const newKeys = this.getUnsupportedKeys();
if (this.hasKeysChanged(oldKeys, newKeys)) {
if (!equals(oldContents, this._folderSettingsModelParser.folderSettingsModel.contents)) {
this.consolidate();
}
return this._cache;
......@@ -202,18 +202,6 @@ export class FolderConfiguration extends Disposable {
return this._folderSettingsModelParser.folderSettingsModel.unsupportedKeys;
}
private hasKeysChanged(oldKeys: string[], newKeys: string[]): boolean {
if (oldKeys.length !== newKeys.length) {
return true;
}
for (const key of oldKeys) {
if (newKeys.indexOf(key) === -1) {
return true;
}
}
return false;
}
private consolidate(): void {
this._cache = this._folderSettingsModelParser.folderSettingsModel.merge(...this._standAloneConfigurations);
}
......
......@@ -968,6 +968,26 @@ suite('WorkspaceConfigurationService - Multiroot', () => {
});
});
test('resource setting in folder is read after it is registered later', () => {
fs.writeFileSync(workspaceContextService.getWorkspace().folders[0].toResource('.vscode/settings.json').fsPath, '{ "configurationService.workspace.testNewResourceSetting2": "workspaceFolderValue" }');
return jsonEditingServce.write(workspaceContextService.getWorkspace().configuration, { key: 'settings', value: { 'configurationService.workspace.testNewResourceSetting2': 'workspaceValue' } }, true)
.then(() => testObject.reloadConfiguration())
.then(() => {
configurationRegistry.registerConfiguration({
'id': '_test',
'type': 'object',
'properties': {
'configurationService.workspace.testNewResourceSetting2': {
'type': 'string',
'default': 'isSet',
scope: ConfigurationScope.RESOURCE
}
}
});
assert.equal(testObject.getValue('configurationService.workspace.testNewResourceSetting2', { resource: workspaceContextService.getWorkspace().folders[0].uri }), 'workspaceFolderValue');
});
});
test('inspect', () => {
let actual = testObject.inspect('something.missing');
assert.equal(actual.default, void 0);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册