Duplicate "go to definition" results when using table assignment syntax in a module
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 45/100
Piste de recherche
Reproduisez les résultats en double avec l’exemple utilisant les deux fichiers lib.lua et other.lua, puis comparez-le avec la forme function lib.func(). Commencez par suivre la gestion de go-to-definition du serveur de langage pour la syntaxe d’affectation de table et utilisez le fichier journal fourni comme contexte. Le travail est considéré comme terminé lorsque la forme d’affectation renvoie un seul résultat de définition au niveau de la déclaration de la fonction.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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
- Langage dominant
- Lua
- Étoiles
- 4.4k
- Forks
- 442
- Merge moyen
- 8 j 9 h
- PR mergées (30 j)
- 1
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de LuaLS/lua-language-server
-
enhancement
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100
LuaLS/lua-language-server#1776 ·
-
泛型for迭代器的类型推导漏掉了带__call的类 Ouverte
Difficulté 3/5 1-2 jours Accessibilité débutants 65/100
LuaLS/lua-language-server#3463 · 5 commentaires ·
-
Difficulté 4/5 3-5 jours Accessibilité débutants 55/100
LuaLS/lua-language-server#3461 ·
-
Difficulté 3/5 1-2 jours Accessibilité débutants 68/100
LuaLS/lua-language-server#3460 · 1 commentaire · 1 réaction ·
-
Difficulté 3/5 1-2 jours Accessibilité débutants 68/100
LuaLS/lua-language-server#3459 · 1 réaction ·
Toutes les issues de LuaLS/lua-language-server
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
openSUSE/python-rpm-macros#219 ·
-
bug mini.bracketed
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
-
accessibility bug typst
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
quarto-dev/quarto-cli#14947 · 2 commentaires ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
HenrikBengtsson/CBI-software#134 ·
-
Nmap
Difficulté 1/5 Moins d'une heure Accessibilité débutants 85/100