Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Massive ZLS textDocument/codeAction delay #2101

Open
xydone opened this issue Dec 1, 2024 · 2 comments
Open

Massive ZLS textDocument/codeAction delay #2101

xydone opened this issue Dec 1, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@xydone
Copy link

xydone commented Dec 1, 2024

Zig Version

0.13.0

ZLS Version

0.13.0

Client / Code Editor / Extensions

VSCode with Zig Language extension

Steps to Reproduce and Observed Behavior

Writing code leads to a big slow-down in intellisense, which in itself leads to me being unable to save the file for a long period of time as formatOnSave is trying to run, but is unable to.
When I check ZLS' output in VSCode, I see a massive spike in ms for textDocument/codeAction whenever the issue occurs. However, I do not have clear steps of reproduction as it happens randomly, yet often.

Things I have tried:

  1. Running latest Zig and latest ZLS
  2. Reinstalling VSCode Zig Language extension
  3. Reinstalling VSCode
  4. Testing with a different lightweight codebase (~50 lines) to see if it still occurs and it does.
  5. Checking if my PC resource utilization is not normal and it is indeed normal. I have also tried restarting my PC multiple times, to no avail.
  6. Checking if my VSCode Zig extension settings are correct and they seem to be. I have attached them below:
  "zig.initialSetupDone": true,
  "editor.multiCursorLimit": 20000,
  "zig.path": "zig",
  "zig.zls.path": "zls",
  "git.ignoreRebaseWarning": true,
  "workbench.statusBar.visible": false,
  "zig.zls.debugLog": true,
  "zig.checkForUpdate": false,
  "zig.zls.warnStyle": true

Expected Behavior

Normal ZLS usage with low latency

Relevant log output

(... normal logs ...)
debug: (server): Took 0ms to process notification-textDocument/didChange on Thread 14792
debug: (server): Took 0ms to process notification-$/cancelRequest on Thread 16892
debug: (server): Took 0ms to process notification-$/cancelRequest on Thread 23452
debug: (server): Took 0ms to process request-12810-textDocument/inlayHint on Thread 23236
debug: (server): Took 0ms to process request-12817-textDocument/semanticTokens/full on Thread 23236
debug: (server): Took 0ms to process notification-$/cancelRequest on Thread 23236
debug: (server): Took 0ms to process request-12815-textDocument/inlayHint on Thread 14792
debug: (server): Took 0ms to process notification-$/cancelRequest on Thread 14792
debug: (server): Took 0ms to process notification-$/cancelRequest on Thread 14792
debug: (server): Took 0ms to process request-12813-textDocument/documentSymbol on Thread 14792
debug: (server): Took 0ms to process request-12812-textDocument/foldingRange on Thread 14792
debug: (server): Took 829ms to process request-12811-textDocument/codeAction on Thread 16892
debug: (server): Took 1243ms to process request-12814-textDocument/codeAction on Thread 23452
debug: (server): Took 1655ms to process request-12816-textDocument/codeAction on Thread 23236
debug: (server): Took 0ms to process notification-textDocument/didChange on Thread 14792
debug: (server): Took 0ms to process notification-$/cancelRequest on Thread 16892
debug: (server): Took 0ms to process notification-$/cancelRequest on Thread 23452
(... etc ...)
@xydone xydone added the bug Something isn't working label Dec 1, 2024
@Techatrix
Copy link
Member

Could you try adding "zig.zls.preferAstCheckAsChildProcess": false, to your settings and see if that makes a difference?
If not, remove the "zig.path": "zig" setting so that ZLS doesn't use Zig. That should help to nail down the cause of this issue.

Could you also post the entire ZLS log output. The first few messages contains some useful information.

@xydone
Copy link
Author

xydone commented Dec 1, 2024

Just gave "zig.zls.preferAstCheckAsChildProcess": false, a try and I am not able to replicate it at the moment. If it comes up again, I will post more info, but it's looking good for now.

edit: update from a day later, this indeed has fixed the issue. thanks! I am leaving the issue open in case you want any more information about the problem as to narrow down the root of the cause.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants