Skip to content

Commit ced1335

Browse files
author
Benjamin Pasero
committed
debt - less null
1 parent a4be32a commit ced1335

14 files changed

Lines changed: 22 additions & 24 deletions

File tree

src/vs/base/browser/dnd.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,4 +111,4 @@ export interface IStaticDND {
111111

112112
export const StaticDND: IStaticDND = {
113113
CurrentDragAndDropData: undefined
114-
};
114+
};

src/vs/base/common/labels.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ interface ISegment {
283283
* @param value string to which templating is applied
284284
* @param values the values of the templates to use
285285
*/
286-
export function template(template: string, values: { [key: string]: string | ISeparator | null } = Object.create(null)): string {
286+
export function template(template: string, values: { [key: string]: string | ISeparator | undefined | null } = Object.create(null)): string {
287287
const segments: ISegment[] = [];
288288

289289
let inVariable = false;

src/vs/workbench/browser/composite.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ export abstract class Composite extends Component implements IComposite {
8484
this.visible = false;
8585
}
8686

87-
getTitle(): string | null {
88-
return null;
87+
getTitle(): string | undefined {
88+
return undefined;
8989
}
9090

9191
protected get telemetryService(): ITelemetryService {

src/vs/workbench/browser/parts/compositePart.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ import { attachProgressBarStyler } from 'vs/platform/theme/common/styler';
3232
import { INotificationService } from 'vs/platform/notification/common/notification';
3333
import { Dimension, append, $, addClass, hide, show, addClasses } from 'vs/base/browser/dom';
3434
import { AnchorAlignment } from 'vs/base/browser/ui/contextview/contextview';
35-
import { withNullAsUndefined } from 'vs/base/common/types';
3635

3736
export interface ICompositeTitleLabel {
3837

@@ -240,7 +239,7 @@ export abstract class CompositePart<T extends Composite> extends Part {
240239
// Update title with composite title if it differs from descriptor
241240
const descriptor = this.registry.getComposite(composite.getId());
242241
if (descriptor && descriptor.name !== composite.getTitle()) {
243-
this.updateTitle(composite.getId(), withNullAsUndefined(composite.getTitle()));
242+
this.updateTitle(composite.getId(), composite.getTitle());
244243
}
245244

246245
// Handle Composite Actions

src/vs/workbench/browser/parts/editor/textDiffEditor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export class TextDiffEditor extends BaseTextEditor implements ITextDiffEditor {
6161
return new EditorMemento(this.getId(), key, Object.create(null), limit, editorGroupService); // do not persist in storage as diff editors are never persisted
6262
}
6363

64-
getTitle(): string | null {
64+
getTitle(): string | undefined {
6565
if (this.input) {
6666
return this.input.getName();
6767
}

src/vs/workbench/browser/parts/editor/textResourceEditor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export class AbstractTextResourceEditor extends BaseTextEditor {
4646
super(id, telemetryService, instantiationService, storageService, configurationService, themeService, textFileService, editorService, editorGroupService, windowService);
4747
}
4848

49-
getTitle(): string | null {
49+
getTitle(): string | undefined {
5050
if (this.input) {
5151
return this.input.getName();
5252
}

src/vs/workbench/browser/parts/editor/titleControl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ export abstract class TitleControl extends Themable {
274274
label = localize('draggedEditorGroup', "{0} (+{1})", label, this.group.count - 1);
275275
}
276276

277-
applyDragImage(e, label, 'monaco-editor-group-drag-image');
277+
applyDragImage(e, withUndefinedAsNull(label), 'monaco-editor-group-drag-image');
278278
}
279279
}));
280280

src/vs/workbench/common/composite.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export interface IComposite {
1515
/**
1616
* Returns the name of this composite to show in the title area.
1717
*/
18-
getTitle(): string | null;
18+
getTitle(): string | undefined;
1919

2020
/**
2121
* Returns the primary actions of the composite.

src/vs/workbench/common/editor.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ export interface IEditorInput extends IDisposable {
292292
/**
293293
* Returns the display name of this input.
294294
*/
295-
getName(): string | null;
295+
getName(): string | undefined;
296296

297297
/**
298298
* Returns the display description of this input.
@@ -302,7 +302,7 @@ export interface IEditorInput extends IDisposable {
302302
/**
303303
* Returns the display title of this input.
304304
*/
305-
getTitle(verbosity?: Verbosity): string | null;
305+
getTitle(verbosity?: Verbosity): string | undefined;
306306

307307
/**
308308
* Resolves the input.
@@ -358,8 +358,8 @@ export abstract class EditorInput extends Disposable implements IEditorInput {
358358
* Returns the name of this input that can be shown to the user. Examples include showing the name of the input
359359
* above the editor area when the input is shown.
360360
*/
361-
getName(): string | null {
362-
return null;
361+
getName(): string | undefined {
362+
return undefined;
363363
}
364364

365365
/**
@@ -374,7 +374,7 @@ export abstract class EditorInput extends Disposable implements IEditorInput {
374374
* Returns the title of this input that can be shown to the user. Examples include showing the title of
375375
* the input above the editor area as hover over the input label.
376376
*/
377-
getTitle(verbosity?: Verbosity): string | null {
377+
getTitle(verbosity?: Verbosity): string | undefined {
378378
return this.getName();
379379
}
380380

src/vs/workbench/common/editor/dataUriEditorInput.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { URI } from 'vs/base/common/uri';
88
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
99
import { BinaryEditorModel } from 'vs/workbench/common/editor/binaryEditorModel';
1010
import { DataUri } from 'vs/base/common/resources';
11-
import { withUndefinedAsNull } from 'vs/base/common/types';
1211

1312
/**
1413
* 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 {
5150
return DataUriEditorInput.ID;
5251
}
5352

54-
getName(): string | null {
55-
return withUndefinedAsNull(this.name);
53+
getName(): string | undefined {
54+
return this.name;
5655
}
5756

5857
getDescription(): string | undefined {

0 commit comments

Comments
 (0)