Provide API for add-ons to register only unique watchers
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 28/100
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.
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.
- Dominant language
- Ruby
- Stars
- 2k
- Forks
- 281
- Avg merge
- 1h 47m
- Merged PRs (30d)
- 8
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.
More from Shopify/ruby-lsp
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
bug help-wanted pinned
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
bug pinned
Difficulty 4/5 3-5 days Newbie friendliness 45/100
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 68/100
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 35/100
All issues in Shopify/ruby-lsp
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
palladius/rails8-app-on-gcp#145 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
rubocop/rubocop-rspec#2236 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
riscv/riscv-unified-db#2624 · 1 reaction ·
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100