ChristianKohler / NpmIntellisense

Visual Studio Code plugin that autocompletes npm modules in import statements
MIT License
155 stars 45 forks source link

Support subfolder intellisense for scoped npm packages #55

Open nachocodoner opened 6 years ago

nachocodoner commented 6 years ago

I have been testing the extension, concretely the experimental feature of npm subfolder intellisense, which works greats. However, when having scoped packages, such as @scope/package-name, it doesn't work.

I have been diving into the code and I have seen that the scoped scenario is not covered, the plugin always split from the first slash it finds, check out here.

Probably we just need to do something like:

const scopedPkg = /(@\w*\/\w*)\/?(.*)/g.exec(pkgFragment);
const pkgFragmentSplit = scopedPkg ? scopedPkg.slice(1, 3) : pkgFragment.split('/');
const packageName: string = pkgFragmentSplit[0];

I have tried to change that in a fork, but I am not experienced to debug a vscode extension yet. So I thought that you may provide this fix quicker, it may affect to other parts as well.

Thank you!

RusinovAnton commented 6 years ago

Need this and ready to help. Could someone help with info on testing extensions from the fork/local package?