'vscode auto import, suggestion problem in Angular 7
vscode auto import and suggestion worked just fine with angular 6. but ever since I had upgraded to Angular 7 it didn't work. It seems to me that vscode can't import from node modules. I was trying to import module but no suggestion came from vscode. For example, it can't even suggest and import FormsModule. What can I do to overcome this issue ?
Vscode Version: 1.33.1
Node.js: 10.2.0
OS: Windows_NT x64 6.3.9600
Package Version
@angular-devkit/architect 0.13.8
@angular-devkit/build-angular 0.13.8
@angular-devkit/build-optimizer 0.13.8
@angular-devkit/build-webpack 0.13.8
@angular-devkit/core 7.3.8
@angular-devkit/schematics 7.3.8
@angular/cdk 7.2.0
@angular/cli 7.3.8
@angular/http 6.1.10
@angular/material 7.2.0
@ngtools/webpack 7.3.8
@schematics/angular 7.3.8
@schematics/update 0.13.8
rxjs 6.3.3
typescript 3.2.4
webpack 4.29.0
Solution 1:[1]
Set:
"typescript.preferences.importModuleSpecifier": "non-relative"
and it will start working.
Solution 2:[2]
I have solved my problem. First I had to import any class/module from any folder in node modules in any file under my workspace. After that vscode automatically detect the other contents (class/module) of that folder under node modules in that workspace.
for example I manually imported MatCardModule from angular/material in one of my file under my workspace. From the next time, vscode detected MatButtonsModule and others in that folder in every file of my workspace.
Thanks for patience
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Sebastian |
Solution 2 | Shah Ali Hridoy |