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 intellisense not working with typescript 3.7.5 in Angular projects #37187

Closed
admosity opened this issue Mar 3, 2020 · 9 comments
Closed
Assignees
Labels
Duplicate An existing issue was already created

Comments

@admosity
Copy link

admosity commented Mar 3, 2020

TS Template added by @mjbvz

TypeScript Version: 3.7.5

Search Terms

  • angular

Using the latest vscode with Typescript 3.7.5, intellisense breaks for anything referencing node_modules. This is reflected on new projects created with @angular/cli as well. Tested on an Angular 7 project to see if the version difference between Angular 7 and Angular 9 made a difference.

> code --version
1.42.1
c47d83b293181d9be64f27ff093689e8e7aed054
x64

Steps to Reproduce:

  1. Type a symbol that can be indexed from node_modules (e.g. ReactiveFormsModule from Angular).
  2. Hit ctrl+space or whatever is the intellisense hotkey is configured..
  3. No Suggestions appears.

Switching to the lower workspace Typescript version in my Angular 7 setup I can get the suggestions to show again.

Video reproduction with Typescript version switch:
intellisense-repro

On a fresh Angular 9 setup:

image

Does this issue occur when all extensions are disabled?: Yes
image

Same project in Atom:

image

EDIT: This appears to be happening in Atom with Typescript 3.7.5 as well now in the Angular 9 setup. Might be specifically a Typescript 3.7.5 issue.

EDIT EDIT: It seems that adding node_modules/@angular as a typeRoot fixes some issues:

TSCONFIG:

{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "downlevelIteration": true,
    "experimentalDecorators": true,
    "module": "esnext",
    "moduleResolution": "node",
    "importHelpers": true,
    "target": "es2015",
    "typeRoots": [
      "node_modules/@types",
      "node_modules/@angular"
    ],
    "lib": [
      "es2018",
      "dom"
    ]
  },
  "angularCompilerOptions": {
    "fullTemplateTypeCheck": true,
    "strictInjectionParameters": true
  }
}

It seems that adding node_modules/@angular as a typeRoot fixes some issues:
image

image

@mjbvz
Copy link
Contributor

mjbvz commented Mar 3, 2020

Does it work as expected with Ts 3.8? I believe they fixed a few bugs related to newer angular versions in that release

@admosity
Copy link
Author

admosity commented Mar 3, 2020

Same result with 3.8:

image

@admosity
Copy link
Author

admosity commented Mar 3, 2020

I pushed up the setup that was generated by angular's cli tool:

https://github.com/admosity/angular-9-vscode-intellisense

Maybe it could just be me...

@mjbvz mjbvz transferred this issue from microsoft/vscode Mar 3, 2020
@mjbvz mjbvz removed their assignment Mar 3, 2020
@microsoft microsoft deleted a comment from vscodebot bot Mar 3, 2020
@DanielRosenwasser
Copy link
Member

Verified in 3.9.0-dev.20200303

@DanielRosenwasser
Copy link
Member

Ideally typeRoots shouldn't need to be specified at all here. I'm not sure if Angular CLI itself does that at all. (@mgechev)

@mgechev
Copy link

mgechev commented Mar 4, 2020

FYI angular/angular-cli#17149.

@andrewbranch
Copy link
Member

Duplicate of #36042 (canonical), #30033, #30474, and #28773.

@andrewbranch andrewbranch added Duplicate An existing issue was already created and removed Bug A bug in TypeScript Domain: Auto-import labels Mar 4, 2020
@andrewbranch andrewbranch removed this from the TypeScript 3.9.0 milestone Mar 4, 2020
@typescript-bot
Copy link
Collaborator

This issue has been marked as a 'Duplicate' and has seen no recent activity. It has been automatically closed for house-keeping purposes.

@cjdreiss
Copy link

cjdreiss commented Aug 3, 2020

@admosity did you ever find a solution? This seems like an issue I have at work. We have a parent library/project which contains all the dependancies in its package json (angular, rxjs, etc). Our child apps have only the parent in their package.json now so we don't need to worry about updating every app's package.json, but now imports don't work.

I've tried adding to typeRoots but it doesn't seem to do anything... Using Angular 10 / TS 3.9.6 (although we had the issue in Angular 9 and whatever TS 3.8.x version it used too).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

7 participants