eclipse-lsp4e / eclipse-lsp4e/lsp4e

Rationalise Timeouts (and other constants)

Open
#414 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
85
Forks
69
Avg merge
8h 33m
Merged PRs (30d)
6

Description

Having just sinned by adding one in myself (into LSPFormatFilesHandler...) it reminded me that we have quite a few literals scattered round the code, and in particular timeouts - various implementing classes have added timeouts when dereferencing LS response futures and they all seem to do their own thing.

Would it be sensible to try and make those plugin-level constants defined centrally, with just a few core values? If we did that, then those constants could also be made injectable using system properties or preferences/platform debug options.

I think rather than ad-hoc values there is probably a small number of categories of responsiveness we need to support:

  • batch (can be long)
  • user-initiated command (of the order of a few seconds)
  • UI transient (executed on the UI thread, needs to be sub second)

Consuming code should probably choose the most appropriate one of those standard values, depending on their task, rather than plucking a value out of the air.

I was just trying out the batch file formatter using corrosion and a random (not very big) Rust project I got off GitHub as a test subject. I see the 5s timeout I added there isn't quite enough for this project.

The Corrosion plugin & the rust LS seem to be a good example of needing to tweak these values depending on the consuming plugin: the rust LS seems to start up very quickly but then takes quite a while indexing the project before it is really ready. Any operations run early in the lifetime of that LS tend to time out. For example when I start the server by opening a file in smallish project, the outline view for that file shows waiting for metadata or cargo and doesn't recover unless you close and reopen that file.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the timeout added in LSPFormatFilesHandler and inventorying the timeout literals in the Corrosion plugin and other implementing classes. Compare their use for batch work, user commands, and UI transients; the work is done when a small, agreed set of centrally defined and configurable values replaces ad-hoc choices without the Rust LS startup and indexing failures described.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
devtools
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.