diff --git a/src/vs/code/electron-main/window.ts b/src/vs/code/electron-main/window.ts index 4a11a3a662f..fc10019bb23 100644 --- a/src/vs/code/electron-main/window.ts +++ b/src/vs/code/electron-main/window.ts @@ -161,7 +161,7 @@ export class CodeWindow implements ICodeWindow { options.icon = path.join(this.environmentService.appRoot, 'resources/linux/code.png'); // Windows and Mac are better off using the embedded icon(s) } - const windowConfig = this.configurationService.getConfiguration('window'); + const windowConfig = this.configurationService.getValue('window'); let useNativeTabs = false; if (windowConfig && windowConfig.nativeTabs) { @@ -451,7 +451,7 @@ export class CodeWindow implements ICodeWindow { // Swipe command support (macOS) if (isMacintosh) { - const config = this.configurationService.getConfiguration(); + const config = this.configurationService.getValue(); if (config && config.workbench && config.workbench.editor && config.workbench.editor.swipeToNavigate) { this.registerNavigationListenerOn('swipe', 'left', 'right', true); } else { @@ -562,7 +562,7 @@ export class CodeWindow implements ICodeWindow { private getUrl(windowConfiguration: IWindowConfiguration): string { // Set zoomlevel - const windowConfig = this.configurationService.getConfiguration('window'); + const windowConfig = this.configurationService.getValue('window'); const zoomLevel = windowConfig && windowConfig.zoomLevel; if (typeof zoomLevel === 'number') { windowConfiguration.zoomLevel = zoomLevel; @@ -796,7 +796,7 @@ export class CodeWindow implements ICodeWindow { } private getMenuBarVisibility(): MenuBarVisibility { - const windowConfig = this.configurationService.getConfiguration('window'); + const windowConfig = this.configurationService.getValue('window'); if (!windowConfig || !windowConfig.menuBarVisibility) { return 'default'; } diff --git a/src/vs/code/electron-main/windows.ts b/src/vs/code/electron-main/windows.ts index f0d030a42ef..1d8a0b8a6ed 100644 --- a/src/vs/code/electron-main/windows.ts +++ b/src/vs/code/electron-main/windows.ts @@ -934,7 +934,7 @@ export class WindowsManager implements IWindowsMainService { if (this.lifecycleService.wasRestarted) { restoreWindows = 'all'; // always reopen all windows when an update was applied } else { - const windowConfig = this.configurationService.getConfiguration('window'); + const windowConfig = this.configurationService.getValue('window'); restoreWindows = ((windowConfig && windowConfig.restoreWindows) || 'one') as RestoreWindowsSetting; if (restoreWindows === 'one' /* default */ && windowConfig && windowConfig.reopenFolders) { @@ -1003,7 +1003,7 @@ export class WindowsManager implements IWindowsMainService { private shouldOpenNewWindow(openConfig: IOpenConfiguration): { openFolderInNewWindow: boolean; openFilesInNewWindow: boolean; } { // let the user settings override how folders are open in a new window or same window unless we are forced - const windowConfig = this.configurationService.getConfiguration('window'); + const windowConfig = this.configurationService.getValue('window'); const openFolderInNewWindowConfig = (windowConfig && windowConfig.openFoldersInNewWindow) || 'default' /* default */; const openFilesInNewWindowConfig = (windowConfig && windowConfig.openFilesInNewWindow) || 'off' /* default */; @@ -1094,7 +1094,7 @@ export class WindowsManager implements IWindowsMainService { // New window if (!window) { - const windowConfig = this.configurationService.getConfiguration('window'); + const windowConfig = this.configurationService.getValue('window'); const state = this.getNewWindowState(configuration); // Window state is not from a previous session: only allow fullscreen if we inherit it or user wants fullscreen @@ -1257,7 +1257,7 @@ export class WindowsManager implements IWindowsMainService { state.y = displayToUse.bounds.y + (displayToUse.bounds.height / 2) - (state.height / 2); // Check for newWindowDimensions setting and adjust accordingly - const windowConfig = this.configurationService.getConfiguration('window'); + const windowConfig = this.configurationService.getValue('window'); let ensureNoOverlap = true; if (windowConfig && windowConfig.newWindowDimensions) { if (windowConfig.newWindowDimensions === 'maximized') { diff --git a/src/vs/editor/common/services/modelServiceImpl.ts b/src/vs/editor/common/services/modelServiceImpl.ts index caaa8470b7e..ee8c3c28143 100644 --- a/src/vs/editor/common/services/modelServiceImpl.ts +++ b/src/vs/editor/common/services/modelServiceImpl.ts @@ -272,7 +272,7 @@ export class ModelServiceImpl implements IModelService { public getCreationOptions(language: string, resource: URI): editorCommon.ITextModelCreationOptions { let creationOptions = this._modelCreationOptionsByLanguageAndResource[language + resource]; if (!creationOptions) { - creationOptions = ModelServiceImpl._readModelOptions(this._configurationService.getConfiguration({ overrideIdentifier: language, resource })); + creationOptions = ModelServiceImpl._readModelOptions(this._configurationService.getValue({ overrideIdentifier: language, resource })); this._modelCreationOptionsByLanguageAndResource[language + resource] = creationOptions; } return creationOptions; diff --git a/src/vs/editor/contrib/colorPicker/colorDetector.ts b/src/vs/editor/contrib/colorPicker/colorDetector.ts index 7dc0b569ef9..a1a967f0427 100644 --- a/src/vs/editor/contrib/colorPicker/colorDetector.ts +++ b/src/vs/editor/contrib/colorPicker/colorDetector.ts @@ -73,7 +73,7 @@ export class ColorDetector implements IEditorContribution { } const languageId = model.getLanguageIdentifier(); // handle deprecated settings. [languageId].colorDecorators.enable - let deprecatedConfig = this._configurationService.getConfiguration(languageId.language); + let deprecatedConfig = this._configurationService.getValue(languageId.language); if (deprecatedConfig) { let colorDecorators = deprecatedConfig['colorDecorators']; // deprecatedConfig.valueOf('.colorDecorators.enable'); if (colorDecorators && colorDecorators['enable'] !== undefined && !colorDecorators['enable']) { diff --git a/src/vs/editor/standalone/browser/simpleServices.ts b/src/vs/editor/standalone/browser/simpleServices.ts index 658a18dc3fc..efeda004244 100644 --- a/src/vs/editor/standalone/browser/simpleServices.ts +++ b/src/vs/editor/standalone/browser/simpleServices.ts @@ -458,16 +458,6 @@ export class SimpleConfigurationService implements IConfigurationService { return this._configuration; } - getConfiguration(): T; - getConfiguration(section: string): T; - getConfiguration(overrides: IConfigurationOverrides): T; - getConfiguration(section: string, overrides: IConfigurationOverrides): T; - getConfiguration(arg1?: any, arg2?: any): any { - const section = typeof arg1 === 'string' ? arg1 : void 0; - const overrides = isConfigurationOverrides(arg1) ? arg1 : isConfigurationOverrides(arg2) ? arg2 : {}; - return this.configuration().getSection(section, overrides, null); - } - getValue(): T; getValue(section: string): T; getValue(overrides: IConfigurationOverrides): T; diff --git a/src/vs/platform/backup/electron-main/backupMainService.ts b/src/vs/platform/backup/electron-main/backupMainService.ts index ceb1a0e5cbc..b36a581d93c 100644 --- a/src/vs/platform/backup/electron-main/backupMainService.ts +++ b/src/vs/platform/backup/electron-main/backupMainService.ts @@ -65,7 +65,7 @@ export class BackupMainService implements IBackupMainService { } private getHotExitConfig(): string { - const config = this.configurationService.getConfiguration(); + const config = this.configurationService.getValue(); return (config && config.files && config.files.hotExit) || HotExitConfiguration.ON_EXIT; } diff --git a/src/vs/platform/configuration/common/configuration.ts b/src/vs/platform/configuration/common/configuration.ts index 065df162d8a..b5b9e722192 100644 --- a/src/vs/platform/configuration/common/configuration.ts +++ b/src/vs/platform/configuration/common/configuration.ts @@ -57,11 +57,6 @@ export interface IConfigurationService { getConfigurationData(): IConfigurationData; - getConfiguration(): T; - getConfiguration(section: string): T; - getConfiguration(overrides: IConfigurationOverrides): T; - getConfiguration(section: 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. diff --git a/src/vs/platform/configuration/common/configurationModels.ts b/src/vs/platform/configuration/common/configurationModels.ts index 27e0492c63b..8d1787284d9 100644 --- a/src/vs/platform/configuration/common/configurationModels.ts +++ b/src/vs/platform/configuration/common/configurationModels.ts @@ -37,8 +37,8 @@ export class ConfigurationModel implements IConfigurationModel { return this.checkAndFreeze(this._keys); } - getSectionContents(section: string): V { - return this.contents[section]; + getValue(section: string): V { + return section ? getConfigurationValue(this.contents, section) : this.contents; } override(identifier: string): ConfigurationModel { @@ -298,14 +298,9 @@ export class Configuration { private _memoryConfigurationByResource: StrictResourceMap = new StrictResourceMap()) { } - getSection(section: string = '', overrides: IConfigurationOverrides, workspace: Workspace): C { - const configModel = this.getConsolidateConfigurationModel(overrides, workspace); - return section ? configModel.getSectionContents(section) : configModel.contents; - } - getValue(section: string, overrides: IConfigurationOverrides, workspace: Workspace): any { const consolidateConfigurationModel = this.getConsolidateConfigurationModel(overrides, workspace); - return section ? getConfigurationValue(consolidateConfigurationModel.contents, section) : consolidateConfigurationModel.contents; + return consolidateConfigurationModel.getValue(section); } 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 e6116f1b062..e522d0e79d8 100644 --- a/src/vs/platform/configuration/node/configurationService.ts +++ b/src/vs/platform/configuration/node/configurationService.ts @@ -48,16 +48,6 @@ export class ConfigurationService extends Disposable implements IConfigurationSe return this.configuration.toData(); } - getConfiguration(): T; - getConfiguration(section: string): T; - getConfiguration(overrides: IConfigurationOverrides): T; - getConfiguration(section: string, overrides: IConfigurationOverrides): T; - getConfiguration(arg1?: any, arg2?: any): any { - const section = typeof arg1 === 'string' ? arg1 : void 0; - const overrides = isConfigurationOverrides(arg1) ? arg1 : isConfigurationOverrides(arg2) ? arg2 : {}; - return this.configuration.getSection(section, overrides, null); - } - getValue(): T; getValue(section: string): T; getValue(overrides: IConfigurationOverrides): T; diff --git a/src/vs/platform/configuration/test/common/configurationModels.test.ts b/src/vs/platform/configuration/test/common/configurationModels.test.ts index 6de854a9778..3f66d5b710b 100644 --- a/src/vs/platform/configuration/test/common/configurationModels.test.ts +++ b/src/vs/platform/configuration/test/common/configurationModels.test.ts @@ -211,7 +211,7 @@ suite('ConfigurationModel', () => { let result = base.merge(add); assert.deepEqual(result.contents, { 'a': { 'b': 2 } }); - assert.deepEqual(result.getSectionContents('a'), { 'b': 2 }); + assert.deepEqual(result.getValue('a'), { 'b': 2 }); assert.deepEqual(result.keys, ['a.b']); }); @@ -239,16 +239,16 @@ suite('ConfigurationModel', () => { test('Test contents while getting an existing property', () => { let testObject = new ConfigurationModel({ 'a': 1 }); - assert.deepEqual(testObject.getSectionContents('a'), 1); + assert.deepEqual(testObject.getValue('a'), 1); testObject = new ConfigurationModel({ 'a': { 'b': 1 } }); - assert.deepEqual(testObject.getSectionContents('a'), { 'b': 1 }); + assert.deepEqual(testObject.getValue('a'), { 'b': 1 }); }); test('Test contents are undefined for non existing properties', () => { const testObject = new ConfigurationModel({ awesome: true }); - assert.deepEqual(testObject.getSectionContents('unknownproperty'), undefined); + assert.deepEqual(testObject.getValue('unknownproperty'), undefined); }); test('Test override gives all content merged with overrides', () => { @@ -319,10 +319,10 @@ suite('CustomConfigurationModel', () => { test('Test contents while getting an existing property', () => { let testObject = new ConfigurationModelParser('test'); testObject.parse(JSON.stringify({ 'a': 1 })); - assert.deepEqual(testObject.configurationModel.getSectionContents('a'), 1); + assert.deepEqual(testObject.configurationModel.getValue('a'), 1); testObject.parse(JSON.stringify({ 'a': { 'b': 1 } })); - assert.deepEqual(testObject.configurationModel.getSectionContents('a'), { 'b': 1 }); + assert.deepEqual(testObject.configurationModel.getValue('a'), { 'b': 1 }); }); test('Test contents are undefined for non existing properties', () => { @@ -331,13 +331,13 @@ suite('CustomConfigurationModel', () => { awesome: true })); - assert.deepEqual(testObject.configurationModel.getSectionContents('unknownproperty'), undefined); + assert.deepEqual(testObject.configurationModel.getValue('unknownproperty'), undefined); }); test('Test contents are undefined for undefined config', () => { const testObject = new ConfigurationModelParser('test'); - assert.deepEqual(testObject.configurationModel.getSectionContents('unknownproperty'), undefined); + assert.deepEqual(testObject.configurationModel.getValue('unknownproperty'), undefined); }); test('Test configWithOverrides gives all content merged with overrides', () => { @@ -385,7 +385,7 @@ suite('CustomConfigurationModel', () => { } } }); - assert.equal(true, new DefaultConfigurationModel().getSectionContents('a')); + assert.equal(true, new DefaultConfigurationModel().getValue('a')); }); test('Test registering the language property', () => { @@ -402,7 +402,7 @@ suite('CustomConfigurationModel', () => { } } }); - assert.equal(undefined, new DefaultConfigurationModel().getSectionContents('[a]')); + assert.equal(undefined, new DefaultConfigurationModel().getValue('[a]')); }); }); diff --git a/src/vs/platform/configuration/test/common/testConfigurationService.ts b/src/vs/platform/configuration/test/common/testConfigurationService.ts index bf71b9381db..f0ba3aedcbc 100644 --- a/src/vs/platform/configuration/test/common/testConfigurationService.ts +++ b/src/vs/platform/configuration/test/common/testConfigurationService.ts @@ -19,24 +19,19 @@ export class TestConfigurationService extends EventEmitter implements IConfigura private configurationByRoot: TernarySearchTree = TernarySearchTree.forPaths(); public reloadConfiguration(): TPromise { - return TPromise.as(this.getConfiguration()); - } - - public getConfiguration(arg1?: any, arg2?: any): C { - const overrides = isConfigurationOverrides(arg1) ? arg1 : isConfigurationOverrides(arg2) ? arg2 : void 0; - if (overrides && overrides.resource) { - const configForResource = this.configurationByRoot.findSubstr(overrides.resource.fsPath); - return configForResource || this.configuration; - } - - return this.configuration; + return TPromise.as(this.getValue()); } public getValue(arg1?: any, arg2?: any): any { if (arg1 && typeof arg1 === 'string') { return this.inspect(arg1).value; } - return this.getConfiguration(arg1, arg2); + const overrides = isConfigurationOverrides(arg1) ? arg1 : isConfigurationOverrides(arg2) ? arg2 : void 0; + if (overrides && overrides.resource) { + const configForResource = this.configurationByRoot.findSubstr(overrides.resource.fsPath); + return configForResource || this.configuration; + } + return this.configuration; } public updateValue(key: string, overrides?: IConfigurationOverrides): TPromise { @@ -66,7 +61,7 @@ export class TestConfigurationService extends EventEmitter implements IConfigura workspaceFolder: T value: T, } { - const config = this.getConfiguration(undefined, overrides); + const config = this.getValue(undefined, overrides); return { value: getConfigurationValue(config, key), diff --git a/src/vs/platform/configuration/test/node/configurationService.test.ts b/src/vs/platform/configuration/test/node/configurationService.test.ts index 60652d4b614..60394c19de8 100644 --- a/src/vs/platform/configuration/test/node/configurationService.test.ts +++ b/src/vs/platform/configuration/test/node/configurationService.test.ts @@ -47,7 +47,7 @@ suite('ConfigurationService - Node', () => { const service = new ConfigurationService(new SettingsTestEnvironmentService(parseArgs(process.argv), process.execPath, testFile)); - const config = service.getConfiguration<{ foo: string }>(); + const config = service.getValue<{ foo: string }>(); assert.ok(config); assert.equal(config.foo, 'bar'); @@ -63,7 +63,7 @@ suite('ConfigurationService - Node', () => { const service = new ConfigurationService(new SettingsTestEnvironmentService(parseArgs(process.argv), process.execPath, testFile)); - const config = service.getConfiguration<{ testworkbench: { editor: { tabs: boolean } } }>(); + const config = service.getValue<{ testworkbench: { editor: { tabs: boolean } } }>(); assert.ok(config); assert.ok(config.testworkbench); assert.ok(config.testworkbench.editor); @@ -81,7 +81,7 @@ suite('ConfigurationService - Node', () => { const service = new ConfigurationService(new SettingsTestEnvironmentService(parseArgs(process.argv), process.execPath, testFile)); - const config = service.getConfiguration<{ foo: string }>(); + const config = service.getValue<{ foo: string }>(); assert.ok(config); service.dispose(); @@ -98,7 +98,7 @@ suite('ConfigurationService - Node', () => { const service = new ConfigurationService(new SettingsTestEnvironmentService(parseArgs(process.argv), process.execPath, testFile)); - const config = service.getConfiguration<{ foo: string }>(); + const config = service.getValue<{ foo: string }>(); assert.ok(config); service.dispose(); @@ -110,20 +110,20 @@ suite('ConfigurationService - Node', () => { const service = new ConfigurationService(new SettingsTestEnvironmentService(parseArgs(process.argv), process.execPath, testFile)); - let config = service.getConfiguration<{ foo: string }>(); + let config = service.getValue<{ foo: string }>(); assert.ok(config); assert.equal(config.foo, 'bar'); fs.writeFileSync(testFile, '{ "foo": "changed" }'); // still outdated - config = service.getConfiguration<{ foo: string }>(); + config = service.getValue<{ foo: string }>(); assert.ok(config); assert.equal(config.foo, 'bar'); // force a reload to get latest service.reloadConfiguration().then(() => { - config = service.getConfiguration<{ foo: string }>(); + config = service.getValue<{ foo: string }>(); assert.ok(config); assert.equal(config.foo, 'changed'); @@ -156,7 +156,7 @@ suite('ConfigurationService - Node', () => { }); let serviceWithoutFile = new ConfigurationService(new SettingsTestEnvironmentService(parseArgs(process.argv), process.execPath, '__testFile')); - let setting = serviceWithoutFile.getConfiguration(); + let setting = serviceWithoutFile.getValue(); assert.ok(setting); assert.equal(setting.configuration.service.testSetting, 'isSet'); @@ -166,7 +166,7 @@ suite('ConfigurationService - Node', () => { const service = new ConfigurationService(new SettingsTestEnvironmentService(parseArgs(process.argv), process.execPath, testFile)); - let setting = service.getConfiguration(); + let setting = service.getValue(); assert.ok(setting); assert.equal(setting.configuration.service.testSetting, 'isSet'); @@ -174,7 +174,7 @@ suite('ConfigurationService - Node', () => { fs.writeFileSync(testFile, '{ "configuration.service.testSetting": "isChanged" }'); service.reloadConfiguration().then(() => { - let setting = service.getConfiguration(); + let setting = service.getValue(); assert.ok(setting); assert.equal(setting.configuration.service.testSetting, 'isChanged'); diff --git a/src/vs/platform/contextkey/browser/contextKeyService.ts b/src/vs/platform/contextkey/browser/contextKeyService.ts index 600d9ecb3b9..ea163d70cc6 100644 --- a/src/vs/platform/contextkey/browser/contextKeyService.ts +++ b/src/vs/platform/contextkey/browser/contextKeyService.ts @@ -91,7 +91,7 @@ class ConfigAwareContextValuesContainer extends Context { private _initFromConfiguration() { const prefix = 'config.'; - const config = this._configurationService.getConfiguration(); + const config = this._configurationService.getValue(); const configKeys: { [key: string]: boolean } = Object.create(null); const configKeysChanged: string[] = []; diff --git a/src/vs/platform/request/node/requestService.ts b/src/vs/platform/request/node/requestService.ts index a6e58846724..8b6f3fabd19 100644 --- a/src/vs/platform/request/node/requestService.ts +++ b/src/vs/platform/request/node/requestService.ts @@ -28,8 +28,8 @@ export class RequestService implements IRequestService { constructor( @IConfigurationService configurationService: IConfigurationService ) { - this.configure(configurationService.getConfiguration()); - configurationService.onDidChangeConfiguration(() => this.configure(configurationService.getConfiguration()), this, this.disposables); + this.configure(configurationService.getValue()); + configurationService.onDidChangeConfiguration(() => this.configure(configurationService.getValue()), this, this.disposables); } private configure(config: IHTTPConfiguration) { diff --git a/src/vs/platform/telemetry/common/experiments.ts b/src/vs/platform/telemetry/common/experiments.ts index fa40eff9876..e2108f20888 100644 --- a/src/vs/platform/telemetry/common/experiments.ts +++ b/src/vs/platform/telemetry/common/experiments.ts @@ -88,5 +88,5 @@ function splitRandom(random: number): [number, boolean] { } function getExperimentsOverrides(configurationService: IConfigurationService): IExperiments { - return configurationService.getConfiguration('experiments') || {}; + return configurationService.getValue('experiments') || {}; } diff --git a/src/vs/platform/telemetry/common/telemetryService.ts b/src/vs/platform/telemetry/common/telemetryService.ts index 45c89aa945a..23eab275679 100644 --- a/src/vs/platform/telemetry/common/telemetryService.ts +++ b/src/vs/platform/telemetry/common/telemetryService.ts @@ -75,7 +75,7 @@ export class TelemetryService implements ITelemetryService { } private _updateUserOptIn(): void { - const config = this._configurationService.getConfiguration(TELEMETRY_SECTION_ID); + const config = this._configurationService.getValue(TELEMETRY_SECTION_ID); this._userOptIn = config ? config.enableTelemetry : this._userOptIn; } 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 c8084219921..b269f49b287 100644 --- a/src/vs/platform/telemetry/test/electron-browser/telemetryService.test.ts +++ b/src/vs/platform/telemetry/test/electron-browser/telemetryService.test.ts @@ -676,11 +676,6 @@ suite('TelemetryService', () => { appender: testAppender }, { _serviceBrand: undefined, - getConfiguration() { - return { - enableTelemetry: enableTelemetry - } as any; - }, getValue() { return { enableTelemetry: enableTelemetry @@ -691,9 +686,9 @@ suite('TelemetryService', () => { }, inspect(key: string) { return { - value: getConfigurationValue(this.getConfiguration(), key), - default: getConfigurationValue(this.getConfiguration(), key), - user: getConfigurationValue(this.getConfiguration(), key), + value: getConfigurationValue(this.getValue(), key), + default: getConfigurationValue(this.getValue(), key), + user: getConfigurationValue(this.getValue(), key), workspace: null, workspaceFolder: null }; diff --git a/src/vs/platform/update/electron-main/updateService.ts b/src/vs/platform/update/electron-main/updateService.ts index bb4b2da6262..907364dbd20 100644 --- a/src/vs/platform/update/electron-main/updateService.ts +++ b/src/vs/platform/update/electron-main/updateService.ts @@ -224,9 +224,7 @@ export class UpdateService implements IUpdateService { } private getUpdateChannel(): string { - const config = this.configurationService.getConfiguration<{ channel: string; }>('update'); - const channel = config && config.channel; - + const channel = this.configurationService.getValue('update.channel'); return channel === 'none' ? null : product.quality; } diff --git a/src/vs/workbench/api/electron-browser/mainThreadWorkspace.ts b/src/vs/workbench/api/electron-browser/mainThreadWorkspace.ts index 18e06d646ee..5105287b174 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadWorkspace.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadWorkspace.ts @@ -66,12 +66,12 @@ export class MainThreadWorkspace implements MainThreadWorkspaceShape { } const useRipgrep = folderQueries.every(folderQuery => { - const folderConfig = this._configurationService.getConfiguration({ resource: folderQuery.folder }); + const folderConfig = this._configurationService.getValue({ resource: folderQuery.folder }); return folderConfig.search.useRipgrep; }); const ignoreSymlinks = folderQueries.every(folderQuery => { - const folderConfig = this._configurationService.getConfiguration({ resource: folderQuery.folder }); + const folderConfig = this._configurationService.getValue({ resource: folderQuery.folder }); return !folderConfig.search.followSymlinks; }); diff --git a/src/vs/workbench/api/node/extHostConfiguration.ts b/src/vs/workbench/api/node/extHostConfiguration.ts index 44833b91369..ec5f0f695f5 100644 --- a/src/vs/workbench/api/node/extHostConfiguration.ts +++ b/src/vs/workbench/api/node/extHostConfiguration.ts @@ -62,8 +62,8 @@ export class ExtHostConfiguration implements ExtHostConfigurationShape { getConfiguration(section?: string, resource?: URI, extensionId?: string): vscode.WorkspaceConfiguration { const config = section - ? lookUp(this._configuration.getSection(null, { resource }, this._extHostWorkspace.workspace), section) - : this._configuration.getSection(null, { resource }, this._extHostWorkspace.workspace); + ? lookUp(this._configuration.getValue(null, { resource }, this._extHostWorkspace.workspace), section) + : this._configuration.getValue(null, { resource }, this._extHostWorkspace.workspace); if (section) { this._validateConfigurationAccess(section, resource, extensionId); diff --git a/src/vs/workbench/browser/parts/editor/editorPart.ts b/src/vs/workbench/browser/parts/editor/editorPart.ts index 4bd4b8e7435..3cfa3c4474e 100644 --- a/src/vs/workbench/browser/parts/editor/editorPart.ts +++ b/src/vs/workbench/browser/parts/editor/editorPart.ts @@ -153,7 +153,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService this.textCompareEditorVisible = TextCompareEditorVisible.bindTo(contextKeyService); - const config = configurationService.getConfiguration(); + const config = configurationService.getValue(); if (config && config.workbench && config.workbench.editor) { const editorConfig = config.workbench.editor; @@ -215,7 +215,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService private onConfigurationUpdated(event: IConfigurationChangeEvent): void { if (event.affectsConfiguration('workbench.editor')) { - const configuration = this.configurationService.getConfiguration(); + const configuration = this.configurationService.getValue(); if (configuration && configuration.workbench && configuration.workbench.editor) { const editorConfig = configuration.workbench.editor; @@ -282,7 +282,7 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService public hideTabs(forceHide: boolean): void { this.forceHideTabs = forceHide; - const config = this.configurationService.getConfiguration(); + const config = this.configurationService.getValue(); this.tabOptions.showTabs = forceHide ? false : config && config.workbench && config.workbench.editor && config.workbench.editor.showTabs; this._onTabOptionsChanged.fire(this.tabOptions); } diff --git a/src/vs/workbench/browser/parts/editor/editorStatus.ts b/src/vs/workbench/browser/parts/editor/editorStatus.ts index 261a8246112..c9af86c263b 100644 --- a/src/vs/workbench/browser/parts/editor/editorStatus.ts +++ b/src/vs/workbench/browser/parts/editor/editorStatus.ts @@ -631,7 +631,7 @@ export class EditorStatus implements IStatusbarItem { if (editorWidget) { const screenReaderDetected = (browser.getAccessibilitySupport() === AccessibilitySupport.Enabled); if (screenReaderDetected) { - const screenReaderConfiguration = this.configurationService.getConfiguration('editor').accessibilitySupport; + const screenReaderConfiguration = this.configurationService.getValue('editor').accessibilitySupport; if (screenReaderConfiguration === 'auto') { // show explanation if (!this._promptedScreenReader) { diff --git a/src/vs/workbench/browser/parts/quickopen/quickOpenController.ts b/src/vs/workbench/browser/parts/quickopen/quickOpenController.ts index d40e65a496d..bc3517a4f7e 100644 --- a/src/vs/workbench/browser/parts/quickopen/quickOpenController.ts +++ b/src/vs/workbench/browser/parts/quickopen/quickOpenController.ts @@ -1315,7 +1315,7 @@ export class EditorHistoryEntry extends EditorQuickOpenEntry { public run(mode: Mode, context: IEntryRunContext): boolean { if (mode === Mode.OPEN) { const sideBySide = !context.quickNavigateConfiguration && context.keymods.indexOf(KeyMod.CtrlCmd) >= 0; - const pinned = !this.configurationService.getConfiguration().workbench.editor.enablePreviewFromQuickOpen; + const pinned = !this.configurationService.getValue().workbench.editor.enablePreviewFromQuickOpen; if (this.input instanceof EditorInput) { this.editorService.openEditor(this.input, { pinned }, sideBySide).done(null, errors.onUnexpectedError); diff --git a/src/vs/workbench/electron-browser/shell.ts b/src/vs/workbench/electron-browser/shell.ts index 60cc8295f4a..4ef9feb789c 100644 --- a/src/vs/workbench/electron-browser/shell.ts +++ b/src/vs/workbench/electron-browser/shell.ts @@ -297,7 +297,7 @@ export class WorkbenchShell { // Warm up font cache information before building up too many dom elements restoreFontInfo(this.storageService); - readFontInfo(BareFontInfo.createFromRawSettings(this.configurationService.getConfiguration('editor'), browser.getZoomLevel())); + readFontInfo(BareFontInfo.createFromRawSettings(this.configurationService.getValue('editor'), browser.getZoomLevel())); // Hash serviceCollection.set(IHashService, new SyncDescriptor(HashService)); diff --git a/src/vs/workbench/electron-browser/window.ts b/src/vs/workbench/electron-browser/window.ts index ce9f81ed794..c3fd3434b1f 100644 --- a/src/vs/workbench/electron-browser/window.ts +++ b/src/vs/workbench/electron-browser/window.ts @@ -207,7 +207,7 @@ export class ElectronWindow extends Themable { // High Contrast Events ipc.on('vscode:enterHighContrast', () => { - const windowConfig = this.configurationService.getConfiguration('window'); + const windowConfig = this.configurationService.getValue('window'); if (windowConfig && windowConfig.autoDetectHighContrast) { this.lifecycleService.when(LifecyclePhase.Running).then(() => { this.themeService.setColorTheme(VS_HC_THEME, null); @@ -216,7 +216,7 @@ export class ElectronWindow extends Themable { }); ipc.on('vscode:leaveHighContrast', () => { - const windowConfig = this.configurationService.getConfiguration('window'); + const windowConfig = this.configurationService.getValue('window'); if (windowConfig && windowConfig.autoDetectHighContrast) { this.lifecycleService.when(LifecyclePhase.Running).then(() => { this.themeService.setColorTheme(VS_DARK_THEME, null); @@ -261,7 +261,7 @@ export class ElectronWindow extends Themable { return; } - const windowConfig: IWindowsConfiguration = this.configurationService.getConfiguration(); + const windowConfig: IWindowsConfiguration = this.configurationService.getValue(); let newZoomLevel = 0; if (windowConfig.window && typeof windowConfig.window.zoomLevel === 'number') { diff --git a/src/vs/workbench/electron-browser/workbench.ts b/src/vs/workbench/electron-browser/workbench.ts index 965c1089670..99e9b3d2052 100644 --- a/src/vs/workbench/electron-browser/workbench.ts +++ b/src/vs/workbench/electron-browser/workbench.ts @@ -402,7 +402,7 @@ export class Workbench implements IPartService { workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(OpenRecentAction, OpenRecentAction.ID, OpenRecentAction.LABEL, { primary: isDeveloping ? null : KeyMod.CtrlCmd | KeyCode.KEY_R, mac: { primary: KeyMod.WinCtrl | KeyCode.KEY_R } }), 'File: Open Recent...', localize('file', "File")); // Actions for macOS native tabs management (only when enabled) - const windowConfig = this.configurationService.getConfiguration(); + const windowConfig = this.configurationService.getValue(); if (windowConfig && windowConfig.window && windowConfig.window.nativeTabs) { workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(ShowPreviousWindowTab, ShowPreviousWindowTab.ID, ShowPreviousWindowTab.LABEL), 'Show Previous Window Tab'); workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(ShowNextWindowTab, ShowNextWindowTab.ID, ShowNextWindowTab.LABEL), 'Show Next Window Tab'); @@ -748,7 +748,7 @@ export class Workbench implements IPartService { return null; // not enabled when developing due to https://github.com/electron/electron/issues/3647 } - const windowConfig = this.configurationService.getConfiguration(); + const windowConfig = this.configurationService.getValue(); if (windowConfig && windowConfig.window) { const useNativeTabs = windowConfig.window.nativeTabs; if (useNativeTabs) { @@ -974,7 +974,7 @@ export class Workbench implements IPartService { } // Preserve zen mode only on reload. Real quit gets out of zen mode so novice users do not get stuck in zen mode. - const zenConfig = this.configurationService.getConfiguration('zenMode'); + const zenConfig = this.configurationService.getValue('zenMode'); const zenModeActive = (zenConfig.restore || reason === ShutdownReason.RELOAD) && this.zenMode.active; if (zenModeActive) { this.storageService.store(Workbench.zenModeActiveSettingKey, true, StorageScope.WORKSPACE); @@ -1283,7 +1283,7 @@ export class Workbench implements IPartService { // Check if zen mode transitioned to full screen and if now we are out of zen mode -> we need to go out of full screen let toggleFullScreen = false; if (this.zenMode.active) { - const config = this.configurationService.getConfiguration('zenMode'); + const config = this.configurationService.getValue('zenMode'); toggleFullScreen = !browser.isFullscreen() && config.fullScreen; this.zenMode.transitionedToFullScreen = toggleFullScreen; this.zenMode.wasSideBarVisible = this.isVisible(Parts.SIDEBAR_PART); diff --git a/src/vs/workbench/parts/backup/common/backupModelTracker.ts b/src/vs/workbench/parts/backup/common/backupModelTracker.ts index 4b1408847d2..c0d91880f14 100644 --- a/src/vs/workbench/parts/backup/common/backupModelTracker.ts +++ b/src/vs/workbench/parts/backup/common/backupModelTracker.ts @@ -50,7 +50,7 @@ export class BackupModelTracker implements IWorkbenchContribution { this.toDispose.push(this.untitledEditorService.onDidDisposeModel((e) => this.discardBackup(e))); // Listen to config changes - this.toDispose.push(this.configurationService.onDidChangeConfiguration(e => this.onConfigurationChange(this.configurationService.getConfiguration()))); + this.toDispose.push(this.configurationService.onDidChangeConfiguration(e => this.onConfigurationChange(this.configurationService.getValue()))); } private onConfigurationChange(configuration: IFilesConfiguration): void { diff --git a/src/vs/workbench/parts/codeEditor/electron-browser/accessibility.ts b/src/vs/workbench/parts/codeEditor/electron-browser/accessibility.ts index 14bdfe81cd9..da83137738d 100644 --- a/src/vs/workbench/parts/codeEditor/electron-browser/accessibility.ts +++ b/src/vs/workbench/parts/codeEditor/electron-browser/accessibility.ts @@ -191,7 +191,7 @@ class AccessibilityHelpWidget extends Widget implements IOverlayWidget { text += '\n\n' + nls.localize('status', "Status:"); - const configuredValue = this._configurationService.getConfiguration('editor').accessibilitySupport; + const configuredValue = this._configurationService.getValue('editor').accessibilitySupport; const actualValue = opts.accessibilitySupport; const emergencyTurnOnMessage = ( diff --git a/src/vs/workbench/parts/codeEditor/electron-browser/toggleMultiCursorModifier.ts b/src/vs/workbench/parts/codeEditor/electron-browser/toggleMultiCursorModifier.ts index a2022660076..d80759e0f44 100644 --- a/src/vs/workbench/parts/codeEditor/electron-browser/toggleMultiCursorModifier.ts +++ b/src/vs/workbench/parts/codeEditor/electron-browser/toggleMultiCursorModifier.ts @@ -28,7 +28,7 @@ export class ToggleMultiCursorModifierAction extends Action { } public run(): TPromise { - const editorConf = this.configurationService.getConfiguration<{ multiCursorModifier: 'ctrlCmd' | 'alt' }>('editor'); + const editorConf = this.configurationService.getValue<{ multiCursorModifier: 'ctrlCmd' | 'alt' }>('editor'); const newValue: 'ctrlCmd' | 'alt' = (editorConf.multiCursorModifier === 'ctrlCmd' ? 'alt' : 'ctrlCmd'); return this.configurationService.updateValue(ToggleMultiCursorModifierAction.multiCursorModifierConfigurationKey, newValue, ConfigurationTarget.USER); diff --git a/src/vs/workbench/parts/debug/browser/debugActionsWidget.ts b/src/vs/workbench/parts/debug/browser/debugActionsWidget.ts index 3513a9f08ac..e62e3ab823f 100644 --- a/src/vs/workbench/parts/debug/browser/debugActionsWidget.ts +++ b/src/vs/workbench/parts/debug/browser/debugActionsWidget.ts @@ -202,7 +202,7 @@ export class DebugActionsWidget extends Themable implements IWorkbenchContributi } private update(state: State): void { - if (state === State.Inactive || state === State.Initializing || this.configurationService.getConfiguration('debug').hideActionBar) { + if (state === State.Inactive || state === State.Initializing || this.configurationService.getValue('debug').hideActionBar) { return this.hide(); } diff --git a/src/vs/workbench/parts/debug/electron-browser/debugConfigurationManager.ts b/src/vs/workbench/parts/debug/electron-browser/debugConfigurationManager.ts index f8342eaf9f7..104aee6ac41 100644 --- a/src/vs/workbench/parts/debug/electron-browser/debugConfigurationManager.ts +++ b/src/vs/workbench/parts/debug/electron-browser/debugConfigurationManager.ts @@ -380,7 +380,7 @@ export class ConfigurationManager implements IConfigurationManager { // do not allow breakpoints in our settings files return false; } - if (this.configurationService.getConfiguration('debug').allowBreakpointsEverywhere) { + if (this.configurationService.getValue('debug').allowBreakpointsEverywhere) { return true; } @@ -449,7 +449,7 @@ class Launch implements ILaunch { } public getCompound(name: string): ICompound { - const config = this.configurationService.getConfiguration('launch', { resource: this.workspace.uri }); + const config = this.configurationService.getValue('launch', { resource: this.workspace.uri }); if (!config || !config.compounds) { return null; } @@ -458,7 +458,7 @@ class Launch implements ILaunch { } public getConfigurationNames(): string[] { - const config = this.configurationService.getConfiguration('launch', { resource: this.workspace.uri }); + const config = this.configurationService.getValue('launch', { resource: this.workspace.uri }); if (!config || !config.configurations || !Array.isArray(config.configurations)) { return []; } else { @@ -475,7 +475,7 @@ class Launch implements ILaunch { } public getConfiguration(name: string): IConfig { - const config = this.configurationService.getConfiguration('launch', { resource: this.workspace.uri }); + const config = this.configurationService.getValue('launch', { resource: this.workspace.uri }); if (!config || !config.configurations) { return null; } diff --git a/src/vs/workbench/parts/debug/electron-browser/debugEditorContribution.ts b/src/vs/workbench/parts/debug/electron-browser/debugEditorContribution.ts index 33e09d2ace5..6e7c8032b18 100644 --- a/src/vs/workbench/parts/debug/electron-browser/debugEditorContribution.ts +++ b/src/vs/workbench/parts/debug/electron-browser/debugEditorContribution.ts @@ -468,7 +468,7 @@ export class DebugEditorContribution implements IDebugEditorContribution { // Inline Decorations private updateInlineDecorations(stackFrame: IStackFrame): void { const model = this.editor.getModel(); - if (!this.configurationService.getConfiguration('debug').inlineValues || + if (!this.configurationService.getValue('debug').inlineValues || !model || !stackFrame || model.uri.toString() !== stackFrame.source.uri.toString()) { if (!this.removeInlineValuesScheduler.isScheduled()) { this.removeInlineValuesScheduler.schedule(); diff --git a/src/vs/workbench/parts/debug/electron-browser/debugService.ts b/src/vs/workbench/parts/debug/electron-browser/debugService.ts index e6f8c88eab3..0dcadf4258e 100644 --- a/src/vs/workbench/parts/debug/electron-browser/debugService.ts +++ b/src/vs/workbench/parts/debug/electron-browser/debugService.ts @@ -862,12 +862,12 @@ export class DebugService implements debug.IDebugService { this._onDidNewProcess.fire(process); this.focusStackFrameAndEvaluate(null, process); - const internalConsoleOptions = configuration.internalConsoleOptions || this.configurationService.getConfiguration('debug').internalConsoleOptions; + const internalConsoleOptions = configuration.internalConsoleOptions || this.configurationService.getValue('debug').internalConsoleOptions; if (internalConsoleOptions === 'openOnSessionStart' || (this.firstSessionStart && internalConsoleOptions === 'openOnFirstSessionStart')) { this.panelService.openPanel(debug.REPL_ID, false).done(undefined, errors.onUnexpectedError); } - const openDebugOptions = this.configurationService.getConfiguration('debug').openDebug; + const openDebugOptions = this.configurationService.getValue('debug').openDebug; // Open debug viewlet based on the visibility of the side bar and openDebug setting if (openDebugOptions === 'openOnSessionStart' || (openDebugOptions === 'openOnFirstSessionStart' && this.firstSessionStart)) { this.viewletService.openViewlet(debug.VIEWLET_ID); @@ -898,7 +898,7 @@ export class DebugService implements debug.IDebugService { watchExpressionsCount: this.model.getWatchExpressions().length, extensionName: `${adapter.extensionDescription.publisher}.${adapter.extensionDescription.name}`, isBuiltin: adapter.extensionDescription.isBuiltin, - launchJsonExists: root && !!this.configurationService.getConfiguration('launch', { resource: root.uri }) + launchJsonExists: root && !!this.configurationService.getValue('launch', { resource: root.uri }) }); }).then(() => process, (error: any) => { if (error instanceof Error && error.message === 'Canceled') { @@ -1085,7 +1085,7 @@ export class DebugService implements debug.IDebugService { this.debugType.reset(); this.viewModel.setMultiProcessView(false); - if (this.partService.isVisible(Parts.SIDEBAR_PART) && this.configurationService.getConfiguration('debug').openExplorerOnEnd) { + if (this.partService.isVisible(Parts.SIDEBAR_PART) && this.configurationService.getValue('debug').openExplorerOnEnd) { this.viewletService.openViewlet(EXPLORER_VIEWLET_ID).done(null, errors.onUnexpectedError); } } diff --git a/src/vs/workbench/parts/debug/electron-browser/terminalSupport.ts b/src/vs/workbench/parts/debug/electron-browser/terminalSupport.ts index df6f2affc77..d4b478ccb17 100644 --- a/src/vs/workbench/parts/debug/electron-browser/terminalSupport.ts +++ b/src/vs/workbench/parts/debug/electron-browser/terminalSupport.ts @@ -61,7 +61,7 @@ export class TerminalSupport { // get the shell configuration for the current platform let shell: string; - const shell_config = (configurationService.getConfiguration().terminal.integrated).shell; + const shell_config = (configurationService.getValue().terminal.integrated).shell; if (platform.isWindows) { shell = shell_config.windows; shellType = ShellType.cmd; diff --git a/src/vs/workbench/parts/debug/node/debugAdapter.ts b/src/vs/workbench/parts/debug/node/debugAdapter.ts index 6f0aeb9bff9..d96386f6033 100644 --- a/src/vs/workbench/parts/debug/node/debugAdapter.ts +++ b/src/vs/workbench/parts/debug/node/debugAdapter.ts @@ -157,7 +157,7 @@ export class Adapter { ].join('\n'); // fix formatting - const editorConfig = this.configurationService.getConfiguration(); + const editorConfig = this.configurationService.getValue(); if (editorConfig.editor && editorConfig.editor.insertSpaces) { content = content.replace(new RegExp('\t', 'g'), strings.repeat(' ', editorConfig.editor.tabSize)); } diff --git a/src/vs/workbench/parts/execution/electron-browser/execution.contribution.ts b/src/vs/workbench/parts/execution/electron-browser/execution.contribution.ts index 913c3e87ccf..0d39eea4017 100644 --- a/src/vs/workbench/parts/execution/electron-browser/execution.contribution.ts +++ b/src/vs/workbench/parts/execution/electron-browser/execution.contribution.ts @@ -196,7 +196,7 @@ export class ExplorerViewerActionContributor extends ActionBarContributor { resource = resources.dirname(resource); } - const configuration = this.configurationService.getConfiguration(); + const configuration = this.configurationService.getValue(); const explorerKind = configuration.terminal.explorerKind; if (explorerKind === 'integrated') { diff --git a/src/vs/workbench/parts/execution/electron-browser/terminalService.ts b/src/vs/workbench/parts/execution/electron-browser/terminalService.ts index 6c60fce0673..4c2ef371872 100644 --- a/src/vs/workbench/parts/execution/electron-browser/terminalService.ts +++ b/src/vs/workbench/parts/execution/electron-browser/terminalService.ts @@ -36,7 +36,7 @@ export class WinTerminalService implements ITerminalService { } public openTerminal(cwd?: string): void { - const configuration = this._configurationService.getConfiguration(); + const configuration = this._configurationService.getValue(); this.spawnTerminal(cp, configuration, processes.getWindowsShell(), cwd) .done(null, errors.onUnexpectedError); @@ -44,7 +44,7 @@ export class WinTerminalService implements ITerminalService { public runInTerminal(title: string, dir: string, args: string[], envVars: IProcessEnvironment): TPromise { - const configuration = this._configurationService.getConfiguration(); + const configuration = this._configurationService.getValue(); const terminalConfig = configuration.terminal.external; const exec = terminalConfig.windowsExec || DEFAULT_TERMINAL_WINDOWS; @@ -121,14 +121,14 @@ export class MacTerminalService implements ITerminalService { ) { } public openTerminal(cwd?: string): void { - const configuration = this._configurationService.getConfiguration(); + const configuration = this._configurationService.getValue(); this.spawnTerminal(cp, configuration, cwd).done(null, errors.onUnexpectedError); } public runInTerminal(title: string, dir: string, args: string[], envVars: IProcessEnvironment): TPromise { - const configuration = this._configurationService.getConfiguration(); + const configuration = this._configurationService.getValue(); const terminalConfig = configuration.terminal.external; const terminalApp = terminalConfig.osxExec || DEFAULT_TERMINAL_OSX; @@ -207,7 +207,7 @@ export class LinuxTerminalService implements ITerminalService { public openTerminal(cwd?: string): void { - const configuration = this._configurationService.getConfiguration(); + const configuration = this._configurationService.getValue(); this.spawnTerminal(cp, configuration, cwd) .done(null, errors.onUnexpectedError); @@ -215,7 +215,7 @@ export class LinuxTerminalService implements ITerminalService { public runInTerminal(title: string, dir: string, args: string[], envVars: IProcessEnvironment): TPromise { - const configuration = this._configurationService.getConfiguration(); + const configuration = this._configurationService.getValue(); const terminalConfig = configuration.terminal.external; const execPromise = terminalConfig.linuxExec ? TPromise.as(terminalConfig.linuxExec) : DEFAULT_TERMINAL_LINUX_READY; diff --git a/src/vs/workbench/parts/extensions/electron-browser/extensionTipsService.ts b/src/vs/workbench/parts/extensions/electron-browser/extensionTipsService.ts index 3f49d969024..145aee5c510 100644 --- a/src/vs/workbench/parts/extensions/electron-browser/extensionTipsService.ts +++ b/src/vs/workbench/parts/extensions/electron-browser/extensionTipsService.ts @@ -249,7 +249,7 @@ export class ExtensionTipsService extends Disposable implements IExtensionTipsSe StorageScope.GLOBAL ); - const config = this.configurationService.getConfiguration(ConfigurationKey); + const config = this.configurationService.getValue(ConfigurationKey); if (config.ignoreRecommendations) { return; @@ -345,7 +345,7 @@ export class ExtensionTipsService extends Disposable implements IExtensionTipsSe return; } - const config = this.configurationService.getConfiguration(ConfigurationKey); + const config = this.configurationService.getValue(ConfigurationKey); if (config.ignoreRecommendations) { return; diff --git a/src/vs/workbench/parts/files/browser/explorerViewlet.ts b/src/vs/workbench/parts/files/browser/explorerViewlet.ts index e0bb4bc7d1e..4175dc945a6 100644 --- a/src/vs/workbench/parts/files/browser/explorerViewlet.ts +++ b/src/vs/workbench/parts/files/browser/explorerViewlet.ts @@ -177,7 +177,7 @@ export class ExplorerViewlet extends PersistentViewsViewlet { if (openEditorsView) { let delay = 0; - const config = this.configurationService.getConfiguration(); + const config = this.configurationService.getValue(); // No need to delay if preview is disabled const delayEditorOpeningInOpenedEditors = !!config.workbench.editor.enablePreview; diff --git a/src/vs/workbench/parts/files/browser/views/explorerView.ts b/src/vs/workbench/parts/files/browser/views/explorerView.ts index 70dd333879a..aa58908d1e4 100644 --- a/src/vs/workbench/parts/files/browser/views/explorerView.ts +++ b/src/vs/workbench/parts/files/browser/views/explorerView.ts @@ -124,7 +124,7 @@ export class ExplorerView extends ViewsViewletPanel { private getFileEventsExcludes(root?: URI): glob.IExpression { const scope = root ? { resource: root } : void 0; - const configuration = this.configurationService.getConfiguration(scope); + const configuration = this.configurationService.getValue(scope); return (configuration && configuration.files && configuration.files.exclude) || Object.create(null); } @@ -202,7 +202,7 @@ export class ExplorerView extends ViewsViewletPanel { public create(): TPromise { // Update configuration - const configuration = this.configurationService.getConfiguration(); + const configuration = this.configurationService.getValue(); this.onConfigurationUpdated(configuration); // Load and Fill Viewer @@ -216,7 +216,7 @@ export class ExplorerView extends ViewsViewletPanel { this.disposables.push(this.editorGroupService.onEditorsChanged(() => this.revealActiveFile())); // Also handle configuration updates - this.disposables.push(this.configurationService.onDidChangeConfiguration(e => this.onConfigurationUpdated(this.configurationService.getConfiguration(), e))); + this.disposables.push(this.configurationService.onDidChangeConfiguration(e => this.onConfigurationUpdated(this.configurationService.getValue(), e))); this.revealActiveFile(); }); diff --git a/src/vs/workbench/parts/files/browser/views/explorerViewer.ts b/src/vs/workbench/parts/files/browser/views/explorerViewer.ts index 5791ec4b0fd..8cc7a47aaa7 100644 --- a/src/vs/workbench/parts/files/browser/views/explorerViewer.ts +++ b/src/vs/workbench/parts/files/browser/views/explorerViewer.ts @@ -286,10 +286,10 @@ export class FileRenderer implements IRenderer { @IConfigurationService private configurationService: IConfigurationService ) { this.state = state; - this.config = this.configurationService.getConfiguration(); + this.config = this.configurationService.getValue(); this.configListener = this.configurationService.onDidChangeConfiguration(e => { if (e.affectsConfiguration('explorer')) { - this.config = this.configurationService.getConfiguration(); + this.config = this.configurationService.getValue(); } }); } @@ -690,7 +690,7 @@ export class FileFilter implements IFilter { public updateConfiguration(): boolean { let needsRefresh = false; this.contextService.getWorkspace().folders.forEach(folder => { - const configuration = this.configurationService.getConfiguration({ resource: folder.uri }); + const configuration = this.configurationService.getValue({ resource: folder.uri }); const excludesConfig = (configuration && configuration.files && configuration.files.exclude) || Object.create(null); needsRefresh = needsRefresh || !objects.equals(this.hiddenExpressionPerRoot.get(folder.uri.toString()), excludesConfig); this.hiddenExpressionPerRoot.set(folder.uri.toString(), objects.clone(excludesConfig)); // do not keep the config, as it gets mutated under our hoods diff --git a/src/vs/workbench/parts/files/browser/views/openEditorsViewer.ts b/src/vs/workbench/parts/files/browser/views/openEditorsViewer.ts index c72ae86cbaa..8024b248317 100644 --- a/src/vs/workbench/parts/files/browser/views/openEditorsViewer.ts +++ b/src/vs/workbench/parts/files/browser/views/openEditorsViewer.ts @@ -154,7 +154,7 @@ export class Renderer implements IRenderer { templateData.root.setEditor(editor.editorInput, { italic: editor.isPreview(), extraClasses: ['open-editor'], - fileDecorations: this.configurationService.getConfiguration().explorer.decorations + fileDecorations: this.configurationService.getValue().explorer.decorations }); templateData.actionBar.context = { group: editor.editorGroup, editor: editor.editorInput }; } diff --git a/src/vs/workbench/parts/files/common/editors/fileEditorTracker.ts b/src/vs/workbench/parts/files/common/editors/fileEditorTracker.ts index 771cde62269..8d7c062d4ce 100644 --- a/src/vs/workbench/parts/files/common/editors/fileEditorTracker.ts +++ b/src/vs/workbench/parts/files/common/editors/fileEditorTracker.ts @@ -49,7 +49,7 @@ export class FileEditorTracker implements IWorkbenchContribution { this.modelLoadQueue = new ResourceQueue(); this.activeOutOfWorkspaceWatchers = new ResourceMap(); - this.onConfigurationUpdated(configurationService.getConfiguration()); + this.onConfigurationUpdated(configurationService.getValue()); this.registerListeners(); } @@ -73,7 +73,7 @@ export class FileEditorTracker implements IWorkbenchContribution { this.lifecycleService.onShutdown(this.dispose, this); // Configuration - this.toUnbind.push(this.configurationService.onDidChangeConfiguration(e => this.onConfigurationUpdated(this.configurationService.getConfiguration()))); + this.toUnbind.push(this.configurationService.onDidChangeConfiguration(e => this.onConfigurationUpdated(this.configurationService.getValue()))); } private onConfigurationUpdated(configuration: IWorkbenchEditorConfiguration): void { diff --git a/src/vs/workbench/parts/markers/browser/markersFileDecorations.ts b/src/vs/workbench/parts/markers/browser/markersFileDecorations.ts index 5f9edce74d8..030a56a19be 100644 --- a/src/vs/workbench/parts/markers/browser/markersFileDecorations.ts +++ b/src/vs/workbench/parts/markers/browser/markersFileDecorations.ts @@ -80,7 +80,7 @@ class MarkersFileDecorations implements IWorkbenchContribution { } private _updateEnablement(): void { - let value = this._configurationService.getConfiguration<{ decorations: { enabled: boolean } }>('problems'); + let value = this._configurationService.getValue<{ decorations: { enabled: boolean } }>('problems'); if (value.decorations.enabled === this._enabled) { return; } diff --git a/src/vs/workbench/parts/preferences/browser/preferencesRenderers.ts b/src/vs/workbench/parts/preferences/browser/preferencesRenderers.ts index f8d401e9fc3..000e814f19c 100644 --- a/src/vs/workbench/parts/preferences/browser/preferencesRenderers.ts +++ b/src/vs/workbench/parts/preferences/browser/preferencesRenderers.ts @@ -651,7 +651,7 @@ export class FeedbackWidgetRenderer extends Disposable { const altsAdded = expectedQuery.alts && expectedQuery.alts[0] && (expectedQuery.alts[0][0] !== FeedbackWidgetRenderer.DEFAULT_ALTS[0] || expectedQuery.alts[0][1] !== FeedbackWidgetRenderer.DEFAULT_ALTS[1]); const alts = altsAdded ? expectedQuery.alts : undefined; - const workbenchSettings = this.configurationService.getConfiguration().workbench.settings; + const workbenchSettings = this.configurationService.getValue().workbench.settings; const autoIngest = workbenchSettings.experimentalFuzzySearchAutoIngestFeedback; /* __GDPR__ diff --git a/src/vs/workbench/parts/preferences/browser/preferencesSearch.ts b/src/vs/workbench/parts/preferences/browser/preferencesSearch.ts index eda9991fce8..81b544c8306 100644 --- a/src/vs/workbench/parts/preferences/browser/preferencesSearch.ts +++ b/src/vs/workbench/parts/preferences/browser/preferencesSearch.ts @@ -43,7 +43,7 @@ export class PreferencesSearchProvider { } get endpoint(): IEndpointDetails { - const workbenchSettings = this.configurationService.getConfiguration().workbench.settings; + const workbenchSettings = this.configurationService.getValue().workbench.settings; return { urlBase: workbenchSettings.experimentalFuzzySearchEndpoint, key: workbenchSettings.experimentalFuzzySearchKey, diff --git a/src/vs/workbench/parts/preferences/browser/preferencesService.ts b/src/vs/workbench/parts/preferences/browser/preferencesService.ts index f568fd3e1a2..3114a2f5ab6 100644 --- a/src/vs/workbench/parts/preferences/browser/preferencesService.ts +++ b/src/vs/workbench/parts/preferences/browser/preferencesService.ts @@ -376,16 +376,16 @@ export class PreferencesService extends Disposable implements IPreferencesServic const languageKey = `[${language}]`; let setting = settingsModel.getPreference(languageKey); const model = codeEditor.getModel(); - const configuration = this.configurationService.getConfiguration<{ tabSize: number; insertSpaces: boolean }>('editor'); - const { eol } = this.configurationService.getConfiguration<{ eol: string }>('files'); + const configuration = this.configurationService.getValue<{ editor: { tabSize: number; insertSpaces: boolean }, files: { eol: string } }>(); + const eol = configuration.files && configuration.files.eol; if (setting) { if (setting.overrides.length) { const lastSetting = setting.overrides[setting.overrides.length - 1]; let content; if (lastSetting.valueRange.endLineNumber === setting.range.endLineNumber) { - content = ',' + eol + this.spaces(2, configuration) + eol + this.spaces(1, configuration); + content = ',' + eol + this.spaces(2, configuration.editor) + eol + this.spaces(1, configuration.editor); } else { - content = ',' + eol + this.spaces(2, configuration); + content = ',' + eol + this.spaces(2, configuration.editor); } const editOperation = EditOperation.insert(new Position(lastSetting.valueRange.endLineNumber, lastSetting.valueRange.endColumn), content); model.pushEditOperations([], [editOperation], () => []); @@ -396,7 +396,7 @@ export class PreferencesService extends Disposable implements IPreferencesServic return this.configurationService.updateValue(languageKey, {}, ConfigurationTarget.USER) .then(() => { setting = settingsModel.getPreference(languageKey); - let content = eol + this.spaces(2, configuration) + eol + this.spaces(1, configuration); + let content = eol + this.spaces(2, configuration.editor) + eol + this.spaces(1, configuration.editor); let editOperation = EditOperation.insert(new Position(setting.valueRange.endLineNumber, setting.valueRange.endColumn - 1), content); model.pushEditOperations([], [editOperation], () => []); let lineNumber = setting.valueRange.endLineNumber + 1; diff --git a/src/vs/workbench/parts/quickopen/browser/commandsHandler.ts b/src/vs/workbench/parts/quickopen/browser/commandsHandler.ts index f5b2deb6951..dd3e07e162c 100644 --- a/src/vs/workbench/parts/quickopen/browser/commandsHandler.ts +++ b/src/vs/workbench/parts/quickopen/browser/commandsHandler.ts @@ -43,7 +43,7 @@ let commandHistory: BoundedMap; let commandCounter = 1; function resolveCommandHistory(configurationService: IConfigurationService): number { - const config = configurationService.getConfiguration(); + const config = configurationService.getValue(); let commandHistory = config.workbench && config.workbench.commandPalette && config.workbench.commandPalette.history; if (typeof commandHistory !== 'number') { @@ -135,7 +135,7 @@ export class ShowAllCommandsAction extends Action { } public run(context?: any): TPromise { - const config = this.configurationService.getConfiguration(); + const config = this.configurationService.getValue(); const restoreInput = config.workbench && config.workbench.commandPalette && config.workbench.commandPalette.preserveInput === true; // Show with last command palette input if any and configured diff --git a/src/vs/workbench/parts/relauncher/electron-browser/relauncher.contribution.ts b/src/vs/workbench/parts/relauncher/electron-browser/relauncher.contribution.ts index 9f0570fbc06..fe5c250d755 100644 --- a/src/vs/workbench/parts/relauncher/electron-browser/relauncher.contribution.ts +++ b/src/vs/workbench/parts/relauncher/electron-browser/relauncher.contribution.ts @@ -52,14 +52,14 @@ export class SettingsChangeRelauncher implements IWorkbenchContribution { this.firstFolderResource = workspace.folders.length > 0 ? workspace.folders[0].uri : void 0; this.extensionHostRestarter = new RunOnceScheduler(() => this.extensionService.restartExtensionHost(), 10); - this.onConfigurationChange(configurationService.getConfiguration(), false); + this.onConfigurationChange(configurationService.getValue(), false); this.handleWorkbenchState(); this.registerListeners(); } private registerListeners(): void { - this.toDispose.push(this.configurationService.onDidChangeConfiguration(e => this.onConfigurationChange(this.configurationService.getConfiguration(), true))); + this.toDispose.push(this.configurationService.onDidChangeConfiguration(e => this.onConfigurationChange(this.configurationService.getValue(), true))); this.toDispose.push(this.contextService.onDidChangeWorkbenchState(() => setTimeout(() => this.handleWorkbenchState()))); } diff --git a/src/vs/workbench/parts/search/browser/openAnythingHandler.ts b/src/vs/workbench/parts/search/browser/openAnythingHandler.ts index 7e9faa28fd4..02c4d96dbe4 100644 --- a/src/vs/workbench/parts/search/browser/openAnythingHandler.ts +++ b/src/vs/workbench/parts/search/browser/openAnythingHandler.ts @@ -142,13 +142,13 @@ export class OpenAnythingHandler extends QuickOpenHandler { this.openSymbolHandler = instantiationService.createInstance(OpenSymbolHandler); this.openFileHandler = instantiationService.createInstance(OpenFileHandler); - this.updateHandlers(this.configurationService.getConfiguration()); + this.updateHandlers(this.configurationService.getValue()); this.registerListeners(); } private registerListeners(): void { - this.configurationService.onDidChangeConfiguration(e => this.updateHandlers(this.configurationService.getConfiguration())); + this.configurationService.onDidChangeConfiguration(e => this.updateHandlers(this.configurationService.getValue())); } private updateHandlers(configuration: IWorkbenchSearchConfiguration): void { diff --git a/src/vs/workbench/parts/search/browser/openFileHandler.ts b/src/vs/workbench/parts/search/browser/openFileHandler.ts index 0c72fa5787d..4e2a3042199 100644 --- a/src/vs/workbench/parts/search/browser/openFileHandler.ts +++ b/src/vs/workbench/parts/search/browser/openFileHandler.ts @@ -96,7 +96,7 @@ export class FileEntry extends EditorQuickOpenEntry { const input: IResourceInput = { resource: this.resource, options: { - pinned: !this.configurationService.getConfiguration().workbench.editor.enablePreviewFromQuickOpen + pinned: !this.configurationService.getValue().workbench.editor.enablePreviewFromQuickOpen } }; diff --git a/src/vs/workbench/parts/search/browser/openSymbolHandler.ts b/src/vs/workbench/parts/search/browser/openSymbolHandler.ts index 24f7ec1e96e..5beb64bb53b 100644 --- a/src/vs/workbench/parts/search/browser/openSymbolHandler.ts +++ b/src/vs/workbench/parts/search/browser/openSymbolHandler.ts @@ -96,7 +96,7 @@ class SymbolEntry extends EditorQuickOpenEntry { let input: IResourceInput = { resource: this._bearing.location.uri, options: { - pinned: !this._configurationService.getConfiguration().workbench.editor.enablePreviewFromQuickOpen + pinned: !this._configurationService.getValue().workbench.editor.enablePreviewFromQuickOpen } }; diff --git a/src/vs/workbench/parts/search/browser/searchViewlet.ts b/src/vs/workbench/parts/search/browser/searchViewlet.ts index 329e99de9db..ab20d68c6c5 100644 --- a/src/vs/workbench/parts/search/browser/searchViewlet.ts +++ b/src/vs/workbench/parts/search/browser/searchViewlet.ts @@ -979,7 +979,7 @@ export class SearchViewlet extends Viewlet { isRegExp: isRegex, isCaseSensitive: isCaseSensitive, isWordMatch: isWholeWords, - wordSeparators: this.configurationService.getConfiguration().editor.wordSeparators + wordSeparators: this.configurationService.getValue().editor.wordSeparators }; const excludePattern = this.inputPatternExcludes.getValue(); diff --git a/src/vs/workbench/parts/search/common/queryBuilder.ts b/src/vs/workbench/parts/search/common/queryBuilder.ts index 14e85f7d108..5a31a2de651 100644 --- a/src/vs/workbench/parts/search/common/queryBuilder.ts +++ b/src/vs/workbench/parts/search/common/queryBuilder.ts @@ -57,16 +57,16 @@ export class QueryBuilder { // TODO@rob - see #37998 const useIgnoreFiles = !folderResources || folderResources.every(folder => { - const folderConfig = this.configurationService.getConfiguration({ resource: folder }); + const folderConfig = this.configurationService.getValue({ resource: folder }); return folderConfig.search.useIgnoreFiles; }); const useRipgrep = !folderResources || folderResources.every(folder => { - const folderConfig = this.configurationService.getConfiguration({ resource: folder }); + const folderConfig = this.configurationService.getValue({ resource: folder }); return folderConfig.search.useRipgrep; }); - const ignoreSymlinks = !this.configurationService.getConfiguration().search.followSymlinks; + const ignoreSymlinks = !this.configurationService.getValue().search.followSymlinks; const query = { type, @@ -253,7 +253,7 @@ export class QueryBuilder { private getFolderQueryForSearchPath(searchPath: ISearchPathPattern): IFolderQuery { const folder = searchPath.searchPath; - const folderConfig = this.configurationService.getConfiguration({ resource: folder }); + const folderConfig = this.configurationService.getValue({ resource: folder }); return { folder, includePattern: searchPath.pattern && patternListToIExpression([searchPath.pattern]), @@ -262,7 +262,7 @@ export class QueryBuilder { } private getFolderQueryForRoot(folder: uri, perFolderUseIgnoreFiles: boolean, options?: IQueryOptions): IFolderQuery { - const folderConfig = this.configurationService.getConfiguration({ resource: folder }); + const folderConfig = this.configurationService.getValue({ resource: folder }); return { folder, excludePattern: this.getExcludesForFolder(folderConfig, options), diff --git a/src/vs/workbench/parts/tasks/electron-browser/task.contribution.ts b/src/vs/workbench/parts/tasks/electron-browser/task.contribution.ts index 3b672f6b75b..d7951d1066c 100644 --- a/src/vs/workbench/parts/tasks/electron-browser/task.contribution.ts +++ b/src/vs/workbench/parts/tasks/electron-browser/task.contribution.ts @@ -1018,7 +1018,7 @@ class TaskService extends EventEmitter implements ITaskService { '\t// See https://go.microsoft.com/fwlink/?LinkId=733558', '\t// for the documentation about the tasks.json format', ].join('\n') + JSON.stringify(value, null, '\t').substr(1); - let editorConfig = this.configurationService.getConfiguration(); + let editorConfig = this.configurationService.getValue(); if (editorConfig.editor.insertSpaces) { content = content.replace(/(\n)(\t+)/g, (_, s1, s2) => s1 + strings.repeat(' ', s2.length * editorConfig.editor.tabSize)); } @@ -1601,7 +1601,7 @@ class TaskService extends EventEmitter implements ITaskService { private getConfiguration(workspaceFolder: IWorkspaceFolder): { config: TaskConfig.ExternalTaskRunnerConfiguration; hasParseErrors: boolean } { let result = this.contextService.getWorkbenchState() !== WorkbenchState.EMPTY - ? this.configurationService.getConfiguration('tasks', { resource: workspaceFolder.uri }) + ? this.configurationService.getValue('tasks', { resource: workspaceFolder.uri }) : undefined; if (!result) { return { config: undefined, hasParseErrors: false }; @@ -2140,7 +2140,7 @@ class TaskService extends EventEmitter implements ITaskService { return undefined; } let content = selection.content; - let editorConfig = this.configurationService.getConfiguration(); + let editorConfig = this.configurationService.getValue(); if (editorConfig.editor.insertSpaces) { content = content.replace(/(\n)(\t+)/g, (_, s1, s2) => s1 + strings.repeat(' ', s2.length * editorConfig.editor.tabSize)); } diff --git a/src/vs/workbench/parts/terminal/electron-browser/terminalConfigHelper.ts b/src/vs/workbench/parts/terminal/electron-browser/terminalConfigHelper.ts index 3724726111a..79171f0b066 100644 --- a/src/vs/workbench/parts/terminal/electron-browser/terminalConfigHelper.ts +++ b/src/vs/workbench/parts/terminal/electron-browser/terminalConfigHelper.ts @@ -49,7 +49,7 @@ export class TerminalConfigHelper implements ITerminalConfigHelper { } public get config(): ITerminalConfiguration { - return this._configurationService.getConfiguration().terminal.integrated; + return this._configurationService.getValue().terminal.integrated; } private _measureFont(fontFamily: string, fontSize: number, lineHeight: number): ITerminalFont { @@ -88,7 +88,7 @@ export class TerminalConfigHelper implements ITerminalConfigHelper { * terminal.integrated.fontSize, terminal.integrated.lineHeight configuration properties */ public getFont(excludeDimensions?: boolean): ITerminalFont { - const config = this._configurationService.getConfiguration(); + const config = this._configurationService.getValue(); const editorConfig = (config).editor; const terminalConfig = this.config; diff --git a/src/vs/workbench/parts/terminal/electron-browser/terminalLinkHandler.ts b/src/vs/workbench/parts/terminal/electron-browser/terminalLinkHandler.ts index 22634f79026..b34fb730079 100644 --- a/src/vs/workbench/parts/terminal/electron-browser/terminalLinkHandler.ts +++ b/src/vs/workbench/parts/terminal/electron-browser/terminalLinkHandler.ts @@ -167,7 +167,7 @@ export class TerminalLinkHandler { } private _isLinkActivationModifierDown(event: MouseEvent): boolean { - const editorConf = this._configurationService.getConfiguration<{ multiCursorModifier: 'ctrlCmd' | 'alt' }>('editor'); + const editorConf = this._configurationService.getValue<{ multiCursorModifier: 'ctrlCmd' | 'alt' }>('editor'); if (editorConf.multiCursorModifier === 'ctrlCmd') { return !!event.altKey; } @@ -175,7 +175,7 @@ export class TerminalLinkHandler { } private _getLinkHoverString(): string { - const editorConf = this._configurationService.getConfiguration<{ multiCursorModifier: 'ctrlCmd' | 'alt' }>('editor'); + const editorConf = this._configurationService.getValue<{ multiCursorModifier: 'ctrlCmd' | 'alt' }>('editor'); if (editorConf.multiCursorModifier === 'ctrlCmd') { return nls.localize('terminalLinkHandler.followLinkAlt', 'Alt + click to follow link'); } 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 8a4df80df44..7ef4320a57b 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 @@ -16,9 +16,8 @@ class MockConfigurationService implements IConfigurationService { public _serviceBrand: any; public serviceId = IConfigurationService; public constructor(private configuration: any = {}) { } - 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 inspect(key: string, overrides?: IConfigurationOverrides): any { return { value: getConfigurationValue(this.getValue(), key), default: getConfigurationValue(this.getValue(), key), user: getConfigurationValue(this.getValue(), 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(): any { return this.configuration; } public updateValue(): TPromise { return null; } public getConfigurationData(): any { return null; } diff --git a/src/vs/workbench/parts/welcome/walkThrough/electron-browser/walkThroughPart.ts b/src/vs/workbench/parts/welcome/walkThrough/electron-browser/walkThroughPart.ts index c71f25381d4..7f85830d76b 100644 --- a/src/vs/workbench/parts/welcome/walkThrough/electron-browser/walkThroughPart.ts +++ b/src/vs/workbench/parts/welcome/walkThrough/electron-browser/walkThroughPart.ts @@ -461,7 +461,7 @@ export class WalkThroughPart extends BaseEditor { } private getEditorOptions(language: string): IEditorOptions { - const config = this.configurationService.getConfiguration('editor', { overrideIdentifier: language }); + const config = this.configurationService.getValue('editor', { overrideIdentifier: language }); return { ...isObject(config) ? config : Object.create(null), scrollBeyondLastLine: false, diff --git a/src/vs/workbench/services/configuration/common/configurationModels.ts b/src/vs/workbench/services/configuration/common/configurationModels.ts index 0c4276fbff5..4fc01e3b258 100644 --- a/src/vs/workbench/services/configuration/common/configurationModels.ts +++ b/src/vs/workbench/services/configuration/common/configurationModels.ts @@ -144,10 +144,6 @@ export class Configuration extends BaseConfiguration { super(defaults, user, workspaceConfiguration, folders, memoryConfiguration, memoryConfigurationByResource); } - getSection(section: string = '', overrides: IConfigurationOverrides = {}): C { - return super.getSection(section, overrides, this._workspace); - } - getValue(key: string, overrides: IConfigurationOverrides = {}): any { return super.getValue(key, overrides, this._workspace); } diff --git a/src/vs/workbench/services/configuration/node/configurationService.ts b/src/vs/workbench/services/configuration/node/configurationService.ts index 18e5755ae13..453ae3aee46 100644 --- a/src/vs/workbench/services/configuration/node/configurationService.ts +++ b/src/vs/workbench/services/configuration/node/configurationService.ts @@ -225,16 +225,6 @@ export class WorkspaceService extends Disposable implements IWorkspaceConfigurat return this._configuration.toData(); } - getConfiguration(): T; - getConfiguration(section: string): T; - getConfiguration(overrides: IConfigurationOverrides): T; - getConfiguration(section: string, overrides: IConfigurationOverrides): T; - getConfiguration(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.getSection(section, overrides); - } - getValue(): T; getValue(section: string): T; getValue(overrides: IConfigurationOverrides): T; diff --git a/src/vs/workbench/services/configurationResolver/node/configurationResolverService.ts b/src/vs/workbench/services/configurationResolver/node/configurationResolverService.ts index 8bfa0b7f050..00070cfd969 100644 --- a/src/vs/workbench/services/configurationResolver/node/configurationResolverService.ts +++ b/src/vs/workbench/services/configurationResolver/node/configurationResolverService.ts @@ -171,7 +171,7 @@ export class ConfigurationResolverService implements IConfigurationResolverServi private resolveConfigVariable(root: IWorkspaceFolder, value: string, originalValue: string): string { const replacer = (match: string, name: string) => { - let config = this.configurationService.getConfiguration({ resource: root.uri }); + let config = this.configurationService.getValue({ resource: root.uri }); let newValue: any; try { const keys: string[] = name.split('.'); 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 59f8a418675..1187cd5a701 100644 --- a/src/vs/workbench/services/configurationResolver/test/node/configurationResolverService.test.ts +++ b/src/vs/workbench/services/configurationResolver/test/node/configurationResolverService.test.ts @@ -348,9 +348,8 @@ class MockConfigurationService implements IConfigurationService { public _serviceBrand: any; public serviceId = IConfigurationService; public constructor(private configuration: any = {}) { } - 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 inspect(key: string, overrides?: IConfigurationOverrides): any { return { value: getConfigurationValue(this.getValue(), key), default: getConfigurationValue(this.getValue(), key), user: getConfigurationValue(this.getValue(), key), workspaceFolder: void 0, folder: void 0 }; } public keys() { return { default: [], user: [], workspace: [], workspaceFolder: [] }; } - public getConfiguration(): any { return this.configuration; } public getValue(): any { return this.configuration; } public updateValue(): TPromise { return null; } public getConfigurationData(): any { return null; } diff --git a/src/vs/workbench/services/crashReporter/electron-browser/crashReporterService.ts b/src/vs/workbench/services/crashReporter/electron-browser/crashReporterService.ts index d04c2c33c50..c518b84f6b7 100644 --- a/src/vs/workbench/services/crashReporter/electron-browser/crashReporterService.ts +++ b/src/vs/workbench/services/crashReporter/electron-browser/crashReporterService.ts @@ -64,7 +64,7 @@ export class CrashReporterService implements ICrashReporterService { @IWindowsService private windowsService: IWindowsService, @IConfigurationService configurationService: IConfigurationService ) { - const config = configurationService.getConfiguration(TELEMETRY_SECTION_ID); + const config = configurationService.getValue(TELEMETRY_SECTION_ID); this.isEnabled = !!config.enableCrashReporter; if (this.isEnabled) { diff --git a/src/vs/workbench/services/files/electron-browser/fileService.ts b/src/vs/workbench/services/files/electron-browser/fileService.ts index 78dfae4e7d2..2c415f75930 100644 --- a/src/vs/workbench/services/files/electron-browser/fileService.ts +++ b/src/vs/workbench/services/files/electron-browser/fileService.ts @@ -57,7 +57,7 @@ export class FileService implements IFileService { this._onAfterOperation = new Emitter(); this.toUnbind.push(this._onAfterOperation); - const configuration = this.configurationService.getConfiguration(); + const configuration = this.configurationService.getValue(); let watcherIgnoredPatterns: string[] = []; if (configuration.files && configuration.files.watcherExclude) { diff --git a/src/vs/workbench/services/files/node/watcher/nsfw/watcherService.ts b/src/vs/workbench/services/files/node/watcher/nsfw/watcherService.ts index b8c93d184de..cde68eb3cc4 100644 --- a/src/vs/workbench/services/files/node/watcher/nsfw/watcherService.ts +++ b/src/vs/workbench/services/files/node/watcher/nsfw/watcherService.ts @@ -99,7 +99,7 @@ export class FileWatcher { this.service.setRoots(this.contextService.getWorkspace().folders.map(folder => { // Fetch the root's watcherExclude setting and return it - const configuration = this.configurationService.getConfiguration({ + const configuration = this.configurationService.getValue({ resource: folder.uri }); let ignored: string[] = []; diff --git a/src/vs/workbench/services/history/browser/history.ts b/src/vs/workbench/services/history/browser/history.ts index 680e22f777b..bfd0b35e94f 100644 --- a/src/vs/workbench/services/history/browser/history.ts +++ b/src/vs/workbench/services/history/browser/history.ts @@ -225,7 +225,7 @@ export class HistoryService extends BaseHistoryService implements IHistoryServic private getExcludes(root?: URI): IExpression { const scope = root ? { resource: root } : void 0; - return getExcludes(this.configurationService.getConfiguration(scope)); + return getExcludes(this.configurationService.getValue(scope)); } private registerListeners(): void { diff --git a/src/vs/workbench/services/keybinding/common/keybindingEditing.ts b/src/vs/workbench/services/keybinding/common/keybindingEditing.ts index c1876d709f1..2188daf311c 100644 --- a/src/vs/workbench/services/keybinding/common/keybindingEditing.ts +++ b/src/vs/workbench/services/keybinding/common/keybindingEditing.ts @@ -215,7 +215,7 @@ export class KeybindingsEditingService extends Disposable implements IKeybinding private resolveModelReference(): TPromise> { return this.fileService.existsFile(this.resource) .then(exists => { - const EOL = this.configurationService.getConfiguration('files', { overrideIdentifier: 'json' })['eol']; + const EOL = this.configurationService.getValue('files', { overrideIdentifier: 'json' })['eol']; const result = exists ? TPromise.as(null) : this.fileService.updateContent(this.resource, this.getEmptyContent(EOL), { encoding: 'utf8' }); return result.then(() => this.textModelResolverService.createModelReference(this.resource)); }); diff --git a/src/vs/workbench/services/keybinding/electron-browser/keybindingService.ts b/src/vs/workbench/services/keybinding/electron-browser/keybindingService.ts index 562e8972512..94a1322ea9a 100644 --- a/src/vs/workbench/services/keybinding/electron-browser/keybindingService.ts +++ b/src/vs/workbench/services/keybinding/electron-browser/keybindingService.ts @@ -243,7 +243,7 @@ export const enum DispatchConfig { } function getDispatchConfig(configurationService: IConfigurationService): DispatchConfig { - const keyboard = configurationService.getConfiguration('keyboard'); + const keyboard = configurationService.getValue('keyboard'); const r = (keyboard ? (keyboard).dispatch : null); return (r === 'keyCode' ? DispatchConfig.KeyCode : DispatchConfig.Code); } diff --git a/src/vs/workbench/services/mode/common/workbenchModeService.ts b/src/vs/workbench/services/mode/common/workbenchModeService.ts index 621e9a5f65e..26c5e935472 100644 --- a/src/vs/workbench/services/mode/common/workbenchModeService.ts +++ b/src/vs/workbench/services/mode/common/workbenchModeService.ts @@ -148,7 +148,7 @@ export class WorkbenchModeServiceImpl extends ModeServiceImpl { } private updateMime(): void { - const configuration = this._configurationService.getConfiguration(); + const configuration = this._configurationService.getValue(); // Clear user configured mime associations mime.clearTextMimes(true /* user configured */); diff --git a/src/vs/workbench/services/search/node/searchService.ts b/src/vs/workbench/services/search/node/searchService.ts index 54480e2b8a7..47460320970 100644 --- a/src/vs/workbench/services/search/node/searchService.ts +++ b/src/vs/workbench/services/search/node/searchService.ts @@ -54,7 +54,7 @@ export class SearchService implements ISearchService { } public extendQuery(query: ISearchQuery): void { - const configuration = this.configurationService.getConfiguration(); + const configuration = this.configurationService.getValue(); // Configuration: Encoding if (!query.fileEncoding) { diff --git a/src/vs/workbench/services/textfile/common/textFileService.ts b/src/vs/workbench/services/textfile/common/textFileService.ts index c185124e868..862246e60ea 100644 --- a/src/vs/workbench/services/textfile/common/textFileService.ts +++ b/src/vs/workbench/services/textfile/common/textFileService.ts @@ -82,7 +82,7 @@ export abstract class TextFileService implements ITextFileService { this._models = this.instantiationService.createInstance(TextFileEditorModelManager); - const configuration = this.configurationService.getConfiguration(); + const configuration = this.configurationService.getValue(); this.currentFilesAssociationConfig = configuration && configuration.files && configuration.files.associations; this.onFilesConfigurationChange(configuration); @@ -126,7 +126,7 @@ export abstract class TextFileService implements ITextFileService { // Files configuration changes this.toUnbind.push(this.configurationService.onDidChangeConfiguration(e => { if (e.affectsConfiguration('files')) { - this.onFilesConfigurationChange(this.configurationService.getConfiguration()); + this.onFilesConfigurationChange(this.configurationService.getValue()); } })); } diff --git a/src/vs/workbench/services/untitled/common/untitledEditorService.ts b/src/vs/workbench/services/untitled/common/untitledEditorService.ts index 0435be3546a..6806f656748 100644 --- a/src/vs/workbench/services/untitled/common/untitledEditorService.ts +++ b/src/vs/workbench/services/untitled/common/untitledEditorService.ts @@ -233,7 +233,7 @@ export class UntitledEditorService implements IUntitledEditorService { // Look up default language from settings if any if (!modeId && !hasAssociatedFilePath) { - const configuration = this.configurationService.getConfiguration(); + const configuration = this.configurationService.getValue(); if (configuration.files && configuration.files.defaultLanguage) { modeId = configuration.files.defaultLanguage; }