diff --git a/src/vs/workbench/parts/preferences/browser/preferences.contribution.ts b/src/vs/workbench/parts/preferences/browser/preferences.contribution.ts index e13e74b66fefabc6c8a9c209c99dc5f3e9320e8e..8e56a542b97ebc82e8d111c4ee3c5b79d9e74d1a 100644 --- a/src/vs/workbench/parts/preferences/browser/preferences.contribution.ts +++ b/src/vs/workbench/parts/preferences/browser/preferences.contribution.ts @@ -17,17 +17,19 @@ import { KeyMod, KeyChord, KeyCode } from 'vs/base/common/keyCodes'; import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors'; import { DefaultPreferencesEditorInput, PreferencesEditor, PreferencesEditorInput } from 'vs/workbench/parts/preferences/browser/preferencesEditor'; import { KeybindingsEditor, KeybindingsEditorInput } from 'vs/workbench/parts/preferences/browser/keybindingsEditor'; -import { OpenGlobalSettingsAction, OpenGlobalKeybindingsAction, OpenGlobalKeybindingsFileAction, OpenWorkspaceSettingsAction, OpenFolderSettingsAction, ConfigureLanguageBasedSettingsAction } from 'vs/workbench/parts/preferences/browser/preferencesActions'; +import { OpenGlobalSettingsAction, OpenGlobalKeybindingsAction, OpenGlobalKeybindingsFileAction, OpenWorkspaceSettingsAction, OpenFolderSettingsAction, ConfigureLanguageBasedSettingsAction, OPEN_FOLDER_SETTINGS_COMMAND } from 'vs/workbench/parts/preferences/browser/preferencesActions'; import { IPreferencesService, IKeybindingsEditor, CONTEXT_KEYBINDING_FOCUS, CONTEXT_KEYBINDINGS_EDITOR, CONTEXT_KEYBINDINGS_SEARCH_FOCUS, KEYBINDINGS_EDITOR_COMMAND_DEFINE, KEYBINDINGS_EDITOR_COMMAND_REMOVE, KEYBINDINGS_EDITOR_COMMAND_SEARCH, KEYBINDINGS_EDITOR_COMMAND_COPY, KEYBINDINGS_EDITOR_COMMAND_RESET, KEYBINDINGS_EDITOR_COMMAND_SHOW_CONFLICTS, KEYBINDINGS_EDITOR_COMMAND_FOCUS_KEYBINDINGS, KEYBINDINGS_EDITOR_COMMAND_CLEAR_SEARCH_RESULTS } from 'vs/workbench/parts/preferences/common/preferences'; import { PreferencesService } from 'vs/workbench/parts/preferences/browser/preferencesService'; -import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; +import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions'; import { PreferencesContentProvider } from 'vs/workbench/parts/preferences/common/preferencesContentProvider'; import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService'; +import { CommandsRegistry } from 'vs/platform/commands/common/commands'; +import { IWorkspaceFolder } from 'vs/platform/workspace/common/workspace'; registerSingleton(IPreferencesService, PreferencesService); @@ -257,4 +259,9 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ } }); -Registry.as(WorkbenchExtensions.Workbench).registerWorkbenchContribution(PreferencesContentProvider); \ No newline at end of file +Registry.as(WorkbenchExtensions.Workbench).registerWorkbenchContribution(PreferencesContentProvider); + +CommandsRegistry.registerCommand(OPEN_FOLDER_SETTINGS_COMMAND, function (accessor: ServicesAccessor, args?: IWorkspaceFolder) { + const preferencesService = accessor.get(IPreferencesService); + return preferencesService.openFolderSettings(args.uri); +}); \ No newline at end of file diff --git a/src/vs/workbench/parts/preferences/browser/preferencesActions.ts b/src/vs/workbench/parts/preferences/browser/preferencesActions.ts index f120d63a291459b11d6db5e9b027ba0680570d8f..1bdd9b31166a21d3ed7f0f9e66338a93717fb02b 100644 --- a/src/vs/workbench/parts/preferences/browser/preferencesActions.ts +++ b/src/vs/workbench/parts/preferences/browser/preferencesActions.ts @@ -102,6 +102,7 @@ export class OpenWorkspaceSettingsAction extends Action { } } +export const OPEN_FOLDER_SETTINGS_COMMAND = '_workbench.action.openFolderSettings'; export class OpenFolderSettingsAction extends Action { public static ID = 'workbench.action.openFolderSettings'; @@ -131,7 +132,7 @@ export class OpenFolderSettingsAction extends Action { return this.commandService.executeCommand(PICK_WORKSPACE_FOLDER_COMMAND) .then(workspaceFolder => { if (workspaceFolder) { - return this.preferencesService.openFolderSettings(workspaceFolder.uri); + return this.commandService.executeCommand(OPEN_FOLDER_SETTINGS_COMMAND, workspaceFolder); } return null; }); diff --git a/src/vs/workbench/services/configuration/common/configuration.ts b/src/vs/workbench/services/configuration/common/configuration.ts index c38ff73b6d6ce11b8f87e4e4f1adec3d26fad638..28c1b711fed4989f78668a8e51caccd91d8be32f 100644 --- a/src/vs/workbench/services/configuration/common/configuration.ts +++ b/src/vs/workbench/services/configuration/common/configuration.ts @@ -21,7 +21,9 @@ export interface IWorkspaceConfigurationService extends IConfigurationService { } -export const WORKSPACE_STANDALONE_CONFIGURATIONS = { - 'tasks': `${WORKSPACE_CONFIG_FOLDER_DEFAULT_NAME}/tasks.json`, - 'launch': `${WORKSPACE_CONFIG_FOLDER_DEFAULT_NAME}/launch.json` -}; \ No newline at end of file +export const TASKS_CONFIGURATION_KEY = 'tasks'; +export const LAUNCH_CONFIGURATION_KEY = 'launch'; + +export const WORKSPACE_STANDALONE_CONFIGURATIONS = {}; +WORKSPACE_STANDALONE_CONFIGURATIONS[TASKS_CONFIGURATION_KEY] = `${WORKSPACE_CONFIG_FOLDER_DEFAULT_NAME}/tasks.json`; +WORKSPACE_STANDALONE_CONFIGURATIONS[LAUNCH_CONFIGURATION_KEY] = `${WORKSPACE_CONFIG_FOLDER_DEFAULT_NAME}/launch.json`; \ No newline at end of file diff --git a/src/vs/workbench/services/configuration/node/configuration.ts b/src/vs/workbench/services/configuration/node/configuration.ts index 8fed9ed5247d9cac47afa53ed6d96aabe839b704..435446e1fffb30cd73941680883ab4abcfbde289 100644 --- a/src/vs/workbench/services/configuration/node/configuration.ts +++ b/src/vs/workbench/services/configuration/node/configuration.ts @@ -25,7 +25,7 @@ import { IEnvironmentService } from 'vs/platform/environment/common/environment' import { CustomConfigurationModel } from 'vs/platform/configuration/common/model'; import { WorkspaceConfigurationModel, ScopedConfigurationModel, FolderConfigurationModel, FolderSettingsModel } from 'vs/workbench/services/configuration/common/configurationModels'; import { IConfigurationServiceEvent, ConfigurationSource, IConfigurationKeys, IConfigurationValue, ConfigurationModel, IConfigurationOverrides, Configuration as BaseConfiguration, IConfigurationValues, IConfigurationData } from 'vs/platform/configuration/common/configuration'; -import { IWorkspaceConfigurationService, WORKSPACE_CONFIG_FOLDER_DEFAULT_NAME, WORKSPACE_STANDALONE_CONFIGURATIONS, WORKSPACE_CONFIG_DEFAULT_PATH } from 'vs/workbench/services/configuration/common/configuration'; +import { IWorkspaceConfigurationService, WORKSPACE_CONFIG_FOLDER_DEFAULT_NAME, WORKSPACE_STANDALONE_CONFIGURATIONS, WORKSPACE_CONFIG_DEFAULT_PATH, TASKS_CONFIGURATION_KEY, LAUNCH_CONFIGURATION_KEY } from 'vs/workbench/services/configuration/common/configuration'; import { ConfigurationService as GlobalConfigurationService } from 'vs/platform/configuration/node/configurationService'; import * as nls from 'vs/nls'; import { Registry } from 'vs/platform/registry/common/platform'; @@ -789,7 +789,7 @@ class FolderConfiguration extends Disposable { } private isWorkspaceConfigurationFile(folderRelativePath: string): boolean { - return [WORKSPACE_CONFIG_DEFAULT_PATH, WORKSPACE_STANDALONE_CONFIGURATIONS.launch, WORKSPACE_STANDALONE_CONFIGURATIONS.tasks].some(p => p === folderRelativePath); + return [WORKSPACE_CONFIG_DEFAULT_PATH, WORKSPACE_STANDALONE_CONFIGURATIONS[TASKS_CONFIGURATION_KEY], WORKSPACE_STANDALONE_CONFIGURATIONS[LAUNCH_CONFIGURATION_KEY]].some(p => p === folderRelativePath); } private toResource(folderRelativePath: string): URI { diff --git a/src/vs/workbench/services/configuration/node/configurationEditingService.ts b/src/vs/workbench/services/configuration/node/configurationEditingService.ts index fa81d5be3cfbffdbdfed7cfed1bbc936c98e5c50..9787cfcbc1cb7dde5b3417c034771e7a85651e7b 100644 --- a/src/vs/workbench/services/configuration/node/configurationEditingService.ts +++ b/src/vs/workbench/services/configuration/node/configurationEditingService.ts @@ -25,18 +25,21 @@ import { IEnvironmentService } from 'vs/platform/environment/common/environment' import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles'; import { IConfigurationService, IConfigurationOverrides } from 'vs/platform/configuration/common/configuration'; import { keyFromOverrideIdentifier } from 'vs/platform/configuration/common/model'; -import { WORKSPACE_CONFIG_DEFAULT_PATH, WORKSPACE_STANDALONE_CONFIGURATIONS } from 'vs/workbench/services/configuration/common/configuration'; +import { WORKSPACE_CONFIG_DEFAULT_PATH, WORKSPACE_STANDALONE_CONFIGURATIONS, TASKS_CONFIGURATION_KEY, LAUNCH_CONFIGURATION_KEY } from 'vs/workbench/services/configuration/common/configuration'; import { IFileService } from 'vs/platform/files/common/files'; import { IConfigurationEditingService, ConfigurationEditingErrorCode, ConfigurationEditingError, ConfigurationTarget, IConfigurationValue, IConfigurationEditingOptions } from 'vs/workbench/services/configuration/common/configurationEditing'; import { ITextModelService, ITextEditorModel } from 'vs/editor/common/services/resolverService'; import { OVERRIDE_PROPERTY_PATTERN, IConfigurationRegistry, Extensions as ConfigurationExtensions, ConfigurationScope } from 'vs/platform/configuration/common/configurationRegistry'; import { IChoiceService, IMessageService, Severity } from 'vs/platform/message/common/message'; import { ICommandService } from 'vs/platform/commands/common/commands'; +import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService'; interface IConfigurationEditOperation extends IConfigurationValue { + target: ConfigurationTarget; jsonPath: json.JSONPath; resource: URI; - isWorkspaceStandalone?: boolean; + workspaceStandAloneConfigurationKey?: string; + } interface IValidationResult { @@ -63,28 +66,28 @@ export class ConfigurationEditingService implements IConfigurationEditingService @ITextFileService private textFileService: ITextFileService, @IChoiceService private choiceService: IChoiceService, @IMessageService private messageService: IMessageService, - @ICommandService private commandService: ICommandService + @ICommandService private commandService: ICommandService, + @IWorkbenchEditorService private editorService: IWorkbenchEditorService ) { this.queue = new Queue(); } writeConfiguration(target: ConfigurationTarget, value: IConfigurationValue, options: IConfigurationEditingOptions = {}): TPromise { - return this.queue.queue(() => this.doWriteConfiguration(target, value, options) // queue up writes to prevent race conditions + const operation = this.getConfigurationEditOperation(target, value, options.scopes || {}); + return this.queue.queue(() => this.doWriteConfiguration(operation, options) // queue up writes to prevent race conditions .then(() => null, error => { if (!options.donotNotifyError) { - this.onError(error, target, value, options.scopes); + this.onError(error, operation, options.scopes); } return TPromise.wrapError(error); })); } - private doWriteConfiguration(target: ConfigurationTarget, value: IConfigurationValue, options: ConfigurationEditingOptions): TPromise { - const operation = this.getConfigurationEditOperation(target, value, options.scopes || {}); - + private doWriteConfiguration(operation: IConfigurationEditOperation, options: ConfigurationEditingOptions): TPromise { const checkDirtyConfiguration = !(options.force || options.donotSave); const saveConfiguration = options.force || !options.donotSave; - return this.resolveAndValidate(target, operation, checkDirtyConfiguration, options.scopes || {}) + return this.resolveAndValidate(operation.target, operation, checkDirtyConfiguration, options.scopes || {}) .then(reference => this.writeToBuffer(reference.object.textEditorModel, operation, saveConfiguration) .then(() => reference.dispose())); } @@ -112,45 +115,97 @@ export class ConfigurationEditingService implements IConfigurationEditingService return false; } - private onError(error: ConfigurationEditingError, target: ConfigurationTarget, value: IConfigurationValue, scopes: IConfigurationOverrides): void { + private onError(error: ConfigurationEditingError, operation: IConfigurationEditOperation, scopes: IConfigurationOverrides): void { switch (error.code) { case ConfigurationEditingErrorCode.ERROR_INVALID_CONFIGURATION: - this.onInvalidConfigurationError(error, target); + this.onInvalidConfigurationError(error, operation); break; case ConfigurationEditingErrorCode.ERROR_CONFIGURATION_FILE_DIRTY: - this.onConfigurationFileDirtyError(error, target, value, scopes); + this.onConfigurationFileDirtyError(error, operation, scopes); break; default: this.messageService.show(Severity.Error, error.message); } } - private onInvalidConfigurationError(error: ConfigurationEditingError, target: ConfigurationTarget): void { - this.choiceService.choose(Severity.Error, error.message, [nls.localize('open', "Open Settings"), nls.localize('close', "Close")], 1) - .then(option => { - switch (option) { - case 0: - this.openSettings(target); - } - }); + private onInvalidConfigurationError(error: ConfigurationEditingError, operation: IConfigurationEditOperation, ): void { + const openStandAloneConfigurationActionLabel = operation.workspaceStandAloneConfigurationKey === TASKS_CONFIGURATION_KEY ? nls.localize('openTasksConfiguration', "Open Tasks Configuration") + : operation.workspaceStandAloneConfigurationKey === LAUNCH_CONFIGURATION_KEY ? nls.localize('openLaunchConfiguration', "Open Launch Configuration") + : null; + if (openStandAloneConfigurationActionLabel) { + this.choiceService.choose(Severity.Error, error.message, [openStandAloneConfigurationActionLabel, nls.localize('close', "Close")], 1) + .then(option => { + switch (option) { + case 0: + this.openFile(operation.resource); + break; + } + }); + } else { + this.choiceService.choose(Severity.Error, error.message, [nls.localize('open', "Open Settings"), nls.localize('close', "Close")], 1) + .then(option => { + switch (option) { + case 0: + this.openSettings(operation); + break; + } + }); + } } - private onConfigurationFileDirtyError(error: ConfigurationEditingError, target: ConfigurationTarget, value: IConfigurationValue, scopes: IConfigurationOverrides): void { - this.choiceService.choose(Severity.Error, error.message, [nls.localize('saveAndRetry', "Save Settings and Retry"), nls.localize('open', "Open Settings"), nls.localize('close', "Close")], 2) - .then(option => { - switch (option) { - case 0: - this.writeConfiguration(target, value, { force: true, scopes }); - break; - case 1: - this.openSettings(target); - break; + private onConfigurationFileDirtyError(error: ConfigurationEditingError, operation: IConfigurationEditOperation, scopes: IConfigurationOverrides): void { + const openStandAloneConfigurationActionLabel = operation.workspaceStandAloneConfigurationKey === TASKS_CONFIGURATION_KEY ? nls.localize('openTasksConfiguration', "Open Tasks Configuration") + : operation.workspaceStandAloneConfigurationKey === LAUNCH_CONFIGURATION_KEY ? nls.localize('openLaunchConfiguration', "Open Launch Configuration") + : null; + if (openStandAloneConfigurationActionLabel) { + this.choiceService.choose(Severity.Error, error.message, [nls.localize('saveAndRetry', "Save and Retry"), openStandAloneConfigurationActionLabel, nls.localize('close', "Close")], 2) + .then(option => { + switch (option) { + case 0: + const key = operation.key ? `${operation.workspaceStandAloneConfigurationKey}.${operation.key}` : operation.workspaceStandAloneConfigurationKey; + this.writeConfiguration(operation.target, { key, value: operation.value }, { force: true, scopes }); + break; + case 1: + this.openFile(operation.resource); + break; + } + }); + } else { + this.choiceService.choose(Severity.Error, error.message, [nls.localize('saveAndRetry', "Save and Retry"), nls.localize('open', "Open Settings"), nls.localize('close', "Close")], 2) + .then(option => { + switch (option) { + case 0: + this.writeConfiguration(operation.target, { key: operation.key, value: operation.value }, { force: true, scopes }); + break; + case 1: + this.openSettings(operation); + break; + } + }); + } + } + + private openSettings(operation: IConfigurationEditOperation): void { + switch (operation.target) { + case ConfigurationTarget.USER: + this.commandService.executeCommand('workbench.action.openGlobalSettings'); + break; + case ConfigurationTarget.WORKSPACE: + this.commandService.executeCommand('workbench.action.openWorkspaceSettings'); + break; + case ConfigurationTarget.FOLDER: + if (operation.resource) { + const workspaceFolder = this.contextService.getWorkspaceFolder(operation.resource); + if (workspaceFolder) { + this.commandService.executeCommand('_workbench.action.openFolderSettings', workspaceFolder); + } } - }); + break; + } } - private openSettings(target: ConfigurationTarget): void { - this.commandService.executeCommand(ConfigurationTarget.USER === target ? 'workbench.action.openGlobalSettings' : 'workbench.action.openWorkspaceSettings'); + private openFile(resource: URI): void { + this.editorService.openEditor({ resource }); } private wrapError(code: ConfigurationEditingErrorCode, target: ConfigurationTarget, operation: IConfigurationEditOperation): TPromise { @@ -171,18 +226,40 @@ export class ConfigurationEditingService implements IConfigurationEditingService // User issues case ConfigurationEditingErrorCode.ERROR_INVALID_CONFIGURATION: { - if (target === ConfigurationTarget.USER) { - return nls.localize('errorInvalidConfiguration', "Unable to write into settings. Please open **User Settings** to correct errors/warnings in the file and try again."); + if (operation.workspaceStandAloneConfigurationKey === TASKS_CONFIGURATION_KEY) { + return nls.localize('errorInvalidTaskConfiguration', "Unable to write into tasks file. Please open **Tasks** file to correct errors/warnings in it and try again."); } - - return nls.localize('errorInvalidConfigurationWorkspace', "Unable to write into settings. Please open **Workspace Settings** to correct errors/warnings in the file and try again."); + if (operation.workspaceStandAloneConfigurationKey === LAUNCH_CONFIGURATION_KEY) { + return nls.localize('errorInvalidLaunchConfiguration', "Unable to write into launch file. Please open **Launch** file to correct errors/warnings in it and try again."); + } + switch (target) { + case ConfigurationTarget.USER: + return nls.localize('errorInvalidConfiguration', "Unable to write into user settings. Please open **User Settings** file to correct errors/warnings in it and try again."); + case ConfigurationTarget.WORKSPACE: + return nls.localize('errorInvalidConfigurationWorkspace', "Unable to write into workspace settings. Please open **Workspace Settings** file to correct errors/warnings in the file and try again."); + case ConfigurationTarget.FOLDER: + const workspaceFolderName = this.contextService.getWorkspaceFolder(operation.resource).name; + return nls.localize('errorInvalidConfigurationFolder', "Unable to write into folder settings. Please open **Folder Settings** file under **{0}** folder to correct errors/warnings in it and try again.", workspaceFolderName); + } + return ''; }; case ConfigurationEditingErrorCode.ERROR_CONFIGURATION_FILE_DIRTY: { - if (target === ConfigurationTarget.USER) { - return nls.localize('errorConfigurationFileDirty', "Unable to write into settings because the file is dirty. Please save the **User Settings** file and try again."); + if (operation.workspaceStandAloneConfigurationKey === TASKS_CONFIGURATION_KEY) { + return nls.localize('errorTasksConfigurationFileDirty', "Unable to write into tasks file because the file is dirty. Please save the **Tasks Configuration** file and try again."); } - - return nls.localize('errorConfigurationFileDirtyWorkspace', "Unable to write into settings because the file is dirty. Please save the **Workspace Settings** file and try again."); + if (operation.workspaceStandAloneConfigurationKey === LAUNCH_CONFIGURATION_KEY) { + return nls.localize('errorLaunchConfigurationFileDirty', "Unable to write into launch file because the file is dirty. Please save the **Launch Configuration** file and try again."); + } + switch (target) { + case ConfigurationTarget.USER: + return nls.localize('errorConfigurationFileDirty', "Unable to write into user settings because the file is dirty. Please save the **User Settings** file and try again."); + case ConfigurationTarget.WORKSPACE: + return nls.localize('errorConfigurationFileDirtyWorkspace', "Unable to write into workspace settings because the file is dirty. Please save the **Workspace Settings** file and try again."); + case ConfigurationTarget.FOLDER: + const workspaceFolderName = this.contextService.getWorkspaceFolder(operation.resource).name; + return nls.localize('errorConfigurationFileDirtyFolder', "Unable to write into folder settings because the file is dirty. Please save the **Folder Settings** file under **{0}** folder and try again.", workspaceFolderName); + } + return ''; }; } } @@ -227,7 +304,7 @@ export class ConfigurationEditingService implements IConfigurationEditingService private hasParseErrors(model: editorCommon.IModel, operation: IConfigurationEditOperation): boolean { // If we write to a workspace standalone file and replace the entire contents (no key provided) // we can return here because any parse errors can safely be ignored since all contents are replaced - if (operation.isWorkspaceStandalone && !operation.key) { + if (operation.workspaceStandAloneConfigurationKey && !operation.key) { return false; } const parseErrors: json.ParseError[] = []; @@ -238,7 +315,7 @@ export class ConfigurationEditingService implements IConfigurationEditingService private resolveAndValidate(target: ConfigurationTarget, operation: IConfigurationEditOperation, checkDirty: boolean, overrides: IConfigurationOverrides): TPromise> { // Any key must be a known setting from the registry (unless this is a standalone config) - if (!operation.isWorkspaceStandalone) { + if (!operation.workspaceStandAloneConfigurationKey) { const validKeys = this.configurationService.keys().default; if (validKeys.indexOf(operation.key) < 0 && !OVERRIDE_PROPERTY_PATTERN.test(operation.key)) { return this.wrapError(ConfigurationEditingErrorCode.ERROR_UNKNOWN_KEY, target, operation); @@ -246,7 +323,7 @@ export class ConfigurationEditingService implements IConfigurationEditingService } // Target cannot be user if is standalone - if (operation.isWorkspaceStandalone && target === ConfigurationTarget.USER) { + if (operation.workspaceStandAloneConfigurationKey && target === ConfigurationTarget.USER) { return this.wrapError(ConfigurationEditingErrorCode.ERROR_INVALID_USER_TARGET, target, operation); } @@ -260,7 +337,7 @@ export class ConfigurationEditingService implements IConfigurationEditingService return this.wrapError(ConfigurationEditingErrorCode.ERROR_INVALID_FOLDER_TARGET, target, operation); } - if (!operation.isWorkspaceStandalone) { + if (!operation.workspaceStandAloneConfigurationKey) { const configurationProperties = Registry.as(ConfigurationExtensions.Configuration).getConfigurationProperties(); if (configurationProperties[operation.key].scope !== ConfigurationScope.RESOURCE) { return this.wrapError(ConfigurationEditingErrorCode.ERROR_INVALID_FOLDER_CONFIGURATION, target, operation); @@ -298,14 +375,14 @@ export class ConfigurationEditingService implements IConfigurationEditingService // Check for prefix if (config.key === key) { const jsonPath = workspace.configuration && resource && workspace.configuration.fsPath === resource.fsPath ? [key] : []; - return { key: jsonPath[jsonPath.length - 1], jsonPath, value: config.value, resource, isWorkspaceStandalone: true }; + return { key: jsonPath[jsonPath.length - 1], jsonPath, value: config.value, resource, workspaceStandAloneConfigurationKey: key, target }; } // Check for prefix. const keyPrefix = `${key}.`; if (config.key.indexOf(keyPrefix) === 0) { const jsonPath = workspace.configuration && resource && workspace.configuration.fsPath === resource.fsPath ? [key, config.key.substr(keyPrefix.length)] : [config.key.substr(keyPrefix.length)]; - return { key: jsonPath[jsonPath.length - 1], jsonPath, value: config.value, resource, isWorkspaceStandalone: true }; + return { key: jsonPath[jsonPath.length - 1], jsonPath, value: config.value, resource, workspaceStandAloneConfigurationKey: key, target }; } } } @@ -313,14 +390,14 @@ export class ConfigurationEditingService implements IConfigurationEditingService let key = config.key; let jsonPath = overrides.overrideIdentifier ? [keyFromOverrideIdentifier(overrides.overrideIdentifier), key] : [key]; if (target === ConfigurationTarget.USER) { - return { key, jsonPath, value: config.value, resource: URI.file(this.environmentService.appSettingsPath) }; + return { key, jsonPath, value: config.value, resource: URI.file(this.environmentService.appSettingsPath), target }; } const resource = this.getConfigurationFileResource(target, WORKSPACE_CONFIG_DEFAULT_PATH, overrides.resource); if (workspace.configuration && resource && workspace.configuration.fsPath === resource.fsPath) { jsonPath = ['settings', ...jsonPath]; } - return { key, jsonPath, value: config.value, resource }; + return { key, jsonPath, value: config.value, resource, target }; } private getConfigurationFileResource(target: ConfigurationTarget, relativePath: string, resource: URI): URI {