In #44713, we started to do partial resolutions of paths for auto-import completions. This is great, however, it would be nice if we could do a small amount of work for common cases just to clean up paths that go through node_modules even without further keystrokes.
- In cases where the resolution strategy is
node and there are no path mappings, we could try to rewrite some number of dotted segments, followed by node_modules into package_name/... until fully resolved.
- In other cases, we could even just use
containingFolderName/filename
Of course, there are risks here since in JS, string math isn't always cheap. In cases where you have hundreds of thousands of auto-imports from node_modules, this could still get expensive.
In #44713, we started to do partial resolutions of paths for auto-import completions. This is great, however, it would be nice if we could do a small amount of work for common cases just to clean up paths that go through
node_moduleseven without further keystrokes.nodeand there are no path mappings, we could try to rewrite some number of dotted segments, followed bynode_modulesintopackage_name/...until fully resolved.containingFolderName/filenameOf course, there are risks here since in JS, string math isn't always cheap. In cases where you have hundreds of thousands of auto-imports from
node_modules, this could still get expensive.