ChristianKohler / NpmIntellisense

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

Feature: Prompt user to install the package he's importing. #91

Open onexbash opened 6 months ago

onexbash commented 6 months ago

An idea for a next-level user experience

=> When importing a package that doesn't exist in the package.json => Prompt the user if he/she wants to add the package.

But this feature would only be awesome if it's #1 optional - can be turned on in settings.json #2 not forcing one to use npm. - pnpm / yarn / yarn pnp can be specified in settings.json.

That would be a game-changer, because it delivers a full circle feature, where you dont need to care about packages ever again. Right now I don't even see the big benefit of the extension how it is at the moment, because we already have all kinds of auto completions, that are working for npm modules as well.

onexbash commented 6 months ago

yarn & yarn pnp could be difficult and impossible for some packages, but pnpm uses the same library as npm, so all packages available for npm are also available for pnpm. That shouldn't be a big deal to implement. If you agree that the feature would be awesome but connected with too much import, let me know and I'll create a pull request for it.

ChristianKohler commented 6 months ago

Hey @fschlegelone

Thank you very much for the proposal. Since I am regularly using Stackblitz which offers this feature it also crossed my mind. Would definitely be a great feature.

Currently this plugins functionality is pretty simple which makes it also easy to maintain. I am hesitant to add this feature to this plugin since it would make it more complex and I don‘t have the capacity at the moment to maintain it then. I released the plugin under the MIT license and you can freely use this plugin as a basis for a new plugin if it helps you.

I appreciate that you first proposed the idea here before you created a new plugin and I hope you understand why I am hesitant to add the feature. Let me know if this works for you or if you see a strong reason why the feature should be added to the existing plugin. Thank you.