vscode icon indicating copy to clipboard operation
vscode copied to clipboard

TS Server high CPU usage (Intellisense and typescript features stop working)

Open thomscoder opened this issue 1 year ago • 1 comments

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

  • VS Code Version: Version: 1.94.2 Commit: 384ff7382de624fb94dbaf6da11977bba1ecd427 Date: 2024-10-09T16:08:44.566Z Electron: 30.5.1 ElectronBuildId: 10262041 Chromium: 124.0.6367.243 Node.js: 20.16.0 V8: 12.4.254.20-electron.0 OS: Darwin arm64 24.0.0

  • OS Version: MacOS Sequoia 15.0.1

Steps to Reproduce:

Opening a fairly large typescript project (in my case React-typescript project) and switching between files, the Intellisense stops working. Gets stuck on Analyzing FILE_NAME and its dependencies, Macbook heats up.

electron-nodejs (tsserver.js) process exceeds the 100% CPU usage and does not get lower than 80% in background.

Image

ps aux returns (on another instance)

Image

thomscoder avatar Oct 18 '24 11:10 thomscoder

Same issue for me. It's preventing intellisense from showing results at all.

Image

I am also on an M1 Mac.

Of note: I disabled all extensions and I still have the same issue.

More investigating: This seems to be project specific. Some of my projects have this issue and some work fine. I am attempting to find where the issue originates, but these are big projects and will take a lot of time to pull apart.

FInal edit:

I found the issue. It specifically had to deal with a recursive type that was introduced from a typo when I utilized react-hook-form. After resolving the typo causing the recursion, my intellisense feedback is back online.

I will note, this is my first time having a major issue with recursive types. Usually VSCode has historically been able to graciously handle the scenario without hosing the process.

Also of note: running a direct ts check on the project ran a little -longer- than usual with the recursion, but still didn't break near as bad as what VSCode was experiencing.

Diniden avatar Oct 18 '24 21:10 Diniden

Any chance you could provide a minimally reproducible example for this recursive type? Did you discover it via logs or something else?

rwalle avatar Oct 24 '24 11:10 rwalle

@Diniden Could you please provide the code to reproduce the issue? Even if the type is invalid this really shouldn't happen

mjbvz avatar Nov 05 '24 19:11 mjbvz

This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.

Happy Coding!