提交 703fb75e 编写于 作者: S Sandeep Somavarapu

Fix #31593

上级 0a1b82ca
......@@ -53,7 +53,7 @@ export interface IConfigurationRegistry {
}
export enum ConfigurationScope {
WORKBENCH = 1,
WINDOW = 1,
RESOURCE
}
......@@ -158,7 +158,7 @@ class ConfigurationRegistry implements IConfigurationRegistry {
}
}
private validateAndRegisterProperties(configuration: IConfigurationNode, validate: boolean = true, scope: ConfigurationScope = ConfigurationScope.WORKBENCH, overridable: boolean = false) {
private validateAndRegisterProperties(configuration: IConfigurationNode, validate: boolean = true, scope: ConfigurationScope = ConfigurationScope.WINDOW, overridable: boolean = false) {
scope = configuration.scope !== void 0 && configuration.scope !== null ? configuration.scope : scope;
overridable = configuration.overridable || overridable;
let properties = configuration.properties;
......
......@@ -1003,7 +1003,7 @@ class UnsupportedWorkbenchSettingsRenderer extends Disposable {
const configurationRegistry = Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration).getConfigurationProperties();
const folderKeys = this.configurationService.keys({ resource: this.workspaceSettingsEditorModel.uri }).folder;
const workbenchKeys = folderKeys.filter(key => configurationRegistry[key] && configurationRegistry[key].scope === ConfigurationScope.WORKBENCH);
const workbenchKeys = folderKeys.filter(key => configurationRegistry[key] && configurationRegistry[key].scope === ConfigurationScope.WINDOW);
if (workbenchKeys.length) {
const ranges: IRange[] = [];
for (const unsupportedKey of workbenchKeys) {
......
......@@ -135,7 +135,7 @@ export class PreferencesService extends Disposable implements IPreferencesServic
promise = TPromise.join<any>([this.extensionService.onReady(), this.fetchMostCommonlyUsedSettings()])
.then(result => {
const mostCommonSettings = result[1];
const model = this.instantiationService.createInstance(DefaultSettingsEditorModel, uri, mostCommonSettings, ConfigurationScope.WORKBENCH);
const model = this.instantiationService.createInstance(DefaultSettingsEditorModel, uri, mostCommonSettings, ConfigurationScope.WINDOW);
return model;
});
this.defaultPreferencesEditorModels.set(uri, promise);
......
......@@ -751,7 +751,7 @@ export class DefaultSettingsEditorModel extends AbstractSettingsModel implements
}
private matchesScope(property: IConfigurationNode): boolean {
if (this.configurationScope === ConfigurationScope.WORKBENCH) {
if (this.configurationScope === ConfigurationScope.WINDOW) {
return true;
}
return property.scope === this.configurationScope;
......
......@@ -131,7 +131,7 @@ export class FolderSettingsModel<T> extends CustomConfigurationModel<T> {
}
public createWorkspaceConfigurationModel(): ConfigurationModel<any> {
return this.createScopedConfigurationModel(ConfigurationScope.WORKBENCH);
return this.createScopedConfigurationModel(ConfigurationScope.WINDOW);
}
public createFolderScopedConfigurationModel(): ConfigurationModel<any> {
......@@ -153,7 +153,7 @@ export class FolderSettingsModel<T> extends CustomConfigurationModel<T> {
private getScope(key: string, configurationProperties: { [qualifiedKey: string]: IConfigurationPropertySchema }): ConfigurationScope {
const propertySchema = configurationProperties[key];
return propertySchema ? propertySchema.scope : ConfigurationScope.WORKBENCH;
return propertySchema ? propertySchema.scope : ConfigurationScope.WINDOW;
}
}
......@@ -168,7 +168,7 @@ export class FolderConfigurationModel<T> extends CustomConfigurationModel<T> {
this._contents = <T>{};
this._overrides = [];
this.doMerge(this, ConfigurationScope.WORKBENCH === this.scope ? this.workspaceSettingsConfig : this.workspaceSettingsConfig.createFolderScopedConfigurationModel());
this.doMerge(this, ConfigurationScope.WINDOW === this.scope ? this.workspaceSettingsConfig : this.workspaceSettingsConfig.createFolderScopedConfigurationModel());
for (const configModel of this.scopedConfigs) {
this.doMerge(this, configModel);
}
......
......@@ -79,13 +79,13 @@ const configurationExtPoint = ExtensionsRegistry.registerExtensionPoint<IConfigu
},
scope: {
type: 'string',
enum: ['workbench', 'resource'],
default: 'workbench',
enum: ['window', 'resource'],
default: 'window',
enumDescriptions: [
nls.localize('scope.workbench.description', "Workbench specific configuration, which can be configured in the User or Workspace settings."),
nls.localize('scope.window.description', "Window specific configuration, which can be configured in the User or Workspace settings."),
nls.localize('scope.resource.description', "Resource specific configuration, which can be configured in the User, Workspace or Folder settings.")
],
description: nls.localize('scope.description', "Scope in which the configuration is applicable. Available scopes are `workbench` and `resource`.")
description: nls.localize('scope.description', "Scope in which the configuration is applicable. Available scopes are `window` and `resource`.")
}
}
}
......@@ -158,7 +158,7 @@ function validateProperties(configuration: IConfigurationNode, collector: Extens
for (let key in properties) {
const message = validateProperty(key);
const propertyConfiguration = configuration.properties[key];
propertyConfiguration.scope = propertyConfiguration.scope && propertyConfiguration.scope.toString() === 'resource' ? ConfigurationScope.RESOURCE : ConfigurationScope.WORKBENCH;
propertyConfiguration.scope = propertyConfiguration.scope && propertyConfiguration.scope.toString() === 'resource' ? ConfigurationScope.RESOURCE : ConfigurationScope.WINDOW;
if (message) {
collector.warn(message);
delete properties[key];
......@@ -499,7 +499,7 @@ export class WorkspaceServiceImpl extends WorkspaceService {
private initCachesForFolders(folders: URI[]): void {
for (const folder of folders) {
this.cachedFolderConfigs.set(folder, this._register(new FolderConfiguration(folder, this.workspaceSettingsRootFolder, this.hasMultiFolderWorkspace() ? ConfigurationScope.RESOURCE : ConfigurationScope.WORKBENCH)));
this.cachedFolderConfigs.set(folder, this._register(new FolderConfiguration(folder, this.workspaceSettingsRootFolder, this.hasMultiFolderWorkspace() ? ConfigurationScope.RESOURCE : ConfigurationScope.WINDOW)));
this.updateFolderConfiguration(folder, new FolderConfigurationModel<any>(new FolderSettingsModel<any>(null), [], ConfigurationScope.RESOURCE), false);
}
}
......
......@@ -15,7 +15,7 @@ suite('ConfigurationService - Model', () => {
awesome: true
}));
const testObject = new FolderConfigurationModel(settingsConfig, [], ConfigurationScope.WORKBENCH);
const testObject = new FolderConfigurationModel(settingsConfig, [], ConfigurationScope.WINDOW);
assert.equal(testObject.getContentsFor('task'), undefined);
});
......@@ -36,7 +36,7 @@ suite('ConfigurationService - Model', () => {
}
};
assert.deepEqual(new FolderConfigurationModel(settingsConfig, [tasksConfig], ConfigurationScope.WORKBENCH).contents, expected);
assert.deepEqual(new FolderConfigurationModel(settingsConfig, [tasksConfig], ConfigurationScope.WINDOW).contents, expected);
});
test('Test consolidate (settings and launch)', () => {
......@@ -55,7 +55,7 @@ suite('ConfigurationService - Model', () => {
}
};
assert.deepEqual(new FolderConfigurationModel(settingsConfig, [launchConfig], ConfigurationScope.WORKBENCH).contents, expected);
assert.deepEqual(new FolderConfigurationModel(settingsConfig, [launchConfig], ConfigurationScope.WINDOW).contents, expected);
});
test('Test consolidate (settings and launch and tasks) - launch/tasks wins over settings file', () => {
......@@ -91,7 +91,7 @@ suite('ConfigurationService - Model', () => {
}
};
assert.deepEqual(new FolderConfigurationModel(settingsConfig, [launchConfig, tasksConfig], ConfigurationScope.WORKBENCH).contents, expected);
assert.deepEqual(new FolderConfigurationModel(settingsConfig, [tasksConfig, launchConfig], ConfigurationScope.WORKBENCH).contents, expected);
assert.deepEqual(new FolderConfigurationModel(settingsConfig, [launchConfig, tasksConfig], ConfigurationScope.WINDOW).contents, expected);
assert.deepEqual(new FolderConfigurationModel(settingsConfig, [tasksConfig, launchConfig], ConfigurationScope.WINDOW).contents, expected);
});
});
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册