LuaLS / LuaLS/lua-language-server
Two Rule Suggestions: multiple returns in function calls / table definitions and string concatenation
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
multiple returns in function calls / table definitions
local a = { "one", "two", "three" }
local b = { unpack(a), "four" }
local c = { "four", unpack(a) }
print(#b) -- 2
print(#c) -- 4
unpack's behavior is quite unintuitive; when the output is not in the last position of a table definition, only the first element is actually included in the new table. (In fact, this not only applies to unpack, but to every function that returns multiple values – only happens most often with unpack that will people will notice, I assume.)
see explainer in the docs: https://www.lua.org/manual/5.3/manual.html#3.4
I think a diagnostic that reminds one of such cases would be very useful, since it's a common gotcha in lua.
string concatenation
print("foo" + "bar")
Common mistake to not use .. for string concatenation. Even though I am used to lua, it still happens to me all the time after coming back from writing in a different language. A diagnostic here would be useful. (And I am actually a bit surprised that there isn't one yet.)
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 pela seção do manual do Lua 5.3 vinculada na issue, especialmente pelas regras de múltiplos valores de retorno ilustradas pelos exemplos de tabelas. Em seguida, localize os pontos de entrada de diagnóstico do language server para expressões com múltiplos valores de retorno em definições de tabelas e para o uso de + com strings. O trabalho estará concluído quando ambos os exemplos produzirem diagnósticos úteis sem sinalizar incorretamente código Lua válido.
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
- 4/5
- Tempo estimado
- 3-5 dias
- Status de atividade
- Estagnada
- Clareza
- Razoavelmente clara
- Facilidade para iniciantes
- 42/100