eclipse-lsp4e / eclipse-lsp4e/lsp4e
Clean up lifecycle code
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 85
- Forks
- 69
- Avg merge
- 8h 33m
- Merged PRs (30d)
- 6
Description
This isn't a coherent proposal as such (yet!), I just wanted to note down some observations as I've spent quite a bit of time in the low-level lifecycle code one way or another recently. I think it would be good to do a bit of maintenance on this area.
- I think there are some outstanding, subtle race conditions that can occur when
.start()and.stop()overlap inLanguageServerWrapper. I'm not quite sure what they are, and making the default timeout > 0 probably makes them less likely, but I definitely saw some 'odd' errors when investigating the issues withLSPFileFormatHandler. It would be good to pick through this very carefully and check how they interact. - Document connection in
LanguageServerWrapperlooks to be missing a layer of coordination when multiple operations are trying to connect to a document at overlapping times. I think this is benign, but it does result in a lot of unnecessary tasks spawned in the fork join pool. It might be better to have a second map of 'pending connection' futures so that multiple calls to this function all return the same object. - The
start()method is a bit scary, constructing severalCompletableFutureobjects chained together, with a lot of very long blocks of statements inline. It would be nice to split things such as the construction of the initialisation parameters out into separate methods, so that the overall critical flow of control (and the various possible lifecycle stages) became easier to read.
What do others think? Happy to spend a bit of time on this at some point if people agree.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Begin with LanguageServerWrapper and the LSPFileFormatHandler issues mentioned in the report. Trace overlapping start/stop and document-connection operations, then review the existing CompletableFuture flow. Done would require an agreed scope, verified lifecycle behavior, and evidence covering the reported races and redundant tasks.
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