Artemis
Artemis

Reputation: 83

VS Code is not sugging imports from inside the node_modules

I am experiencing issues when using "V.S. Code". All of my settings were deleted (or that is the way it seems). I reinstalled V.S. Code, but now I cannot get auto imports to work.

For example:

When I write useEffect, I expect VS Code to suggest an import for it from the node modules, however, its not suggesting it.

enter image description here


        How can this issue be fixed?

Upvotes: 4

Views: 7254

Answers (4)

thfrod
thfrod

Reputation: 1

I faced the same issue and the @Adrian Mole answer helped fix it. Basically, my settings.json had the property "typescript.tsdk" like that:

"typescript.tsdk": "node_modules\\typescript\\lib",

So, I basically changed to:

"typescript.tsdk": "./node_modules/typescript/lib",

And it all worked out. Thanks!

Upvotes: 0

Ihab
Ihab

Reputation: 21

You might need to add this line to your VS Code "settings.json" file:

{
  "typescript.tsdk": "./node_modules/typescript/lib"
}

Upvotes: 2

Artemis
Artemis

Reputation: 83

Okay, I found the answer. The problem was that by default the extension "TypeScript and JavaScript Language Features" was disabled. After enabling now everything work

https://i.sstatic.net/mGp4H.png

Upvotes: 4

Lucifer
Lucifer

Reputation: 502

Use language extension if vs code as Typescript React Js

Upvotes: 0

Related Questions