提交 e4217281 编写于 作者: J Jackson Kearl

Add limitHit messaging to search editor.

上级 c539d219
......@@ -82,6 +82,7 @@ export class SearchEditor extends BaseTextEditor {
private messageDisposables: IDisposable[] = [];
private container: HTMLElement;
private searchModel: SearchModel;
private ongoingOperations: number = 0;
constructor(
@ITelemetryService telemetryService: ITelemetryService,
......@@ -493,7 +494,14 @@ export class SearchEditor extends BaseTextEditor {
}
this.searchOperation.start(500);
await this.searchModel.search(query).finally(() => this.searchOperation.stop());
this.ongoingOperations++;
const exit = await this.searchModel.search(query).finally(() => {
this.ongoingOperations--;
if (this.ongoingOperations === 0) {
this.searchOperation.stop();
}
});
const input = this.getInput();
if (!input ||
input !== startInput ||
......@@ -505,7 +513,7 @@ export class SearchEditor extends BaseTextEditor {
const controller = ReferencesController.get(this.searchResultEditor);
controller.closeWidget(false);
const labelFormatter = (uri: URI): string => this.labelService.getUriLabel(uri, { relative: true });
const results = serializeSearchResultForEditor(this.searchModel.searchResult, config.includes, config.excludes, config.contextLines, labelFormatter, sortOrder);
const results = serializeSearchResultForEditor(this.searchModel.searchResult, config.includes, config.excludes, config.contextLines, labelFormatter, sortOrder, exit?.limitHit);
const { body } = await input.getModels();
this.modelService.updateModel(body, results.text);
input.config = config;
......
......@@ -208,7 +208,7 @@ export const extractSearchQueryFromLines = (lines: string[]): SearchConfiguratio
};
export const serializeSearchResultForEditor =
(searchResult: SearchResult, rawIncludePattern: string, rawExcludePattern: string, contextLines: number, labelFormatter: (x: URI) => string, sortOrder: SearchSortOrder): { matchRanges: Range[], text: string, config: Partial<SearchConfiguration> } => {
(searchResult: SearchResult, rawIncludePattern: string, rawExcludePattern: string, contextLines: number, labelFormatter: (x: URI) => string, sortOrder: SearchSortOrder, limitHit?: boolean): { matchRanges: Range[], text: string, config: Partial<SearchConfiguration> } => {
if (!searchResult.query) { throw Error('Internal Error: Expected query, got null'); }
const config = contentPatternToSearchConfiguration(searchResult.query, rawIncludePattern, rawExcludePattern, contextLines);
......@@ -219,7 +219,11 @@ export const serializeSearchResultForEditor =
searchResult.count()
? `${resultcount} - ${filecount}`
: localize('noResults', "No Results"),
''];
];
if (limitHit) {
info.push(localize('searchMaxResultsWarning', "The result set only contains a subset of all matches. Please be more specific in your search to narrow down the results."));
}
info.push('');
const matchComparer = (a: FileMatch | FolderMatch, b: FileMatch | FolderMatch) => searchMatchComparer(a, b, sortOrder);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册