Suggestion: Add ability to search in parent folders #13
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.
background
In #11 I attempted to solve the use-case of a user opening a monorepo with several projects, by allowing to search in any of them.
However, some users prefer not to open the entire monorepo, but rather only a single project from it - and I want to address this use-case as well.
Since some node modules may be hoisted to the root level by lerna/yarn, they may be located outside the scope of the VSCode workspace, and the user can't find them.
My suggestion is to have the search results also include node_modules from parent directories.
details
consider the following structure of a monorepo:
The folder opened in VSCode is
/packages/project-a
.jquery
is unfortunately out of scope for the search.With this new feature, instead of only searching under the workspace directory, the extension will also search above it. i.e. Recursively traversing the directory tree upwards looking for
/node_modules
.Note:
All found node modules will include their relative path (e.g.
../../node_modules
) to indicate their non-trivial location.The parent modules will only be included when searching at the root level of the workspace, meaning that after a specific folder is selected for traversing, these extra modules will not appear.
When traversing a specific module from a parent folder, the extra option to navigate back to
root/node_modules
will appear, but the extra option to step back (..
) that is usually shown, will not be shown, since it will only take you further away from the workspace.You can opt out of this feature by turning off the new configuration field
searchParentModules
This feature can work together with the one suggested in Suggestion: Add initial support for Lerna monorepos #11. They are meant for different use-cases, and will not break each other
@jasonnutter