Tombalabomba
Tombalabomba

Reputation: 480

Intellisense/autoImport/importSuggestions not working in angular/vsCode/typescript

I am having trouble with auto importing node_modules in angular, vsCode

Expected behaviour: When i start typing a name of an installed module in my angular typescript files, for instance "MatMenuM" or "HttpCl", a suggestion for an import should appear.

Current behaviour: The correct suggestion does not appear

matMenuModule suggestion fail

httpclient suggestion fail

My environment: Fresh angular project on windows 10 with newest(28.03.2022) versions of angular cli, node, typescript, vsCode, only two extensions, all up-to-date, and imported newest angular material.

angular version

tsconfig.json

tsconfig.app.json

extensions all up-to-date

angular.json 1

angular.json 2

package.json

import settings

I realize that this question has been asked a couple of times, but none of the answers solve my problem. Also the angular and ts versions might be different. I will link all related questions below. I also tried all of the suggested solutions:

I tried:

typeroot issue with cli

Also this github issue related to the same problem sais the issue should be fixed with the new ts version... which it isn't for me.

Related questions: 1, 2, 3, 4, 5

Help will be much appreciated!

Edits: images not formatted correctly, spelling

Upvotes: 4

Views: 10711

Answers (1)

Tombalabomba
Tombalabomba

Reputation: 480

Solved my problem:

VsCode does not autosuggest modules out of the box, even with older versions as far as i can tell. I was under the misconception that it did, since in my work project, suggestions work fine, however now i realize that was only because:

VsCode needs the module to be imported at least once (doesn't matter where) to suggest it everywhere.

So you have to import it once, then vsCode starts suggestions, which means only one time pain.

Still setting up a new project can be tedeous that way, i will use webstorm(suggests everything out of the box) as a setup IDE, then if my project as enough imports, i can still switch back to vsCode.

Upvotes: 12

Related Questions