提交 5a622a99 编写于 作者: S Sandeep Somavarapu

Implemente feedback

上级 06550ab0
......@@ -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<T>(section: string): { key: string; defaultValue?: T; globalValue?: T; workspaceValue?: T, folderValue?: T } | undefined;
inspect<T>(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<void>;
update(section: string, value: any, global?: boolean): Thenable<void>;
update(section: string, value: any, configurationTarget?: ConfigurationTarget | boolean): Thenable<void>;
/**
* Readable dictionary that backs this configuration.
......
......@@ -30,7 +30,7 @@ type ConfigurationInspect<T> = {
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;
......
......@@ -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 () {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册