-
Notifications
You must be signed in to change notification settings - Fork 31.7k
LSP textDocument/documentSymbol
is delayed by ~350ms
#135453
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
Comments
It is more or less an arbitrary number which is driven by two things: we don't want to overwhelm extensions with requests and we want the UI to be stable. If asking for outline too quickly after typing it raises the chances to ask at an unfavorable time, like at time of invalid syntax. That usually result in visually very different outline, e.g a missing closing bracket of a method makes a huge difference to most outlines |
Thanks for the quick response.
I understand the need to debounce sluggish extensions. As I read the source code, the business logic in place measures the time the server needs to respond to a specific request and penalizes it for subsequent requests when it responds slowly. However, the current logic imposes a minimum delay of 350ms. So even when a language server answers within a few milliseconds, the delay will always be +350ms. This does not only affect the outline, but also Ohne.Titel.mp4Two ideas:
I think that this would significantly improve the writing experience. |
Almost everything that updates as you type is debounced but all use different delays and logic so I suggest that we leaf colors out of this.
Sure, we can tweak timeouts but I am not yet ready for that. I understand that your POV is one of an extension author that cannot show the true performance of their language service because of use. That's disappointing but different from usage feedback and I haven't seen users complain about this yet |
'Not ready' means that work on this end is planned?
My POV is actually a mixed one, as I use VS Code to write a lot of CSS, but am currently also writing a new CSS language server, so I'm actually on both ends. Going forward, I think maybe an extension to the LSP that allows a language server to send a "ready" notification that can be consumed by the extension host might be more stable option than arbitrary delays. Something like an |
I'm developing a VS Code extension and the experience so far has been tremendous!
I want my language server to be as fast as possible, which already works well for the
textDocument/didChange
andtextDocument/publishDiagnostics
notification roundtrip. However, VS Code seems to wait for ~350ms after the document change notification until it asks the language server for other providers, like for exampletextDocument/documentSymbol
andtextDocument/documentColor
.Trace captured with
ngrep
when run via TCP transportAs can be seen from the trace, my language server responds within the order of milliseconds:
However, VS Code will wait for more than 300ms before invoking the other providers, which becomes very noticeable:
My question is why does VS Code wait for so long? Can this interval be reduced via a language client, language server option, or setting? I would really like to mitigate this behavior because this delay renders the otherwise instantaneous experience rather sluggish.
I dug into the code base of VS Code and think I've found traces of the issue, e.g. in
outlineModel.ts
:A search for this class yields:
https://github.com/microsoft/vscode/search?q=LanguageFeatureRequestDelays
The issue was first reported here: microsoft/vscode-languageserver-node#838
The text was updated successfully, but these errors were encountered: