Skip to content

Commit aeb7669

Browse files
committed
Convert getLabel to return undefined instead of null
1 parent d3d842c commit aeb7669

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

src/vs/base/parts/quickopen/browser/quickOpenModel.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ let IDS = 0;
3636
export class QuickOpenItemAccessorClass implements IItemAccessor<QuickOpenEntry> {
3737

3838
getItemLabel(entry: QuickOpenEntry): string | null {
39-
return entry.getLabel();
39+
return types.withUndefinedAsNull(entry.getLabel());
4040
}
4141

4242
getItemDescription(entry: QuickOpenEntry): string | null {
@@ -75,8 +75,8 @@ export class QuickOpenEntry {
7575
/**
7676
* The label of the entry to identify it from others in the list
7777
*/
78-
getLabel(): string | null {
79-
return null;
78+
getLabel(): string | undefined {
79+
return undefined;
8080
}
8181

8282
/**
@@ -229,7 +229,7 @@ export class QuickOpenEntryGroup extends QuickOpenEntry {
229229
this.withBorder = showBorder;
230230
}
231231

232-
getLabel(): string | null {
232+
getLabel(): string | undefined {
233233
return this.entry ? this.entry.getLabel() : super.getLabel();
234234
}
235235

@@ -556,7 +556,7 @@ export class QuickOpenModel implements
556556
}
557557

558558
getLabel(entry: QuickOpenEntry): string | null {
559-
return entry.getLabel();
559+
return types.withUndefinedAsNull(entry.getLabel());
560560
}
561561

562562
getAriaLabel(entry: QuickOpenEntry): string {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export class EditorPickerEntry extends QuickOpenEntryGroup {
3939
}
4040

4141
getLabel() {
42-
return this.editor.getName();
42+
return withNullAsUndefined(this.editor.getName());
4343
}
4444

4545
getIcon(): string {

src/vs/workbench/browser/parts/quickopen/quickOpenController.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,7 @@ export class EditorHistoryEntryGroup extends QuickOpenEntryGroup {
724724
export class EditorHistoryEntry extends EditorQuickOpenEntry {
725725
private input: IEditorInput | IResourceInput;
726726
private resource: URI | undefined;
727-
private label: string | null;
727+
private label: string | undefined;
728728
private description?: string;
729729
private dirty: boolean;
730730

@@ -744,7 +744,7 @@ export class EditorHistoryEntry extends EditorQuickOpenEntry {
744744

745745
if (input instanceof EditorInput) {
746746
this.resource = resourceForEditorHistory(input, fileService);
747-
this.label = input.getName();
747+
this.label = types.withNullAsUndefined(input.getName());
748748
this.description = types.withNullAsUndefined(input.getDescription());
749749
this.dirty = input.isDirty();
750750
} else {
@@ -764,7 +764,7 @@ export class EditorHistoryEntry extends EditorQuickOpenEntry {
764764
return this.dirty ? 'dirty' : '';
765765
}
766766

767-
getLabel(): string | null {
767+
getLabel(): string | undefined {
768768
return this.label;
769769
}
770770

0 commit comments

Comments
 (0)