Duplicate "go to definition" results when using table assignment syntax in a module
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 45/100
Direção de pesquisa
Reproduza os resultados duplicados com o exemplo de dois arquivos lib.lua e other.lua e, em seguida, compare-o com a forma function lib.func(). Comece rastreando o tratamento de go-to-definition do servidor de linguagem para a sintaxe de atribuição de tabela e use o arquivo de log fornecido como contexto. O trabalho estará concluído quando a forma de atribuição retornar um único resultado de definição na declaração da função.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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
- Linguagem predominante
- Lua
- Estrelas
- 4.4k
- Forks
- 442
- Merge médio
- 8d 9h
- PRs com merge (30d)
- 1
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de LuaLS/lua-language-server
-
enhancement
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
LuaLS/lua-language-server#1776 ·
-
泛型for迭代器的类型推导漏掉了带__call的类 Aberta
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 65/100
LuaLS/lua-language-server#3463 · 5 comentários ·
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 55/100
LuaLS/lua-language-server#3461 ·
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 68/100
LuaLS/lua-language-server#3460 · 1 comentário · 1 reação ·
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 68/100
LuaLS/lua-language-server#3459 · 1 reação ·
Todas as issues de LuaLS/lua-language-server
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
openSUSE/python-rpm-macros#219 ·
-
bug mini.bracketed
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
-
accessibility bug typst
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
quarto-dev/quarto-cli#14947 · 2 comentários ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
HenrikBengtsson/CBI-software#134 ·
-
Nmap
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 85/100