LuaLS / LuaLS/lua-language-server

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

未關閉
#1,281 5 則留言 1 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

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. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

使用所示的巢狀表格範例在 Lua 檔案中重現問題,並針對第一個型別鍵要求 textDocument/references。將傳回的位置與 textDocument/rename 的行為進行比較;當 references 包含全部三個型別鍵,且不包含 VALUE1 或 VALUE2 時,即表示完成。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
lua, neovim
領域
devtools
Issue 類型
缺陷
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。