From c01fc29b8d5b794f7007e4c8409cbda60c12506e Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Mon, 16 Dec 2019 17:23:13 +0100 Subject: [PATCH] remove redundant api --- src/vs/vscode.d.ts | 13 ------------- src/vs/workbench/api/common/extHost.api.impl.ts | 2 +- src/vs/workbench/api/common/extHostConfiguration.ts | 8 +++++--- 3 files changed, 6 insertions(+), 17 deletions(-) diff --git a/src/vs/vscode.d.ts b/src/vs/vscode.d.ts index 7eb42594fc9..aa0dd703cc7 100644 --- a/src/vs/vscode.d.ts +++ b/src/vs/vscode.d.ts @@ -8739,19 +8739,6 @@ declare module 'vscode' { */ export function getConfiguration(section: string | undefined, textDocument: TextDocument): TextDocumentConfiguration; - /** - * Get a workspace configuration object for the given scope. - * - * When a section-identifier is provided only that part of the configuration - * is returned. Dots in the section-identifier are interpreted as child-access, - * like `{ myExt: { setting: { doIt: true }}}` and `getConfiguration('myExt.setting').get('doIt') === true`. - * - * @param section A dot-separated identifier. - * @param scope A scope for which the configuration is confied to. - * @return The full configuration or a subset. - */ - export function getConfiguration(section: string | undefined, scope: { resource: Uri, language?: string }): WorkspaceConfiguration; - /** * @deprecated Instead use other variants of `getConfiguration` */ diff --git a/src/vs/workbench/api/common/extHost.api.impl.ts b/src/vs/workbench/api/common/extHost.api.impl.ts index 82a186dd882..f8724e75305 100644 --- a/src/vs/workbench/api/common/extHost.api.impl.ts +++ b/src/vs/workbench/api/common/extHost.api.impl.ts @@ -664,7 +664,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I onDidChangeConfiguration: (listener: (_: any) => any, thisArgs?: any, disposables?: extHostTypes.Disposable[]) => { return configProvider.onDidChangeConfiguration(listener, thisArgs, disposables); }, - getConfiguration(section?: string, scope?: vscode.ConfigurationScope): vscode.WorkspaceConfiguration { + getConfiguration(section?: string, scope?: vscode.Uri | vscode.WorkspaceFolder | vscode.TextDocument | null): vscode.WorkspaceConfiguration { scope = arguments.length === 1 ? undefined : scope; return configProvider.getConfiguration(section, scope, extension.identifier); }, diff --git a/src/vs/workbench/api/common/extHostConfiguration.ts b/src/vs/workbench/api/common/extHostConfiguration.ts index 8091f52196e..055d72584fa 100644 --- a/src/vs/workbench/api/common/extHostConfiguration.ts +++ b/src/vs/workbench/api/common/extHostConfiguration.ts @@ -117,7 +117,7 @@ export class ExtHostConfigProvider { this._onDidChangeConfiguration.fire(this._toConfigurationChangeEvent(change, previous)); } - getConfiguration(section: string | undefined, scope: vscode.Uri | vscode.WorkspaceFolder | vscode.TextDocument | null | undefined, extensionId?: ExtensionIdentifier): vscode.WorkspaceConfiguration { + getConfiguration(section?: string, scope?: vscode.Uri | vscode.WorkspaceFolder | vscode.TextDocument | null, extensionId?: ExtensionIdentifier): vscode.WorkspaceConfiguration { const overrides: IConfigurationOverrides = scope ? scope instanceof vscode.Uri ? { resource: scope } : isWorkspaceFolder(scope) ? { resource: scope.uri } @@ -309,8 +309,10 @@ export class ExtHostConfigProvider { /** * Special scenario: Write a configuration under a specific language */ - const configuration = vscode.workspace.getConfiguration('editor', { resource: vscode.Uri.file('abc'), language: 'javascript' }); - configuration.update('formatOnSave', false); // Writes under languge overrides + const languageConfiguration = vscode.workspace.getConfiguration(); + const value = languageConfiguration.get<{ 'editor.formatOnSave': boolean }>('[javascript]')!; + value['editor.formatOnSave'] = false; + languageConfiguration.update('[javascript]', value); /** * deprecated