LuaLS / LuaLS/lua-language-server
Feature Request: Hide a parameter from the annotation
Ninguém assumiu esta issue ainda.
- Linguagem predominante
- Lua
- Estrelas
- 4.4k
- Forks
- 442
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Descrição
I have a table with a metatable assigned to it to implement inheritance. The metatable's __index metamethod intercepts a call to a function on the original table and gets the actual function from the "parent" table and then injects another parameter into the function call.
For example, the user would call the function like this: tbl:Execute("hello", "world") and the function would be implemented like this:
function ParentTable:Execute(data, hello, world)
-- data is a special parameter controlled by the metatable and is given a table value
-- hello is assigned "hello" and world is assigned "world"
end
The problem with this is that VS Code and LuaLS warns the user that they didn't provide a value to data. I have to use @overload to every single method to say you can call this method with just "hello" and "world" arguments provided.
I want to be able to tell LuaLS to completely hide/ignore the data parameter and pretend it doesn't exist; essentially moving all other parameter indexes down by 1 to fill the empty spot, so "hello" is recognized as parameter 1 and "world" as parameter 2.
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.
Direção de pesquisa
Comece rastreando como o LuaLS lida com anotações de parâmetros de função, declarações @overload e chamadas interceptadas por meio do metamétodo __index de uma metatabela. O trabalho estará concluído quando o LuaLS puder ocultar o parâmetro de dados injetado, deslocar os argumentos visíveis e deixar de emitir um aviso quando os chamadores fornecerem apenas hello e world.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- lua
- Domínio
- devtools
- Tipo de issue
- Funcionalidade
- Dificuldade
- 5/5
- Tempo estimado
- Mais de uma semana
- Status de atividade
- Estagnada
- Clareza
- Razoavelmente clara
- Facilidade para iniciantes
- 25/100