Shopify / Shopify/ruby-lsp

Duplicate entries when receiving a `textDocument/didOpen` before indexing is complete

Open
#3,639 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug pinned
Dominant language
Ruby
Stars
2k
Forks
281
Avg merge
2h 14m
Merged PRs (30d)
6

Description

If the user opens the editor with files already opened, the editor might be able to get some didOpen notifications sent before indexing is complete. In this case, opening the documents will also index them, but we have no way to tell the indexing process to drop the URI.

We need to ensure that that indexing the same file twice without any modifications never results in duplicates because there are some scenarios that risk it:

  • open a document before indexing is finished
  • a file is modified on disk before indexing is finished
  • a file is modified on disk and then immediately opened

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.

Research direction

Start by tracing the textDocument/didOpen handler and the indexing process, then reproduce the three timing scenarios described in the issue. Done means indexing the same unchanged URI through those paths never creates duplicate entries; add or run focused tests for each scenario if the existing test structure supports them.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.