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

File changes are not debounced to the language server. #689

Closed
Industrial opened this issue Jun 29, 2022 · 3 comments
Closed

File changes are not debounced to the language server. #689

Industrial opened this issue Jun 29, 2022 · 3 comments

Comments

@Industrial
Copy link

Describe the bug
Flashing errors / hanging language server for 30 seconds.

To Reproduce
Currently when I edit documents that contain a lot of types/backend like React components with MaterialUI for example it happens that when I am making edits quickly it will flash errors for 30 seconds. It looks like all changes are pushed into a queue and sent into the language server and then processed one by one.

Expected behavior
When updating the language server with information from the document, cancel and throw away all request but the last one. This will ensure only the version of the document that you care about (when you stop typing) will be checked for errors.

A clear and concise description of what you expected to happen.

VSCode: 1.67.2
VSCode Deno: 3.13.0

@kitsonk
Copy link
Contributor

kitsonk commented Jul 8, 2022

This is more complex than it sounds. That changes are applied as quickly as they are received. The diagnostic calculation is debounced already. The TypeScript language server is single threaded and things like completions and other requests take a higher priority than a diagnostic run. Once those requests have been completed and there isn't further input coming in. A diagnostic run is requested. This enables the language server to be more responsive, but if there are other requests sent and are in the language server, they can't be cancelled, because of the non-async nature of the async server for many requests.

The changes cannot be discarded, because they are cumulative.

We still have some work to do with dealing with fully supporting cancellation tokens throughout the whole stack, which will help in some cases, but it is complicated. @dsherret has been looking at it.

What version of Deno are you using?

@Industrial
Copy link
Author

This was on 1.23.0.

@bartlomieju
Copy link
Member

I believe this is now fixed and we do debounce inside LSP. Feel free to reopen if the problem persists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants