language-tools
language-tools copied to clipboard
Extension slow to respond
Describe the bug
Getting auto-completion, symbol navigation or symbol information can be very slow (tooltip stuck on Loading...).
(It is probably the language server, because the profile from "Running Extensions" does not pick it up as causing CPU load.)
To Reproduce Invoke commands like "Trigger Suggest" and "Go to Definition".
As for the conditions necessary to cause the slowdown, i am not sure. It may have to do with using carbon-components-svelte/carbon-icons-svelte which introduce a lot of Svelte files.
The "Output" panel shows this for Svelte:
SnapshotManager File Statistics:
Project files: 26022
Svelte files: 7210
From node_modules: 33251
Total: 33276
Expected behavior Language features are reasonably fast.
Screenshots

System (please complete the following information):
- OS: Windows 10, 64bit
- IDE: VSCode
- Plugin/Package: Svelte for VSCode
I did encounter a similar issue before. Still can't found out why, but it maybe is slowing down in the typescript language service part. It only pops up occasionally for me so this is not easy to debug.
Some other context might help. Do you use pnpm? There's seem to be some pnpm issues in the typescript repo. And what version of svelte for vscode you're using? if it's 105.3.3, does roll back to 105.3.1 helps? Or does turning off typescript.suggest.includeCompletionsForImportStatements and javascript.suggest.includeCompletionsForImportStatements helps?
We're having major slowdown and often get a pop up saying that VSCode is waiting of the Svelte formatter.
Some details v. 105.3.3 Svelte Kit App TS for js Scss for css NOT using pnpm, just npm.
Giving typescript.suggest.includeCompletionsForImportStatements a try
I publish a new version(105.3.4). Hope this would address the performance issues you're facing.
That might have fixed it. Right now the file statistics do not grow as much as previously:
SnapshotManager File Statistics:
Project files: 21
Svelte files: 6
From node_modules: 382
Total: 404
I will have to revoke that statement. After working on a Svelte file, opening a new element tag, trying to get import suggestions, it started to load a lot of the other files again and slowed down to a crawl.
SnapshotManager File Statistics:
Project files: 26022
Svelte files: 6
From node_modules: 26040
Total: 26066
SnapshotManager File Statistics:
Project files: 26022
Svelte files: 7
From node_modules: 26041
Total: 26067
SnapshotManager File Statistics:
Project files: 26022
Svelte files: 2420
From node_modules: 28454
Total: 28480
~Turning off the includeCompletionsForImportStatements options might have helped, but i should probably test a bit longer.~
After a while with includeCompletionsForImportStatements turned off i also managed to trigger a load of thousands of files again, more or less freezing the server
SnapshotManager File Statistics:
Project files: 26022
Svelte files: 7
From node_modules: 26041
Total: 26066
SnapshotManager File Statistics:
Project files: 26022
Svelte files: 3080
From node_modules: 29114
Total: 29139
SnapshotManager File Statistics:
Project files: 26022
Svelte files: 6294
From node_modules: 32328
Total: 32353
Tried downgrading to version 105.3.1; it also has this problem. I am not using pnpm.
I think that i could work or Carbon projects without the freezes at some point. When I have some more time i could try to bisect the extension version, but any help in that regard would also be appreciated.
Do you have a tsconfig.json or jsconfig.json? It looks like maybe your problem isn't about the recent updates.
My tsconfig.json currently looks like this:
{
"compilerOptions": {
"strict": true,
"moduleResolution": "node",
"target": "es6",
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"sourceMap": true,
"importsNotUsedAsValues": "error", /* for svelte-preprocess */
"resolveJsonModule": true,
"allowSyntheticDefaultImports": true,
"allowJs": true,
"skipLibCheck": true,
},
"exclude": ["out/**/*"],
}
I can also try to put together a repro repository later.
You can try excluding node_modulus and build directories like __sapper__ or .svelte-kit. From the number of svelte files, I guess it is some sort of hashed generated files.
This does not use sapper or svelte-kit.
Have a look at what carbon-icons-svelte exposes: https://unpkg.com/[email protected]/lib/index.js
All of those are separate .svelte files.
If i were to exclude that, i would lose the completion for that, though, right?
carbon-icons-svelte have provided typescript definitions. So it's safe to exclude the source files.
I tried excluding node_modules, worked on a project for a few hours and the issue did not come up.
Did the slowness in any way creep back or can we close this?
@dummdidumm Would be fine by me. Don't know about @stolinski's issue though.
Hi, I'm also experiencing significant slowdowns with the latest version of the Svelte extension.
I'm also using carbon-components-svelte. I have not been able to pinpoint the root problem.
This is the process hogs my cpu and makes both VS Code and my entire system barely usable:
Code Helper (Renderer) --experimental-modules /Users/andvac/.vscode/extensions/svelte.svelte-vscode-105.3.4/node_modules/svelte-language-server/bin/server.js
I'd be happy to provide logs/dumps to help sort this out.
My slowdowns have improved. Not getting direct freezing, but working on Svelte Kit projects does seem to kill my battery much faster than React apps. I haven't done the work to find out why, but it does seem to be VSCode that's causing the battery drain.
I'd like to give more context because I suspect my issues are caused by our monorepo setup:
monorepo/
├─ node_modules/
├─ packages/
│ ├─ package1/
│ │ ├─ tsconfig.json
│ │ ├─ vite.config.js
│ ├─ package2/
│ │ ├─ tsconfig.json
│ │ ├─ vite.config.js
├─ svelte.config.js
├─ tsconfig.json
├─ tsconfig.base.json
- Each package has a
vite.config.jsthat callssvelte({ configFile: "../../svelte.config.js" }) - Each package has a
tsconfig.jsonthat extends/tsconfig.base.jsonand excludesnode_modules - The other
tsconfig.jsonin the monorepo root only includes project references to some packages.
When looking at the output of the Svelte extension, I notice two possible issues:
- There are multiple consecutive lines of
Using Svelte v3.42.2 from...without any statistics printed - The stats on files processed vary wildly.
We have many small packages, and the stats usually look like this:
Project files: 5
Svelte files: 8
From node_modules: 416
Total: 555
But then sometimes they look like this:
Project files: 484
Svelte files: 66
From node_modules: 596
Total: 1062
I hope this long comment is helpful and I'd be happy to provide more info.
My current setup is barely usable and I would really appreciate your help.
The latest release includes some performance improvements, for example completions should have higher priority now. Please let me know if it improved for you.
When you say "barely usable", which parts are those where you experience the slowness? Completion, diagnostics, ..?
Also, could you add "svelte.trace.server": "messages" to your user settings JSON, then reproduce your slowness for 1-2 minutes and then copy the output of the Svelte extension in here? I'm interested in the response times that are logged for the various requests.
Hi @dummdidumm, thank you for looking into this. I've added a settings and I'll share the output asap.
The most notable slowdowns are when VS Code is waiting for code actions from the Svelte extension:
- I enabled save on blur on so this happens a lot with my setup.
- In these situations, a file can take from several seconds to over a minute to save.
- I often have to cancel the code actions by clicking cancel on the VS Code popup.
- This saves the file but
svelte-language-server/bin/server.jscontinues to churn in the background. - While it's churning, everything is slow: the cursor is jittery, switching windows is sluggish, ...
- I'm on a maxed out Macbook Pro 16in so my hardware shouldn't be the problem.
When you say "code actions" do you only refer to saving specifically, or other code actions as well? I guess while saving, you also format the code? What if you turn off "format on save" (if my guess is right; just for testing), is it then fast again? I ask this because the Svelte for VS Code extension by default is also responsible for formatting the code. Or do did you set the Prettier extension as the default formatter for Svelte files?
I use this extension for formatting .svelte files and my code actions on save are:
editor.formatOnSavesource.organizeImportssource.fixAllsource.addMissingImports
Q: Should I only disable editor.formatOnSave or also the other options?
I haven't started coding yet so I haven't bumped into the issue, but I figured I would share the output of the extension after a clean open of the monorepo main directory with "svelte.trace.server": "messages". Note the last line[Trace - 10:25:31 AM] Received response 'textDocument/codeAction - (16)' in 48636ms.
[Trace - 10:24:30 AM] Sending request 'initialize - (0)'.
Initialize language server at file:///Users/andreavaccari/monorepo
[Trace - 10:24:31 AM] Received response 'initialize - (0)' in 1121ms.
[Trace - 10:24:31 AM] Sending notification 'initialized'.
[Trace - 10:24:31 AM] Sending notification 'workspace/didChangeConfiguration'.
[Trace - 10:24:31 AM] Sending notification 'textDocument/didOpen'.
[Trace - 10:24:31 AM] Sending notification 'textDocument/didOpen'.
Initialize new ts service at /Users/andreavaccari/monorepo/packages/ui-viewer/tsconfig.json
[Trace - 10:24:31 AM] Sending request 'textDocument/documentSymbol - (1)'.
[Trace - 10:24:31 AM] Sending request 'textDocument/codeAction - (2)'.
[Trace - 10:24:31 AM] Sending request 'textDocument/codeAction - (3)'.
[Trace - 10:24:31 AM] Sending request 'textDocument/documentColor - (4)'.
[Trace - 10:24:31 AM] Sending request 'textDocument/documentColor - (5)'.
[Trace - 10:24:31 AM] Sending request 'textDocument/linkedEditingRange - (6)'.
[Trace - 10:24:31 AM] Sending request 'textDocument/linkedEditingRange - (7)'.
Trying to load configs for /Users/andreavaccari/monorepo/packages/ui-viewer
Initialize new ts service at /Users/andreavaccari/monorepo/packages/app-review/tsconfig.json
Trying to load configs for /Users/andreavaccari/monorepo/packages/app-review
[Trace - 10:24:31 AM] Sending request 'textDocument/semanticTokens/range - (8)'.
[Trace - 10:24:31 AM] Sending request 'textDocument/semanticTokens/range - (9)'.
[Trace - 10:24:31 AM] Received response 'textDocument/codeAction - (2)' in 123ms.
[Trace - 10:24:31 AM] Received response 'textDocument/codeAction - (3)' in 124ms.
[Trace - 10:24:31 AM] Received response 'textDocument/linkedEditingRange - (6)' in 140ms.
Loaded config at /Users/andreavaccari/monorepo/svelte.config.js
SnapshotManager File Statistics:
Project files: 6
Svelte files: 4
From node_modules: 0
Total: 6
SnapshotManager File Statistics:
Project files: 9
Svelte files: 5
From node_modules: 0
Total: 9
[Trace - 10:24:31 AM] Received response 'textDocument/linkedEditingRange - (7)' in 249ms.
[Trace - 10:24:31 AM] Sending request 'textDocument/semanticTokens/full - (10)'.
[Trace - 10:24:31 AM] Sending request 'textDocument/semanticTokens/full - (11)'.
Using Svelte v3.42.2 from /Users/andreavaccari/monorepo/node_modules/svelte/compiler
[Trace - 10:24:32 AM] Sending notification '$/cancelRequest'.
[Trace - 10:24:32 AM] Sending request 'textDocument/documentSymbol - (12)'.
[Trace - 10:24:32 AM] Sending request 'textDocument/documentSymbol - (13)'.
Initialize new ts service at /Users/andreavaccari/monorepo/packages/card-note/tsconfig.json
Trying to load configs for /Users/andreavaccari/monorepo/packages/card-note
[Trace - 10:24:34 AM] Sending notification '$/cancelRequest'.
[Trace - 10:24:34 AM] Sending request 'textDocument/documentColor - (14)'.
[Trace - 10:24:34 AM] Sending notification '$/cancelRequest'.
[Trace - 10:24:34 AM] Sending request 'textDocument/documentColor - (15)'.
Initialize new ts service at /Users/andreavaccari/monorepo/packages/card-qa/tsconfig.json
Trying to load configs for /Users/andreavaccari/monorepo/packages/card-qa
[Trace - 10:24:38 AM] Received response 'textDocument/documentColor - (4)' in 6835ms.
[Trace - 10:24:38 AM] Received response 'textDocument/documentColor - (5)' in 6835ms.
[Trace - 10:24:38 AM] Received response 'textDocument/semanticTokens/range - (8)' in 6734ms.
[Trace - 10:24:38 AM] Received response 'textDocument/semanticTokens/range - (9)' in 6735ms.
[Trace - 10:24:38 AM] Received response 'textDocument/semanticTokens/full - (10)' in 6535ms.
Using Svelte v3.42.2 from /Users/andreavaccari/monorepo/node_modules/svelte/compiler
SnapshotManager File Statistics:
Project files: 15
Svelte files: 2
From node_modules: 0
Total: 15
warn - You have enabled the JIT engine which is currently in preview.
warn - Preview features are not covered by semver, may introduce breaking changes, and can change at any time.
Using Svelte v3.42.2 from /Users/andreavaccari/monorepo/node_modules/svelte/compiler
[Trace - 10:24:42 AM] Received response 'textDocument/documentSymbol - (1)' in 10948ms.
[Trace - 10:24:42 AM] Received response 'textDocument/semanticTokens/full - (11)' in 10645ms.
[Trace - 10:24:42 AM] Received notification 'textDocument/publishDiagnostics'.
[Trace - 10:24:42 AM] Received response 'textDocument/documentSymbol - (12)' in 9445ms.
[Trace - 10:24:42 AM] Received response 'textDocument/documentSymbol - (13)' in 9454ms.
[Trace - 10:24:42 AM] Received response 'textDocument/documentColor - (14)' in 8000ms.
[Trace - 10:24:42 AM] Received response 'textDocument/documentColor - (15)' in 8000ms.
[Trace - 10:24:42 AM] Sending request 'textDocument/codeAction - (16)'.
Using Svelte v3.42.2 from /Users/andreavaccari/monorepo/node_modules/svelte/compiler
[Trace - 10:25:31 AM] Received notification 'textDocument/publishDiagnostics'.
[Trace - 10:25:31 AM] Received response 'textDocument/codeAction - (16)' in 48636ms.
I just bumped into the problem: slow autocompletion (on ctrl-space) and slow formatting:
Using Svelte v3.42.2 from /Users/andreavaccari/monorepo/node_modules/svelte/compiler
[Trace - 10:36:44 AM] Received notification 'textDocument/publishDiagnostics'.
[Trace - 10:36:44 AM] Received response 'textDocument/linkedEditingRange - (58)' in 50198ms.
[Trace - 10:36:44 AM] Received response 'textDocument/codeAction - (59)' in 50151ms.
[Trace - 10:36:44 AM] Received response 'textDocument/hover - (60)' in 49787ms.
[Trace - 10:36:44 AM] Received response 'textDocument/hover - (61)' in 43943ms.
[Trace - 10:36:44 AM] Received response 'textDocument/definition - (62)' in 43689ms.
[Trace - 10:36:44 AM] Received response 'textDocument/linkedEditingRange - (65)' in 42492ms.
[Trace - 10:36:44 AM] Received response 'textDocument/codeAction - (66)' in 42493ms.
[Trace - 10:36:44 AM] Received response 'textDocument/linkedEditingRange - (68)' in 42306ms.
[Trace - 10:36:44 AM] Received response 'textDocument/codeAction - (69)' in 42279ms.
[Trace - 10:36:44 AM] Received response 'textDocument/hover - (70)' in 41926ms.
[Trace - 10:36:44 AM] Received response 'textDocument/hover - (71)' in 41743ms.
[Trace - 10:36:44 AM] Received response 'textDocument/hover - (72)' in 41564ms.
[Trace - 10:36:44 AM] Received response 'textDocument/hover - (73)' in 40803ms.
[Trace - 10:36:44 AM] Received response 'textDocument/linkedEditingRange - (75)' in 37574ms.
[Trace - 10:36:44 AM] Received response 'textDocument/codeAction - (76)' in 37573ms.
[Trace - 10:36:44 AM] Received response 'textDocument/linkedEditingRange - (81)' in 33427ms.
[Trace - 10:36:44 AM] Received response 'textDocument/codeAction - (82)' in 33427ms.
[Trace - 10:36:44 AM] Received response 'textDocument/linkedEditingRange - (84)' in 33312ms.
[Trace - 10:36:44 AM] Received response 'textDocument/codeAction - (85)' in 33272ms.
[Trace - 10:36:44 AM] Received response 'textDocument/linkedEditingRange - (86)' in 32310ms.
[Trace - 10:36:44 AM] Received response 'textDocument/codeAction - (87)' in 32260ms.
[Trace - 10:36:44 AM] Received response 'textDocument/linkedEditingRange - (88)' in 30650ms.
[Trace - 10:36:44 AM] Received response 'textDocument/codeAction - (89)' in 30600ms.
[Trace - 10:36:44 AM] Received response 'textDocument/linkedEditingRange - (90)' in 30352ms.
[Trace - 10:36:44 AM] Received response 'textDocument/codeAction - (91)' in 30300ms.
[Trace - 10:36:44 AM] Received response 'textDocument/hover - (92)' in 25329ms.
[Trace - 10:36:44 AM] Received response 'textDocument/hover - (93)' in 24149ms.
[Trace - 10:36:44 AM] Received response 'textDocument/hover - (94)' in 21740ms.
[Trace - 10:36:44 AM] Received response 'textDocument/linkedEditingRange - (95)' in 21356ms.
[Trace - 10:36:44 AM] Received response 'textDocument/codeAction - (96)' in 21305ms.
SnapshotManager File Statistics:
Project files: 24
Svelte files: 44
From node_modules: 623
Total: 748
[Trace - 10:36:44 AM] Received response 'textDocument/completion - (97)' in 20969ms.
[Trace - 10:36:44 AM] Received response 'textDocument/linkedEditingRange - (98)' in 20970ms.
[Trace - 10:36:45 AM] Sending request 'completionItem/resolve - (102)'.
[Trace - 10:36:45 AM] Received response 'completionItem/resolve - (102)' in 42ms.
[Trace - 10:36:45 AM] Received response 'textDocument/documentSymbol - (63)' in 43490ms.
[Trace - 10:36:45 AM] Received response 'textDocument/documentColor - (64)' in 43490ms.
[Trace - 10:36:45 AM] Received response 'textDocument/documentSymbol - (67)' in 43492ms.
Using Svelte v3.42.2 from /Users/andreavaccari/monorepo/node_modules/svelte/compiler
[Trace - 10:36:46 AM] Received response 'textDocument/documentColor - (74)' in 39002ms.
[Trace - 10:36:46 AM] Received response 'textDocument/documentSymbol - (77)' in 39000ms.
[Trace - 10:36:46 AM] Received response 'textDocument/semanticTokens/full - (78)' in 38968ms.
[Trace - 10:36:46 AM] Received response 'textDocument/semanticTokens/range - (79)' in 38947ms.
[Trace - 10:36:46 AM] Received response 'textDocument/documentColor - (80)' in 34855ms.
[Trace - 10:36:46 AM] Received response 'textDocument/documentSymbol - (83)' in 34849ms.
[Trace - 10:36:46 AM] Received response 'textDocument/semanticTokens/full - (99)' in 22275ms.
[Trace - 10:36:46 AM] Received response 'textDocument/documentColor - (100)' in 21581ms.
[Trace - 10:36:46 AM] Received response 'textDocument/documentSymbol - (101)' in 21174ms.
[Trace - 10:36:52 AM] Sending request 'textDocument/formatting - (103)'.
Using Svelte v3.42.2 from /Users/andreavaccari/monorepo/node_modules/svelte/compiler
[Trace - 10:37:36 AM] Received notification 'textDocument/publishDiagnostics'.
Using Prettier v2.3.2 from /Users/andreavaccari/monorepo/node_modules/prettier
[Trace - 10:37:37 AM] Received response 'textDocument/formatting - (103)' in 44768ms.
[Trace - 10:37:37 AM] Sending notification 'textDocument/didChange'.
[Trace - 10:37:37 AM] Sending notification 'textDocument/didSave'.
[Trace - 10:37:37 AM] Sending request 'textDocument/linkedEditingRange - (104)'.
[Trace - 10:37:37 AM] Received response 'textDocument/linkedEditingRange - (104)' in 1ms.
[Trace - 10:37:37 AM] Sending request 'textDocument/semanticTokens/full - (105)'.
Using Svelte v3.42.2 from /Users/andreavaccari/monorepo/node_modules/svelte/compiler
[Trace - 10:37:38 AM] Sending request 'textDocument/documentColor - (106)'.
Using Svelte v3.42.2 from /Users/andreavaccari/monorepo/node_modules/svelte/compiler
Using Svelte v3.42.2 from /Users/andreavaccari/monorepo/node_modules/svelte/compiler
Using Svelte v3.42.2 from /Users/andreavaccari/monorepo/node_modules/svelte/compiler
[Trace - 10:37:39 AM] Received notification 'textDocument/publishDiagnostics'.
[Trace - 10:37:39 AM] Received notification 'textDocument/publishDiagnostics'.
Using Svelte v3.42.2 from /Users/andreavaccari/monorepo/node_modules/svelte/compiler
[Trace - 10:37:39 AM] Received notification 'textDocument/publishDiagnostics'.
[Trace - 10:37:39 AM] Received response 'textDocument/semanticTokens/full - (105)' in 1450ms.
Using Svelte v3.42.2 from /Users/andreavaccari/monorepo/node_modules/svelte/compiler
[Trace - 10:37:39 AM] Received notification 'textDocument/publishDiagnostics'.
[Trace - 10:37:39 AM] Sending request 'textDocument/codeAction - (107)'.
[Trace - 10:37:39 AM] Received response 'textDocument/codeAction - (107)' in 59ms.
[Trace - 10:37:39 AM] Received response 'textDocument/documentColor - (106)' in 1058ms.
[Trace - 10:38:10 AM] Sending request 'textDocument/documentSymbol - (108)'.
Using Svelte v3.42.2 from /Users/andreavaccari/monorepo/node_modules/svelte/compiler
[Trace - 10:38:28 AM] Received notification 'textDocument/publishDiagnostics'.
[Trace - 10:38:29 AM] Sending request 'textDocument/codeAction - (109)'.
[Trace - 10:39:08 AM] Received notification 'textDocument/publishDiagnostics'.
[Trace - 10:39:08 AM] Received response 'textDocument/documentSymbol - (108)' in 58252ms.
[Trace - 10:39:08 AM] Received response 'textDocument/codeAction - (109)' in 39482ms.
[Trace - 10:39:08 AM] Sending request 'textDocument/codeAction - (110)'.
[Trace - 10:39:08 AM] Received response 'textDocument/codeAction - (110)' in 1ms.
Ok these diagnostics look like it has nothing to do with formatting, it's only the most visible then, because something else blocks the thread and the formatter is waiting to get started for a long time. From looking at the logs it looks like it may be the diagnostics that take so long. What if happens if you turn them off?
"svelte.plugin.typescript.diagnostics.enable": false,
"svelte.plugin.svelte.diagnostics.enable": false
If it is much faster, try turning only one off to see which diagnostic part takes longer.
Big improvement!
- Some responses still take a few seconds
- Prettier sneaks into the logs even though I explicitly set this extension as the formatter
- Should I enable
"svelte.enable-ts-plugin"in mysettings.json?
[Trace - 10:45:23 AM] Sending notification 'textDocument/didChange'.
[Trace - 10:45:23 AM] Sending request 'textDocument/formatting - (31)'.
Using Prettier v2.3.2 from /Users/andreavaccari/monorepo/node_modules/prettier
[Trace - 10:45:23 AM] Sending request 'textDocument/linkedEditingRange - (32)'.
[Trace - 10:45:23 AM] Sending request 'textDocument/codeAction - (33)'.
[Trace - 10:45:23 AM] Received response 'textDocument/linkedEditingRange - (32)' in 51ms.
[Trace - 10:45:23 AM] Received response 'textDocument/codeAction - (33)' in 2ms.
[Trace - 10:45:23 AM] Sending request 'textDocument/semanticTokens/full - (34)'.
[Trace - 10:45:24 AM] Sending notification '$/cancelRequest'.
[Trace - 10:45:24 AM] Sending request 'textDocument/linkedEditingRange - (35)'.
[Trace - 10:45:24 AM] Sending request 'textDocument/codeAction - (36)'.
[Trace - 10:45:24 AM] Received response 'textDocument/formatting - (31)' in 763ms.
[Trace - 10:45:24 AM] Received notification 'textDocument/publishDiagnostics'.
[Trace - 10:45:24 AM] Received response 'textDocument/linkedEditingRange - (35)' in 175ms.
[Trace - 10:45:24 AM] Received response 'textDocument/codeAction - (36)' in 123ms.
[Trace - 10:45:24 AM] Sending notification 'textDocument/didSave'.
[Trace - 10:45:24 AM] Sending request 'textDocument/documentColor - (37)'.
[Trace - 10:45:25 AM] Received response 'textDocument/semanticTokens/full - (34)' in 1840ms.
[Trace - 10:45:25 AM] Received notification 'textDocument/publishDiagnostics'.
[Trace - 10:45:25 AM] Received notification 'textDocument/publishDiagnostics'.
[Trace - 10:45:25 AM] Received response 'textDocument/documentColor - (37)' in 1140ms.
[Trace - 10:45:27 AM] Sending request 'textDocument/documentSymbol - (38)'.
[Trace - 10:45:28 AM] Received response 'textDocument/documentSymbol - (38)' in 1016ms.
[Trace - 10:45:31 AM] Sending request 'textDocument/linkedEditingRange - (39)'.
[Trace - 10:45:31 AM] Received response 'textDocument/linkedEditingRange - (39)' in 0ms.
[Trace - 10:45:31 AM] Sending request 'textDocument/codeAction - (40)'.
[Trace - 10:45:31 AM] Received response 'textDocument/codeAction - (40)' in 1ms.
[Trace - 10:45:35 AM] Sending request 'textDocument/hover - (41)'.
[Trace - 10:45:35 AM] Sending notification '$/cancelRequest'.
[Trace - 10:45:35 AM] Received response 'textDocument/hover - (41)' in 78ms.
[Trace - 10:45:37 AM] Sending request 'textDocument/documentSymbol - (42)'.
[Trace - 10:45:37 AM] Sending notification 'textDocument/didOpen'.
[Trace - 10:45:37 AM] Sending request 'textDocument/documentColor - (43)'.
[Trace - 10:45:37 AM] Sending request 'textDocument/linkedEditingRange - (44)'.
[Trace - 10:45:37 AM] Sending request 'textDocument/codeAction - (45)'.
[Trace - 10:45:37 AM] Sending notification '$/cancelRequest'.
[Trace - 10:45:37 AM] Received response 'textDocument/linkedEditingRange - (44)' in 16ms.
[Trace - 10:45:37 AM] Received response 'textDocument/codeAction - (45)' in 15ms.
[Trace - 10:45:37 AM] Sending request 'textDocument/documentSymbol - (46)'.
[Trace - 10:45:37 AM] Sending request 'textDocument/semanticTokens/full - (47)'.
[Trace - 10:45:37 AM] Sending request 'textDocument/semanticTokens/range - (48)'.
[Trace - 10:45:38 AM] Received notification 'textDocument/publishDiagnostics'.
[Trace - 10:45:38 AM] Received response 'textDocument/documentSymbol - (42)' in 1003ms.
[Trace - 10:45:38 AM] Sending request 'textDocument/linkedEditingRange - (49)'.
[Trace - 10:45:38 AM] Received response 'textDocument/linkedEditingRange - (49)' in 0ms.
[Trace - 10:45:38 AM] Sending request 'textDocument/codeAction - (50)'.
[Trace - 10:45:38 AM] Received response 'textDocument/codeAction - (50)' in 119ms.
[Trace - 10:45:38 AM] Received response 'textDocument/documentColor - (43)' in 1030ms.
[Trace - 10:45:38 AM] Sending request 'textDocument/hover - (51)'.
[Trace - 10:45:38 AM] Received response 'textDocument/documentSymbol - (46)' in 1315ms.
[Trace - 10:45:38 AM] Received response 'textDocument/semanticTokens/full - (47)' in 1329ms.
[Trace - 10:45:38 AM] Received response 'textDocument/semanticTokens/range - (48)' in 1330ms.
[Trace - 10:45:38 AM] Received response 'textDocument/hover - (51)' in 235ms.
[Trace - 10:45:42 AM] Sending request 'textDocument/documentSymbol - (52)'.
[Trace - 10:45:42 AM] Sending request 'textDocument/documentColor - (53)'.
[Trace - 10:45:42 AM] Sending request 'textDocument/linkedEditingRange - (54)'.
[Trace - 10:45:42 AM] Sending request 'textDocument/codeAction - (55)'.
[Trace - 10:45:42 AM] Sending notification '$/cancelRequest'.
[Trace - 10:45:42 AM] Sending request 'textDocument/documentSymbol - (56)'.
[Trace - 10:45:42 AM] Received response 'textDocument/linkedEditingRange - (54)' in 11ms.
[Trace - 10:45:42 AM] Received response 'textDocument/codeAction - (55)' in 10ms.
[Trace - 10:45:42 AM] Sending request 'textDocument/linkedEditingRange - (57)'.
[Trace - 10:45:42 AM] Received response 'textDocument/linkedEditingRange - (57)' in 1ms.
[Trace - 10:45:42 AM] Sending request 'textDocument/codeAction - (58)'.
[Trace - 10:45:42 AM] Received response 'textDocument/codeAction - (58)' in 10ms.
[Trace - 10:45:43 AM] Sending request 'textDocument/hover - (59)'.
[Trace - 10:45:43 AM] Received response 'textDocument/hover - (59)' in 12ms.
[Trace - 10:45:43 AM] Received response 'textDocument/documentSymbol - (52)' in 1005ms.
[Trace - 10:45:43 AM] Received response 'textDocument/documentColor - (53)' in 1005ms.
[Trace - 10:45:43 AM] Received response 'textDocument/documentSymbol - (56)' in 1006ms.
[Trace - 10:45:48 AM] Sending request 'textDocument/linkedEditingRange - (60)'.
[Trace - 10:45:48 AM] Received response 'textDocument/linkedEditingRange - (60)' in 1ms.
[Trace - 10:45:48 AM] Sending request 'textDocument/codeAction - (61)'.
[Trace - 10:45:48 AM] Received response 'textDocument/codeAction - (61)' in 1ms.
[Trace - 10:45:48 AM] Sending request 'textDocument/completion - (62)'.
[Trace - 10:45:49 AM] Received response 'textDocument/completion - (62)' in 433ms.
[Trace - 10:45:49 AM] Sending request 'completionItem/resolve - (63)'.
[Trace - 10:45:49 AM] Received response 'completionItem/resolve - (63)' in 806ms.
...
[Trace - 10:46:27 AM] Sending request 'textDocument/documentSymbol - (64)'.
[Trace - 10:46:27 AM] Sending notification 'textDocument/didOpen'.
[Trace - 10:46:27 AM] Sending request 'textDocument/documentColor - (65)'.
[Trace - 10:46:27 AM] Sending request 'textDocument/linkedEditingRange - (66)'.
[Trace - 10:46:27 AM] Sending request 'textDocument/codeAction - (67)'.
[Trace - 10:46:27 AM] Sending notification '$/cancelRequest'.
[Trace - 10:46:27 AM] Sending request 'textDocument/documentSymbol - (68)'.
[Trace - 10:46:27 AM] Received response 'textDocument/linkedEditingRange - (66)' in 13ms.
[Trace - 10:46:27 AM] Sending request 'textDocument/semanticTokens/full - (69)'.
[Trace - 10:46:27 AM] Received response 'textDocument/codeAction - (67)' in 14ms.
[Trace - 10:46:27 AM] Sending request 'textDocument/semanticTokens/range - (70)'.
[Trace - 10:46:27 AM] Sending request 'textDocument/linkedEditingRange - (71)'.
[Trace - 10:46:27 AM] Received response 'textDocument/linkedEditingRange - (71)' in 1ms.
[Trace - 10:46:27 AM] Sending request 'textDocument/codeAction - (72)'.
SnapshotManager File Statistics:
Project files: 24
Svelte files: 44
From node_modules: 623
Total: 750
[Trace - 10:46:27 AM] Received response 'textDocument/codeAction - (72)' in 89ms.
[Trace - 10:46:28 AM] Received notification 'textDocument/publishDiagnostics'.
[Trace - 10:46:28 AM] Received response 'textDocument/documentSymbol - (64)' in 1006ms.
[Trace - 10:46:28 AM] Received response 'textDocument/documentColor - (65)' in 1006ms.
[Trace - 10:46:28 AM] Received response 'textDocument/documentSymbol - (68)' in 1008ms.
[Trace - 10:46:28 AM] Received response 'textDocument/semanticTokens/full - (69)' in 1001ms.
[Trace - 10:46:28 AM] Received response 'textDocument/semanticTokens/range - (70)' in 1042ms.
[Trace - 10:46:30 AM] Sending request 'textDocument/linkedEditingRange - (73)'.
[Trace - 10:46:30 AM] Received response 'textDocument/linkedEditingRange - (73)' in 1ms.
[Trace - 10:46:30 AM] Sending request 'textDocument/codeAction - (74)'.
[Trace - 10:46:30 AM] Received response 'textDocument/codeAction - (74)' in 0ms.
[Trace - 10:46:30 AM] Sending request 'textDocument/linkedEditingRange - (75)'.
[Trace - 10:46:30 AM] Received response 'textDocument/linkedEditingRange - (75)' in 1ms.
[Trace - 10:46:30 AM] Sending request 'textDocument/codeAction - (76)'.
[Trace - 10:46:30 AM] Received response 'textDocument/codeAction - (76)' in 0ms.
[Trace - 10:46:31 AM] Sending request 'textDocument/completion - (77)'.
[Trace - 10:46:31 AM] Received response 'textDocument/completion - (77)' in 45ms.
[Trace - 10:46:31 AM] Sending request 'completionItem/resolve - (78)'.
[Trace - 10:46:31 AM] Received response 'completionItem/resolve - (78)' in 40ms.
...
[Trace - 10:47:22 AM] Received notification 'textDocument/publishDiagnostics'.
SnapshotManager File Statistics:
Project files: 15
Svelte files: 10
From node_modules: 0
Total: 15
[Trace - 10:47:23 AM] Received response 'textDocument/documentColor - (115)' in 1015ms.
[Trace - 10:47:23 AM] Received response 'textDocument/documentSymbol - (118)' in 1014ms.
[Trace - 10:47:23 AM] Received response 'textDocument/semanticTokens/full - (119)' in 1007ms.
[Trace - 10:47:24 AM] Sending request 'textDocument/linkedEditingRange - (125)'.
[Trace - 10:47:24 AM] Sending request 'textDocument/codeAction - (126)'.
[Trace - 10:47:24 AM] Sending notification 'textDocument/didChange'.
[Trace - 10:47:24 AM] Sending notification '$/cancelRequest'.
[Trace - 10:47:24 AM] Sending notification '$/cancelRequest'.
[Trace - 10:47:24 AM] Sending request 'textDocument/linkedEditingRange - (127)'.
[Trace - 10:47:24 AM] Sending request 'textDocument/semanticTokens/full - (128)'.
[Trace - 10:47:25 AM] Sending request 'textDocument/completion - (129)'.
[Trace - 10:47:25 AM] Sending request 'textDocument/hover - (130)'.
[Trace - 10:47:25 AM] Sending notification '$/cancelRequest'.
[Trace - 10:47:25 AM] Sending request 'textDocument/documentColor - (131)'.
[Trace - 10:47:25 AM] Sending request 'textDocument/hover - (132)'.
[Trace - 10:47:26 AM] Sending request 'textDocument/documentSymbol - (133)'.
[Trace - 10:47:26 AM] Sending notification '$/cancelRequest'.
[Trace - 10:47:27 AM] Received response 'textDocument/semanticTokens/range - (120)' in 5337ms.
[Trace - 10:47:27 AM] Received response 'textDocument/linkedEditingRange - (125)' in 3137ms.
[Trace - 10:47:27 AM] Received notification 'textDocument/publishDiagnostics'.
[Trace - 10:47:27 AM] Received response 'textDocument/codeAction - (126)' in 3088ms.
[Trace - 10:47:27 AM] Received response 'textDocument/linkedEditingRange - (127)' in 2836ms.
[Trace - 10:47:28 AM] Received response 'textDocument/completion - (129)' in 2923ms.
[Trace - 10:47:28 AM] Sending request 'completionItem/resolve - (134)'.
[Trace - 10:47:28 AM] Received response 'textDocument/hover - (130)' in 2783ms.
[Trace - 10:47:28 AM] Received response 'textDocument/hover - (132)' in 2400ms.
[Trace - 10:47:28 AM] Received response 'completionItem/resolve - (134)' in 40ms.
[Trace - 10:47:28 AM] Received notification 'textDocument/publishDiagnostics'.
[Trace - 10:47:28 AM] Received response 'textDocument/semanticTokens/full - (128)' in 3769ms.
[Trace - 10:47:29 AM] Received response 'textDocument/documentColor - (131)' in 3514ms.
[Trace - 10:47:29 AM] Received response 'textDocument/documentSymbol - (133)' in 2884ms.
[Trace - 10:47:48 AM] Sending request 'textDocument/formatting - (135)'.
Using Prettier v2.3.2 from /Users/andreavaccari/monorepo/node_modules/prettier
[Trace - 10:47:49 AM] Received response 'textDocument/formatting - (135)' in 196ms.
[Trace - 10:47:49 AM] Sending notification 'textDocument/didChange'.
[Trace - 10:47:49 AM] Sending notification 'textDocument/didSave'.
[Trace - 10:47:49 AM] Sending request 'textDocument/linkedEditingRange - (136)'.
[Trace - 10:47:49 AM] Received response 'textDocument/linkedEditingRange - (136)' in 1ms.
[Trace - 10:47:49 AM] Sending request 'textDocument/semanticTokens/full - (137)'.
[Trace - 10:47:49 AM] Received notification 'textDocument/publishDiagnostics'.
[Trace - 10:47:50 AM] Sending request 'textDocument/documentColor - (138)'.
[Trace - 10:47:50 AM] Received notification 'textDocument/publishDiagnostics'.
[Trace - 10:47:50 AM] Received notification 'textDocument/publishDiagnostics'.
[Trace - 10:47:50 AM] Received notification 'textDocument/publishDiagnostics'.
[Trace - 10:47:50 AM] Received notification 'textDocument/publishDiagnostics'.
[Trace - 10:47:50 AM] Received notification 'textDocument/publishDiagnostics'.
[Trace - 10:47:50 AM] Received notification 'textDocument/publishDiagnostics'.
[Trace - 10:47:50 AM] Received response 'textDocument/semanticTokens/full - (137)' in 1139ms.
[Trace - 10:47:51 AM] Received response 'textDocument/documentColor - (138)' in 1005ms.
[Trace - 10:47:51 AM] Sending request 'textDocument/documentSymbol - (139)'.
[Trace - 10:47:52 AM] Received response 'textDocument/documentSymbol - (139)' in 1009ms.
The Prettier log is alright, it's a sign that the extension uses the referenced package for formatting. To be more specific: The Svelte extension uses Prettier to format the file, which is why, if you have prettier-plugin-svelte installed, you could also use the Prettier extension for this.
The logs also seem ok. My guess now is that "svelte.plugin.svelte.diagnostics.enable": false should be enough to make it fast again. This disables running the Svelte compiler to find the warnings, which involves preprocessing the files, which can be costly, depending on the circumstances.
How many files are open when the diagnostics are slow? Which preprocessors are you using? Are you by any chance using a CSS preprocessor like SCSS/Tailwind and referencing a big external stylesheet in one of the open files?
The TS plugin is unrelated to this issue.
Thank you for the detailed explanation. I will keep "svelte.plugin.svelte.diagnostics.enable": false and removed "svelte.plugin.typescript.diagnostics.enable": false. I will also switch on "svelte.enable-ts-plugin": true (I understand it's unrelated but I figure I should mention it.)
Re open files:
- I don't use tabs so I don't have a visual reference. My guess is between 20-40 on average.
- You made me realize this is bad practice so I added the following global settings:
"workbench.editor.limit.enabled": true
"workbench.editor.limit.perEditorGroup": true
"workbench.editor.limit.value": 1
Re preprocessors:
- We use
svelte-preprocess,typescript,postcss, andtailwind - Tailwind is configured to use jit mode and to process always all packages (instead of just the one being run or built)
- We use
carbon-components-svelte. We have a sass-only package in the monorepo that compiles the theme with our custom color and tweaks. It used to be that preprocessing the sass theme would slow everything down but the separate package solved that. We tried to set up the custom preprocessors to optimize imports and css for carbon but we haven't found a way to make them work. viteonly takes a few seconds torun dev. The slowdowns are in VS Code with the Svelte extensions.
One question:
- Running
vite buildon our app-level package (which imports all other packages) only took 20 seconds. - Why would the diagnostics be slower than the build? Is it because they are executed for each open file in parallel?
Vite could certainly be faster since AFAIK it only transpiles the code and does not run type checking, which takes longer. But the fact that you have to wait 30 seconds to get a response from the language server when svelte.diagnostics.enable is true still sounds bad/sounds like there's a problem.
Ultimately it's very hard for me to track down the culprit without a reproduction repository. If you could provide one that would be greatly appreciated.
Re enabling the TS plugin: If you have any feedback after using it for a while, please leave a comment in #580
Hey, I use pnpm and my TS code auto-complete takes a long time to show up. I tried disabling diagnostics but it didn't improve things. Is there a open issue about that?
Are you talking about completions inside .ts files? If so, that's unrelated, the extension only kicks in for .svelte files (which can use TS though).
How much delay are we talking about? Do you have a repository I can look at to reproduce this? Performance issues like these are almost impossible to track down without one.
In my experience PNPM is a significant factor here. I've been seeing performance problems in the autocomplete as well and if I install my project's dependencies with Yarn instead then it's a lot faster. 5-7 seconds with pnpm compared to a second or so with Yarn on my system. And this only happens in Svelte files; plain Typescript files perform great.
The public project I'm working on that exposes this the most is at https://github.com/dimfeld/ergo. It's not really minimal but hopefully it'll help. The specific steps I'm doing are:
- Clone the repo
cd webpnpm i- Open
src/components/Query.svelte. - Somewhere in the file, start to type "delayedLoading" (a variable declared in the component) and see the slowness.
I'm actually using Neovim but my language server dependencies are up to date. I wouldn't expect VS Code to be any different here.
If I have some time this week I'll try to dive in more to see where exactly in the language server internals is running slowly.
That's very strange. I tried to reproduce this and got the 1 second delay with pnpm you only get when using yarn/npm (which sounds like it has something to do with pnpm's module structure and virtual store). What's your OS and the Svelte extension version? Mine is windows. If you have some time to look into this and find out what's causing this, that indeed would be great. If you need any help setting up the repo for local debugging, let me know (these are the general setup instructions).