Repository navigation
Closed
Labels
searchSearch widget and operation issuesunder-discussionIssue is under discussion for relevance, priority, approach
Description
I looked into what it will take to run search in the extension host using extension APIs.
- Ripgrep search
- Just need to port ripgrepTextSearch.ts and ripgrepFileSearch.ts
- Currently it downloads the correct ripgrep binary at build time. A builtin extension in the core repo can still do that. A marketplace extension would have to ship all binaries and pick one at runtime.
- Dependencies
- Has lots of trivial dependencies from vs/base/common. It's ok to copy them, move to native node versions, or native ES versions
- glob.ts, but we should get rid of that dependency. It's only used for sibling clauses and those should be handled on the frontend
- API
- Doesn't expose all features that builtin search needs
- Whether to use gitignore file
- Follow symlinks
- Max filesize
- Encoding (can be read from files.encoding, do we expect all
extension authors to think of that?) - Result limit count (handled by frontend using CancellationToken?)
- Searching outside of the workspace
- Smart case (front end)
- wordSeparators (front end)
- Cache search (for file search)
- Sort by score (for file search)
- Multiroot search (change it to search per single folder)
- Need to read RelativePattern, instead of the current IFolderQuery
- Doesn't expose all features that builtin search needs
- Logging
- Use extensionhost logger and output pane
- Frontend changes - SearchService just need to talk to search provider API
- Non-rg search is harder
- Need glob.ts, and all of its dependencies
- Mime
- Iconv and the stuff we have built around it
- IPC stuff from core for spawning worker processes
- All of the dependencies would have to be moved to a separate node module so they can be shared with search. We probably don't want to do that.
Reacted by Patrick Trant, Alexey Volodkin and Yukai Huang
Metadata
Metadata
Assignees
Labels
searchSearch widget and operation issuesunder-discussionIssue is under discussion for relevance, priority, approach
Activity
move proposed search api logic into its own world, #47058
roblourens commentedon Apr 17, 2018
jrieken commentedon Apr 18, 2018
In the
TextSearchOptionshow doesfolderandincludeswork together? Is the former an implicit prefix for all include-patterns?roblourens commentedon Apr 18, 2018
Yes that's what I'm imagining, and I think includes/excludes maybe should actually just be strings of globs relative to
folder, rather than GlobPatterns, which can be relative to some other absolute path, since I'm not sure how to interpret that along withfolder.Was the original intention to have the extension read
workspaceFolders, or to include the folder inincludes? I think it's easier for implementors to separate "folder to search in" and "glob patterns to apply" and to have all the relevant info on the query object.This also doesn't handle searching in extra open files. I'm not sure how to express that.
where just one of those is set.
Or maybe they don't need to be differentiated.
roblourens commentedon May 3, 2018
#47058 - Search provider running in EH with switch to enable
[-]Search in extensionHost investigation[/-][+]Search Provider extension API[/+]roblourens commentedon May 26, 2018
Need to decide whether the search provider API options include maxResults.
When maxResults is hit, the expensive search should terminate as quickly as possible, so it makes sense for the provider to know about it. Especially important in the workspaceContains case where maxResults = 1.
But the search service needs to know whether maxResults would have been exceeded, so it can show a warning in the text search viewlet. (What else do we use
limitHitfor?)We could pass maxResult+1 to the provider so we know whether the provider has exactly 10,000 results, or would have produced more. Not good for the maxResults=1 case because some providers may have an optimization for just finding whether a pattern exists.
So, we could pass maxResults=1 in that case and maxResults+1 in all other cases. This is assuming
limitHitdoesn't really matter when maxResults=1.27 remaining items
Add text search results limit back (on EH side) - #47058
Send search results back from EH in batches - #47058
roblourens commentedon Aug 21, 2018
re: FileIndexProvider - Did some basic perf testing and realized that URI-ifying every file in the workspace is... very expensive. I've always thought of this as a string-based API.
Can we change it to return strings of relative paths? I think it's justifiable even if we usually use URIs to refer to files. We are in a clear context of asking for files in a particular folder.
jrieken commentedon Aug 22, 2018
No - the API uses
Uriroblourens commentedon Aug 22, 2018
Then FileIndexProvider is ☠️ 😢
sebastian-lenz commentedon Sep 13, 2018
Playing around with the insider build, I just noted that the results returned by a
FileSearchProviderare filtered by VS Code against the include and exclude patterns. Also open text editors seem to emit search results on their own bypassing the implementation in a custom search provider. I think both behaviors are quite limiting when implementing a custom search.In my current project the language internally organizes files into virtual folders, it does this as the language allows files to appear at multiple locations within a virtual tree. I was hoping to implement a custom search that allows filtering by include / exclude, but as VS Code always filters the results based on the uri which does not reflect this structure, I always end up with empty result sets.
roblourens commentedon Oct 3, 2018
This issue is old and a bit stale, I am closing it and opening more specific issues.