enhancementhelp wanted
Description
There is a requirement that we want to find enough modules to import from. But it also brings up noise and brings down performance.
An idea to optimize performance: scan through the all the node_modules, but skip all its sub node_modules. It's rare to import anything from node_modules of a node_modules module, while those files are the most costy and noisy.
Ideas to rank the possible imports:
- Look at current file's sibling files. Imported modules referred by those files are likely more interested for current file
- To extend idea 1, we can use a daemon to construct a tree of import histograms. It will be a mirror of the workspace folder structure but the leaves will be the imported objects. When a file request a import keyword, then query through the tree to find all import leaves that has the matching name. Then use some algorithm to properly add weight or reduce weight based on number of usages and distance of those usages from current file.
I don't have specific algorithm in mind yet but it can be some heuristic approach.
@lencioni