Duplicate "go to definition" results when using table assignment syntax in a module
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 45/100
Rechercherichtung
Reproduziere die doppelten Ergebnisse mit dem Beispiel aus den zwei Dateien lib.lua und other.lua und vergleiche es anschließend mit der Form function lib.func(). Beginne damit, die go-to-definition-Verarbeitung des Language Servers für die Syntax von Tabellenzuweisungen nachzuverfolgen, und verwende die bereitgestellte Logdatei als Kontext. Als erledigt gilt die Aufgabe, wenn die Zuweisungsform an der Funktionsdeklaration genau ein Definitionsergebnis zurückgibt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
How are you using the lua-language-server?
Kakoune
Which OS are you using?
MacOS
What is the issue affecting?
Other
Expected Behaviour
When a module is written by assigning functions to table members with the following syntax:
local lib={}
lib.func = function()
-- ...
end
return lib
Performing a "Go to definition" on this function from another file that requires the module should go to the function defintion.
Actual Behaviour
Instead when doing a "Go to defintion", there are 2 results, and the user must choose one. They both point to the same line, one points to the table member's name and the other to the start of the function declaration.
Reproduction steps
- Create a project with two files,
lib.luaandother.lua, and populate them as follows:
lib.lua:
local lib={}
lib.func = function() end
return lib
other.lua:
local lib = require('lib')
lib.func()
-
From
other.lua, perform a "Go to definition" onfunc. Note that it has two results that must be chosen, one will take you to the table member's name, and the other will take you to the start of the function declaration. -
Change
lib.luato:
local lib={}
function lib.func() end
return lib
- From
other.lua, perform a "Go to definition" onfunc. It takes you directly to the start of the function declaration (which is also the table member's name).
Additional Notes
I know that the function lib.func() syntax is preferred, but this is an issue for me when using libraries that use the lib.func = function() syntax. I wasn't able to find any discussions of this issue, but it seems likely that others have run into it, so I am wondering if there is a solution that I just haven't found.
Log File
- Vorherrschende Sprache
- Lua
- Sterne
- 4.4k
- Forks
- 442
- Ø Merge
- 8 T. 9 Std.
- Gemergte PRs (30 T.)
- 1
Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus LuaLS/lua-language-server
-
enhancement
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
LuaLS/lua-language-server#1776 ·
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 65/100
LuaLS/lua-language-server#3463 · 5 Kommentare ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 55/100
LuaLS/lua-language-server#3461 ·
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 68/100
LuaLS/lua-language-server#3460 · 1 Kommentar · 1 Reaktion ·
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 68/100
LuaLS/lua-language-server#3459 · 1 Reaktion ·
Alle Issues in LuaLS/lua-language-server
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
openSUSE/python-rpm-macros#219 ·
-
bug mini.bracketed
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
-
accessibility bug typst
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
quarto-dev/quarto-cli#14947 · 2 Kommentare ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100