diff --git a/src/vs/editor/common/services/editorWorkerServiceImpl.ts b/src/vs/editor/common/services/editorWorkerServiceImpl.ts index 42a9e0a9ce109..3f4b60f047cf3 100644 --- a/src/vs/editor/common/services/editorWorkerServiceImpl.ts +++ b/src/vs/editor/common/services/editorWorkerServiceImpl.ts @@ -125,7 +125,7 @@ class WordBasedCompletionItemProvider implements modes.ISuggestSupport { } provideCompletionItems(model: editorCommon.IModel, position: Position): TPromise { - const { wordBasedSuggestions } = this._configurationService.getConfiguration(model.uri, position, 'editor'); + const { wordBasedSuggestions } = this._configurationService.getValue(model.uri, position, 'editor'); if (!wordBasedSuggestions) { return undefined; } diff --git a/src/vs/editor/common/services/resourceConfiguration.ts b/src/vs/editor/common/services/resourceConfiguration.ts index e65c4a1210436..21a7b4ee0524b 100644 --- a/src/vs/editor/common/services/resourceConfiguration.ts +++ b/src/vs/editor/common/services/resourceConfiguration.ts @@ -21,15 +21,15 @@ export interface ITextResourceConfigurationService { onDidChangeConfiguration: Event; /** - * Fetches the appropriate section of the for the given resource with appropriate overrides (e.g. language). - * This will be an object keyed off the section name. + * Fetches the value of the section for the given resource by applying language overrides. + * Value can be of native type or an object keyed off the section name. * * @param resource - Resource for which the configuration has to be fetched. Can be `null` or `undefined`. * @param postion - Position in the resource for which configuration has to be fetched. Can be `null` or `undefined`. * @param section - Section of the configuraion. Can be `null` or `undefined`. * */ - getConfiguration(resource: URI, section?: string): T; - getConfiguration(resource: URI, position?: IPosition, section?: string): T; + getValue(resource: URI, section?: string): T; + getValue(resource: URI, position?: IPosition, section?: string): T; } \ No newline at end of file diff --git a/src/vs/editor/common/services/resourceConfigurationImpl.ts b/src/vs/editor/common/services/resourceConfigurationImpl.ts index 00c24a097a8b6..9b2365842f953 100644 --- a/src/vs/editor/common/services/resourceConfigurationImpl.ts +++ b/src/vs/editor/common/services/resourceConfigurationImpl.ts @@ -28,13 +28,13 @@ export class TextResourceConfigurationService extends Disposable implements ITex this._register(this.configurationService.onDidChangeConfiguration(e => this._onDidChangeConfiguration.fire(e))); } - getConfiguration(resource: URI, section?: string): T; - getConfiguration(resource: URI, at?: IPosition, section?: string): T; - getConfiguration(resource: URI, arg2?: any, arg3?: any): T { + getValue(resource: URI, section?: string): T; + getValue(resource: URI, at?: IPosition, section?: string): T; + getValue(resource: URI, arg2?: any, arg3?: any): T { const position: IPosition = Position.isIPosition(arg2) ? arg2 : null; const section: string = position ? (typeof arg3 === 'string' ? arg3 : void 0) : (typeof arg2 === 'string' ? arg2 : void 0); const language = resource ? this.getLanguage(resource, position) : void 0; - return this.configurationService.getConfiguration(section, { resource, overrideIdentifier: language }); + return this.configurationService.getValue(section, { resource, overrideIdentifier: language }); } private getLanguage(resource: URI, position: IPosition): string { diff --git a/src/vs/editor/standalone/browser/simpleServices.ts b/src/vs/editor/standalone/browser/simpleServices.ts index 6eb0d2e8beaa4..658a18dc3fc5d 100644 --- a/src/vs/editor/standalone/browser/simpleServices.ts +++ b/src/vs/editor/standalone/browser/simpleServices.ts @@ -468,8 +468,14 @@ export class SimpleConfigurationService implements IConfigurationService { return this.configuration().getSection(section, overrides, null); } - public getValue(key: string, options: IConfigurationOverrides = {}): C { - return this.configuration().getValue(key, options, null); + getValue(): T; + getValue(section: string): T; + getValue(overrides: IConfigurationOverrides): T; + getValue(section: string, overrides: IConfigurationOverrides): T; + getValue(arg1?: any, arg2?: any): any { + const section = typeof arg1 === 'string' ? arg1 : void 0; + const overrides = isConfigurationOverrides(arg1) ? arg1 : isConfigurationOverrides(arg2) ? arg2 : {}; + return this.configuration().getValue(section, overrides, null); } public updateValue(key: string, value: any, arg3?: any, arg4?: any): TPromise { @@ -512,8 +518,8 @@ export class SimpleResourceConfigurationService implements ITextResourceConfigur }); } - public getConfiguration(): T { - return this.configurationService.getConfiguration(); + public getValue(): T { + return this.configurationService.getValue(); } } diff --git a/src/vs/platform/configuration/common/configuration.ts b/src/vs/platform/configuration/common/configuration.ts index ffa86c0267a6f..065df162d8ae7 100644 --- a/src/vs/platform/configuration/common/configuration.ts +++ b/src/vs/platform/configuration/common/configuration.ts @@ -62,7 +62,18 @@ export interface IConfigurationService { getConfiguration(overrides: IConfigurationOverrides): T; getConfiguration(section: string, overrides: IConfigurationOverrides): T; - getValue(key: string, overrides?: IConfigurationOverrides): T; + /** + * Fetches the value of the section for the given overrides. + * Value can be of native type or an object keyed off the section name. + * + * @param section - Section of the configuraion. Can be `null` or `undefined`. + * @param overrides - Overrides that has to be applied while fetching + * + */ + getValue(): T; + getValue(section: string): T; + getValue(overrides: IConfigurationOverrides): T; + getValue(section: string, overrides: IConfigurationOverrides): T; updateValue(key: string, value: any): TPromise; updateValue(key: string, value: any, overrides: IConfigurationOverrides): TPromise; diff --git a/src/vs/platform/configuration/common/configurationModels.ts b/src/vs/platform/configuration/common/configurationModels.ts index 4f613e1ae30d1..27e0492c63b63 100644 --- a/src/vs/platform/configuration/common/configurationModels.ts +++ b/src/vs/platform/configuration/common/configurationModels.ts @@ -303,9 +303,9 @@ export class Configuration { return section ? configModel.getSectionContents(section) : configModel.contents; } - getValue(key: string, overrides: IConfigurationOverrides, workspace: Workspace): any { + getValue(section: string, overrides: IConfigurationOverrides, workspace: Workspace): any { const consolidateConfigurationModel = this.getConsolidateConfigurationModel(overrides, workspace); - return getConfigurationValue(consolidateConfigurationModel.contents, key); + return section ? getConfigurationValue(consolidateConfigurationModel.contents, section) : consolidateConfigurationModel.contents; } updateValue(key: string, value: any, overrides: IConfigurationOverrides = {}): void { diff --git a/src/vs/platform/configuration/node/configurationService.ts b/src/vs/platform/configuration/node/configurationService.ts index d13e0ed5d2631..e6116f1b062c1 100644 --- a/src/vs/platform/configuration/node/configurationService.ts +++ b/src/vs/platform/configuration/node/configurationService.ts @@ -58,8 +58,14 @@ export class ConfigurationService extends Disposable implements IConfigurationSe return this.configuration.getSection(section, overrides, null); } - getValue(key: string, overrides: IConfigurationOverrides = {}): any { - return this.configuration.getValue(key, overrides, null); + getValue(): T; + getValue(section: string): T; + getValue(overrides: IConfigurationOverrides): T; + getValue(section: string, overrides: IConfigurationOverrides): T; + getValue(arg1?: any, arg2?: any): any { + const section = typeof arg1 === 'string' ? arg1 : void 0; + const overrides = isConfigurationOverrides(arg1) ? arg1 : isConfigurationOverrides(arg2) ? arg2 : {}; + return this.configuration.getValue(section, overrides, null); } updateValue(key: string, value: any): TPromise; diff --git a/src/vs/platform/configuration/test/common/testConfigurationService.ts b/src/vs/platform/configuration/test/common/testConfigurationService.ts index dcb88e2eb1dc4..bf71b9381dbc4 100644 --- a/src/vs/platform/configuration/test/common/testConfigurationService.ts +++ b/src/vs/platform/configuration/test/common/testConfigurationService.ts @@ -32,8 +32,11 @@ export class TestConfigurationService extends EventEmitter implements IConfigura return this.configuration; } - public getValue(key: string, overrides?: IConfigurationOverrides): any { - return this.inspect(key).value; + public getValue(arg1?: any, arg2?: any): any { + if (arg1 && typeof arg1 === 'string') { + return this.inspect(arg1).value; + } + return this.getConfiguration(arg1, arg2); } public updateValue(key: string, overrides?: IConfigurationOverrides): TPromise { diff --git a/src/vs/platform/telemetry/test/electron-browser/telemetryService.test.ts b/src/vs/platform/telemetry/test/electron-browser/telemetryService.test.ts index 341ba75b47716..c8084219921c6 100644 --- a/src/vs/platform/telemetry/test/electron-browser/telemetryService.test.ts +++ b/src/vs/platform/telemetry/test/electron-browser/telemetryService.test.ts @@ -681,8 +681,10 @@ suite('TelemetryService', () => { enableTelemetry: enableTelemetry } as any; }, - getValue(key) { - return getConfigurationValue(this.getConfiguration(), key); + getValue() { + return { + enableTelemetry: enableTelemetry + } as any; }, updateValue(): TPromise { return null; diff --git a/src/vs/workbench/browser/parts/editor/editorStatus.ts b/src/vs/workbench/browser/parts/editor/editorStatus.ts index a64028b4d31b2..261a8246112fa 100644 --- a/src/vs/workbench/browser/parts/editor/editorStatus.ts +++ b/src/vs/workbench/browser/parts/editor/editorStatus.ts @@ -33,7 +33,7 @@ import { IEditor as IBaseEditor, IEditorInput } from 'vs/platform/editor/common/ import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService'; import { IQuickOpenService, IPickOpenEntry, IFilePickOpenEntry } from 'vs/platform/quickOpen/common/quickOpen'; import { IWorkspaceConfigurationService } from 'vs/workbench/services/configuration/common/configuration'; -import { SUPPORTED_ENCODINGS, IFileService, IFilesConfiguration, FILES_ASSOCIATIONS_CONFIG } from 'vs/platform/files/common/files'; +import { SUPPORTED_ENCODINGS, IFileService, FILES_ASSOCIATIONS_CONFIG } from 'vs/platform/files/common/files'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { IModeService } from 'vs/editor/common/services/modeService'; import { IModelService } from 'vs/editor/common/services/modelService'; @@ -1159,8 +1159,7 @@ export class ChangeEncodingAction extends Action { .then((guessedEncoding: string) => { const isReopenWithEncoding = (action === reopenWithEncodingPick); - const config = this.textResourceConfigurationService.getConfiguration(resource) as IFilesConfiguration; - const configuredEncoding = config && config.files && config.files.encoding; + const configuredEncoding = this.textResourceConfigurationService.getValue(resource, 'files.encoding'); let directMatchIndex: number; let aliasMatchIndex: number; diff --git a/src/vs/workbench/browser/parts/editor/textEditor.ts b/src/vs/workbench/browser/parts/editor/textEditor.ts index e3cded228ced3..b7ba465561882 100644 --- a/src/vs/workbench/browser/parts/editor/textEditor.ts +++ b/src/vs/workbench/browser/parts/editor/textEditor.ts @@ -59,7 +59,7 @@ export abstract class BaseTextEditor extends BaseEditor { ) { super(id, telemetryService, themeService); - this.toUnbind.push(this.configurationService.onDidChangeConfiguration(e => this.handleConfigurationChangeEvent(this.configurationService.getConfiguration(this.getResource())))); + this.toUnbind.push(this.configurationService.onDidChangeConfiguration(e => this.handleConfigurationChangeEvent(this.configurationService.getValue(this.getResource())))); } protected get instantiationService(): IInstantiationService { @@ -127,7 +127,7 @@ export abstract class BaseTextEditor extends BaseEditor { // Editor for Text this._editorContainer = parent; - this.editorControl = this.createEditorControl(parent, this.computeConfiguration(this.configurationService.getConfiguration(this.getResource()))); + this.editorControl = this.createEditorControl(parent, this.computeConfiguration(this.configurationService.getValue(this.getResource()))); // Model & Language changes const codeEditor = getCodeEditor(this); @@ -280,7 +280,7 @@ export abstract class BaseTextEditor extends BaseEditor { return null; } - private updateEditorConfiguration(configuration = this.configurationService.getConfiguration(this.getResource())): void { + private updateEditorConfiguration(configuration = this.configurationService.getValue(this.getResource())): void { if (!this.editorControl) { return; } diff --git a/src/vs/workbench/common/editor/untitledEditorModel.ts b/src/vs/workbench/common/editor/untitledEditorModel.ts index 278e1bdcad8e1..a399f7da6fa30 100644 --- a/src/vs/workbench/common/editor/untitledEditorModel.ts +++ b/src/vs/workbench/common/editor/untitledEditorModel.ts @@ -11,7 +11,7 @@ import { BaseTextEditorModel } from 'vs/workbench/common/editor/textEditorModel' import URI from 'vs/base/common/uri'; import { PLAINTEXT_MODE_ID } from 'vs/editor/common/modes/modesRegistry'; import { EndOfLinePreference } from 'vs/editor/common/editorCommon'; -import { IFilesConfiguration, CONTENT_CHANGE_EVENT_BUFFER_DELAY } from 'vs/platform/files/common/files'; +import { CONTENT_CHANGE_EVENT_BUFFER_DELAY } from 'vs/platform/files/common/files'; import { IModeService } from 'vs/editor/common/services/modeService'; import { IModelService } from 'vs/editor/common/services/modelService'; import { IMode } from 'vs/editor/common/modes'; @@ -98,8 +98,7 @@ export class UntitledEditorModel extends BaseTextEditorModel implements IEncodin } private onConfigurationChange(): void { - const configuration = this.configurationService.getConfiguration(this.resource); - const configuredEncoding = configuration && configuration.files && configuration.files.encoding; + const configuredEncoding = this.configurationService.getValue(this.resource, 'files.encoding'); if (this.configuredEncoding !== configuredEncoding) { this.configuredEncoding = configuredEncoding; @@ -185,10 +184,8 @@ export class UntitledEditorModel extends BaseTextEditorModel implements IEncodin this.setDirty(this.hasAssociatedFilePath || !!backupContent); return this.doLoad(backupContent || this.initialValue || '').then(model => { - const configuration = this.configurationService.getConfiguration(this.resource); - // Encoding - this.configuredEncoding = configuration && configuration.files && configuration.files.encoding; + this.configuredEncoding = this.configurationService.getValue(this.resource, 'files.encoding'); // Listen to content changes this.toDispose.push(this.textEditorModel.onDidChangeContent(() => this.onModelContentChanged())); diff --git a/src/vs/workbench/parts/codeEditor/electron-browser/toggleWordWrap.ts b/src/vs/workbench/parts/codeEditor/electron-browser/toggleWordWrap.ts index 972b235fd843e..2db0fe76780d6 100644 --- a/src/vs/workbench/parts/codeEditor/electron-browser/toggleWordWrap.ts +++ b/src/vs/workbench/parts/codeEditor/electron-browser/toggleWordWrap.ts @@ -54,7 +54,7 @@ function readTransientState(model: IModel, codeEditorService: ICodeEditorService } function readWordWrapState(model: IModel, configurationService: ITextResourceConfigurationService, codeEditorService: ICodeEditorService): IWordWrapState { - const editorConfig = configurationService.getConfiguration(model.uri, 'editor') as { wordWrap: 'on' | 'off' | 'wordWrapColumn' | 'bounded'; wordWrapMinified: boolean }; + const editorConfig = configurationService.getValue(model.uri, 'editor') as { wordWrap: 'on' | 'off' | 'wordWrapColumn' | 'bounded'; wordWrapMinified: boolean }; let _configuredWordWrap = editorConfig && (typeof editorConfig.wordWrap === 'string' || typeof editorConfig.wordWrap === 'boolean') ? editorConfig.wordWrap : void 0; // Compatibility with old true or false values diff --git a/src/vs/workbench/parts/output/browser/outputPanel.ts b/src/vs/workbench/parts/output/browser/outputPanel.ts index 73c2d9a89bee4..aeb4863884f34 100644 --- a/src/vs/workbench/parts/output/browser/outputPanel.ts +++ b/src/vs/workbench/parts/output/browser/outputPanel.ts @@ -23,6 +23,7 @@ import { SwitchOutputAction, SwitchOutputActionItem, ClearOutputAction, ToggleOu import { IThemeService } from 'vs/platform/theme/common/themeService'; import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService'; import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles'; +import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; export class OutputPanel extends TextResourceEditor { private actions: IAction[]; @@ -32,14 +33,15 @@ export class OutputPanel extends TextResourceEditor { @ITelemetryService telemetryService: ITelemetryService, @IInstantiationService instantiationService: IInstantiationService, @IStorageService storageService: IStorageService, - @ITextResourceConfigurationService configurationService: ITextResourceConfigurationService, + @IConfigurationService private baseConfigurationService: IConfigurationService, + @ITextResourceConfigurationService textResourceConfigurationService: ITextResourceConfigurationService, @IThemeService themeService: IThemeService, @IOutputService private outputService: IOutputService, @IContextKeyService private contextKeyService: IContextKeyService, @IEditorGroupService editorGroupService: IEditorGroupService, @ITextFileService textFileService: ITextFileService ) { - super(telemetryService, instantiationService, storageService, configurationService, themeService, editorGroupService, textFileService); + super(telemetryService, instantiationService, storageService, textResourceConfigurationService, themeService, editorGroupService, textFileService); this.scopedInstantiationService = instantiationService; } @@ -84,7 +86,7 @@ export class OutputPanel extends TextResourceEditor { options.renderLineHighlight = 'none'; options.minimap = { enabled: false }; - const outputConfig = this.configurationService.getConfiguration(null, '[Log]'); + const outputConfig = this.baseConfigurationService.getValue('[Log]'); if (outputConfig && outputConfig['editor.minimap.enabled']) { options.minimap = { enabled: true }; } diff --git a/src/vs/workbench/parts/terminal/test/electron-browser/terminalConfigHelper.test.ts b/src/vs/workbench/parts/terminal/test/electron-browser/terminalConfigHelper.test.ts index 3dfbf80c37610..8a4df80df4410 100644 --- a/src/vs/workbench/parts/terminal/test/electron-browser/terminalConfigHelper.test.ts +++ b/src/vs/workbench/parts/terminal/test/electron-browser/terminalConfigHelper.test.ts @@ -19,7 +19,7 @@ class MockConfigurationService implements IConfigurationService { public inspect(key: string, overrides?: IConfigurationOverrides): any { return { value: getConfigurationValue(this.getConfiguration(), key), default: getConfigurationValue(this.getConfiguration(), key), user: getConfigurationValue(this.getConfiguration(), key), workspace: void 0, workspaceFolder: void 0 }; } public keys() { return { default: [] as string[], user: [] as string[], workspace: [] as string[], workspaceFolder: [] as string[] }; } public getConfiguration(): any { return this.configuration; } - public getValue(key: string, overrides?: IConfigurationOverrides): T { return getConfigurationValue(this.getConfiguration(), key); } + public getValue(): any { return this.configuration; } public updateValue(): TPromise { return null; } public getConfigurationData(): any { return null; } public onDidChangeConfiguration() { return { dispose() { } }; } diff --git a/src/vs/workbench/services/configuration/node/configurationService.ts b/src/vs/workbench/services/configuration/node/configurationService.ts index 2d3c1a8a0a943..18e5755ae13bc 100644 --- a/src/vs/workbench/services/configuration/node/configurationService.ts +++ b/src/vs/workbench/services/configuration/node/configurationService.ts @@ -235,8 +235,14 @@ export class WorkspaceService extends Disposable implements IWorkspaceConfigurat return this._configuration.getSection(section, overrides); } - getValue(key: string, overrides?: IConfigurationOverrides): T { - return this._configuration.getValue(key, overrides); + getValue(): T; + getValue(section: string): T; + getValue(overrides: IConfigurationOverrides): T; + getValue(section: string, overrides: IConfigurationOverrides): T; + getValue(arg1?: any, arg2?: any): any { + const section = typeof arg1 === 'string' ? arg1 : void 0; + const overrides = isConfigurationOverrides(arg1) ? arg1 : isConfigurationOverrides(arg2) ? arg2 : void 0; + return this._configuration.getValue(section, overrides); } updateValue(key: string, value: any): TPromise; diff --git a/src/vs/workbench/services/configurationResolver/test/node/configurationResolverService.test.ts b/src/vs/workbench/services/configurationResolver/test/node/configurationResolverService.test.ts index a7ad4e84a3fd0..59f8a418675db 100644 --- a/src/vs/workbench/services/configurationResolver/test/node/configurationResolverService.test.ts +++ b/src/vs/workbench/services/configurationResolver/test/node/configurationResolverService.test.ts @@ -351,7 +351,7 @@ class MockConfigurationService implements IConfigurationService { public inspect(key: string, overrides?: IConfigurationOverrides): any { return { value: getConfigurationValue(this.getConfiguration(), key), default: getConfigurationValue(this.getConfiguration(), key), user: getConfigurationValue(this.getConfiguration(), key), workspaceFolder: void 0, folder: void 0 }; } public keys() { return { default: [], user: [], workspace: [], workspaceFolder: [] }; } public getConfiguration(): any { return this.configuration; } - public getValue(key: string): any { return getConfigurationValue(this.getConfiguration(), key); } + public getValue(): any { return this.configuration; } public updateValue(): TPromise { return null; } public getConfigurationData(): any { return null; } public onDidChangeConfiguration() { return { dispose() { } }; } diff --git a/src/vs/workbench/services/files/node/fileService.ts b/src/vs/workbench/services/files/node/fileService.ts index 8b24b0806563f..48f3c24dd4feb 100644 --- a/src/vs/workbench/services/files/node/fileService.ts +++ b/src/vs/workbench/services/files/node/fileService.ts @@ -11,7 +11,7 @@ import os = require('os'); import crypto = require('crypto'); import assert = require('assert'); -import { isParent, FileOperation, FileOperationEvent, IContent, IFileService, IResolveFileOptions, IResolveFileResult, IResolveContentOptions, IFileStat, IStreamContent, FileOperationError, FileOperationResult, IUpdateContentOptions, FileChangeType, IImportResult, MAX_FILE_SIZE, FileChangesEvent, IFilesConfiguration, ICreateFileOptions } from 'vs/platform/files/common/files'; +import { isParent, FileOperation, FileOperationEvent, IContent, IFileService, IResolveFileOptions, IResolveFileResult, IResolveContentOptions, IFileStat, IStreamContent, FileOperationError, FileOperationResult, IUpdateContentOptions, FileChangeType, IImportResult, MAX_FILE_SIZE, FileChangesEvent, ICreateFileOptions } from 'vs/platform/files/common/files'; import { isEqualOrParent } from 'vs/base/common/paths'; import { ResourceMap } from 'vs/base/common/map'; import arrays = require('vs/base/common/arrays'); @@ -643,15 +643,11 @@ export class FileService implements IFileService { } private configuredAutoGuessEncoding(resource: uri): boolean { - const config = this.textResourceConfigurationService.getConfiguration(resource) as IFilesConfiguration; - - return config && config.files && config.files.autoGuessEncoding === true; + return this.textResourceConfigurationService.getValue(resource, 'files.autoGuessEncoding'); } private configuredEncoding(resource: uri): string { - const config = this.textResourceConfigurationService.getConfiguration(resource) as IFilesConfiguration; - - return config && config.files && config.files.encoding; + return this.textResourceConfigurationService.getValue(resource, 'files.encoding'); } private getEncodingOverride(resource: uri): string { diff --git a/src/vs/workbench/test/workbenchTestServices.ts b/src/vs/workbench/test/workbenchTestServices.ts index 39bda762d00b6..7a4c18cde9885 100644 --- a/src/vs/workbench/test/workbenchTestServices.ts +++ b/src/vs/workbench/test/workbenchTestServices.ts @@ -57,7 +57,7 @@ import { TestThemeService } from 'vs/platform/theme/test/common/testThemeService import { IWorkspaceIdentifier, ISingleFolderWorkspaceIdentifier, isSingleFolderWorkspaceIdentifier, IWorkspaceFolderCreationData } from 'vs/platform/workspaces/common/workspaces'; import { IRecentlyOpened } from 'vs/platform/history/common/history'; import { ITextResourceConfigurationService } from 'vs/editor/common/services/resourceConfiguration'; -import { IPosition } from 'vs/editor/common/core/position'; +import { IPosition, Position as EditorPosition } from 'vs/editor/common/core/position'; import { ICommandAction } from 'vs/platform/actions/common/actions'; import { IHashService } from 'vs/workbench/services/hash/common/hashService'; import { notImplemented } from 'vs/base/common/errors'; @@ -1229,11 +1229,10 @@ export class TestTextResourceConfigurationService implements ITextResourceConfig return { dispose() { } }; } - public getConfiguration(resource: URI, section?: string): any; - public getConfiguration(resource: URI, position?: IPosition, section?: string): any; - public getConfiguration(resource: any, position?: any, section?: any): any; - public getConfiguration(resource: any, position?: any, section?: any): any { - return this.configurationService.getConfiguration(section, { resource }); + getValue(resource: URI, arg2?: any, arg3?: any): T { + const position: IPosition = EditorPosition.isIPosition(arg2) ? arg2 : null; + const section: string = position ? (typeof arg3 === 'string' ? arg3 : void 0) : (typeof arg2 === 'string' ? arg2 : void 0); + return this.configurationService.getValue(section, { resource }); } }