Shopify / Shopify/ruby-lsp

Explore making indexing locations lazily fetched with comments

Open
#2,705 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Currently, we eagerly capture all entry locations in the index. We may be able to improve both performance and memory usage if we delay that to only when entries are interacted with.

Entries already know which file they were discovered in and we already fetch their comments lazily, so we could very well build the indexer locations lazily too. Something like

class Entry
  def comments
    return @comments if @comments

    fetch_lazy_data!
    @comments
  end

  def location
    return @location if @location

    fetch_lazy_data!
    @location
  end

  private

  def fetch_lazy_data!
    parse_result = Prism.parse_file(@file_path)

    # Figure out the location for this entry
    # Figure out comments
    # Other things we fetch lazily
  end
end

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 Entry indexing path and the existing lazy comments handling, then inspect where indexer locations are eagerly captured. Use Prism.parse_file and the Entry location/comments entry points as the comparison boundary; done means the proposal is evaluated with behavior preserved and its performance and memory impact demonstrated.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
performance
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.