Provide API for add-ons to register only unique watchers
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 2k
- Forks
- 281
- Avg merge
- 2h 14m
- Merged PRs (30d)
- 6
Description
We are currently allowing add-ons to register file watchers freely, but I just realized this is not a good approach for a few reasons.
- It is better to register for file watching only once with multiple patterns, rather than creating several separate registrations
- If registration IDs are not unique, they will cause orphan LSP client objects that continue to receive file change events as we saw in #3137
- If add-ons register for the same pattern, like the RuboCop add-on registering for
.rubocop.yml(same as the Ruby LSP), then the server will receive duplicate changes for those patterns
We need to provide a proper API for file watching registration that provides the LSP with the opportunity to:
- Register them all at once
- Ensure ID uniqueness (it will be a single registration, so that is fixed by default)
- Verify that patterns are unique to avoid receiving the duplicate notifications in the first place
I haven't prototyped anything, but I think we may need a breaking change to expose a nicer API to add-ons. Instead of passing the outgoing_queue as a Thread::Queue, it would be better to have our own abstraction so that we can limit what add-ons can pass and ensure that bugs like these cannot happen.
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
No files or tests are named. Start by tracing how add-ons use the outgoing_queue and how file-watcher registrations reach the LSP; then define an API that batches registrations, guarantees unique IDs, and rejects duplicate patterns. Done means add-ons can register watchers through the abstraction without duplicate notifications or orphaned clients.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100