Implement "Add to project" action for querysync. #5246
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implement "Add to project" action for querysync.
Create a new action rather than updating the existing AddSourceToProjectAction since there is little in common between the new and existing.
The new action works by finding candidate packages by running a query on the selected directory until it finds one with some build packages defined in it. If it finds a directory with a single package, it also queries parent directories to offer the user some choice. This also ensures that the directory chosen is always meaningful, i.e. contains some build packages. Adding a directory with no packages defined inside would break subsequent sync queries.
Use a popup to show the packages that were found, allowing the user to choose. Show some progress UI while running the queries, allowing the user to cancel.
Use the existing support to edit the local project view, and then perform a full project sync to update the project structure.
Add a test case for the core logic inside CandidatePackageFinder.