Skip to content

Commit c2bf8a1

Browse files
committed
Rename getConfiguraiton to getValue
1 parent 6f03367 commit c2bf8a1

73 files changed

Lines changed: 144 additions & 202 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/vs/code/electron-main/window.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ export class CodeWindow implements ICodeWindow {
161161
options.icon = path.join(this.environmentService.appRoot, 'resources/linux/code.png'); // Windows and Mac are better off using the embedded icon(s)
162162
}
163163

164-
const windowConfig = this.configurationService.getConfiguration<IWindowSettings>('window');
164+
const windowConfig = this.configurationService.getValue<IWindowSettings>('window');
165165

166166
let useNativeTabs = false;
167167
if (windowConfig && windowConfig.nativeTabs) {
@@ -451,7 +451,7 @@ export class CodeWindow implements ICodeWindow {
451451

452452
// Swipe command support (macOS)
453453
if (isMacintosh) {
454-
const config = this.configurationService.getConfiguration<IWorkbenchEditorConfiguration>();
454+
const config = this.configurationService.getValue<IWorkbenchEditorConfiguration>();
455455
if (config && config.workbench && config.workbench.editor && config.workbench.editor.swipeToNavigate) {
456456
this.registerNavigationListenerOn('swipe', 'left', 'right', true);
457457
} else {
@@ -562,7 +562,7 @@ export class CodeWindow implements ICodeWindow {
562562
private getUrl(windowConfiguration: IWindowConfiguration): string {
563563

564564
// Set zoomlevel
565-
const windowConfig = this.configurationService.getConfiguration<IWindowSettings>('window');
565+
const windowConfig = this.configurationService.getValue<IWindowSettings>('window');
566566
const zoomLevel = windowConfig && windowConfig.zoomLevel;
567567
if (typeof zoomLevel === 'number') {
568568
windowConfiguration.zoomLevel = zoomLevel;
@@ -796,7 +796,7 @@ export class CodeWindow implements ICodeWindow {
796796
}
797797

798798
private getMenuBarVisibility(): MenuBarVisibility {
799-
const windowConfig = this.configurationService.getConfiguration<IWindowSettings>('window');
799+
const windowConfig = this.configurationService.getValue<IWindowSettings>('window');
800800
if (!windowConfig || !windowConfig.menuBarVisibility) {
801801
return 'default';
802802
}

src/vs/code/electron-main/windows.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -934,7 +934,7 @@ export class WindowsManager implements IWindowsMainService {
934934
if (this.lifecycleService.wasRestarted) {
935935
restoreWindows = 'all'; // always reopen all windows when an update was applied
936936
} else {
937-
const windowConfig = this.configurationService.getConfiguration<IWindowSettings>('window');
937+
const windowConfig = this.configurationService.getValue<IWindowSettings>('window');
938938
restoreWindows = ((windowConfig && windowConfig.restoreWindows) || 'one') as RestoreWindowsSetting;
939939

940940
if (restoreWindows === 'one' /* default */ && windowConfig && windowConfig.reopenFolders) {
@@ -1003,7 +1003,7 @@ export class WindowsManager implements IWindowsMainService {
10031003
private shouldOpenNewWindow(openConfig: IOpenConfiguration): { openFolderInNewWindow: boolean; openFilesInNewWindow: boolean; } {
10041004

10051005
// let the user settings override how folders are open in a new window or same window unless we are forced
1006-
const windowConfig = this.configurationService.getConfiguration<IWindowSettings>('window');
1006+
const windowConfig = this.configurationService.getValue<IWindowSettings>('window');
10071007
const openFolderInNewWindowConfig = (windowConfig && windowConfig.openFoldersInNewWindow) || 'default' /* default */;
10081008
const openFilesInNewWindowConfig = (windowConfig && windowConfig.openFilesInNewWindow) || 'off' /* default */;
10091009

@@ -1094,7 +1094,7 @@ export class WindowsManager implements IWindowsMainService {
10941094

10951095
// New window
10961096
if (!window) {
1097-
const windowConfig = this.configurationService.getConfiguration<IWindowSettings>('window');
1097+
const windowConfig = this.configurationService.getValue<IWindowSettings>('window');
10981098
const state = this.getNewWindowState(configuration);
10991099

11001100
// 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 {
12571257
state.y = displayToUse.bounds.y + (displayToUse.bounds.height / 2) - (state.height / 2);
12581258

12591259
// Check for newWindowDimensions setting and adjust accordingly
1260-
const windowConfig = this.configurationService.getConfiguration<IWindowSettings>('window');
1260+
const windowConfig = this.configurationService.getValue<IWindowSettings>('window');
12611261
let ensureNoOverlap = true;
12621262
if (windowConfig && windowConfig.newWindowDimensions) {
12631263
if (windowConfig.newWindowDimensions === 'maximized') {

src/vs/editor/common/services/modelServiceImpl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ export class ModelServiceImpl implements IModelService {
272272
public getCreationOptions(language: string, resource: URI): editorCommon.ITextModelCreationOptions {
273273
let creationOptions = this._modelCreationOptionsByLanguageAndResource[language + resource];
274274
if (!creationOptions) {
275-
creationOptions = ModelServiceImpl._readModelOptions(this._configurationService.getConfiguration({ overrideIdentifier: language, resource }));
275+
creationOptions = ModelServiceImpl._readModelOptions(this._configurationService.getValue({ overrideIdentifier: language, resource }));
276276
this._modelCreationOptionsByLanguageAndResource[language + resource] = creationOptions;
277277
}
278278
return creationOptions;

src/vs/editor/contrib/colorPicker/colorDetector.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export class ColorDetector implements IEditorContribution {
7373
}
7474
const languageId = model.getLanguageIdentifier();
7575
// handle deprecated settings. [languageId].colorDecorators.enable
76-
let deprecatedConfig = this._configurationService.getConfiguration(languageId.language);
76+
let deprecatedConfig = this._configurationService.getValue(languageId.language);
7777
if (deprecatedConfig) {
7878
let colorDecorators = deprecatedConfig['colorDecorators']; // deprecatedConfig.valueOf('.colorDecorators.enable');
7979
if (colorDecorators && colorDecorators['enable'] !== undefined && !colorDecorators['enable']) {

src/vs/editor/standalone/browser/simpleServices.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -458,16 +458,6 @@ export class SimpleConfigurationService implements IConfigurationService {
458458
return this._configuration;
459459
}
460460

461-
getConfiguration<T>(): T;
462-
getConfiguration<T>(section: string): T;
463-
getConfiguration<T>(overrides: IConfigurationOverrides): T;
464-
getConfiguration<T>(section: string, overrides: IConfigurationOverrides): T;
465-
getConfiguration(arg1?: any, arg2?: any): any {
466-
const section = typeof arg1 === 'string' ? arg1 : void 0;
467-
const overrides = isConfigurationOverrides(arg1) ? arg1 : isConfigurationOverrides(arg2) ? arg2 : {};
468-
return this.configuration().getSection(section, overrides, null);
469-
}
470-
471461
getValue<T>(): T;
472462
getValue<T>(section: string): T;
473463
getValue<T>(overrides: IConfigurationOverrides): T;

src/vs/platform/backup/electron-main/backupMainService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export class BackupMainService implements IBackupMainService {
6565
}
6666

6767
private getHotExitConfig(): string {
68-
const config = this.configurationService.getConfiguration<IFilesConfiguration>();
68+
const config = this.configurationService.getValue<IFilesConfiguration>();
6969

7070
return (config && config.files && config.files.hotExit) || HotExitConfiguration.ON_EXIT;
7171
}

src/vs/platform/configuration/common/configuration.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,6 @@ export interface IConfigurationService {
5757

5858
getConfigurationData(): IConfigurationData;
5959

60-
getConfiguration<T>(): T;
61-
getConfiguration<T>(section: string): T;
62-
getConfiguration<T>(overrides: IConfigurationOverrides): T;
63-
getConfiguration<T>(section: string, overrides: IConfigurationOverrides): T;
64-
6560
/**
6661
* Fetches the value of the section for the given overrides.
6762
* Value can be of native type or an object keyed off the section name.

src/vs/platform/configuration/common/configurationModels.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ export class ConfigurationModel implements IConfigurationModel {
3737
return this.checkAndFreeze(this._keys);
3838
}
3939

40-
getSectionContents<V>(section: string): V {
41-
return this.contents[section];
40+
getValue<V>(section: string): V {
41+
return section ? getConfigurationValue<any>(this.contents, section) : this.contents;
4242
}
4343

4444
override(identifier: string): ConfigurationModel {
@@ -298,14 +298,9 @@ export class Configuration {
298298
private _memoryConfigurationByResource: StrictResourceMap<ConfigurationModel> = new StrictResourceMap<ConfigurationModel>()) {
299299
}
300300

301-
getSection<C>(section: string = '', overrides: IConfigurationOverrides, workspace: Workspace): C {
302-
const configModel = this.getConsolidateConfigurationModel(overrides, workspace);
303-
return section ? configModel.getSectionContents<C>(section) : configModel.contents;
304-
}
305-
306301
getValue(section: string, overrides: IConfigurationOverrides, workspace: Workspace): any {
307302
const consolidateConfigurationModel = this.getConsolidateConfigurationModel(overrides, workspace);
308-
return section ? getConfigurationValue<any>(consolidateConfigurationModel.contents, section) : consolidateConfigurationModel.contents;
303+
return consolidateConfigurationModel.getValue(section);
309304
}
310305

311306
updateValue(key: string, value: any, overrides: IConfigurationOverrides = {}): void {

src/vs/platform/configuration/node/configurationService.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,6 @@ export class ConfigurationService extends Disposable implements IConfigurationSe
4848
return this.configuration.toData();
4949
}
5050

51-
getConfiguration<T>(): T;
52-
getConfiguration<T>(section: string): T;
53-
getConfiguration<T>(overrides: IConfigurationOverrides): T;
54-
getConfiguration<T>(section: string, overrides: IConfigurationOverrides): T;
55-
getConfiguration(arg1?: any, arg2?: any): any {
56-
const section = typeof arg1 === 'string' ? arg1 : void 0;
57-
const overrides = isConfigurationOverrides(arg1) ? arg1 : isConfigurationOverrides(arg2) ? arg2 : {};
58-
return this.configuration.getSection(section, overrides, null);
59-
}
60-
6151
getValue<T>(): T;
6252
getValue<T>(section: string): T;
6353
getValue<T>(overrides: IConfigurationOverrides): T;

src/vs/platform/configuration/test/common/configurationModels.test.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ suite('ConfigurationModel', () => {
211211
let result = base.merge(add);
212212

213213
assert.deepEqual(result.contents, { 'a': { 'b': 2 } });
214-
assert.deepEqual(result.getSectionContents('a'), { 'b': 2 });
214+
assert.deepEqual(result.getValue('a'), { 'b': 2 });
215215
assert.deepEqual(result.keys, ['a.b']);
216216
});
217217

@@ -239,16 +239,16 @@ suite('ConfigurationModel', () => {
239239

240240
test('Test contents while getting an existing property', () => {
241241
let testObject = new ConfigurationModel({ 'a': 1 });
242-
assert.deepEqual(testObject.getSectionContents('a'), 1);
242+
assert.deepEqual(testObject.getValue('a'), 1);
243243

244244
testObject = new ConfigurationModel({ 'a': { 'b': 1 } });
245-
assert.deepEqual(testObject.getSectionContents('a'), { 'b': 1 });
245+
assert.deepEqual(testObject.getValue('a'), { 'b': 1 });
246246
});
247247

248248
test('Test contents are undefined for non existing properties', () => {
249249
const testObject = new ConfigurationModel({ awesome: true });
250250

251-
assert.deepEqual(testObject.getSectionContents('unknownproperty'), undefined);
251+
assert.deepEqual(testObject.getValue('unknownproperty'), undefined);
252252
});
253253

254254
test('Test override gives all content merged with overrides', () => {
@@ -319,10 +319,10 @@ suite('CustomConfigurationModel', () => {
319319
test('Test contents while getting an existing property', () => {
320320
let testObject = new ConfigurationModelParser('test');
321321
testObject.parse(JSON.stringify({ 'a': 1 }));
322-
assert.deepEqual(testObject.configurationModel.getSectionContents('a'), 1);
322+
assert.deepEqual(testObject.configurationModel.getValue('a'), 1);
323323

324324
testObject.parse(JSON.stringify({ 'a': { 'b': 1 } }));
325-
assert.deepEqual(testObject.configurationModel.getSectionContents('a'), { 'b': 1 });
325+
assert.deepEqual(testObject.configurationModel.getValue('a'), { 'b': 1 });
326326
});
327327

328328
test('Test contents are undefined for non existing properties', () => {
@@ -331,13 +331,13 @@ suite('CustomConfigurationModel', () => {
331331
awesome: true
332332
}));
333333

334-
assert.deepEqual(testObject.configurationModel.getSectionContents('unknownproperty'), undefined);
334+
assert.deepEqual(testObject.configurationModel.getValue('unknownproperty'), undefined);
335335
});
336336

337337
test('Test contents are undefined for undefined config', () => {
338338
const testObject = new ConfigurationModelParser('test');
339339

340-
assert.deepEqual(testObject.configurationModel.getSectionContents('unknownproperty'), undefined);
340+
assert.deepEqual(testObject.configurationModel.getValue('unknownproperty'), undefined);
341341
});
342342

343343
test('Test configWithOverrides gives all content merged with overrides', () => {
@@ -385,7 +385,7 @@ suite('CustomConfigurationModel', () => {
385385
}
386386
}
387387
});
388-
assert.equal(true, new DefaultConfigurationModel().getSectionContents('a'));
388+
assert.equal(true, new DefaultConfigurationModel().getValue('a'));
389389
});
390390

391391
test('Test registering the language property', () => {
@@ -402,7 +402,7 @@ suite('CustomConfigurationModel', () => {
402402
}
403403
}
404404
});
405-
assert.equal(undefined, new DefaultConfigurationModel().getSectionContents('[a]'));
405+
assert.equal(undefined, new DefaultConfigurationModel().getValue('[a]'));
406406
});
407407

408408
});

0 commit comments

Comments
 (0)