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

debt - less null

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