diff --git a/src/vs/vscode.d.ts b/src/vs/vscode.d.ts index c880739c315c97d2b14e007cace4028ea5a79bf1..16f71db579ac7d34bcc774f47c7d0930622dba0a 100644 --- a/src/vs/vscode.d.ts +++ b/src/vs/vscode.d.ts @@ -2978,11 +2978,11 @@ declare module 'vscode' { * - Workspace configuration (if available) * - Workspace folder configuration of the requested resource (if available) * - * **Global configuration** comes from User Settings and shadows Defaults. + * *Global configuration* comes from User Settings and shadows Defaults. * - * **Workspace configuration** comes from Workspace Settings and shadows Global configuration. + * *Workspace configuration* comes from Workspace Settings and shadows Global configuration. * - * **Workspace Folder configuration** comes from `.vscode` folder under one of the [workspace folders](#workspace.workspaceFolders). + * *Workspace Folder configuration* comes from `.vscode` folder under one of the [workspace folders](#workspace.workspaceFolders). * * *Note:* Workspace and Workspace Folder configurations contains `launch` and `tasks` settings. Their basename will be * part of the section identifier. The following snippets shows how to retrieve all configurations @@ -2990,7 +2990,7 @@ declare module 'vscode' { * * ```ts * // launch.json configuration - * const config = workspace.getConfiguration(workspace.workspaceFolders[1], 'launch'); + * const config = workspace.getConfiguration('launch', vscode.window.activeTextEditor.document.uri); * * // retrieve values * const values = config.get('configurations'); @@ -3032,7 +3032,7 @@ declare module 'vscode' { * * The *effective* value (returned by [`get`](#WorkspaceConfiguration.get)) * is computed like this: `defaultValue` overwritten by `globalValue`, - * `globalValue` overwritten by `workspaceValue`. `workspaceValue` overwritten by `folderValue`. + * `globalValue` overwritten by `workspaceValue`. `workspaceValue` overwritten by `workspaceFolderValue`. * Refer to [Settings Inheritence](https://code.visualstudio.com/docs/getstarted/settings) * for more information. * @@ -3042,7 +3042,7 @@ declare module 'vscode' { * @param section Configuration name, supports _dotted_ names. * @return Information about a configuration setting or `undefined`. */ - inspect(section: string): { key: string; defaultValue?: T; globalValue?: T; workspaceValue?: T, folderValue?: T } | undefined; + inspect(section: string): { key: string; defaultValue?: T; globalValue?: T; workspaceValue?: T, workspaceFolderValue?: T } | undefined; /** * Update a configuration value. The updated configuration values are persisted. @@ -3064,11 +3064,11 @@ declare module 'vscode' { * * @param section Configuration name, supports _dotted_ names. * @param value The new value. - * @param configurationTarget The [configuration target](#ConfigurationTarget) - * @param global When `true` changes the global configuration value otherwise workspace configuration value + * @param configurationTarget The [configuration target](#ConfigurationTarget) or a boolean value. + * If `undefined` or `null` or `false` configuration target is `ConfigurationTarget.Workspace`. + * If `true` configuration target is `ConfigurationTarget.Global`. */ - update(section: string, value: any, configurationTarget: ConfigurationTarget): Thenable; - update(section: string, value: any, global?: boolean): Thenable; + update(section: string, value: any, configurationTarget?: ConfigurationTarget | boolean): Thenable; /** * Readable dictionary that backs this configuration. diff --git a/src/vs/workbench/api/node/extHostConfiguration.ts b/src/vs/workbench/api/node/extHostConfiguration.ts index 77e42189cc6c8f479ed5d1e51c5ba7ea831f0532..9cb6406ce2d60370b8e53dfd6ccb8f09f6db816e 100644 --- a/src/vs/workbench/api/node/extHostConfiguration.ts +++ b/src/vs/workbench/api/node/extHostConfiguration.ts @@ -30,7 +30,7 @@ type ConfigurationInspect = { defaultValue?: T; globalValue?: T; workspaceValue?: T; - folderValue?: T; + workspaceFolderValue?: T; }; export class ExtHostConfiguration extends ExtHostConfigurationShape { @@ -87,7 +87,7 @@ export class ExtHostConfiguration extends ExtHostConfigurationShape { } return result; }, - update: (key: string, value: any, arg: boolean | ExtHostConfigurationTarget) => { + update: (key: string, value: any, arg: ExtHostConfigurationTarget | boolean) => { key = section ? `${section}.${key}` : key; const target = parseConfigurationTarget(arg); if (value !== void 0) { @@ -105,7 +105,7 @@ export class ExtHostConfiguration extends ExtHostConfigurationShape { defaultValue: config.default, globalValue: config.user, workspaceValue: config.workspace, - folderValue: config.folder + workspaceFolderValue: config.folder }; } return undefined; diff --git a/src/vs/workbench/test/electron-browser/api/extHostConfiguration.test.ts b/src/vs/workbench/test/electron-browser/api/extHostConfiguration.test.ts index accbd651fc616fea4dc0967e09e6b61836031ddc..8a072c4214a6b700fea4380d25c3e40eb47ed3a2 100644 --- a/src/vs/workbench/test/electron-browser/api/extHostConfiguration.test.ts +++ b/src/vs/workbench/test/electron-browser/api/extHostConfiguration.test.ts @@ -108,13 +108,13 @@ suite('ExtHostConfiguration', function () { assert.equal(actual.defaultValue, 'off'); assert.equal(actual.globalValue, 'on'); assert.equal(actual.workspaceValue, undefined); - assert.equal(actual.folderValue, undefined); + assert.equal(actual.workspaceFolderValue, undefined); actual = testObject.getConfiguration('editor').inspect('wordWrap'); assert.equal(actual.defaultValue, 'off'); assert.equal(actual.globalValue, 'on'); assert.equal(actual.workspaceValue, undefined); - assert.equal(actual.folderValue, undefined); + assert.equal(actual.workspaceFolderValue, undefined); }); test('inspect in single root context', function () { @@ -153,25 +153,25 @@ suite('ExtHostConfiguration', function () { assert.equal(actual1.defaultValue, 'off'); assert.equal(actual1.globalValue, 'on'); assert.equal(actual1.workspaceValue, 'bounded'); - assert.equal(actual1.folderValue, undefined); + assert.equal(actual1.workspaceFolderValue, undefined); actual1 = testObject.getConfiguration('editor').inspect('wordWrap'); assert.equal(actual1.defaultValue, 'off'); assert.equal(actual1.globalValue, 'on'); assert.equal(actual1.workspaceValue, 'bounded'); - assert.equal(actual1.folderValue, undefined); + assert.equal(actual1.workspaceFolderValue, undefined); let actual2 = testObject.getConfiguration(null, workspaceUri).inspect('editor.wordWrap'); assert.equal(actual2.defaultValue, 'off'); assert.equal(actual2.globalValue, 'on'); assert.equal(actual2.workspaceValue, 'bounded'); - assert.equal(actual2.folderValue, 'bounded'); + assert.equal(actual2.workspaceFolderValue, 'bounded'); actual2 = testObject.getConfiguration('editor', workspaceUri).inspect('wordWrap'); assert.equal(actual2.defaultValue, 'off'); assert.equal(actual2.globalValue, 'on'); assert.equal(actual2.workspaceValue, 'bounded'); - assert.equal(actual2.folderValue, 'bounded'); + assert.equal(actual2.workspaceFolderValue, 'bounded'); }); test('inspect in multi root context', function () { @@ -226,63 +226,63 @@ suite('ExtHostConfiguration', function () { assert.equal(actual1.defaultValue, 'off'); assert.equal(actual1.globalValue, 'on'); assert.equal(actual1.workspaceValue, 'bounded'); - assert.equal(actual1.folderValue, undefined); + assert.equal(actual1.workspaceFolderValue, undefined); actual1 = testObject.getConfiguration('editor').inspect('wordWrap'); assert.equal(actual1.defaultValue, 'off'); assert.equal(actual1.globalValue, 'on'); assert.equal(actual1.workspaceValue, 'bounded'); - assert.equal(actual1.folderValue, undefined); + assert.equal(actual1.workspaceFolderValue, undefined); actual1 = testObject.getConfiguration('editor').inspect('lineNumbers'); assert.equal(actual1.defaultValue, 'on'); assert.equal(actual1.globalValue, undefined); assert.equal(actual1.workspaceValue, undefined); - assert.equal(actual1.folderValue, undefined); + assert.equal(actual1.workspaceFolderValue, undefined); let actual2 = testObject.getConfiguration(null, firstRoot).inspect('editor.wordWrap'); assert.equal(actual2.defaultValue, 'off'); assert.equal(actual2.globalValue, 'on'); assert.equal(actual2.workspaceValue, 'bounded'); - assert.equal(actual2.folderValue, 'off'); + assert.equal(actual2.workspaceFolderValue, 'off'); actual2 = testObject.getConfiguration('editor', firstRoot).inspect('wordWrap'); assert.equal(actual2.defaultValue, 'off'); assert.equal(actual2.globalValue, 'on'); assert.equal(actual2.workspaceValue, 'bounded'); - assert.equal(actual2.folderValue, 'off'); + assert.equal(actual2.workspaceFolderValue, 'off'); actual2 = testObject.getConfiguration('editor', firstRoot).inspect('lineNumbers'); assert.equal(actual2.defaultValue, 'on'); assert.equal(actual2.globalValue, undefined); assert.equal(actual2.workspaceValue, undefined); - assert.equal(actual2.folderValue, 'relative'); + assert.equal(actual2.workspaceFolderValue, 'relative'); actual2 = testObject.getConfiguration(null, secondRoot).inspect('editor.wordWrap'); assert.equal(actual2.defaultValue, 'off'); assert.equal(actual2.globalValue, 'on'); assert.equal(actual2.workspaceValue, 'bounded'); - assert.equal(actual2.folderValue, 'on'); + assert.equal(actual2.workspaceFolderValue, 'on'); actual2 = testObject.getConfiguration('editor', secondRoot).inspect('wordWrap'); assert.equal(actual2.defaultValue, 'off'); assert.equal(actual2.globalValue, 'on'); assert.equal(actual2.workspaceValue, 'bounded'); - assert.equal(actual2.folderValue, 'on'); + assert.equal(actual2.workspaceFolderValue, 'on'); actual2 = testObject.getConfiguration(null, thirdRoot).inspect('editor.wordWrap'); assert.equal(actual2.defaultValue, 'off'); assert.equal(actual2.globalValue, 'on'); assert.equal(actual2.workspaceValue, 'bounded'); assert.ok(Object.keys(actual2).indexOf('folderValue') !== -1); - assert.equal(actual2.folderValue, undefined); + assert.equal(actual2.workspaceFolderValue, undefined); actual2 = testObject.getConfiguration('editor', thirdRoot).inspect('wordWrap'); assert.equal(actual2.defaultValue, 'off'); assert.equal(actual2.globalValue, 'on'); assert.equal(actual2.workspaceValue, 'bounded'); assert.ok(Object.keys(actual2).indexOf('folderValue') !== -1); - assert.equal(actual2.folderValue, undefined); + assert.equal(actual2.workspaceFolderValue, undefined); }); test('getConfiguration vs get', function () {