Closed OriMarron closed 5 years ago
Nice improvement, thanks again!
@OriMarron Heads up, this appears to get into an infinite loop on Windows. I'm gonna see if I can figure it out before I go to sleep, otherwise I might revert and get the other changes published.
Figured out the infinite loop, but there still a couple of UX things I would like to address (for example, I would like the behavior of the options added to the bottom of the quick pick for going up a level and back to root to be consistent/predictable regardless of where you are, which isn't the case with these new changes), so I will take a look at those tomorrow.
Hi @jasonnutter I would really like to see this published, and I'm willing to help with whatever is needed :)
Hey, @OriMarron will this solve https://github.com/jasonnutter/vscode-search-node-modules/issues/23#issuecomment-519087317? Is it already published?
@deadcoder0904 I believe it will solve the original question, but not your use-case which is slightly different. In any case, a new version of the extension was not published yet as far as I know.
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 #11. They are meant for different use-cases, and will not break each other
@jasonnutter