提交 37670732 编写于 作者: B Benjamin Pasero

debt - reduce usage of || undefined

上级 bba6ee1c
......@@ -285,7 +285,7 @@ export abstract class CompositePart<T extends Composite> extends Part {
if (this.activeComposite && this.activeComposite.getId() === compositeId) {
// Title
this.updateTitle(this.activeComposite.getId(), this.activeComposite.getTitle() || undefined);
this.updateTitle(this.activeComposite.getId(), this.activeComposite.getTitle());
// Actions
const actionsBinding = this.collectCompositeActions(this.activeComposite);
......
......@@ -425,7 +425,7 @@ export class OpenToSideFromQuickOpenAction extends Action {
const input = entry.getInput();
if (input) {
if (input instanceof EditorInput) {
return this.editorService.openEditor(input, entry.getOptions() || undefined, SIDE_GROUP);
return this.editorService.openEditor(input, entry.getOptions(), SIDE_GROUP);
}
const resourceInput = input as IResourceInput;
......
......@@ -659,7 +659,7 @@ export class EditorStatus extends Disposable implements IWorkbenchContribution {
const textModel = editorWidget.getModel();
if (textModel) {
const modeId = textModel.getLanguageIdentifier().language;
info = { mode: this.modeService.getLanguageName(modeId) || undefined };
info = { mode: withNullAsUndefined(this.modeService.getLanguageName(modeId)) };
}
}
......@@ -832,7 +832,7 @@ function isWritableCodeEditor(codeEditor: ICodeEditor | undefined): boolean {
}
function isWritableBaseEditor(e: IBaseEditor): boolean {
return e && isWritableCodeEditor(getCodeEditor(e.getControl()) || undefined);
return e && isWritableCodeEditor(withNullAsUndefined(getCodeEditor(e.getControl())));
}
export class ShowLanguageExtensionsAction extends Action {
......@@ -893,7 +893,7 @@ export class ChangeModeAction extends Action {
let modeId: string | undefined;
if (textModel) {
modeId = textModel.getLanguageIdentifier().language;
currentModeId = this.modeService.getLanguageName(modeId) || undefined;
currentModeId = withNullAsUndefined(this.modeService.getLanguageName(modeId));
}
// All languages are valid picks
......
......@@ -265,7 +265,7 @@ export class NoTabsTitleControl extends TitleControl {
title = ''; // dont repeat what is already shown
}
editorLabel.setResource({ name, description, resource: resource || undefined }, { title: typeof title === 'string' ? title : undefined, italic: !isEditorPinned, extraClasses: ['no-tabs', 'title-label'] });
editorLabel.setResource({ name, description, resource }, { title: typeof title === 'string' ? title : undefined, italic: !isEditorPinned, extraClasses: ['no-tabs', 'title-label'] });
if (isGroupActive) {
editorLabel.element.style.color = this.getColor(TAB_ACTIVE_FOREGROUND);
} else {
......
......@@ -42,7 +42,7 @@ import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { UNTITLED_WORKSPACE_NAME } from 'vs/platform/workspaces/common/workspaces';
import { withUndefinedAsNull } from 'vs/base/common/types';
import { withUndefinedAsNull, withNullAsUndefined } from 'vs/base/common/types';
// Commands
......@@ -138,12 +138,12 @@ async function doSaveAs(
editorGroupService: IEditorGroupsService,
environmentService: IWorkbenchEnvironmentService
): Promise<boolean> {
let viewStateOfSource: IEditorViewState | null = null;
let viewStateOfSource: IEditorViewState | undefined = undefined;
const activeTextEditorWidget = getCodeEditor(editorService.activeTextEditorWidget);
if (activeTextEditorWidget) {
const activeResource = toResource(editorService.activeEditor, { supportSideBySide: SideBySideEditor.MASTER });
if (activeResource && (fileService.canHandleResource(activeResource) || resource.scheme === Schemas.untitled) && isEqual(activeResource, resource)) {
viewStateOfSource = activeTextEditorWidget.saveViewState();
viewStateOfSource = withNullAsUndefined(activeTextEditorWidget.saveViewState());
}
}
......@@ -174,7 +174,7 @@ async function doSaveAs(
resource: target,
options: {
pinned: true,
viewState: viewStateOfSource || undefined
viewState: viewStateOfSource
}
};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册