Make getResource return undefined

This commit is contained in:
Matt Bierner
2019-05-14 11:40:47 -07:00
parent 2b28a35028
commit bfc7b7f55a
3 changed files with 9 additions and 8 deletions
@@ -140,8 +140,8 @@ export class QuickOpenEntry {
* A resource for this entry. Resource URIs can be used to compare different kinds of entries and group
* them together.
*/
getResource(): URI | null {
return null;
getResource(): URI | undefined {
return undefined;
}
/**
@@ -245,7 +245,7 @@ export class QuickOpenEntryGroup extends QuickOpenEntry {
return this.entry ? this.entry.getDetail() : super.getDetail();
}
getResource(): URI | null {
getResource(): URI | undefined {
return this.entry ? this.entry.getResource() : super.getResource();
}
@@ -18,6 +18,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import { EditorInput, toResource, SideBySideEditor } from 'vs/workbench/common/editor';
import { compareItemsByScore, scoreItem, ScorerCache, prepareQuery } from 'vs/base/parts/quickopen/common/quickOpenScorer';
import { CancellationToken } from 'vs/base/common/cancellation';
import { withNullAsUndefined } from 'vs/base/common/types';
export class EditorPickerEntry extends QuickOpenEntryGroup {
@@ -32,7 +33,7 @@ export class EditorPickerEntry extends QuickOpenEntryGroup {
getLabelOptions(): IIconLabelValueOptions {
return {
extraClasses: getIconClasses(this.modelService, this.modeService, this.getResource() || undefined),
extraClasses: getIconClasses(this.modelService, this.modeService, this.getResource()),
italic: !this._group.isPinned(this.editor)
};
}
@@ -50,7 +51,7 @@ export class EditorPickerEntry extends QuickOpenEntryGroup {
}
getResource() {
return toResource(this.editor, { supportSideBySide: SideBySideEditor.MASTER });
return withNullAsUndefined(toResource(this.editor, { supportSideBySide: SideBySideEditor.MASTER }));
}
getAriaLabel(): string {
@@ -782,8 +782,8 @@ export class EditorHistoryEntry extends EditorQuickOpenEntry {
return this.description;
}
getResource(): URI | null {
return types.withUndefinedAsNull(this.resource);
getResource(): URI | undefined {
return this.resource;
}
getInput(): IEditorInput | IResourceInput {
@@ -848,7 +848,7 @@ export class RemoveFromEditorHistoryAction extends Action {
return <IHistoryPickEntry>{
input: h,
iconClasses: getIconClasses(this.modelService, this.modeService, types.withNullAsUndefined(entry.getResource())),
iconClasses: getIconClasses(this.modelService, this.modeService, entry.getResource()),
label: entry.getLabel(),
description: entry.getDescription()
};