Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Provide API for add-ons to register only unique watchers

Open
#3,145 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
28/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
ruby
Domain
devtools

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

enhancement pinned

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.

  1. It is better to register for file watching only once with multiple patterns, rather than creating several separate registrations
  2. 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
  3. 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:

  1. Register them all at once
  2. Ensure ID uniqueness (it will be a single registration, so that is fixed by default)
  3. 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

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.

More from Shopify/ruby-lsp

All issues in Shopify/ruby-lsp

Similar issues

More Ruby issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.