Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Lazy Index Entries

オープン
#3,545 コメント 1 件 リアクション 1 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
機能追加
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
ruby
領域
tooling

調査の方向性

まず、提案されている @listener.add_lazy_method と linearized_ancestors_of の呼び出し周辺にあるインデックス構築および検索の経路を追跡します。RubyIndex::Entry::Method と既存のインデックスエントリの処理を確認します。インデックス作成中に遅延エントリを保存でき、インデックス作成後に評価でき、proc が nil を返した場合に除外できれば完了です。

索引モデルが issue の本文から書いたものです。

説明

enhancement pinned
I have checked that this feature is not already implemented
  • This feature does not exist
Use case

For every Ruby DSL I can think of, false positives could be avoided by querying the index to understand the context of the call. For example, the belongs_to DSL method in Rails is only available on descendants of ActiveRecord::Base.

Unfortunately, it is not possible to query the index to check if the current context inherits from ActiveRecord::Base while still building the index.

Description

I think this problem could be solved by allowing you to store lazy “potential” entries in the index. Let’s say you pick up the method call belongs_to :user. You want to define the method user as a result of this, but only if the class inherits from ActiveRecord::Base.

What if you could add an entry like this?

@listener.add_lazy_method("user") do |index|
  if index.linearized_ancestors_of(owner).include?("ActiveRecord::Base")
    RubyIndex::Entry::Method.new(
      # ...
    )
  end
end

The index could store that there is potentially a method called user and its signature is in this Proc.

At lookup time, once the indexing is completed, the proc could be executed and if it returns nil, the entry is ignored. Otherwise, the returned Method entry is used.

Implementation

No response

主要言語
Ruby
スター
2k
フォーク
284
平均マージ
11時間 11分
マージ済み PR(30日)
10

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Shopify/ruby-lsp のほかの issue

Shopify/ruby-lsp の issue をすべて見る

似ている issue

Ruby の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。