-
Notifications
You must be signed in to change notification settings - Fork 283
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(extensions/#3215): Part 1 - Implement max count parameter for fin…
…dFiles API (#3241) __Issue:__ Some extensions that use the `vscode.workspace.findFiles` API wouldn't work as expected - like the [Live Server](https://open-vsx.org/extension/ritwickdey/LiveServer) extension. __Defect:__ The `maxCount` argument wasn't being used by Onivim - so for a very large folder, we might not finish traversing for a while. In addition, the `readdir` call could fail, in which case no result would be returned at at all. __Fix:__ Implement handling of `maxCount`, and short-circuit the find-in-files once the limit is reached. This fixes the first blocking issue for #3215
- Loading branch information
Showing
7 changed files
with
225 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
open Oni_Model; | ||
open Oni_IntegrationTestLib; | ||
|
||
// This test validates: | ||
// - The 'oni-dev' extension gets activated | ||
// - When typing in an 'oni-dev' buffer, we get some completion results | ||
runTest(~name="ExtHostWorkspaceSearchTest", ({dispatch, wait, _}) => { | ||
wait(~timeout=30.0, ~name="Exthost is initialized", (state: State.t) => | ||
Feature_Exthost.isInitialized(state.exthost) | ||
); | ||
|
||
// Wait until the extension is activated | ||
// Give some time for the exthost to start | ||
wait( | ||
~timeout=30.0, | ||
~name="Validate the 'oni-dev' extension gets activated", | ||
(state: State.t) => | ||
List.exists( | ||
id => id == "oni-dev-extension", | ||
state.extensions |> Feature_Extensions.activatedIds, | ||
) | ||
); | ||
|
||
// Search for 1 match | ||
dispatch( | ||
Actions.Extensions( | ||
Feature_Extensions.Msg.command( | ||
~command="_test.findFiles", | ||
~arguments=[`Int(1)], | ||
), | ||
), | ||
); | ||
|
||
// Wait for a notification | ||
wait( | ||
~timeout=30., | ||
~name="Got success notification for 1 result", | ||
(state: State.t) => { | ||
let notifications = Feature_Notification.all(state.notifications); | ||
notifications | ||
|> List.exists((notification: Feature_Notification.notification) => { | ||
notification.message == "success:1" | ||
}); | ||
}, | ||
); | ||
|
||
// Search for multiple matches | ||
dispatch( | ||
Actions.Extensions( | ||
Feature_Extensions.Msg.command( | ||
~command="_test.findFiles", | ||
~arguments=[`Int(3)], | ||
), | ||
), | ||
); | ||
|
||
// Wait for a notification | ||
wait( | ||
~timeout=60., | ||
~name="Got success notification for 5 results", | ||
(state: State.t) => { | ||
let notifications = Feature_Notification.all(state.notifications); | ||
notifications | ||
|> List.exists((notification: Feature_Notification.notification) => { | ||
notification.message == "success:3" | ||
}); | ||
}, | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.