diff --git a/src/vs/workbench/browser/parts/quickopen/quickOpenController.ts b/src/vs/workbench/browser/parts/quickopen/quickOpenController.ts index a86f1cf60d48c2d03c5274c409259122f4ce6929..77d16f7df09140e0f897ed884ac984cd38065986 100644 --- a/src/vs/workbench/browser/parts/quickopen/quickOpenController.ts +++ b/src/vs/workbench/browser/parts/quickopen/quickOpenController.ts @@ -586,7 +586,7 @@ export class QuickOpenController extends WorkbenchComponent implements IQuickOpe // Apply label to first entry if (entries.length > 0) { - entries[0] = new QuickOpenEntryGroup(entries[0], nls.localize('historyMatches', "recently opened"), false); + entries[0] = new EditorHistoryEntryGroup(entries[0], nls.localize('historyMatches', "recently opened"), false); } return new QuickOpenModel(entries, this.actionProvider); @@ -668,18 +668,20 @@ export class QuickOpenController extends WorkbenchComponent implements IQuickOpe } private handleDefaultHandlers(defaultHandlers: QuickOpenHandlerDescriptor[], value: string, currentResultToken: string): TPromise { + const previousInput = this.quickOpenWidget.getInput(); + const wasShowingHistory = previousInput && previousInput.entries && previousInput.entries.some(e => e instanceof EditorHistoryEntry || e instanceof EditorHistoryEntryGroup); // Fill in history results if matching let matchingHistoryEntries = this.getEditorHistoryEntries(value); if (matchingHistoryEntries.length > 0) { - matchingHistoryEntries[0] = new QuickOpenEntryGroup(matchingHistoryEntries[0], nls.localize('historyMatches', "recently opened"), false); + matchingHistoryEntries[0] = new EditorHistoryEntryGroup(matchingHistoryEntries[0], nls.localize('historyMatches', "recently opened"), false); } - let quickOpenModel = new QuickOpenModel(matchingHistoryEntries, this.actionProvider); - // If we have matching entries from history we want to show them directly and not wait for the other results to come in + // This also applies when we used to have entries from a previous run and now there are no more history results matching let inputSet = false; - if (matchingHistoryEntries.length > 0) { + let quickOpenModel = new QuickOpenModel(matchingHistoryEntries, this.actionProvider); + if (wasShowingHistory || matchingHistoryEntries.length > 0) { this.quickOpenWidget.setInput(quickOpenModel, { autoFocusFirstEntry: true }); inputSet = true; } @@ -1027,6 +1029,10 @@ class PickOpenItem extends QuickOpenEntryItem { } } +export class EditorHistoryEntryGroup extends QuickOpenEntryGroup { + // Marker class +} + export class EditorHistoryEntry extends EditorQuickOpenEntry { private input: EditorInput; private resource: URI;