LuaLS / LuaLS/lua-language-server
Unexpected `textDocument/references` results on keys inside nested tables
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Lua
- Sterne
- 4.4k
- Forks
- 442
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
**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
```lua
ENUM = {
VALUE1 = 1,
VALUE2 = 2,
}
a = {
{ type = ENUM.VALUE1 },
{ type = ENUM.VALUE1 },
{ type = ENUM.VALUE2 },
}
```
2. Move cursor over the 1st instance of `"type"` key in the `a` table
3. Request references (`textDocument/references`)
4. 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
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Reproduzieren Sie das Problem in einer Lua-Datei mit dem gezeigten Beispiel einer verschachtelten Tabelle und fordern Sie textDocument/references für den ersten Typschlüssel an. Vergleichen Sie die zurückgegebenen Positionen mit dem Verhalten von textDocument/rename; abgeschlossen ist die Aufgabe, wenn die Referenzen alle drei Typschlüssel enthalten, ohne VALUE1 oder VALUE2 einzuschließen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- lua, neovim
- Bereich
- devtools
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100