sveltejs / language-tools

The Svelte Language Server, and official extensions which use it
MIT License
1.21k stars 196 forks source link

VSCode Extension not working and Causing high CPU and Memory usage #2105

Closed Frankied2000 closed 1 year ago

Frankied2000 commented 1 year ago

Describe the bug

Using the basic install npm create svelte@latest testrepo ; See repo https://github.com/Frankied2000/testrepo.git

Reproduction

Open the project with VSCode and have extension enabled. Start Clicking on the svelte and ts files. My CPU starts wailing ...

These show up in the VSCode Process Explorer: image This is what it looks like: image

Expected behaviour

Want to not have CPU spike and be able to use the extension normally.

System Info

VSCode Version: 1.80.1 (system setup) Commit: 74f6148eb9ea00507ec113ec51c489d6ffb4b771 Date: 2023-07-12T17:22:07.651Z Electron: 22.3.14 ElectronBuildId: 21893604 Chromium: 108.0.5359.215 Node.js: 16.17.1 V8: 10.8.168.25-electron.0 OS: Windows_NT x64 10.0.19044

Svelte for VS Code: v107.9.0 npm -version 9.6.7 node --version v18.17.0

Which package is the issue about?

Svelte for VS Code extension

Additional Information, eg. Screenshots

I think I followed all the instructions properly really were not many image

I removed code.exe from all file associations also in windows besides checking the extension settings which were empty. Still no help. I physically removed all versions from .vscode\extensions and re-installed from VS Code.

Hoping you can help just converted my larger app to svelte4 and latest everything and this happened. I am going to try a previous version of the extension next.

Frankied2000 commented 1 year ago

svelte for VS Code v107.6.0 works ok. CPU comes up a little when opening files but settles back quickly

jasonlyu123 commented 1 year ago

Does it get stuck for a long time or something? I cloned the repo but didn't see any obvious performance problems. The CPU usage ramped up for less than a minute and returned to normal. Is there a specific file that has a problem?

Frankied2000 commented 1 year ago

It stays at the 40-50% for me just clicking layout.svelte and random files. refresh is very slow to see format changes. What else could be different for me? I do have admin rights and installed the VS Code (system setup). Could the extension be installed somewhere else that I need to remove.

jasonlyu123 commented 1 year ago

Can you follow these steps to get some logs so we can maybe narrow down the problem?

  1. add these two config to your .vsocode/settings.json

    {
    "svelte.language-server.debug": true,
    "svelte.trace.server": "messages"
    }
  2. Restart your editor

  3. F1 > Output: show output channels > Svelte, and there will be some logging in the output channels near the terminal. Copy those and post them here.

Frankied2000 commented 1 year ago

[Trace - 9:41:08 AM] Sending request 'initialize - (0)'. Initialize language server at file:///c%3A/Dev/Workspaces/VSCodeRepos/testrepo [Trace - 9:41:10 AM] Received response 'initialize - (0)' in 1448ms. [Trace - 9:41:10 AM] Sending notification 'initialized'. [Trace - 9:41:10 AM] Sending notification 'textDocument/didOpen'. [Trace - 9:41:10 AM] Sending notification 'workspace/didChangeConfiguration'. [Trace - 9:41:10 AM] Sending request 'textDocument/documentSymbol - (1)'. [Trace - 9:41:10 AM] Sending request 'textDocument/codeAction - (2)'. [Trace - 9:41:10 AM] Received request 'client/registerCapability - (0)'. [Trace - 9:41:10 AM] Sending response 'client/registerCapability - (0)'. Processing request took 1ms [Trace - 9:41:10 AM] Sending request 'textDocument/documentColor - (3)'. [Trace - 9:41:10 AM] Sending request 'textDocument/inlayHint - (4)'. Initialize new ts service at c:/Dev/Workspaces/VSCodeRepos/testrepo/tsconfig.json Trying to load configs for c:/Dev/Workspaces/VSCodeRepos/testrepo [Trace - 9:41:10 AM] Received response 'textDocument/codeAction - (2)' in 78ms. [Trace - 9:41:10 AM] Sending request 'textDocument/semanticTokens/range - (5)'. [Trace - 9:41:10 AM] Sending request 'textDocument/semanticTokens/full - (6)'. [Trace - 9:41:11 AM] Sending notification '$/cancelRequest'. [Trace - 9:41:11 AM] Sending notification '$/cancelRequest'. [Trace - 9:41:11 AM] Sending notification '$/cancelRequest'. [Trace - 9:41:11 AM] Sending notification '$/cancelRequest'. [Trace - 9:41:11 AM] Sending notification '$/cancelRequest'. [Trace - 9:41:11 AM] Sending notification 'textDocument/didClose'. Loaded config at c:\Dev\Workspaces\VSCodeRepos\testrepo\svelte.config.js Using Svelte v4.1.1 from c:\Dev\Workspaces\VSCodeRepos\testrepo\node_modules\svelte\compiler SnapshotManager File Statistics: Project files: 21 Svelte files: 7 From node_modules: 0 Total: 21 [Trace - 9:41:12 AM] Received response 'textDocument/inlayHint - (4)' in 2614ms. [Trace - 9:41:12 AM] Received response 'textDocument/semanticTokens/range - (5)' in 2472ms. [Trace - 9:41:12 AM] Received response 'textDocument/semanticTokens/full - (6)' in 2173ms. Using Svelte v4.1.1 from c:\Dev\Workspaces\VSCodeRepos\testrepo\node_modules\svelte\compiler Using Svelte v4.1.1 from c:\Dev\Workspaces\VSCodeRepos\testrepo\node_modules\svelte\compiler [Trace - 9:41:15 AM] Received notification 'textDocument/publishDiagnostics'. [Trace - 9:41:15 AM] Received response 'textDocument/documentSymbol - (1)' in 5713ms. [Trace - 9:41:15 AM] Received response 'textDocument/documentColor - (3)' in 5709ms. [Trace - 9:41:15 AM] Received notification 'textDocument/publishDiagnostics'. [Trace - 9:42:10 AM] Sending notification 'textDocument/didOpen'. [Trace - 9:42:10 AM] Sending request 'textDocument/documentColor - (7)'. [Trace - 9:42:10 AM] Sending request 'textDocument/codeAction - (8)'. [Trace - 9:42:10 AM] Sending request 'textDocument/documentSymbol - (9)'. [Trace - 9:42:10 AM] Sending request 'textDocument/semanticTokens/full - (10)'. [Trace - 9:42:10 AM] Sending request 'textDocument/inlayHint - (11)'. [Trace - 9:42:10 AM] Sending request 'textDocument/semanticTokens/range - (12)'. [Trace - 9:42:14 AM] Received response 'textDocument/codeAction - (8)' in 3678ms. Executing next invocation of "getSemanticTokens" with low priority Executing next invocation of "getInlayHints" with low priority Executing next invocation of "getSemanticTokens" with low priority Using Svelte v4.1.1 from c:\Dev\Workspaces\VSCodeRepos\testrepo\node_modules\svelte\compiler SnapshotManager File Statistics: Project files: 21 Svelte files: 7 From node_modules: 178 Total: 199 Using Svelte v4.1.1 from c:\Dev\Workspaces\VSCodeRepos\testrepo\node_modules\svelte\compiler [Trace - 9:42:20 AM] Received notification 'textDocument/publishDiagnostics'. [Trace - 9:42:20 AM] Received response 'textDocument/documentColor - (7)' in 9606ms. [Trace - 9:42:20 AM] Received response 'textDocument/documentSymbol - (9)' in 9605ms. [Trace - 9:42:20 AM] Received response 'textDocument/semanticTokens/full - (10)' in 9595ms. [Trace - 9:42:20 AM] Received response 'textDocument/inlayHint - (11)' in 9571ms. [Trace - 9:42:20 AM] Received response 'textDocument/semanticTokens/range - (12)' in 9438ms. [Trace - 9:42:23 AM] Sending notification 'textDocument/didClose'. [Trace - 9:42:23 AM] Sending notification 'textDocument/didOpen'. [Trace - 9:42:23 AM] Sending request 'textDocument/documentColor - (13)'. [Trace - 9:42:23 AM] Sending request 'textDocument/codeAction - (14)'. [Trace - 9:42:23 AM] Sending request 'textDocument/documentSymbol - (15)'. [Trace - 9:42:23 AM] Sending request 'textDocument/semanticTokens/full - (16)'. [Trace - 9:42:23 AM] Sending request 'textDocument/inlayHint - (17)'. [Trace - 9:42:24 AM] Sending request 'textDocument/semanticTokens/range - (18)'. [Trace - 9:42:26 AM] Sending notification '$/cancelRequest'. [Trace - 9:42:26 AM] Sending notification '$/cancelRequest'. [Trace - 9:42:26 AM] Sending notification '$/cancelRequest'. [Trace - 9:42:26 AM] Sending notification '$/cancelRequest'. [Trace - 9:42:30 AM] Received notification 'textDocument/publishDiagnostics'. [Trace - 9:42:30 AM] Received response 'textDocument/codeAction - (14)' in 6782ms. [Trace - 9:42:31 AM] Received response 'textDocument/semanticTokens/full - (16)' in 7199ms. [Trace - 9:42:31 AM] Received response 'textDocument/inlayHint - (17)' in 7199ms. [Trace - 9:42:31 AM] Received response 'textDocument/semanticTokens/range - (18)' in 7166ms. Using Svelte v4.1.1 from c:\Dev\Workspaces\VSCodeRepos\testrepo\node_modules\svelte\compiler [Trace - 9:42:31 AM] Received response 'textDocument/documentColor - (13)' in 7999ms. [Trace - 9:42:31 AM] Received response 'textDocument/documentSymbol - (15)' in 8008ms. [Trace - 9:42:31 AM] Sending notification 'textDocument/didClose'. [Trace - 9:42:31 AM] Received notification 'textDocument/publishDiagnostics'. Using Svelte v4.1.1 from c:\Dev\Workspaces\VSCodeRepos\testrepo\node_modules\svelte\compiler [Trace - 9:42:32 AM] Received notification 'textDocument/publishDiagnostics'. [Trace - 9:44:13 AM] Sending notification 'textDocument/didOpen'. [Trace - 9:44:13 AM] Sending request 'textDocument/documentColor - (19)'. [Trace - 9:44:13 AM] Sending request 'textDocument/codeAction - (20)'. [Trace - 9:44:13 AM] Sending request 'textDocument/documentSymbol - (21)'. [Trace - 9:44:13 AM] Sending request 'textDocument/semanticTokens/full - (22)'. [Trace - 9:44:13 AM] Sending request 'textDocument/inlayHint - (23)'. [Trace - 9:44:13 AM] Sending request 'textDocument/semanticTokens/range - (24)'. [Trace - 9:44:15 AM] Received response 'textDocument/codeAction - (20)' in 1969ms. SnapshotManager File Statistics: Project files: 21 Svelte files: 7 From node_modules: 178 Total: 199 [Trace - 9:44:15 AM] Received response 'textDocument/semanticTokens/full - (22)' in 1968ms. [Trace - 9:44:15 AM] Received response 'textDocument/inlayHint - (23)' in 1943ms. [Trace - 9:44:15 AM] Received response 'textDocument/semanticTokens/range - (24)' in 1816ms. Using Svelte v4.1.1 from c:\Dev\Workspaces\VSCodeRepos\testrepo\node_modules\svelte\compiler Using Svelte v4.1.1 from c:\Dev\Workspaces\VSCodeRepos\testrepo\node_modules\svelte\compiler [Trace - 9:44:21 AM] Received notification 'textDocument/publishDiagnostics'. [Trace - 9:44:21 AM] Received response 'textDocument/documentColor - (19)' in 8176ms. [Trace - 9:44:21 AM] Received response 'textDocument/documentSymbol - (21)' in 8177ms.

mturnshek commented 1 year ago

I'm also experiencing this issue. Heading back to v107.6.0 which is working for now.

Frankied2000 commented 1 year ago

I pulled back to v107.5.1 which works better than v107.6. No clue why.

Frankied2000 commented 1 year ago

As of Svelte for VS Code v107.10.0. ISSUE IS RESOLVED for me. Thanks!