LuaLS / LuaLS/lua-language-server

Unexpected `textDocument/references` results on keys inside nested tables

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

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

enhancement
主要言語
Lua
スター
4.4k
フォーク
442
PR マージ指標
30日以内にマージされた PR はありません

説明

Describe the bug
textDocument/references is returning unexpected results when used in a specific situation (more about that below).

To Reproduce

  1. Paste the following snippet in a lua file
ENUM = {
  VALUE1 = 1,
  VALUE2 = 2,
}

a = {
  { type = ENUM.VALUE1 },
  { type = ENUM.VALUE1 },
  { type = ENUM.VALUE2 },
}
  1. Move cursor over the 1st instance of "type" key in the a table
  2. Request references (textDocument/references)
  3. Observe the faulty results which comprise of the hovered "type" key + both instances of "VALUE1"

Expected behavior
Results that comprise of all 3 instances of "type" key

Additional context
textDocument/rename on the other hand only renames the hovered "type" key while expected to rename all 3 of its instances

Environment

  • OS: Linux
  • Client: Neovim

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

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

調査の方向性

示されているネストしたテーブルの例を使って Lua ファイルで問題を再現し、最初の型キーに対して textDocument/references を要求します。返された位置を textDocument/rename の動作と比較します。references に3つすべての型キーが含まれ、VALUE1 や VALUE2 が含まれていなければ完了です。

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

評価

技術スタック
lua, neovim
領域
devtools
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

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

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