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

Clangd gets arbitarily backed up when clients interleave edits and unimportant requests #298

Closed
sam-mccall opened this issue Mar 3, 2020 · 0 comments

Comments

@sam-mccall
Copy link
Member

e.g:

  • insert a
  • hover
  • insert b
  • hover
  • insert c
  • hover
  • ...

Now we're being forced to rebuild every snapshot. If the AST builds slower than the user types, the ASTWorker queue will increase without bound. Note if the client cancels the requests then we will catch up.

Clients seem to like doing this with hover and codeAction requests. It's tempting to call such clients badly behaved (issuing many requests automatically and never cancelling them). However that may not help much :-)

We could allow requests to be invalidated (implicitly cancelled). This could mean invalidated by edits, or by another request of the same type. Invalidation could possibly be on by default (!), there could be a white/blacklist for request types, there could be protocol extensions or JSON-RPC headers to configure this.

sam-mccall added a commit to llvm/llvm-project that referenced this issue Mar 4, 2020
Summary:
Otherwise they can force us to build lots of snapshots that we don't need.
Particularly, try to do this for operations that are frequently
generated by editors without explicit user interaction, and where
editing the file makes the result less useful. (Code action
enumeration is a good example).

clangd/clangd#298

This doesn't return the "right" LSP error code (ContentModified) to the client,
we need to teach the cancellation API to distinguish between different causes.

Reviewers: kadircet

Subscribers: ilya-biryukov, javed.absar, MaskRay, jkorous, arphaman, jfb, usaxena95, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D75602
arichardson pushed a commit to arichardson/llvm-project that referenced this issue Apr 2, 2020
Summary:
Otherwise they can force us to build lots of snapshots that we don't need.
Particularly, try to do this for operations that are frequently
generated by editors without explicit user interaction, and where
editing the file makes the result less useful. (Code action
enumeration is a good example).

clangd/clangd#298

This doesn't return the "right" LSP error code (ContentModified) to the client,
we need to teach the cancellation API to distinguish between different causes.

Reviewers: kadircet

Subscribers: ilya-biryukov, javed.absar, MaskRay, jkorous, arphaman, jfb, usaxena95, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D75602
mem-frob pushed a commit to draperlaboratory/hope-llvm-project that referenced this issue Oct 7, 2022
Summary:
Otherwise they can force us to build lots of snapshots that we don't need.
Particularly, try to do this for operations that are frequently
generated by editors without explicit user interaction, and where
editing the file makes the result less useful. (Code action
enumeration is a good example).

clangd/clangd#298

This doesn't return the "right" LSP error code (ContentModified) to the client,
we need to teach the cancellation API to distinguish between different causes.

Reviewers: kadircet

Subscribers: ilya-biryukov, javed.absar, MaskRay, jkorous, arphaman, jfb, usaxena95, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D75602
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

2 participants