diff --git a/src/vs/workbench/services/search/common/textSearchManager.ts b/src/vs/workbench/services/search/common/textSearchManager.ts index 223374a7bdd3e7eaae3d78ef8538fda1f0eefa72..ee652bc04826b348d781c3bd376cd315df9b858f 100644 --- a/src/vs/workbench/services/search/common/textSearchManager.ts +++ b/src/vs/workbench/services/search/common/textSearchManager.ts @@ -53,8 +53,7 @@ export class TextSearchManager { } const newResultSize = this.resultSize(result); - this.resultCount += newResultSize; - if (newResultSize > 0) { + this.resultCount += newResultSize; if (newResultSize > 0 || !extensionResultIsMatch(result)) { this.collector!.add(result, folderIdx); } } @@ -83,10 +82,15 @@ export class TextSearchManager { } private resultSize(result: TextSearchResult): number { - const match = result; - return Array.isArray(match.ranges) ? - match.ranges.length : - 1; + if (extensionResultIsMatch(result)) { + return Array.isArray(result.ranges) ? + result.ranges.length : + 1; + } + else { + // #104400 context lines shoudn't count towards result count + return 0; + } } private trimResultToSize(result: TextSearchMatch, size: number): TextSearchMatch {