-
Notifications
You must be signed in to change notification settings - Fork 28.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test: fileSearchProviderNew
(new File Search Provider shape)
#226668
Comments
@jrieken do you mind providing your review for the PR? The main reason I didn't merge this last night was because I wasn't sure whether this was the correct way to do this. |
This was my first time reviewing an API test plan item, so it took me a minute to get my bearings. Things seemed to work well, although I ran out of creative testing scenarios quite quickly :') I also had thoughts related to #226734 as I saw that the API was called on every keypress and made me curious how this would work with a large-latency implementation of I opened one issue which is really just a ploy to get you to explain how things work to me :) |
Refs #73524
Complexity: 5
Roles: Developer, Engineering Manager
Create Issue
History/Context
FYI: you can skip this part if you already know what's going on with these search APIs.
General
There has been a lot of work going into finalizing 4 search APIs. Here is a little table that soft of explains how they're related, plus the main function calls from each. Essentially, for file and text search, we have to finalize APIs for
findFiles2
is meant to replace the existing finalized APIworkspace.findFiles
. So it will be renamed tofindFiles
then. It will be added as an overload of the currentfindFiles
call, where the old call signature will be deprecated (but still supported).Since this is gonna be a huge change for any first-party extensions that are using these proposed APIs, I've split out the new shape in new files that end in
New
. For example, the new shape forfindTextInFiles
is infindTextInFilesNew
.fileSearchProviderNew
This TPI focuses on testing the functionality and shape for
fileSearchProviderNew
The
fileSearchProvider
API is meant to be used when you want file search results to be sourced from an extension instead of a simple ripgrep filesystem scan.Note that a 'file search' is what happens when you do
CTRL+P
/CMD+P
and search for a file in your workspace (but is also done in other places, like when an extension uses an API to find files).Think about the following scenario: you have a virtual filesystem, so you use the filesystem provider API to show files differently than how it is stored on disk. You would want to use this API to override how search usually works so that it searches the content based on how you are presenting it in the virutal filesystem. This way, results in the quick open (for example) are correct.
Note that this currently only works for resources of an alternate (not
file://
) scheme.Set up
Update to the latest Insiders.
Create an extension to test with. To enable the proposed API, use the following in your
package.json
:and run
npx vscode-dts dev
to download the proposed API files.You're going to test
fileSearchProviderNew
, which is the new shape forTextSearchProvider
.See below for the shape to test:
https://github.com/microsoft/vscode/blob/94f869842859c273491a8067d81f82f5fb30709a/src/vscode-dts/vscode.proposed.fileSearchProviderNew.d.ts
Testing
I like testing this with the existing filesystem provider API sample because it introduces a new URI scheme called
memfs://
that I can test with. Note that you can't override how it looks at regularfile://
schemes, so if you have a workspace that shows files normally, you can't trigger a custom provider.fileSearchProviderNew
formemfs://
.Where
yourProviderInstance
is an instance of a class that extendsfileSearchProviderNew
.Now, when testing, when you have the
memfs
filesystem initialized, does your provider work as expected? For example, open the quick open and see whether you can search yourmemfs
workspace as expected.Also, it'd be great if you could test
findFiles
andfindFiles2
against this API to see if you get your expected results.If you're feeling extra gutsy, you can even test with the new
findFiles2New
API (but don't feel too pressured to do this- I have another TPI to test this API in-depth)! :)Thanks for testing! Please message me if you have any questions! I intentionally left this testing section vague so that I can get a measure of how easy it is to adopt the API.
Known bug
The
session
option says it isunknown
, but really, it still is aCancellationToken
. This shouldn't make a difference, but my intention in the future is for the session to be a simple empty JS object. Since aWeakMap
will make entries disappear once they object is garbage collected, the empty JS object would disappear from theWeakMap
once VS Code stops referencing the object in its internal map. PR: #226687The text was updated successfully, but these errors were encountered: