0

I do not expect VSCode to work flawlessly for other programming languages. But it always seemed like it has great support for typescript. But it does not work so well for me. I do not know if something is configured wrong or if I am missing something.

The biggest problem I have is with the auto import. When I try to import for example an angular module, it does not work unless I manually import it once with import {} from '@angular/router' at the top. Then VSCode find all modules in the router package. Is this supposed to work that way?

Another problem is that auto complete suggestion are really slow. While I am typing VSCode just freezes for 1 or 2 seconds and then it show the auto complete suggestions.

This is in my tsconfig.json if this is of any help.

{
  "compileOnSave": false,
  "compilerOptions": {
    "rootDir": ".",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "importHelpers": true,
    "target": "es2015",
    "module": "esnext",
    "typeRoots": ["node_modules/@types"],
    "lib": ["es2017", "dom"],
    "skipLibCheck": true,
    "skipDefaultLibCheck": true,
    "baseUrl": ".",
  },
  "exclude": ["node_modules", "tmp"]
}

Does anyone else have these problems? Or does anyone know how to solve these?

Edit: More info of my system

OS: Manjaro 5.4.44-1

VSCode: v1.47.0

Typescript: 4.0.0-dev.20200710

Sakkaku
  • 1
  • 1
  • 2
  • There are plugins for that like [this](https://marketplace.visualstudio.com/items?itemName=steoates.autoimport) – Eldar Jul 11 '20 at 09:09
  • I tried it. Did not change anything. – Sakkaku Jul 11 '20 at 09:29
  • 1) Your VS Code is out of date. 2) Ensure VS Code is using the latest version of TypeScript. 3) The official VS Code _is_ open source. – Aluan Haddad Jul 11 '20 at 10:32
  • My package manager did not update the package for some reason. So I now installed the microsoft-branded release of vscode (that is what I meant with open source). I am now on version 1.47.0 and have the extension Typescript Nightly and it still does not work. – Sakkaku Jul 11 '20 at 12:04

5 Answers5

0

I am sure there is no issue in your ts configuration.... it must be something with VSCode software only... Do one thing upgrade your VSCode software and also install some third party extension to support Auto intelligence.... In my case I have installed TSLINT and it's working great

vijay sahu
  • 765
  • 1
  • 7
  • 29
  • It is already up-to-date. In case it matters, I am using the open source version of VSCode. And the TSLINT extensions it already installed on default and that should not affect anything for auto import. The name already says that it is for tslint. – Sakkaku Jul 11 '20 at 09:32
  • I have created many project in the past and it always did not work. Do not think it will make a difference now. – Sakkaku Jul 11 '20 at 12:04
  • Then vscode owner him self won't help you brother... It should work.. bcz it's a default feature of vscode.... you should contact them directly via twitter – vijay sahu Jul 11 '20 at 13:05
0

Couple of things that I found out after long research

The freezes on auto complete only happens with the "Javascript and Typescript Nightly" extension enabled.

And the problem with auto import is just not working There is this issue on github #37812 that was just closed recently. It should fix the auto import for modules that have their own location for the @types files like angular material does. It should be in the typescript 4.0 release. So I just have to wait.

Sakkaku
  • 1
  • 1
  • 2
0

Had this issue as well, VSCode auto-import suggestions freezed, just worked once on the editor startup and then stopped.

Disabling the "Javascript and Typescript Nightly" extension fixed this problem, as @Sakkaku mentioned.

0

For those who are experiencing VS Code auto-import issues, it could be likely that your Javascript/Typescript IntelliSense is not working properly because of missing TypeScript and JavaScript Language Features.

In the Extensions tab, search for @builtin TypeScript and JavaScript Language Features, then enable it:

Screenshot of the extension

Reference: Visual Studio Code autocomplete/IntelliSense not working properly for JavaScript

Gino Mempin
  • 25,369
  • 29
  • 96
  • 135
0

JUST use the Auto Import extension in your VScode editor. by writing the name of the module automatically import them at the top of the page. you can even find the link here

Seyed-Amir-Mehrizi
  • 720
  • 1
  • 5
  • 19