Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vscode struggles to auto-import lodash #4062

Closed
tnrich opened this issue Nov 15, 2018 · 7 comments
Closed

vscode struggles to auto-import lodash #4062

tnrich opened this issue Nov 15, 2018 · 7 comments
Labels

Comments

@tnrich
Copy link

tnrich commented Nov 15, 2018

Hey there, does anyone know why vscode struggles to auto-import lodash modules?

Here I'm looking for lodash's array.compact method, but while recompose has an auto-import suggested, lodash's auto-import doesn't seem to want to show up:
image

If this could be remedied that would be awesome because lodash is a great library!

@jdalton
Copy link
Member

jdalton commented Nov 15, 2018

Hi @tnrich!

I'm not too sure. You might have better luck on the vscode repo. I'm going to guess maybe it has to do with the way they prioritize their typing hints.

@jdalton jdalton closed this as completed Nov 15, 2018
@tnrich
Copy link
Author

tnrich commented Nov 15, 2018

Hey @jdalton!

Thanks for the quick response.

It's possible that vscode needs to do something on their end, but... this functionality does seem to work fine with most other popular packages. That makes me think it probably has something to do with how lodash is exporting its modules or how lodash is arranging its declaration files.

If most other packages work it seems like one as popular as lodash should work as well.

@tnrich
Copy link
Author

tnrich commented Aug 1, 2019

Any response to this sentiment @jdalton :

It's possible that vscode needs to do something on their end, but... this functionality does seem to work fine with most other popular packages. That makes me think it probably has something to do with how lodash is exporting its modules or how lodash is arranging its declaration files.

If most other packages work it seems like one as popular as lodash should work as well.

?

It seems like it could be fixed on our end? (And maybe has to because I'm not really getting anywhere with microsoft/vscode#63239 and microsoft/TypeScript#29039)

Thanks!

@jdalton
Copy link
Member

jdalton commented Aug 1, 2019

Lodash is a popular package (the most popular in fact) so the pressure, if the issue is wide spread enough, should raise the priority for vscode. You're likely seeing an issue with lodash or lodash-es compared to others because Lodash has ~643 modules for it to possibly pull in.

@ricsam
Copy link

ricsam commented Aug 8, 2019

To just fix the problem I do the following:

yarn add @types/lodash@npm:@types/lodash-es

and maybe yarn add lodash@npm:lodash-es

If you want some functionality from lodash that is not part of lodash es, like runInContext, install it under an alias:

yarn add lodash_original@npm:lodash
yarn add @types/lodash_original@npm:@types/lodash

@xuych
Copy link

xuych commented Jan 25, 2022

npm i -d @types/lodash, restarted vscode, then it works.

@sarimarton
Copy link

sarimarton commented Mar 9, 2023

npm i -d @types/lodash, restarted vscode, then it works.

Adding @types does not make it work for me. This is still an annoying issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

5 participants