36

this is my computer:

  • MacBook Pro (16-inch, 2019)
  • 2.3 GHz 8-Core Intel Core i9
  • 16 GB 2667 MHz DDR4
  • Intel UHD Graphics 630 1536 MB

When working with typescript in angular this happens: enter image description here

The bigger the project the longer I have to wait for this to load. Really ruins my developer experience. Is there a way I can assign more resources to vs code so it runs faster? Are there any optimizations that I can do to make it work?

Solutions attempted:

Example Project structure:

  • project structure
Raphael Castro
  • 907
  • 1
  • 8
  • 26

5 Answers5

26

Disabling this made it lightning quick.

Try this to see if it is a particular extension.

  • Open Command Palette (Ctrl+Shift+P)
  • Type in "Disable all installed extensions"
  • Enable them one by one or in groups and test the IntelliSense speed
Anush Bhatia
  • 482
  • 3
  • 8
  • 14
    GitLens was the culprit for me. – Ali Bdeir Feb 08 '22 at 23:03
  • 14
    You can do the same with the command `Extension Bisect`. VS Code will guide you through finding the troubled extension – kendepelchin Aug 02 '22 at 12:44
  • 2
    @kendepelchin extension bisect is super cool! I identified `IntelliCode API Usage Examples` extension to be using a similar slowness issue for me. Thanks Microsoft for pushing this one onto me for testing :D – domjancik Aug 11 '22 at 09:18
  • 1
    Bisect is awesome! It should be the correct answer for this question – Cayan Mar 03 '23 at 12:19
11

Options :

  • Disable the built-in extensions and restart the computer

  • Disable eslint and tslint-plugin

  • Depends on your VsCode version

LuckyFr
  • 401
  • 1
  • 5
  • 19
  • 2
    This worked thank you! ESLint and Gitlens being disabled fixed the slowness. The intelisense AND the errors now show instantly – Daniel Feb 10 '22 at 00:16
6

Just go to settings, search for and check this box >

TypeScript: Disable Automatic Type Acquisition

enter image description here

Jeff Hogg
  • 771
  • 6
  • 4
  • 2
    This is a useful feature, I'm not sure OP want to disable it – dolig Nov 22 '22 at 10:26
  • Wow, this feature was causing all sorts of inconsistencies for me, didn't even know it existed. @types are cool and all but sometimes they're wrong/outdated and I've removed them from my package.json but apparently this thing has been downloading and using them anyway, but only sometimes, for some reason. – user1340531 Mar 15 '23 at 17:44
  • I thought this feature is only relevant to JavaScript files. I've never seen @types packages fetched automatically in TypeScript files, I've had to install them explicitly into my project. Intellisense in my TS files is still slow with disabled automatic type acquisition. – Art Ginzburg Jun 13 '23 at 01:13
2

If you are using mongoose, some versions also cause this (5x and apparently some of the 6x). Updating mongoose or switching for prisma might solve the problem.

sorold
  • 475
  • 7
  • 17
1

I myself faced this issue. To fix this I changed the typescript SDK that VScode uses. First get the latest version of Typescript globally using npm or yarn.

npm i -g typescript@latest

Then, you'll need to get the location where your typescript library is installed globally, to do so run the following command

npm root -g

This will give the path of global node_modules. For eg, C:\Users\bob\npm\node_modules Then in VSCode settings search for typescript.tsdk and in the input field paste the path that you copied from the last command and append /typescript/lib. For eg, C:\Users\bob\npm\node_modules\typescript\lib enter image description here

Then try restarting VSCode... Hope this thread helps :)