From 3163b3d679894c82f3eb5e3ff12a8446fc753926 Mon Sep 17 00:00:00 2001 From: Andrea Mah <31675041+andreamah@users.noreply.github.com> Date: Wed, 4 Sep 2024 14:30:33 -0700 Subject: [PATCH] Revert "Allow search provider results to be outside of folder" (#227625) Revert "Allow search provider results to be outside of folder (#227256)" This reverts commit 7d0831a9b9a5944003389797486fab8b2fbd2172. --- .../api/test/node/extHostSearch.test.ts | 38 -------------- .../search/common/fileSearchManager.ts | 10 ++-- .../search/common/searchExtConversionTypes.ts | 41 +++++----------- .../services/search/common/searchExtTypes.ts | 49 ++++++++++++++----- .../search/common/textSearchManager.ts | 12 ++--- .../search/node/ripgrepSearchProvider.ts | 10 ++-- .../search/node/ripgrepTextSearchEngine.ts | 16 +++--- .../test/node/textSearchManager.test.ts | 4 +- ...code.proposed.aiTextSearchProviderNew.d.ts | 2 +- ...vscode.proposed.fileSearchProviderNew.d.ts | 3 +- ...vscode.proposed.textSearchProviderNew.d.ts | 10 +--- 11 files changed, 80 insertions(+), 115 deletions(-) diff --git a/src/vs/workbench/api/test/node/extHostSearch.test.ts b/src/vs/workbench/api/test/node/extHostSearch.test.ts index abd73be2b0eb1..90cba26ee7044 100644 --- a/src/vs/workbench/api/test/node/extHostSearch.test.ts +++ b/src/vs/workbench/api/test/node/extHostSearch.test.ts @@ -702,25 +702,6 @@ suite('ExtHostSearch', () => { const { results } = await runFileSearch(query); compareURIs(results, reportedResults); }); - - test('Works when provider returns files that are not in the original workspace', async () => { - const reportedResults = [ - joinPath(rootFolderB, 'file1.ts'), - joinPath(rootFolderA, 'file2.ts'), - joinPath(rootFolderA, 'subfolder/file3.ts') - ]; - - await registerTestFileSearchProvider({ - provideFileSearchResults(query: vscode.FileSearchQuery, options: vscode.FileSearchOptions, token: vscode.CancellationToken): Promise { - return Promise.resolve(reportedResults); - } - }); - - const { results, stats } = await runFileSearch(getSimpleQuery()); - assert(!stats.limitHit); - assert.strictEqual(results.length, 3); - compareURIs(results, reportedResults); - }); }); suite('Text:', () => { @@ -1315,24 +1296,5 @@ suite('ExtHostSearch', () => { const { results } = await runTextSearch(query); assertResults(results, providedResults); }); - - - test('Works when provider returns files that are not in the original workspace', async () => { - const providedResults: vscode.TextSearchResult[] = [ - makeTextResult(rootFolderB, 'file1.ts'), - makeTextResult(rootFolderA, 'file2.ts') - ]; - - await registerTestTextSearchProvider({ - provideTextSearchResults(query: vscode.TextSearchQuery, options: vscode.TextSearchOptions, progress: vscode.Progress, token: vscode.CancellationToken): Promise { - providedResults.forEach(r => progress.report(r)); - return Promise.resolve(null!); - } - }); - - const { results, stats } = await runTextSearch(getSimpleQuery('foo')); - assert(!stats.limitHit); - assertResults(results, providedResults); - }); }); }); diff --git a/src/vs/workbench/services/search/common/fileSearchManager.ts b/src/vs/workbench/services/search/common/fileSearchManager.ts index d2309ab556a39..3358bd56415e5 100644 --- a/src/vs/workbench/services/search/common/fileSearchManager.ts +++ b/src/vs/workbench/services/search/common/fileSearchManager.ts @@ -12,9 +12,9 @@ import { StopWatch } from '../../../../base/common/stopwatch.js'; import { URI } from '../../../../base/common/uri.js'; import { IFileMatch, IFileSearchProviderStats, IFolderQuery, ISearchCompleteStats, IFileQuery, QueryGlobTester, resolvePatternsForProvider, hasSiblingFn, excludeToGlobPattern, DEFAULT_MAX_SEARCH_RESULTS } from './search.js'; import { FileSearchProviderFolderOptions, FileSearchProviderNew, FileSearchProviderOptions } from './searchExtTypes.js'; +import { TernarySearchTree } from '../../../../base/common/ternarySearchTree.js'; import { Disposable } from '../../../../base/common/lifecycle.js'; import { OldFileSearchProviderConverter } from './searchExtConversionTypes.js'; -import { ResourceMap } from '../../../../base/common/map.js'; interface IInternalFileMatch { base: URI; @@ -126,7 +126,7 @@ class FileSearchEngine { }; - const folderMappings = new ResourceMap(); + const folderMappings: TernarySearchTree = TernarySearchTree.forUris(); fqs.forEach(fq => { const queryTester = new QueryGlobTester(this.config, fq); const noSiblingsClauses = !queryTester.hasSiblingExcludeClauses(); @@ -153,9 +153,9 @@ class FileSearchEngine { if (results) { - results.forEach(resultInfo => { - const result = resultInfo.result; - const fqFolderInfo = folderMappings.get(resultInfo.folder)!; + results.forEach(result => { + + const fqFolderInfo = folderMappings.findSubstr(result)!; const relativePath = path.posix.relative(fqFolderInfo.folder.path, result.path); if (fqFolderInfo.noSiblingsClauses) { diff --git a/src/vs/workbench/services/search/common/searchExtConversionTypes.ts b/src/vs/workbench/services/search/common/searchExtConversionTypes.ts index 42a88642e50da..2e03ba8ee6b71 100644 --- a/src/vs/workbench/services/search/common/searchExtConversionTypes.ts +++ b/src/vs/workbench/services/search/common/searchExtConversionTypes.ts @@ -13,7 +13,7 @@ import { CancellationToken } from '../../../../base/common/cancellation.js'; import { URI } from '../../../../base/common/uri.js'; import { IProgress } from '../../../../platform/progress/common/progress.js'; import { DEFAULT_TEXT_SEARCH_PREVIEW_OPTIONS } from './search.js'; -import { Range, FileSearchProviderNew, FileSearchProviderOptions, ProviderResult, TextSearchCompleteNew, TextSearchContextNew, TextSearchMatchNew, TextSearchProviderNew, TextSearchProviderOptions, TextSearchQueryNew, TextSearchResultNew, AITextSearchProviderNew, TextSearchCompleteMessage, SearchResultFromFolder } from './searchExtTypes.js'; +import { Range, FileSearchProviderNew, FileSearchProviderOptions, ProviderResult, TextSearchCompleteNew, TextSearchContextNew, TextSearchMatchNew, TextSearchProviderNew, TextSearchProviderOptions, TextSearchQueryNew, TextSearchResultNew, AITextSearchProviderNew, TextSearchCompleteMessage } from './searchExtTypes.js'; // old types that are retained for backward compatibility // TODO: delete this when search apis are adopted by all first-party extensions @@ -470,22 +470,13 @@ function newToOldFileProviderOptions(options: FileSearchProviderOptions): FileSe export class OldFileSearchProviderConverter implements FileSearchProviderNew { constructor(private provider: FileSearchProvider) { } - provideFileSearchResults(pattern: string, options: FileSearchProviderOptions, token: CancellationToken): ProviderResult[]> { - const getResult: () => Promise<{ - uris: URI[] | null | undefined; - folder: URI; - }[]> = async () => { + provideFileSearchResults(pattern: string, options: FileSearchProviderOptions, token: CancellationToken): ProviderResult { + const getResult = async () => { const newOpts = newToOldFileProviderOptions(options); return Promise.all(newOpts.map( - async o => ({ uris: await this.provider.provideFileSearchResults({ pattern }, o, token), folder: o.folder }))); + o => this.provider.provideFileSearchResults({ pattern }, o, token))); }; - return getResult().then(rawResult => - coalesce(rawResult.flatMap(e => ( - e.uris?.map(uri => ( - { result: uri, folder: e.folder } - ))) - )) - ); + return getResult().then(e => coalesce(e).flat()); } } @@ -537,22 +528,19 @@ export function oldToNewTextSearchResult(result: TextSearchResult): TextSearchRe export class OldTextSearchProviderConverter implements TextSearchProviderNew { constructor(private provider: TextSearchProvider) { } - provideTextSearchResults(query: TextSearchQueryNew, options: TextSearchProviderOptions, progress: IProgress>, token: CancellationToken): ProviderResult { + provideTextSearchResults(query: TextSearchQueryNew, options: TextSearchProviderOptions, progress: IProgress, token: CancellationToken): ProviderResult { - const progressShim = (oldResult: TextSearchResult, folder: URI) => { + const progressShim = (oldResult: TextSearchResult) => { if (!validateProviderResult(oldResult)) { return; } - progress.report({ - folder, - result: oldToNewTextSearchResult(oldResult) - }); + progress.report(oldToNewTextSearchResult(oldResult)); }; const getResult = async () => { return coalesce(await Promise.all( newToOldTextProviderOptions(options).map( - o => this.provider.provideTextSearchResults(query, o, { report: (e) => progressShim(e, o.folder) }, token)))) + o => this.provider.provideTextSearchResults(query, o, { report: (e) => progressShim(e) }, token)))) .reduce( (prev, cur) => ({ limitHit: prev.limitHit || cur.limitHit }), { limitHit: false } @@ -571,21 +559,18 @@ export class OldTextSearchProviderConverter implements TextSearchProviderNew { export class OldAITextSearchProviderConverter implements AITextSearchProviderNew { constructor(private provider: AITextSearchProvider) { } - provideAITextSearchResults(query: string, options: TextSearchProviderOptions, progress: IProgress>, token: CancellationToken): ProviderResult { - const progressShim = (oldResult: TextSearchResult, folder: URI) => { + provideAITextSearchResults(query: string, options: TextSearchProviderOptions, progress: IProgress, token: CancellationToken): ProviderResult { + const progressShim = (oldResult: TextSearchResult) => { if (!validateProviderResult(oldResult)) { return; } - progress.report({ - folder, - result: oldToNewTextSearchResult(oldResult) - }); + progress.report(oldToNewTextSearchResult(oldResult)); }; const getResult = async () => { return coalesce(await Promise.all( newToOldTextProviderOptions(options).map( - o => this.provider.provideAITextSearchResults(query, o, { report: (e) => progressShim(e, o.folder) }, token)))) + o => this.provider.provideAITextSearchResults(query, o, { report: (e) => progressShim(e) }, token)))) .reduce( (prev, cur) => ({ limitHit: prev.limitHit || cur.limitHit }), { limitHit: false } diff --git a/src/vs/workbench/services/search/common/searchExtTypes.ts b/src/vs/workbench/services/search/common/searchExtTypes.ts index 898e8df3ffc3f..fc64b95b772af 100644 --- a/src/vs/workbench/services/search/common/searchExtTypes.ts +++ b/src/vs/workbench/services/search/common/searchExtTypes.ts @@ -320,6 +320,41 @@ export class TextSearchContextNew { */ export type TextSearchResultNew = TextSearchMatchNew | TextSearchContextNew; + +/** + * A FileSearchProvider provides search results for files in the given folder that match a query string. It can be invoked by quickaccess or other extensions. + * + * A FileSearchProvider is the more powerful of two ways to implement file search in VS Code. Use a FileSearchProvider if you wish to search within a folder for + * all files that match the user's query. + * + * The FileSearchProvider will be invoked on every keypress in quickaccess. When `workspace.findFiles` is called, it will be invoked with an empty query string, + * and in that case, every file in the folder should be returned. + */ +export interface FileSearchProviderNew { + /** + * Provide the set of files that match a certain file path pattern. + * @param query The parameters for this query. + * @param options A set of options to consider while searching files. + * @param progress A progress callback that must be invoked for all results. + * @param token A cancellation token. + */ + provideFileSearchResults(pattern: string, options: FileSearchProviderOptions, token: CancellationToken): ProviderResult; +} + +/** + * A TextSearchProvider provides search results for text results inside files in the workspace. + */ +export interface TextSearchProviderNew { + /** + * Provide results that match the given text pattern. + * @param query The parameters for this query. + * @param options A set of options to consider while searching. + * @param progress A progress callback that must be invoked for all results. + * @param token A cancellation token. + */ + provideTextSearchResults(query: TextSearchQueryNew, options: TextSearchProviderOptions, progress: IProgress, token: CancellationToken): ProviderResult; +} + /** * Information collected when text search is complete. */ @@ -382,7 +417,7 @@ export interface FileSearchProviderNew { * @param progress A progress callback that must be invoked for all results. * @param token A cancellation token. */ - provideFileSearchResults(pattern: string, options: FileSearchProviderOptions, token: CancellationToken): ProviderResult[]>; + provideFileSearchResults(pattern: string, options: FileSearchProviderOptions, token: CancellationToken): ProviderResult; } /** @@ -396,7 +431,7 @@ export interface TextSearchProviderNew { * @param progress A progress callback that must be invoked for all results. * @param token A cancellation token. */ - provideTextSearchResults(query: TextSearchQueryNew, options: TextSearchProviderOptions, progress: IProgress>, token: CancellationToken): ProviderResult; + provideTextSearchResults(query: TextSearchQueryNew, options: TextSearchProviderOptions, progress: IProgress, token: CancellationToken): ProviderResult; } /** @@ -502,13 +537,5 @@ export interface AITextSearchProviderNew { * @param progress A progress callback that must be invoked for all results. * @param token A cancellation token. */ - provideAITextSearchResults(query: string, options: TextSearchProviderOptions, progress: IProgress>, token: CancellationToken): ProviderResult; + provideAITextSearchResults(query: string, options: TextSearchProviderOptions, progress: IProgress, token: CancellationToken): ProviderResult; } - -/** - * A wrapper for a search result that indicates the original workspace folder that this result was found for. - */ -export type SearchResultFromFolder = { - result: T; - folder: URI; -}; diff --git a/src/vs/workbench/services/search/common/textSearchManager.ts b/src/vs/workbench/services/search/common/textSearchManager.ts index 070f273adc479..74857f05baad4 100644 --- a/src/vs/workbench/services/search/common/textSearchManager.ts +++ b/src/vs/workbench/services/search/common/textSearchManager.ts @@ -6,13 +6,13 @@ import { isThenable } from '../../../../base/common/async.js'; import { CancellationToken, CancellationTokenSource } from '../../../../base/common/cancellation.js'; import { toErrorMessage } from '../../../../base/common/errorMessage.js'; -import { ResourceMap } from '../../../../base/common/map.js'; import { Schemas } from '../../../../base/common/network.js'; import * as path from '../../../../base/common/path.js'; import * as resources from '../../../../base/common/resources.js'; +import { TernarySearchTree } from '../../../../base/common/ternarySearchTree.js'; import { URI } from '../../../../base/common/uri.js'; import { DEFAULT_MAX_SEARCH_RESULTS, hasSiblingPromiseFn, IAITextQuery, IExtendedExtensionSearchOptions, IFileMatch, IFolderQuery, excludeToGlobPattern, IPatternInfo, ISearchCompleteStats, ITextQuery, ITextSearchContext, ITextSearchMatch, ITextSearchResult, ITextSearchStats, QueryGlobTester, QueryType, resolvePatternsForProvider, ISearchRange, DEFAULT_TEXT_SEARCH_PREVIEW_OPTIONS } from './search.js'; -import { AITextSearchProviderNew, SearchResultFromFolder, TextSearchCompleteNew, TextSearchMatchNew, TextSearchProviderFolderOptions, TextSearchProviderNew, TextSearchProviderOptions, TextSearchQueryNew, TextSearchResultNew } from './searchExtTypes.js'; +import { AITextSearchProviderNew, TextSearchCompleteNew, TextSearchMatchNew, TextSearchProviderFolderOptions, TextSearchProviderNew, TextSearchProviderOptions, TextSearchQueryNew, TextSearchResultNew } from './searchExtTypes.js'; export interface IFileUtils { readdir: (resource: URI) => Promise; @@ -122,7 +122,7 @@ export class TextSearchManager { } private async doSearch(folderQueries: IFolderQuery[], onResult: (result: TextSearchResultNew, folderIdx: number) => void, token: CancellationToken): Promise { - const folderMappings: ResourceMap = new ResourceMap(); + const folderMappings: TernarySearchTree = TernarySearchTree.forUris(); folderQueries.forEach((fq, i) => { const queryTester = new QueryGlobTester(this.query, fq); folderMappings.set(fq.folder, { queryTester, folder: fq.folder, folderIdx: i }); @@ -130,12 +130,12 @@ export class TextSearchManager { const testingPs: Promise[] = []; const progress = { - report: (resultInfo: SearchResultFromFolder) => { - const result = resultInfo.result; + report: (result: TextSearchResultNew) => { + if (result.uri === undefined) { throw Error('Text search result URI is undefined. Please check provider implementation.'); } - const folderQuery = folderMappings.get(resultInfo.folder)!; + const folderQuery = folderMappings.findSubstr(result.uri)!; const hasSibling = folderQuery.folder.scheme === Schemas.file ? hasSiblingPromiseFn(() => { return this.fileUtils.readdir(resources.dirname(result.uri)); diff --git a/src/vs/workbench/services/search/node/ripgrepSearchProvider.ts b/src/vs/workbench/services/search/node/ripgrepSearchProvider.ts index 7a903a6c8e861..9811308b833e4 100644 --- a/src/vs/workbench/services/search/node/ripgrepSearchProvider.ts +++ b/src/vs/workbench/services/search/node/ripgrepSearchProvider.ts @@ -6,7 +6,7 @@ import { CancellationTokenSource, CancellationToken } from '../../../../base/common/cancellation.js'; import { OutputChannel } from './ripgrepSearchUtils.js'; import { RipgrepTextSearchEngine } from './ripgrepTextSearchEngine.js'; -import { TextSearchProviderNew, TextSearchCompleteNew, TextSearchResultNew, TextSearchQueryNew, TextSearchProviderOptions, SearchResultFromFolder, } from '../common/searchExtTypes.js'; +import { TextSearchProviderNew, TextSearchCompleteNew, TextSearchResultNew, TextSearchQueryNew, TextSearchProviderOptions, } from '../common/searchExtTypes.js'; import { Progress } from '../../../../platform/progress/common/progress.js'; import { Schemas } from '../../../../base/common/network.js'; import type { RipgrepTextSearchOptions } from '../common/searchExtTypesInternal.js'; @@ -18,7 +18,7 @@ export class RipgrepSearchProvider implements TextSearchProviderNew { process.once('exit', () => this.dispose()); } - async provideTextSearchResults(query: TextSearchQueryNew, options: TextSearchProviderOptions, progress: Progress>, token: CancellationToken): Promise { + async provideTextSearchResults(query: TextSearchQueryNew, options: TextSearchProviderOptions, progress: Progress, token: CancellationToken): Promise { const numThreads = await this.getNumThreads(); const engine = new RipgrepTextSearchEngine(this.outputChannel, numThreads); @@ -36,10 +36,10 @@ export class RipgrepSearchProvider implements TextSearchProviderNew { // Ripgrep search engine can only provide file-scheme results, but we want to use it to search some schemes that are backed by the filesystem, but with some other provider as the frontend, // case in point vscode-userdata. In these cases we translate the query to a file, and translate the results back to the frontend scheme. const translatedOptions = { ...extendedOptions, folder: folderOption.folder.with({ scheme: Schemas.file }) }; - const progressTranslator = new Progress>(data => progress.report({ folder: data.folder, result: { ...data.result, uri: data.result.uri.with({ scheme: folderOption.folder.scheme }) } })); - return this.withToken(token, token => engine.provideTextSearchResultsWithRgOptions(query, translatedOptions, folderOption.folder, progressTranslator, token)); + const progressTranslator = new Progress(data => progress.report({ ...data, uri: data.uri.with({ scheme: folderOption.folder.scheme }) })); + return this.withToken(token, token => engine.provideTextSearchResultsWithRgOptions(query, translatedOptions, progressTranslator, token)); } else { - return this.withToken(token, token => engine.provideTextSearchResultsWithRgOptions(query, extendedOptions, folderOption.folder, progress, token)); + return this.withToken(token, token => engine.provideTextSearchResultsWithRgOptions(query, extendedOptions, progress, token)); } })).then((e => { const complete: TextSearchCompleteNew = { diff --git a/src/vs/workbench/services/search/node/ripgrepTextSearchEngine.ts b/src/vs/workbench/services/search/node/ripgrepTextSearchEngine.ts index c3c9df18e4837..3ab8205f2b194 100644 --- a/src/vs/workbench/services/search/node/ripgrepTextSearchEngine.ts +++ b/src/vs/workbench/services/search/node/ripgrepTextSearchEngine.ts @@ -12,23 +12,23 @@ import { groupBy } from '../../../../base/common/collections.js'; import { splitGlobAware } from '../../../../base/common/glob.js'; import { createRegExp, escapeRegExpCharacters } from '../../../../base/common/strings.js'; import { URI } from '../../../../base/common/uri.js'; +import { Progress } from '../../../../platform/progress/common/progress.js'; import { DEFAULT_MAX_SEARCH_RESULTS, IExtendedExtensionSearchOptions, ITextSearchPreviewOptions, SearchError, SearchErrorCode, serializeSearchError, TextSearchMatch } from '../common/search.js'; -import { Range, SearchResultFromFolder, TextSearchCompleteNew, TextSearchContextNew, TextSearchMatchNew, TextSearchProviderNew, TextSearchProviderOptions, TextSearchQueryNew, TextSearchResultNew } from '../common/searchExtTypes.js'; +import { Range, TextSearchCompleteNew, TextSearchContextNew, TextSearchMatchNew, TextSearchProviderOptions, TextSearchQueryNew, TextSearchResultNew } from '../common/searchExtTypes.js'; import { AST as ReAST, RegExpParser, RegExpVisitor } from 'vscode-regexpp'; import { rgPath } from '@vscode/ripgrep'; import { anchorGlob, IOutputChannel, Maybe, rangeToSearchRange, searchRangeToRange } from './ripgrepSearchUtils.js'; import type { RipgrepTextSearchOptions } from '../common/searchExtTypesInternal.js'; import { newToOldPreviewOptions } from '../common/searchExtConversionTypes.js'; -import { Progress } from '../../../../platform/progress/common/progress.js'; // If @vscode/ripgrep is in an .asar file, then the binary is unpacked. const rgDiskPath = rgPath.replace(/\bnode_modules\.asar\b/, 'node_modules.asar.unpacked'); -export class RipgrepTextSearchEngine implements TextSearchProviderNew { +export class RipgrepTextSearchEngine { constructor(private outputChannel: IOutputChannel, private readonly _numThreads?: number | undefined) { } - provideTextSearchResults(query: TextSearchQueryNew, options: TextSearchProviderOptions, progress: Progress>, token: CancellationToken): Promise { + provideTextSearchResults(query: TextSearchQueryNew, options: TextSearchProviderOptions, progress: Progress, token: CancellationToken): Promise { return Promise.all(options.folderOptions.map(folderOption => { const extendedOptions: RipgrepTextSearchOptions = { folderOptions: folderOption, @@ -38,7 +38,7 @@ export class RipgrepTextSearchEngine implements TextSearchProviderNew { maxFileSize: options.maxFileSize, surroundingContext: options.surroundingContext }; - return this.provideTextSearchResultsWithRgOptions(query, extendedOptions, folderOption.folder, progress, token); + return this.provideTextSearchResultsWithRgOptions(query, extendedOptions, progress, token); })).then((e => { const complete: TextSearchCompleteNew = { // todo: get this to actually check @@ -48,7 +48,7 @@ export class RipgrepTextSearchEngine implements TextSearchProviderNew { })); } - provideTextSearchResultsWithRgOptions(query: TextSearchQueryNew, options: RipgrepTextSearchOptions, folder: URI, progress: Progress>, token: CancellationToken): Promise { + provideTextSearchResultsWithRgOptions(query: TextSearchQueryNew, options: RipgrepTextSearchOptions, progress: Progress, token: CancellationToken): Promise { this.outputChannel.appendLine(`provideTextSearchResults ${query.pattern}, ${JSON.stringify({ ...options, ...{ @@ -81,10 +81,10 @@ export class RipgrepTextSearchEngine implements TextSearchProviderNew { let gotResult = false; const ripgrepParser = new RipgrepParser(options.maxResults ?? DEFAULT_MAX_SEARCH_RESULTS, options.folderOptions.folder, newToOldPreviewOptions(options.previewOptions)); - ripgrepParser.on('result', (result: TextSearchResultNew) => { + ripgrepParser.on('result', (match: TextSearchResultNew) => { gotResult = true; dataWithoutResult = ''; - progress.report({ folder, result }); + progress.report(match); }); let isDone = false; diff --git a/src/vs/workbench/services/search/test/node/textSearchManager.test.ts b/src/vs/workbench/services/search/test/node/textSearchManager.test.ts index 00f72e97b0b43..eda186aa3e432 100644 --- a/src/vs/workbench/services/search/test/node/textSearchManager.test.ts +++ b/src/vs/workbench/services/search/test/node/textSearchManager.test.ts @@ -9,14 +9,14 @@ import { URI } from '../../../../../base/common/uri.js'; import { ensureNoDisposablesAreLeakedInTestSuite } from '../../../../../base/test/common/utils.js'; import { Progress } from '../../../../../platform/progress/common/progress.js'; import { ITextQuery, QueryType } from '../../common/search.js'; -import { ProviderResult, TextSearchCompleteNew, TextSearchProviderOptions, TextSearchProviderNew, TextSearchQueryNew, TextSearchResultNew, SearchResultFromFolder } from '../../common/searchExtTypes.js'; +import { ProviderResult, TextSearchCompleteNew, TextSearchProviderOptions, TextSearchProviderNew, TextSearchQueryNew, TextSearchResultNew } from '../../common/searchExtTypes.js'; import { NativeTextSearchManager } from '../../node/textSearchManager.js'; suite('NativeTextSearchManager', () => { test('fixes encoding', async () => { let correctEncoding = false; const provider: TextSearchProviderNew = { - provideTextSearchResults(query: TextSearchQueryNew, options: TextSearchProviderOptions, progress: Progress>, token: CancellationToken): ProviderResult { + provideTextSearchResults(query: TextSearchQueryNew, options: TextSearchProviderOptions, progress: Progress, token: CancellationToken): ProviderResult { correctEncoding = options.folderOptions[0].encoding === 'windows-1252'; return null; diff --git a/src/vscode-dts/vscode.proposed.aiTextSearchProviderNew.d.ts b/src/vscode-dts/vscode.proposed.aiTextSearchProviderNew.d.ts index 1ab4953e3cbac..a7bf57cde32c9 100644 --- a/src/vscode-dts/vscode.proposed.aiTextSearchProviderNew.d.ts +++ b/src/vscode-dts/vscode.proposed.aiTextSearchProviderNew.d.ts @@ -17,7 +17,7 @@ declare module 'vscode' { * @param progress A progress callback that must be invoked for all results. * @param token A cancellation token. */ - provideAITextSearchResults(query: string, options: TextSearchProviderOptions, progress: Progress>, token: CancellationToken): ProviderResult; + provideAITextSearchResults(query: string, options: TextSearchProviderOptions, progress: Progress, token: CancellationToken): ProviderResult; } export namespace workspace { diff --git a/src/vscode-dts/vscode.proposed.fileSearchProviderNew.d.ts b/src/vscode-dts/vscode.proposed.fileSearchProviderNew.d.ts index b45f9ee99797c..36b0b482313c7 100644 --- a/src/vscode-dts/vscode.proposed.fileSearchProviderNew.d.ts +++ b/src/vscode-dts/vscode.proposed.fileSearchProviderNew.d.ts @@ -81,9 +81,8 @@ declare module 'vscode' { * @param pattern The search pattern to match against file paths. * @param options A set of options to consider while searching files. * @param token A cancellation token. - * @returns A list of matching URIs, where each URI is associated with a workspace folder. */ - provideFileSearchResults(pattern: string, options: FileSearchProviderOptions, token: CancellationToken): ProviderResult[]>; + provideFileSearchResults(pattern: string, options: FileSearchProviderOptions, token: CancellationToken): ProviderResult; } export namespace workspace { diff --git a/src/vscode-dts/vscode.proposed.textSearchProviderNew.d.ts b/src/vscode-dts/vscode.proposed.textSearchProviderNew.d.ts index dff1c2e4fa9e9..a82ca8f4ae263 100644 --- a/src/vscode-dts/vscode.proposed.textSearchProviderNew.d.ts +++ b/src/vscode-dts/vscode.proposed.textSearchProviderNew.d.ts @@ -243,14 +243,6 @@ declare module 'vscode' { */ export type TextSearchResultNew = TextSearchMatchNew | TextSearchContextNew; - /** - * A wrapper for a search result that indicates the original workspace folder that this result was found for. - */ - export type SearchResultFromFolder = { - result: T; - folder: Uri; - }; - /** * A TextSearchProvider provides search results for text results inside files in the workspace. */ @@ -265,7 +257,7 @@ declare module 'vscode' { * These results can be direct matches, or context that surrounds matches. * @param token A cancellation token. */ - provideTextSearchResults(query: TextSearchQueryNew, options: TextSearchProviderOptions, progress: Progress>, token: CancellationToken): ProviderResult; + provideTextSearchResults(query: TextSearchQueryNew, options: TextSearchProviderOptions, progress: Progress, token: CancellationToken): ProviderResult; } export namespace workspace {