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

debt - less null

上级 a4be32a8
......@@ -283,7 +283,7 @@ interface ISegment {
* @param value string to which templating is applied
* @param values the values of the templates to use
*/
export function template(template: string, values: { [key: string]: string | ISeparator | null } = Object.create(null)): string {
export function template(template: string, values: { [key: string]: string | ISeparator | undefined | null } = Object.create(null)): string {
const segments: ISegment[] = [];
let inVariable = false;
......
......@@ -84,8 +84,8 @@ export abstract class Composite extends Component implements IComposite {
this.visible = false;
}
getTitle(): string | null {
return null;
getTitle(): string | undefined {
return undefined;
}
protected get telemetryService(): ITelemetryService {
......
......@@ -32,7 +32,6 @@ import { attachProgressBarStyler } from 'vs/platform/theme/common/styler';
import { INotificationService } from 'vs/platform/notification/common/notification';
import { Dimension, append, $, addClass, hide, show, addClasses } from 'vs/base/browser/dom';
import { AnchorAlignment } from 'vs/base/browser/ui/contextview/contextview';
import { withNullAsUndefined } from 'vs/base/common/types';
export interface ICompositeTitleLabel {
......@@ -240,7 +239,7 @@ export abstract class CompositePart<T extends Composite> extends Part {
// Update title with composite title if it differs from descriptor
const descriptor = this.registry.getComposite(composite.getId());
if (descriptor && descriptor.name !== composite.getTitle()) {
this.updateTitle(composite.getId(), withNullAsUndefined(composite.getTitle()));
this.updateTitle(composite.getId(), composite.getTitle());
}
// Handle Composite Actions
......
......@@ -61,7 +61,7 @@ export class TextDiffEditor extends BaseTextEditor implements ITextDiffEditor {
return new EditorMemento(this.getId(), key, Object.create(null), limit, editorGroupService); // do not persist in storage as diff editors are never persisted
}
getTitle(): string | null {
getTitle(): string | undefined {
if (this.input) {
return this.input.getName();
}
......
......@@ -46,7 +46,7 @@ export class AbstractTextResourceEditor extends BaseTextEditor {
super(id, telemetryService, instantiationService, storageService, configurationService, themeService, textFileService, editorService, editorGroupService, windowService);
}
getTitle(): string | null {
getTitle(): string | undefined {
if (this.input) {
return this.input.getName();
}
......
......@@ -274,7 +274,7 @@ export abstract class TitleControl extends Themable {
label = localize('draggedEditorGroup', "{0} (+{1})", label, this.group.count - 1);
}
applyDragImage(e, label, 'monaco-editor-group-drag-image');
applyDragImage(e, withUndefinedAsNull(label), 'monaco-editor-group-drag-image');
}
}));
......
......@@ -15,7 +15,7 @@ export interface IComposite {
/**
* Returns the name of this composite to show in the title area.
*/
getTitle(): string | null;
getTitle(): string | undefined;
/**
* Returns the primary actions of the composite.
......
......@@ -292,7 +292,7 @@ export interface IEditorInput extends IDisposable {
/**
* Returns the display name of this input.
*/
getName(): string | null;
getName(): string | undefined;
/**
* Returns the display description of this input.
......@@ -302,7 +302,7 @@ export interface IEditorInput extends IDisposable {
/**
* Returns the display title of this input.
*/
getTitle(verbosity?: Verbosity): string | null;
getTitle(verbosity?: Verbosity): string | undefined;
/**
* Resolves the input.
......@@ -358,8 +358,8 @@ export abstract class EditorInput extends Disposable implements IEditorInput {
* Returns the name of this input that can be shown to the user. Examples include showing the name of the input
* above the editor area when the input is shown.
*/
getName(): string | null {
return null;
getName(): string | undefined {
return undefined;
}
/**
......@@ -374,7 +374,7 @@ export abstract class EditorInput extends Disposable implements IEditorInput {
* Returns the title of this input that can be shown to the user. Examples include showing the title of
* the input above the editor area as hover over the input label.
*/
getTitle(verbosity?: Verbosity): string | null {
getTitle(verbosity?: Verbosity): string | undefined {
return this.getName();
}
......
......@@ -8,7 +8,6 @@ import { URI } from 'vs/base/common/uri';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { BinaryEditorModel } from 'vs/workbench/common/editor/binaryEditorModel';
import { DataUri } from 'vs/base/common/resources';
import { withUndefinedAsNull } from 'vs/base/common/types';
/**
* An editor input to present data URIs in a binary editor. Data URIs have the form of:
......@@ -51,8 +50,8 @@ export class DataUriEditorInput extends EditorInput {
return DataUriEditorInput.ID;
}
getName(): string | null {
return withUndefinedAsNull(this.name);
getName(): string | undefined {
return this.name;
}
getDescription(): string | undefined {
......
......@@ -107,7 +107,7 @@ export class UntitledEditorInput extends EditorInput implements IEncodingSupport
return this.labelService.getUriLabel(this.resource);
}
getTitle(verbosity: Verbosity): string | null {
getTitle(verbosity: Verbosity): string | undefined {
if (!this.hasAssociatedFilePath) {
return this.getName();
}
......@@ -121,7 +121,7 @@ export class UntitledEditorInput extends EditorInput implements IEncodingSupport
return this.longTitle;
}
return null;
return undefined;
}
isDirty(): boolean {
......
......@@ -57,7 +57,7 @@ export class BinaryFileEditor extends BaseBinaryResourceEditor {
}
}
getTitle(): string | null {
getTitle(): string | undefined {
return this.input ? this.input.getName() : nls.localize('binaryFileEditor', "Binary File Viewer");
}
}
......@@ -635,10 +635,10 @@ export class EditorService extends Disposable implements EditorServiceImpl {
return input;
}
private toDiffLabel(input: EditorInput): string | null {
private toDiffLabel(input: EditorInput): string | undefined {
const res = input.getResource();
if (!res) {
return null;
return undefined;
}
// Do not try to extract any paths from simple untitled editors
......
......@@ -21,7 +21,7 @@ export class PreferencesEditorInput extends SideBySideEditorInput {
return PreferencesEditorInput.ID;
}
getTitle(verbosity: Verbosity): string | null {
getTitle(verbosity: Verbosity): string | undefined {
return this.master.getTitle(verbosity);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册