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

cap visible entries in quick open

上级 ef5fb3c8
......@@ -512,7 +512,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 ({0})", entries.length), false);
entries[0] = new QuickOpenEntryGroup(entries[0], nls.localize('historyMatches', "recently opened"), false);
}
return new QuickOpenModel(entries, this.actionProvider);
......@@ -623,7 +623,7 @@ export class QuickOpenController extends WorkbenchComponent implements IQuickOpe
// Fill in history results if matching
let matchingHistoryEntries = this.editorHistoryModel.getResults(value);
if (matchingHistoryEntries.length > 0) {
matchingHistoryEntries[0] = new QuickOpenEntryGroup(matchingHistoryEntries[0], nls.localize('historyMatches', "recently opened ({0})", matchingHistoryEntries.length), false);
matchingHistoryEntries[0] = new QuickOpenEntryGroup(matchingHistoryEntries[0], nls.localize('historyMatches', "recently opened"), false);
}
let quickOpenModel = new QuickOpenModel(matchingHistoryEntries, this.actionProvider);
......@@ -687,7 +687,7 @@ export class QuickOpenController extends WorkbenchComponent implements IQuickOpe
// Show additional handler results below any existing results
if (additionalHandlerResults.length > 0) {
let useTopBorder = quickOpenModel.getEntries().length > 0;
additionalHandlerResults[0] = new QuickOpenEntryGroup(additionalHandlerResults[0], nls.localize('additionalResultsGroupLabel', "{0} ({1})", groupLabel, additionalHandlerResults.length), useTopBorder);
additionalHandlerResults[0] = new QuickOpenEntryGroup(additionalHandlerResults[0], nls.localize('additionalResultsGroupLabel', "{0}", groupLabel), useTopBorder);
quickOpenModel.addEntries(additionalHandlerResults);
this.quickOpenWidget.refresh(quickOpenModel, { autoFocusFirstEntry: true });
}
......
......@@ -31,6 +31,8 @@ export class OpenAnythingHandler extends QuickOpenHandler {
private static SYMBOL_SEARCH_SUBSEQUENT_TIMEOUT = 100;
private static SEARCH_DELAY = 100; // This delay accommodates for the user typing a word and then stops typing to start searching
private static MAX_DISPLAYED_FILE_RESULTS = 2048;
private openSymbolHandler: _OpenSymbolHandler;
private openFileHandler: OpenFileHandler;
private resultsToSearchCache: { [searchValue: string]: QuickOpenEntry[]; };
......@@ -150,7 +152,10 @@ export class OpenAnythingHandler extends QuickOpenHandler {
// Cache for fast lookup
this.resultsToSearchCache[searchValue] = result;
return TPromise.as<QuickOpenModel>(new QuickOpenModel(result));
// Cap the number of results to make the view snappy
const viewResults = result.slice(0, OpenAnythingHandler.MAX_DISPLAYED_FILE_RESULTS);
return TPromise.as<QuickOpenModel>(new QuickOpenModel(viewResults));
}, (error: Error) => {
this.pendingSearch = null;
this.messageService.show(Severity.Error, error);
......
......@@ -170,7 +170,6 @@ export class OpenFileHandler extends QuickOpenHandler {
}
// Compare by name
let r = comparers.compareFileNames(elementAName, elementBName);
if (r !== 0) {
return r;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册