nextflow-io / nextflow-io/language-server
Some LSP requests should wait for debounced update
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 31
- Forks
- 8
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 2
Description
I got nerd-sniped over the weekend while playing around with the language server. Saving my findings here for later.
Some LSP requests like document link, document symbol, and code lens are made automatically by the editor as a document is edited. They do appear to be debounced (at least in vscode), but the delay is shorter than ours, so these requests are often processed before the AST has been re-compiled. I have seen the document links fall out of sync for this reason.
I would like to make these LSP requests wait for the delayed update if it exists, since the change event always seems to arrive first. Something like this:
- on didChange, trigger a delayed update and set an "awaiting update" flag to true
- on document link/symbol request, if "awaiting update" is true, wait on an "updated" condition variable
- on update, signal the "updated" condition variable, unblocking all relevant LSP requests
The problem I'm seeing is the lock associated with the condition. If the requests need to acquire the lock in order to wait on the condition variable, then the update thread can't acquire that lock to signal the condition variable. Maybe I need to use a read-write lock to handle this.
Contributor guide
No contributing guide indexed for this repository
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
Start by tracing the didChange handling and the document link, document symbol, and code lens request handlers described in the issue. Read how delayed updates and synchronization are currently implemented, then determine how requests can wait for the corresponding update without blocking its signal. Done means these requests use the latest compiled AST after edits without introducing a lock deadlock.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100