volar-plugins icon indicating copy to clipboard operation
volar-plugins copied to clipboard

When opening a huge d.ts file, there will be long periods of high CPU usage.

Open skywalker512 opened this issue 1 year ago • 2 comments

When I use https://github.com/alex8088/electron-vite to create an Electron Vue project, (pnpm create @quick-start/electron). Whenever I open electron.d.ts, I observe that volar ls has a long 100% CPU usage, during which ls does not respond to other operations.

image

CPU-20231031T215046.cpuprofile

I am not very familiar with vscode, ts, lsp. I observed using the Chrome performance panel and found that it occupies a lot of time here.

https://github.com/volarjs/services/blob/v0.0.16/packages/typescript/src/features/codeAction.ts#L102

It was introduced in https://github.com/volarjs/services/pull/29

I looked up the implementation of the vscode ts plugin and found that it does not invoke getEditsForRefactor in provideCodeActions. (I am not very familiar with vscode) https://github.com/microsoft/vscode/blob/1.83.1/extensions/typescript-language-features/src/languageFeatures/refactor.ts#L487

skywalker512 avatar Oct 31 '23 14:10 skywalker512

At the same time, I also found that if I use version 5.1.6 of Typescript, there is no such issue (VSCode will not display the light bulb icon).

  • 5.1.6 image

  • 5.2.2 image

skywalker512 avatar Nov 01 '23 02:11 skywalker512

In volar 2.0, there shouldn't be this issue.

skywalker512 avatar Dec 15 '23 12:12 skywalker512