question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItĀ collects links to all the places you might be looking at while hunting down a tough bug.

And, if youā€™re still stuck at the end, weā€™re happy to hop on a call to see how we can help out.

TypeScript server slow - CPU goes up to 160% when waiting for the autocompletion

See original GitHub issue

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

  • VS Code Version: Version: 1.61.0-insider (Universal)
  • Operating system:
  • macOS 11.5.2

Steps to Reproduce:

  1. Got a simple Next.js application with react-hook-form installed (not sure if that matters), trying to get autocompletion on their useForm hook. Shows me ā€œLoadingā€¦ā€, takes a couple seconds, and CPU jumps up to 160% in the Activity Monitor. (I also got autocomplete issues on other places, not only on their hook, just used that as an example).
  2. Originally got this issue in the normal version. Switched over to the Insiders version and still got this issue. The project isnā€™t large and my CPU usage only spikes when I use features from the TypeScript server. I already installed the typescript@next extension and made sure that VSCode uses that version, unfortunately the same issue.

Even saving ts/tsx files can take a couple seconds. And whenever I try to use something that it is not imported, it shows the red line under it. However, when I do import it, it takes a couple seconds before VSCode notices it so the ā€œnot importedā€ error stays there for quite a long time and my CPU usage spikes.

Edit: I recorded a small video that shows when my CPU usage spikes and that VSCode randomly had trouble with importing a few things and that it takes a couple of seconds before it noticed that I already imported it. Also the autocomplete takes a couple of seconds and the CPU usage also spikes on that.

(I am not too sure why VSCode didnā€™t automatically import the first two hooks, I needed to manually click on them and then it let me import them, as you can see in the video.)

https://user-images.githubusercontent.com/23482089/132833606-1c13bde4-a232-4f11-925f-cedccf7b239c.mov

When using the normal VSCode (not the Insiders version), the autocomplete is even slower and the CPU usage spikes up to 180% (even though all extensions are disabled). I noticed that the fans were going crazy when I was waiting for the autocompletion.

In the Process Explorer, electron_node tsserver.js is the one that spikes.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:6
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
ginocommented, Sep 11, 2021

@andrewbranch Just tried to put that setting to false in VSCode, unfortunately it doesnā€™t seem to be effective for me.

However, as soon as I remove the package that has this ajv package, my autocompletion feels much faster than before. I think the issue is also not there when I just donā€™t import anything from that specific package.

It maybe has something to do with zod, Iā€™ve had seen multiple comments about that crashing TS servers. My issue is completely gone as soon as I remove that package. Iā€™ll try to use 4.2 of TypeScript to see if that solved anything.

1reaction
ginocommented, Oct 17, 2022

@andrewbranch Thanks a lot for your quick response! Totally makes sense. I will look into whatā€™s actually happening and keep you updated.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeScript server slow - CPU goes up to 160% when ... - GitHub
Shows me "Loading..", takes a couple seconds, and CPU jumps up to 160% in the Activity Monitor. (I also got autocomplete issues on...
Read more >
My typescript is very slow - Reddit
Anything related to typescript intellisense, autocompletion, type checking, import, etc. is taking a very long time.
Read more >
VS Code Intellisense is extremely slow - Stack Overflow
Solution 1: First check if you have any extensions that's unresponsive. Navigate to command palette from Settings(bottom left corner), type in 'Ā ...
Read more >
Bug listing with status RESOLVED with resolution OBSOLETE ...
g.o 's SSL cert with AES256+SHA as insecure" status:RESOLVED ... window flash, 100% CPU" status:RESOLVED resolution:OBSOLETE severity:normal Ā· Bug:254877Ā ...
Read more >
VzJ - River Thames Conditions - Environment Agency - GOV.UK
The flock vs nwo, Bikehut cycle computer, Weather 33015 fl, L'est eclair torvilliers, Pachmayr grip glock 22 gen 4. American airline check in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found