mirror of
https://github.com/Microsoft/vscode
synced 2024-08-28 05:19:39 +00:00
Revert "Removing more templated settings #125422"
This reverts commit 40b2219e39
.
This commit is contained in:
parent
40b2219e39
commit
4fe851b9a7
|
@ -360,7 +360,7 @@ export class NativeWindow extends Disposable {
|
|||
// or setting is disabled. Also enabled when running with --wait from the command line.
|
||||
const visibleEditorPanes = this.editorService.visibleEditorPanes;
|
||||
if (visibleEditorPanes.length === 0 && this.contextService.getWorkbenchState() === WorkbenchState.EMPTY && !this.environmentService.isExtensionDevelopment) {
|
||||
const closeWhenEmpty = this.configurationService.getValue('window.closeWhenEmpty');
|
||||
const closeWhenEmpty = this.configurationService.getValue<boolean>('window.closeWhenEmpty');
|
||||
if (closeWhenEmpty || this.environmentService.args.wait) {
|
||||
this.closeEmptyWindowScheduler.schedule();
|
||||
}
|
||||
|
|
|
@ -30,8 +30,8 @@ export class TextResourcePropertiesService implements ITextResourcePropertiesSer
|
|||
}
|
||||
|
||||
getEOL(resource?: URI, language?: string): string {
|
||||
const eol = this.configurationService.getValue('files.eol', { overrideIdentifier: language, resource });
|
||||
if (eol && typeof eol === 'string' && eol !== 'auto') {
|
||||
const eol = this.configurationService.getValue<string>('files.eol', { overrideIdentifier: language, resource });
|
||||
if (eol && eol !== 'auto') {
|
||||
return eol;
|
||||
}
|
||||
const os = this.getOS(resource);
|
||||
|
|
|
@ -380,10 +380,10 @@ export class WorkbenchThemeService implements IWorkbenchThemeService {
|
|||
}
|
||||
|
||||
private getPreferredColorScheme(): ColorScheme | undefined {
|
||||
if (this.configurationService.getValue(ThemeSettings.DETECT_HC) && this.hostColorService.highContrast) {
|
||||
if (this.configurationService.getValue<boolean>(ThemeSettings.DETECT_HC) && this.hostColorService.highContrast) {
|
||||
return ColorScheme.HIGH_CONTRAST;
|
||||
}
|
||||
if (this.configurationService.getValue(ThemeSettings.DETECT_COLOR_SCHEME)) {
|
||||
if (this.configurationService.getValue<boolean>(ThemeSettings.DETECT_COLOR_SCHEME)) {
|
||||
return this.hostColorService.dark ? ColorScheme.DARK : ColorScheme.LIGHT;
|
||||
}
|
||||
return undefined;
|
||||
|
@ -391,8 +391,8 @@ export class WorkbenchThemeService implements IWorkbenchThemeService {
|
|||
|
||||
private async applyPreferredColorTheme(type: ColorScheme): Promise<IWorkbenchColorTheme | null> {
|
||||
const settingId = type === ColorScheme.DARK ? ThemeSettings.PREFERRED_DARK_THEME : type === ColorScheme.LIGHT ? ThemeSettings.PREFERRED_LIGHT_THEME : ThemeSettings.PREFERRED_HC_THEME;
|
||||
const themeSettingId = this.configurationService.getValue(settingId);
|
||||
if (typeof themeSettingId === 'string' && themeSettingId) {
|
||||
const themeSettingId = this.configurationService.getValue<string>(settingId);
|
||||
if (themeSettingId) {
|
||||
const theme = this.colorThemeRegistry.findThemeBySettingsId(themeSettingId, undefined);
|
||||
if (theme) {
|
||||
const configurationTarget = this.settings.findAutoConfigurationTarget(settingId);
|
||||
|
|
|
@ -267,15 +267,15 @@ export class ThemeConfiguration {
|
|||
}
|
||||
|
||||
public get colorTheme(): string {
|
||||
return this.configurationService.getValue(ThemeSettings.COLOR_THEME);
|
||||
return this.configurationService.getValue<string>(ThemeSettings.COLOR_THEME);
|
||||
}
|
||||
|
||||
public get fileIconTheme(): string | null {
|
||||
return this.configurationService.getValue(ThemeSettings.FILE_ICON_THEME);
|
||||
return this.configurationService.getValue<string | null>(ThemeSettings.FILE_ICON_THEME);
|
||||
}
|
||||
|
||||
public get productIconTheme(): string {
|
||||
return this.configurationService.getValue(ThemeSettings.PRODUCT_ICON_THEME);
|
||||
return this.configurationService.getValue<string>(ThemeSettings.PRODUCT_ICON_THEME);
|
||||
}
|
||||
|
||||
public get colorCustomizations(): IColorCustomizations {
|
||||
|
|
|
@ -152,8 +152,8 @@ export class UntitledTextEditorModel extends BaseTextEditorModel implements IUnt
|
|||
private onConfigurationChange(fromEvent: boolean): void {
|
||||
|
||||
// Encoding
|
||||
const configuredEncoding = this.textResourceConfigurationService.getValue(this.resource, 'files.encoding');
|
||||
if (typeof configuredEncoding === 'string' && this.configuredEncoding !== configuredEncoding) {
|
||||
const configuredEncoding = this.textResourceConfigurationService.getValue<string>(this.resource, 'files.encoding');
|
||||
if (this.configuredEncoding !== configuredEncoding) {
|
||||
this.configuredEncoding = configuredEncoding;
|
||||
|
||||
if (fromEvent && !this.preferredEncoding) {
|
||||
|
@ -162,7 +162,7 @@ export class UntitledTextEditorModel extends BaseTextEditorModel implements IUnt
|
|||
}
|
||||
|
||||
// Label Format
|
||||
const configuredLabelFormat = this.textResourceConfigurationService.getValue(this.resource, 'workbench.editor.untitled.labelFormat');
|
||||
const configuredLabelFormat = this.textResourceConfigurationService.getValue<string>(this.resource, 'workbench.editor.untitled.labelFormat');
|
||||
if (this.configuredLabelFormat !== configuredLabelFormat && (configuredLabelFormat === 'content' || configuredLabelFormat === 'name')) {
|
||||
this.configuredLabelFormat = configuredLabelFormat;
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ class UserDataSyncUtilService implements IUserDataSyncUtilService {
|
|||
}
|
||||
return {
|
||||
eol: this.textResourcePropertiesService.getEOL(resource),
|
||||
insertSpaces: this.textResourceConfigurationService.getValue(resource, 'editor.insertSpaces'),
|
||||
insertSpaces: this.textResourceConfigurationService.getValue<boolean>(resource, 'editor.insertSpaces'),
|
||||
tabSize: this.textResourceConfigurationService.getValue(resource, 'editor.tabSize')
|
||||
};
|
||||
}
|
||||
|
|
|
@ -28,10 +28,7 @@ export class WorkingCopyFileOperationParticipant extends Disposable {
|
|||
}
|
||||
|
||||
async participate(files: SourceTargetPair[], operation: FileOperation, undoInfo: IFileOperationUndoRedoInfo | undefined, token: CancellationToken): Promise<void> {
|
||||
const timeout = this.configurationService.getValue('files.participants.timeout');
|
||||
if (typeof timeout !== 'number') {
|
||||
return; // Setting is bad
|
||||
}
|
||||
const timeout = this.configurationService.getValue<number>('files.participants.timeout');
|
||||
if (timeout <= 0) {
|
||||
return; // disabled
|
||||
}
|
||||
|
|
|
@ -80,8 +80,7 @@ export class WorkspaceTrustEnablementService extends Disposable implements IWork
|
|||
return false;
|
||||
}
|
||||
|
||||
const workspaceTrustEnabledSetting = this.configurationService.getValue(WORKSPACE_TRUST_ENABLED);
|
||||
return typeof workspaceTrustEnabledSetting === 'boolean' ? workspaceTrustEnabledSetting : false;
|
||||
return this.configurationService.getValue<boolean>(WORKSPACE_TRUST_ENABLED) ?? false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -309,8 +308,7 @@ export class WorkspaceTrustManagementService extends Disposable implements IWork
|
|||
}
|
||||
|
||||
// User setting
|
||||
const emptyWindowSetting = this.configurationService.getValue(WORKSPACE_TRUST_EMPTY_WINDOW);
|
||||
return typeof emptyWindowSetting === 'boolean' ? emptyWindowSetting : false;
|
||||
return this.configurationService.getValue<boolean>(WORKSPACE_TRUST_EMPTY_WINDOW) ?? false;
|
||||
}
|
||||
|
||||
return this.getUrisTrust(this.getWorkspaceUris());
|
||||
|
|
|
@ -34,8 +34,8 @@ export class TestTextResourcePropertiesService implements ITextResourcePropertie
|
|||
}
|
||||
|
||||
getEOL(resource: URI, language?: string): string {
|
||||
const eol = this.configurationService.getValue('files.eol', { overrideIdentifier: language, resource });
|
||||
if (eol && typeof eol === 'string' && eol !== 'auto') {
|
||||
const eol = this.configurationService.getValue<string>('files.eol', { overrideIdentifier: language, resource });
|
||||
if (eol && eol !== 'auto') {
|
||||
return eol;
|
||||
}
|
||||
return (isLinux || isMacintosh) ? '\n' : '\r\n';
|
||||
|
|
Loading…
Reference in a new issue