diff --git a/extensions/git/package.json b/extensions/git/package.json index c4a03271ec2..3c69526c68e 100644 --- a/extensions/git/package.json +++ b/extensions/git/package.json @@ -878,7 +878,7 @@ ], "description": "%config.path%", "default": null, - "isExecutable": true + "scope": "application" }, "git.autoRepositoryDetection": { "type": "boolean", diff --git a/extensions/typescript-language-features/package.json b/extensions/typescript-language-features/package.json index 6ef7b44302b..649154ef5fe 100644 --- a/extensions/typescript-language-features/package.json +++ b/extensions/typescript-language-features/package.json @@ -71,8 +71,7 @@ ], "default": null, "description": "%typescript.npm%", - "isExecutable": true, - "scope": "window" + "scope": "application" }, "typescript.check.npmIsInstalled": { "type": "boolean", @@ -118,8 +117,7 @@ }, "default": [], "description": "%typescript.tsserver.pluginPaths%", - "scope": "window", - "isExecutable": true + "scope": "application" }, "typescript.tsserver.trace": { "type": "string", diff --git a/src/vs/platform/configuration/common/configurationRegistry.ts b/src/vs/platform/configuration/common/configurationRegistry.ts index 1227443eaf4..30d8205f48d 100644 --- a/src/vs/platform/configuration/common/configurationRegistry.ts +++ b/src/vs/platform/configuration/common/configurationRegistry.ts @@ -69,7 +69,6 @@ export enum ConfigurationScope { export interface IConfigurationPropertySchema extends IJSONSchema { overridable?: boolean; - isExecutable?: boolean; scope?: ConfigurationScope; notMultiRootAdopted?: boolean; included?: boolean; diff --git a/src/vs/workbench/parts/execution/electron-browser/execution.contribution.ts b/src/vs/workbench/parts/execution/electron-browser/execution.contribution.ts index 83bcd7ab055..385db9f497c 100644 --- a/src/vs/workbench/parts/execution/electron-browser/execution.contribution.ts +++ b/src/vs/workbench/parts/execution/electron-browser/execution.contribution.ts @@ -15,7 +15,7 @@ import { ITerminalService } from 'vs/workbench/parts/execution/common/execution' import { MenuId, MenuRegistry } from 'vs/platform/actions/common/actions'; import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService'; import { KeyMod, KeyCode } from 'vs/base/common/keyCodes'; -import { Extensions, IConfigurationRegistry } from 'vs/platform/configuration/common/configurationRegistry'; +import { Extensions, IConfigurationRegistry, ConfigurationScope } from 'vs/platform/configuration/common/configurationRegistry'; import { ITerminalService as IIntegratedTerminalService, KEYBINDING_CONTEXT_TERMINAL_NOT_FOCUSED } from 'vs/workbench/parts/terminal/common/terminal'; import { getDefaultTerminalWindows, getDefaultTerminalLinuxReady, DEFAULT_TERMINAL_OSX, ITerminalConfiguration } from 'vs/workbench/parts/execution/electron-browser/terminal'; import { WinTerminalService, MacTerminalService, LinuxTerminalService } from 'vs/workbench/parts/execution/electron-browser/terminalService'; @@ -52,26 +52,25 @@ getDefaultTerminalLinuxReady().then(defaultTerminalLinux => { 'external' ], 'description': nls.localize('explorer.openInTerminalKind', "Customizes what kind of terminal to launch."), - 'default': 'integrated', - 'isExecutable': false + 'default': 'integrated' }, 'terminal.external.windowsExec': { 'type': 'string', 'description': nls.localize('terminal.external.windowsExec', "Customizes which terminal to run on Windows."), 'default': getDefaultTerminalWindows(), - 'isExecutable': true + 'scope': ConfigurationScope.APPLICATION }, 'terminal.external.osxExec': { 'type': 'string', 'description': nls.localize('terminal.external.osxExec', "Customizes which terminal application to run on OS X."), 'default': DEFAULT_TERMINAL_OSX, - 'isExecutable': true + 'scope': ConfigurationScope.APPLICATION }, 'terminal.external.linuxExec': { 'type': 'string', 'description': nls.localize('terminal.external.linuxExec', "Customizes which terminal to run on Linux."), 'default': defaultTerminalLinux, - 'isExecutable': true + 'scope': ConfigurationScope.APPLICATION } } }); diff --git a/src/vs/workbench/parts/preferences/browser/preferencesRenderers.ts b/src/vs/workbench/parts/preferences/browser/preferencesRenderers.ts index 9d00c6f1c5a..4a11f390a57 100644 --- a/src/vs/workbench/parts/preferences/browser/preferencesRenderers.ts +++ b/src/vs/workbench/parts/preferences/browser/preferencesRenderers.ts @@ -25,7 +25,6 @@ import { IContextMenuService } from 'vs/platform/contextview/browser/contextView import { SettingsGroupTitleWidget, EditPreferenceWidget, SettingsHeaderWidget, DefaultSettingsHeaderWidget, FloatingClickWidget } from 'vs/workbench/parts/preferences/browser/preferencesWidgets'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { RangeHighlightDecorations } from 'vs/workbench/browser/parts/editor/rangeDecorations'; -import { IMarkerService, IMarkerData, MarkerSeverity } from 'vs/platform/markers/common/markers'; import { ICursorPositionChangedEvent } from 'vs/editor/common/controller/cursorEvents'; import { ModelDecorationOptions } from 'vs/editor/common/model/textModel'; import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace'; @@ -188,7 +187,6 @@ export class UserSettingsRenderer extends Disposable implements IPreferencesRend export class WorkspaceSettingsRenderer extends UserSettingsRenderer implements IPreferencesRenderer { - private unsupportedSettingsRenderer: UnsupportedSettingsRenderer; private workspaceConfigurationRenderer: WorkspaceConfigurationRenderer; constructor(editor: ICodeEditor, preferencesModel: SettingsEditorModel, @@ -198,7 +196,6 @@ export class WorkspaceSettingsRenderer extends UserSettingsRenderer implements I @IInstantiationService instantiationService: IInstantiationService ) { super(editor, preferencesModel, preferencesService, configurationService, instantiationService); - this.unsupportedSettingsRenderer = this._register(instantiationService.createInstance(UnsupportedSettingsRenderer, editor, preferencesModel)); this.workspaceConfigurationRenderer = this._register(instantiationService.createInstance(WorkspaceConfigurationRenderer, editor, preferencesModel)); } @@ -213,15 +210,12 @@ export class WorkspaceSettingsRenderer extends UserSettingsRenderer implements I public render(): void { super.render(); - this.unsupportedSettingsRenderer.render(); this.workspaceConfigurationRenderer.render(this.getAssociatedPreferencesModel()); } } export class FolderSettingsRenderer extends UserSettingsRenderer implements IPreferencesRenderer { - private unsupportedSettingsRenderer: UnsupportedSettingsRenderer; - constructor(editor: ICodeEditor, preferencesModel: SettingsEditorModel, @IPreferencesService preferencesService: IPreferencesService, @ITelemetryService telemetryService: ITelemetryService, @@ -229,17 +223,12 @@ export class FolderSettingsRenderer extends UserSettingsRenderer implements IPre @IInstantiationService instantiationService: IInstantiationService ) { super(editor, preferencesModel, preferencesService, configurationService, instantiationService); - this.unsupportedSettingsRenderer = this._register(instantiationService.createInstance(UnsupportedSettingsRenderer, editor, preferencesModel)); } protected createHeader(): void { this._register(new SettingsHeaderWidget(this.editor, '')).setMessage(nls.localize('emptyFolderSettingsHeader', "Place your folder settings here to overwrite those from the Workspace Settings.")); } - public render(): void { - super.render(); - this.unsupportedSettingsRenderer.render(); - } } export class DefaultSettingsRenderer extends Disposable implements IPreferencesRenderer { @@ -1312,63 +1301,6 @@ class SettingHighlighter extends Disposable { } } -class UnsupportedSettingsRenderer extends Disposable { - - private renderingDelayer: Delayer = new Delayer(200); - - constructor( - private editor: ICodeEditor, - private settingsEditorModel: SettingsEditorModel, - @IMarkerService private markerService: IMarkerService - ) { - super(); - this._register(this.editor.getModel().onDidChangeContent(() => this.renderingDelayer.trigger(() => this.render()))); - } - - public render(): void { - const configurationRegistry = Registry.as(ConfigurationExtensions.Configuration).getConfigurationProperties(); - const markerData: IMarkerData[] = []; - for (const settingsGroup of this.settingsEditorModel.settingsGroups) { - for (const section of settingsGroup.sections) { - for (const setting of section.settings) { - if (this.settingsEditorModel.configurationTarget === ConfigurationTarget.WORKSPACE || this.settingsEditorModel.configurationTarget === ConfigurationTarget.WORKSPACE_FOLDER) { - // Show warnings for executable settings - if (configurationRegistry[setting.key] && configurationRegistry[setting.key].isExecutable) { - markerData.push({ - severity: MarkerSeverity.Warning, - startLineNumber: setting.keyRange.startLineNumber, - startColumn: setting.keyRange.startColumn, - endLineNumber: setting.keyRange.endLineNumber, - endColumn: setting.keyRange.endColumn, - message: this.getMarkerMessage(setting.key) - }); - } - } - } - } - } - if (markerData.length) { - this.markerService.changeOne('preferencesEditor', this.settingsEditorModel.uri, markerData); - } else { - this.markerService.remove('preferencesEditor', [this.settingsEditorModel.uri]); - } - } - - private getMarkerMessage(settingKey: string): string { - switch (settingKey) { - case 'php.validate.executablePath': - return nls.localize('unsupportedPHPExecutablePathSetting', "This setting must be a User Setting. To configure PHP for the workspace, open a PHP file and click on 'PHP Path' in the status bar."); - default: - return nls.localize('unsupportedWorkspaceSetting', "This setting must be a User Setting."); - } - } - - public dispose(): void { - this.markerService.remove('preferencesEditor', [this.settingsEditorModel.uri]); - super.dispose(); - } -} - class WorkspaceConfigurationRenderer extends Disposable { private decorationIds: string[] = []; diff --git a/src/vs/workbench/parts/trust/electron-browser/unsupportedWorkspaceSettings.contribution.ts b/src/vs/workbench/parts/trust/electron-browser/unsupportedWorkspaceSettings.contribution.ts deleted file mode 100644 index 167dd657a8c..00000000000 --- a/src/vs/workbench/parts/trust/electron-browser/unsupportedWorkspaceSettings.contribution.ts +++ /dev/null @@ -1,82 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -'use strict'; - -import * as nls from 'vs/nls'; -import { IDisposable, dispose } from 'vs/base/common/lifecycle'; -import { IWorkbenchContributionsRegistry, IWorkbenchContribution, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions'; -import { Registry } from 'vs/platform/registry/common/platform'; -import { ILifecycleService, LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; -import { IPreferencesService } from 'vs/workbench/services/preferences/common/preferences'; -import { IWorkspaceConfigurationService } from 'vs/workbench/services/configuration/common/configuration'; -import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; -import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; -import { Severity, INotificationService } from 'vs/platform/notification/common/notification'; - -class UnsupportedWorkspaceSettingsContribution implements IWorkbenchContribution { - - private static readonly storageKey = 'workspace.settings.unsupported.warning'; - private toDispose: IDisposable[] = []; - private isUntrusted = false; - - constructor( - @ILifecycleService lifecycleService: ILifecycleService, - @IWorkspaceContextService workspaceContextService: IWorkspaceContextService, - @IWorkspaceConfigurationService private workspaceConfigurationService: IWorkspaceConfigurationService, - @IPreferencesService private preferencesService: IPreferencesService, - @IStorageService private storageService: IStorageService, - @INotificationService private notificationService: INotificationService - ) { - lifecycleService.onShutdown(this.dispose, this); - this.toDispose.push(this.workspaceConfigurationService.onDidChangeConfiguration(e => this.checkWorkspaceSettings())); - this.toDispose.push(workspaceContextService.onDidChangeWorkspaceFolders(e => this.checkWorkspaceSettings())); - } - - public dispose(): void { - this.toDispose = dispose(this.toDispose); - } - - private checkWorkspaceSettings(): void { - if (this.isUntrusted) { - return; - } - - const configurationKeys = this.workspaceConfigurationService.getUnsupportedWorkspaceKeys(); - this.isUntrusted = configurationKeys.length > 0; - if (this.isUntrusted && !this.hasShownWarning()) { - this.showWarning(configurationKeys); - } - } - - private hasShownWarning(): boolean { - return this.storageService.getBoolean(UnsupportedWorkspaceSettingsContribution.storageKey, StorageScope.WORKSPACE, false); - } - - private rememberWarningWasShown(): void { - this.storageService.store(UnsupportedWorkspaceSettingsContribution.storageKey, true, StorageScope.WORKSPACE); - } - - private showWarning(unsupportedKeys: string[]): void { - this.notificationService.prompt( - Severity.Warning, - nls.localize('unsupportedWorkspaceSettings', 'This Workspace contains settings that can only be set in User Settings ({0}). Click [here]({1}) to learn more.', unsupportedKeys.join(', '), 'https://go.microsoft.com/fwlink/?linkid=839878'), - [{ - label: nls.localize('openWorkspaceSettings', 'Open Workspace Settings'), - run: () => { - this.rememberWarningWasShown(); - this.preferencesService.openWorkspaceSettings(); - } - }, { - label: nls.localize('dontShowAgain', 'Don\'t Show Again'), - isSecondary: true, - run: () => this.rememberWarningWasShown() - }] - ); - } -} - -const workbenchRegistry = Registry.as(WorkbenchExtensions.Workbench); -workbenchRegistry.registerWorkbenchContribution(UnsupportedWorkspaceSettingsContribution, LifecyclePhase.Running); diff --git a/src/vs/workbench/services/configuration/common/configuration.ts b/src/vs/workbench/services/configuration/common/configuration.ts index a0df6c8cf4a..344bfa78905 100644 --- a/src/vs/workbench/services/configuration/common/configuration.ts +++ b/src/vs/workbench/services/configuration/common/configuration.ts @@ -13,10 +13,6 @@ export const FOLDER_SETTINGS_PATH = `${FOLDER_CONFIG_FOLDER_NAME}/${FOLDER_SETTI export const IWorkspaceConfigurationService = createDecorator('configurationService'); export interface IWorkspaceConfigurationService extends IConfigurationService { - /** - * Returns untrusted configuration keys for the current workspace. - */ - getUnsupportedWorkspaceKeys(): string[]; } export const defaultSettingsSchemaId = 'vscode://schemas/settings/default'; diff --git a/src/vs/workbench/services/configuration/common/configurationExtensionPoint.ts b/src/vs/workbench/services/configuration/common/configurationExtensionPoint.ts index 6e67631266e..ddc4e0db248 100644 --- a/src/vs/workbench/services/configuration/common/configurationExtensionPoint.ts +++ b/src/vs/workbench/services/configuration/common/configurationExtensionPoint.ts @@ -32,7 +32,8 @@ const configurationEntrySchema: IJSONSchema = { type: 'object', properties: { isExecutable: { - type: 'boolean' + type: 'boolean', + deprecationMessage: 'This property is deprecated. Instead use `scope` property and set it to `application` value.' }, scope: { type: 'string', diff --git a/src/vs/workbench/services/configuration/common/configurationModels.ts b/src/vs/workbench/services/configuration/common/configurationModels.ts index 9550abcf826..d97bda0330e 100644 --- a/src/vs/workbench/services/configuration/common/configurationModels.ts +++ b/src/vs/workbench/services/configuration/common/configurationModels.ts @@ -5,7 +5,7 @@ 'use strict'; import { equals } from 'vs/base/common/objects'; -import { compare, toValuesTree, IConfigurationChangeEvent, ConfigurationTarget, IConfigurationModel, IConfigurationOverrides, IOverrides } from 'vs/platform/configuration/common/configuration'; +import { compare, toValuesTree, IConfigurationChangeEvent, ConfigurationTarget, IConfigurationModel, IConfigurationOverrides } from 'vs/platform/configuration/common/configuration'; import { Configuration as BaseConfiguration, ConfigurationModelParser, ConfigurationChangeEvent, ConfigurationModel, AbstractConfigurationChangeEvent } from 'vs/platform/configuration/common/configurationModels'; import { Registry } from 'vs/platform/registry/common/platform'; import { IConfigurationRegistry, IConfigurationPropertySchema, Extensions, ConfigurationScope } from 'vs/platform/configuration/common/configurationRegistry'; @@ -14,21 +14,6 @@ import { Workspace } from 'vs/platform/workspace/common/workspace'; import { StrictResourceMap } from 'vs/base/common/map'; import URI from 'vs/base/common/uri'; -export class SettingsModel extends ConfigurationModel { - - private _unsupportedKeys: string[]; - - constructor(contents: any, keys: string[], overrides: IOverrides[], unsupportedKeys: string[]) { - super(contents, keys, overrides); - this._unsupportedKeys = unsupportedKeys; - } - - public get unsupportedKeys(): string[] { - return this._unsupportedKeys; - } - -} - export class WorkspaceConfigurationModelParser extends ConfigurationModelParser { private _folders: IStoredWorkspaceFolder[] = []; @@ -45,8 +30,8 @@ export class WorkspaceConfigurationModelParser extends ConfigurationModelParser return this._folders; } - get settingsModel(): SettingsModel { - return this._settingsModelParser.settingsModel; + get settingsModel(): ConfigurationModel { + return this._settingsModelParser.configurationModel; } get launchModel(): ConfigurationModel { @@ -96,7 +81,7 @@ export class StandaloneConfigurationModelParser extends ConfigurationModelParser export class FolderSettingsModelParser extends ConfigurationModelParser { private _raw: any; - private _settingsModel: SettingsModel; + private _settingsModel: ConfigurationModel; constructor(name: string, private scopes: ConfigurationScope[]) { super(name); @@ -108,11 +93,7 @@ export class FolderSettingsModelParser extends ConfigurationModelParser { } get configurationModel(): ConfigurationModel { - return this._settingsModel || new SettingsModel({}, [], [], []); - } - - get settingsModel(): SettingsModel { - return this.configurationModel; + return this._settingsModel || new ConfigurationModel(); } reprocess(): void { @@ -120,35 +101,22 @@ export class FolderSettingsModelParser extends ConfigurationModelParser { } private parseWorkspaceSettings(rawSettings: any): void { - const unsupportedKeys = []; const rawWorkspaceSettings = {}; const configurationProperties = Registry.as(Extensions.Configuration).getConfigurationProperties(); for (let key in rawSettings) { - if (this.isNotExecutable(key, configurationProperties)) { - const scope = this.getScope(key, configurationProperties); - if (this.scopes.indexOf(scope) !== -1) { - rawWorkspaceSettings[key] = rawSettings[key]; - } - } else { - unsupportedKeys.push(key); + const scope = this.getScope(key, configurationProperties); + if (this.scopes.indexOf(scope) !== -1) { + rawWorkspaceSettings[key] = rawSettings[key]; } } const configurationModel = this.parseRaw(rawWorkspaceSettings); - this._settingsModel = new SettingsModel(configurationModel.contents, configurationModel.keys, configurationModel.overrides, unsupportedKeys); + this._settingsModel = new ConfigurationModel(configurationModel.contents, configurationModel.keys, configurationModel.overrides); } private getScope(key: string, configurationProperties: { [qualifiedKey: string]: IConfigurationPropertySchema }): ConfigurationScope { const propertySchema = configurationProperties[key]; return propertySchema ? propertySchema.scope : ConfigurationScope.WINDOW; } - - private isNotExecutable(key: string, configurationProperties: { [qualifiedKey: string]: IConfigurationPropertySchema }): boolean { - const propertySchema = configurationProperties[key]; - if (!propertySchema) { - return true; // Unknown propertis are ignored from checks - } - return !propertySchema.isExecutable; - } } export class Configuration extends BaseConfiguration { diff --git a/src/vs/workbench/services/configuration/node/configuration.ts b/src/vs/workbench/services/configuration/node/configuration.ts index d34e9369de0..b763c271181 100644 --- a/src/vs/workbench/services/configuration/node/configuration.ts +++ b/src/vs/workbench/services/configuration/node/configuration.ts @@ -92,10 +92,6 @@ export class WorkspaceConfiguration extends Disposable { return this._cache; } - getUnsupportedKeys(): string[] { - return this._workspaceConfigurationModelParser.settingsModel.unsupportedKeys; - } - reprocessWorkspaceSettings(): ConfigurationModel { this._workspaceConfigurationModelParser.reprocessWorkspaceSettings(); this.consolidate(); @@ -137,7 +133,6 @@ export interface IFolderConfiguration { readonly loaded: boolean; loadConfiguration(): TPromise; reprocess(): ConfigurationModel; - getUnsupportedKeys(): string[]; dispose(): void; } @@ -175,20 +170,16 @@ export abstract class AbstractFolderConfiguration extends Disposable implements } reprocess(): ConfigurationModel { - const oldContents = this._folderSettingsModelParser.settingsModel.contents; + const oldContents = this._folderSettingsModelParser.configurationModel.contents; this._folderSettingsModelParser.reprocess(); - if (!equals(oldContents, this._folderSettingsModelParser.settingsModel.contents)) { + if (!equals(oldContents, this._folderSettingsModelParser.configurationModel.contents)) { this.consolidate(); } return this._cache; } - getUnsupportedKeys(): string[] { - return this._folderSettingsModelParser.settingsModel.unsupportedKeys; - } - private consolidate(): void { - this._cache = this._folderSettingsModelParser.settingsModel.merge(...this._standAloneConfigurations); + this._cache = this._folderSettingsModelParser.configurationModel.merge(...this._standAloneConfigurations); } private parseContents(contents: { resource: URI, value: string }[]): void { @@ -449,10 +440,6 @@ export class FolderConfiguration extends Disposable implements IFolderConfigurat return this.folderConfiguration.reprocess(); } - getUnsupportedKeys(): string[] { - return this.folderConfiguration.getUnsupportedKeys(); - } - get loaded(): boolean { return this._loaded; } diff --git a/src/vs/workbench/services/configuration/node/configurationService.ts b/src/vs/workbench/services/configuration/node/configurationService.ts index fbd6fea2cf6..9bb5735fd44 100644 --- a/src/vs/workbench/services/configuration/node/configurationService.ts +++ b/src/vs/workbench/services/configuration/node/configurationService.ts @@ -37,7 +37,6 @@ import { WorkspaceConfiguration, FolderConfiguration } from 'vs/workbench/servic import { JSONEditingService } from 'vs/workbench/services/configuration/node/jsonEditingService'; import { Schemas } from 'vs/base/common/network'; import { massageFolderPathForWorkspace } from 'vs/platform/workspaces/node/workspaces'; -import { distinct } from 'vs/base/common/arrays'; import { UserConfiguration } from 'vs/platform/configuration/node/configuration'; import { getBaseLabel } from 'vs/base/common/labels'; import { IJSONSchema, IJSONSchemaMap } from 'vs/base/common/jsonSchema'; @@ -296,14 +295,6 @@ export class WorkspaceService extends Disposable implements IWorkspaceConfigurat return this._configuration.keys(); } - getUnsupportedWorkspaceKeys(): string[] { - const unsupportedWorkspaceKeys = [...this.workspaceConfiguration.getUnsupportedKeys()]; - for (const folder of this.workspace.folders) { - unsupportedWorkspaceKeys.push(...this.cachedFolderConfigs.get(folder.uri).getUnsupportedKeys()); - } - return distinct(unsupportedWorkspaceKeys); - } - initialize(arg: IWorkspaceIdentifier | ISingleFolderWorkspaceIdentifier | IWindowConfiguration): TPromise { return this.createWorkspace(arg) .then(workspace => this.updateWorkspaceAndInitializeConfiguration(workspace)); diff --git a/src/vs/workbench/services/configuration/test/common/configurationModels.test.ts b/src/vs/workbench/services/configuration/test/common/configurationModels.test.ts index 78af2a757c8..91b9b6d8529 100644 --- a/src/vs/workbench/services/configuration/test/common/configurationModels.test.ts +++ b/src/vs/workbench/services/configuration/test/common/configurationModels.test.ts @@ -32,10 +32,10 @@ suite('FolderSettingsModelParser', () => { 'default': 'isSet', scope: ConfigurationScope.RESOURCE }, - 'FolderSettingsModelParser.executable': { + 'FolderSettingsModelParser.application': { 'type': 'string', 'default': 'isSet', - isExecutable: true + scope: ConfigurationScope.APPLICATION } } }); @@ -44,7 +44,7 @@ suite('FolderSettingsModelParser', () => { test('parse all folder settings', () => { const testObject = new FolderSettingsModelParser('settings', [ConfigurationScope.RESOURCE, ConfigurationScope.WINDOW]); - testObject.parse(JSON.stringify({ 'FolderSettingsModelParser.window': 'window', 'FolderSettingsModelParser.resource': 'resource', 'FolderSettingsModelParser.executable': 'executable' })); + testObject.parse(JSON.stringify({ 'FolderSettingsModelParser.window': 'window', 'FolderSettingsModelParser.resource': 'resource', 'FolderSettingsModelParser.application': 'executable' })); assert.deepEqual(testObject.configurationModel.contents, { 'FolderSettingsModelParser': { 'window': 'window', 'resource': 'resource' } }); }); @@ -52,27 +52,27 @@ suite('FolderSettingsModelParser', () => { test('parse resource folder settings', () => { const testObject = new FolderSettingsModelParser('settings', [ConfigurationScope.RESOURCE]); - testObject.parse(JSON.stringify({ 'FolderSettingsModelParser.window': 'window', 'FolderSettingsModelParser.resource': 'resource', 'FolderSettingsModelParser.executable': 'executable' })); + testObject.parse(JSON.stringify({ 'FolderSettingsModelParser.window': 'window', 'FolderSettingsModelParser.resource': 'resource', 'FolderSettingsModelParser.application': 'executable' })); assert.deepEqual(testObject.configurationModel.contents, { 'FolderSettingsModelParser': { 'resource': 'resource' } }); }); - test('reprocess folder settings excludes executable', () => { + test('reprocess folder settings excludes application setting', () => { const testObject = new FolderSettingsModelParser('settings', [ConfigurationScope.RESOURCE, ConfigurationScope.WINDOW]); - testObject.parse(JSON.stringify({ 'FolderSettingsModelParser.resource': 'resource', 'FolderSettingsModelParser.anotherExecutable': 'executable' })); + testObject.parse(JSON.stringify({ 'FolderSettingsModelParser.resource': 'resource', 'FolderSettingsModelParser.anotherApplicationSetting': 'executable' })); - assert.deepEqual(testObject.configurationModel.contents, { 'FolderSettingsModelParser': { 'resource': 'resource', 'anotherExecutable': 'executable' } }); + assert.deepEqual(testObject.configurationModel.contents, { 'FolderSettingsModelParser': { 'resource': 'resource', 'anotherApplicationSetting': 'executable' } }); const configurationRegistry = Registry.as(ConfigurationExtensions.Configuration); configurationRegistry.registerConfiguration({ 'id': 'FolderSettingsModelParser_2', 'type': 'object', 'properties': { - 'FolderSettingsModelParser.anotherExecutable': { + 'FolderSettingsModelParser.anotherApplicationSetting': { 'type': 'string', 'default': 'isSet', - isExecutable: true + scope: ConfigurationScope.APPLICATION } } }); diff --git a/src/vs/workbench/services/configuration/test/electron-browser/configurationService.test.ts b/src/vs/workbench/services/configuration/test/electron-browser/configurationService.test.ts index c16e9043969..42eb0daf902 100644 --- a/src/vs/workbench/services/configuration/test/electron-browser/configurationService.test.ts +++ b/src/vs/workbench/services/configuration/test/electron-browser/configurationService.test.ts @@ -641,11 +641,6 @@ suite('WorkspaceConfigurationService - Folder', () => { 'type': 'string', 'default': 'isSet', scope: ConfigurationScope.RESOURCE - }, - 'configurationService.folder.executableSetting': { - 'type': 'string', - 'default': 'isSet', - isExecutable: true } } }); @@ -687,7 +682,7 @@ suite('WorkspaceConfigurationService - Folder', () => { }); test('defaults', () => { - assert.deepEqual(testObject.getValue('configurationService'), { 'folder': { 'applicationSetting': 'isSet', 'testSetting': 'isSet', 'executableSetting': 'isSet' } }); + assert.deepEqual(testObject.getValue('configurationService'), { 'folder': { 'applicationSetting': 'isSet', 'testSetting': 'isSet' } }); }); test('globals override defaults', () => { @@ -743,35 +738,22 @@ suite('WorkspaceConfigurationService - Folder', () => { .then(() => assert.equal(testObject.getValue('configurationService.folder.applicationSetting'), 'userValue')); }); - test('executable settings are not read from workspace', () => { - fs.writeFileSync(globalSettingsFile, '{ "configurationService.folder.executableSetting": "userValue" }'); - fs.writeFileSync(path.join(workspaceDir, '.vscode', 'settings.json'), '{ "configurationService.folder.executableSetting": "workspaceValue" }'); - return testObject.reloadConfiguration() - .then(() => assert.equal(testObject.getValue('configurationService.folder.executableSetting'), 'userValue')); - }); - - test('get unsupported workspace settings', () => { - fs.writeFileSync(path.join(workspaceDir, '.vscode', 'settings.json'), '{ "configurationService.folder.executableSetting": "workspaceValue" }'); - return testObject.reloadConfiguration() - .then(() => assert.deepEqual(testObject.getUnsupportedWorkspaceKeys(), ['configurationService.folder.executableSetting'])); - }); - - test('get unsupported workspace settings after defaults are registered', () => { - fs.writeFileSync(path.join(workspaceDir, '.vscode', 'settings.json'), '{ "configurationService.folder.anotherExecutableSetting": "workspaceValue" }'); + test('get application scope settings are not loaded after defaults are registered', () => { + fs.writeFileSync(path.join(workspaceDir, '.vscode', 'settings.json'), '{ "configurationService.folder.anotherApplicationSetting": "workspaceValue" }'); return testObject.reloadConfiguration() .then(() => { configurationRegistry.registerConfiguration({ 'id': '_test', 'type': 'object', 'properties': { - 'configurationService.folder.anotherExecutableSetting': { + 'configurationService.folder.anotherApplicationSetting': { 'type': 'string', 'default': 'isSet', - isExecutable: true + scope: ConfigurationScope.APPLICATION } } }); - assert.deepEqual(testObject.getUnsupportedWorkspaceKeys(), ['configurationService.folder.anotherExecutableSetting']); + assert.deepEqual(testObject.keys().workspace, []); }); }); @@ -935,17 +917,6 @@ suite('WorkspaceConfigurationService - Multiroot', () => { 'type': 'string', 'default': 'isSet', scope: ConfigurationScope.RESOURCE - }, - 'configurationService.workspace.testExecutableSetting': { - 'type': 'string', - 'default': 'isSet', - isExecutable: true - }, - 'configurationService.workspace.testExecutableResourceSetting': { - 'type': 'string', - 'default': 'isSet', - isExecutable: true, - scope: ConfigurationScope.RESOURCE } } }); @@ -989,27 +960,6 @@ suite('WorkspaceConfigurationService - Multiroot', () => { return void 0; }); - test('executable settings are not read from workspace', () => { - fs.writeFileSync(environmentService.appSettingsPath, '{ "configurationService.workspace.testExecutableSetting": "userValue" }'); - return jsonEditingServce.write(workspaceContextService.getWorkspace().configuration, { key: 'settings', value: { 'configurationService.workspace.testExecutableSetting': 'workspaceValue' } }, true) - .then(() => testObject.reloadConfiguration()) - .then(() => assert.equal(testObject.getValue('configurationService.workspace.testExecutableSetting'), 'userValue')); - }); - - test('executable settings are not read from workspace folder', () => { - fs.writeFileSync(environmentService.appSettingsPath, '{ "configurationService.workspace.testExecutableResourceSetting": "userValue" }'); - fs.writeFileSync(workspaceContextService.getWorkspace().folders[0].toResource('.vscode/settings.json').fsPath, '{ "configurationService.workspace.testExecutableResourceSetting": "workspaceFolderValue" }'); - return testObject.reloadConfiguration() - .then(() => assert.equal(testObject.getValue('configurationService.workspace.testExecutableResourceSetting', { resource: workspaceContextService.getWorkspace().folders[0].uri }), 'userValue')); - }); - - test('get unsupported workspace settings', () => { - fs.writeFileSync(workspaceContextService.getWorkspace().folders[0].toResource('.vscode/settings.json').fsPath, '{ "configurationService.workspace.testExecutableResourceSetting": "workspaceFolderValue" }'); - return jsonEditingServce.write(workspaceContextService.getWorkspace().configuration, { key: 'settings', value: { 'configurationService.workspace.testExecutableSetting': 'workspaceValue' } }, true) - .then(() => testObject.reloadConfiguration()) - .then(() => assert.deepEqual(testObject.getUnsupportedWorkspaceKeys(), ['configurationService.workspace.testExecutableSetting', 'configurationService.workspace.testExecutableResourceSetting'])); - }); - test('application settings are not read from workspace', () => { fs.writeFileSync(environmentService.appSettingsPath, '{ "configurationService.workspace.applicationSetting": "userValue" }'); return jsonEditingServce.write(workspaceContextService.getWorkspace().configuration, { key: 'settings', value: { 'configurationService.workspace.applicationSetting': 'workspaceValue' } }, true) @@ -1043,45 +993,23 @@ suite('WorkspaceConfigurationService - Multiroot', () => { .then(() => assert.equal(testObject.getValue('configurationService.workspace.applicationSetting'), 'userValue')); }); - test('executable settings are not read from workspace folder after defaults are registered', () => { - fs.writeFileSync(environmentService.appSettingsPath, '{ "configurationService.workspace.testNewExecutableResourceSetting": "userValue" }'); - fs.writeFileSync(workspaceContextService.getWorkspace().folders[0].toResource('.vscode/settings.json').fsPath, '{ "configurationService.workspace.testNewExecutableResourceSetting": "workspaceFolderValue" }'); + test('application settings are not read from workspace folder after defaults are registered', () => { + fs.writeFileSync(environmentService.appSettingsPath, '{ "configurationService.workspace.testNewApplicationSetting": "userValue" }'); + fs.writeFileSync(workspaceContextService.getWorkspace().folders[0].toResource('.vscode/settings.json').fsPath, '{ "configurationService.workspace.testNewApplicationSetting": "workspaceFolderValue" }'); return testObject.reloadConfiguration() .then(() => { configurationRegistry.registerConfiguration({ 'id': '_test', 'type': 'object', 'properties': { - 'configurationService.workspace.testNewExecutableResourceSetting': { + 'configurationService.workspace.testNewApplicationSetting': { 'type': 'string', 'default': 'isSet', - isExecutable: true, - scope: ConfigurationScope.RESOURCE + scope: ConfigurationScope.APPLICATION } } }); - assert.equal(testObject.getValue('configurationService.workspace.testNewExecutableResourceSetting', { resource: workspaceContextService.getWorkspace().folders[0].uri }), 'userValue'); - }); - }); - - test('get unsupported workspace settings after defaults are registered', () => { - fs.writeFileSync(workspaceContextService.getWorkspace().folders[0].toResource('.vscode/settings.json').fsPath, '{ "configurationService.workspace.testNewExecutableResourceSetting2": "workspaceFolderValue" }'); - return jsonEditingServce.write(workspaceContextService.getWorkspace().configuration, { key: 'settings', value: { 'configurationService.workspace.testExecutableSetting': 'workspaceValue' } }, true) - .then(() => testObject.reloadConfiguration()) - .then(() => { - configurationRegistry.registerConfiguration({ - 'id': '_test', - 'type': 'object', - 'properties': { - 'configurationService.workspace.testNewExecutableResourceSetting2': { - 'type': 'string', - 'default': 'isSet', - isExecutable: true, - scope: ConfigurationScope.RESOURCE - } - } - }); - assert.deepEqual(testObject.getUnsupportedWorkspaceKeys(), ['configurationService.workspace.testExecutableSetting', 'configurationService.workspace.testNewExecutableResourceSetting2']); + assert.equal(testObject.getValue('configurationService.workspace.testNewApplicationSetting', { resource: workspaceContextService.getWorkspace().folders[0].uri }), 'userValue'); }); }); diff --git a/src/vs/workbench/workbench.main.ts b/src/vs/workbench/workbench.main.ts index 62d2302178b..7fa40f67cec 100644 --- a/src/vs/workbench/workbench.main.ts +++ b/src/vs/workbench/workbench.main.ts @@ -86,8 +86,6 @@ import 'vs/workbench/parts/terminal/electron-browser/terminalPanel'; // can be p import 'vs/workbench/electron-browser/workbench'; -import 'vs/workbench/parts/trust/electron-browser/unsupportedWorkspaceSettings.contribution'; - import 'vs/workbench/parts/relauncher/electron-browser/relauncher.contribution'; import 'vs/workbench/parts/tasks/electron-browser/task.contribution';