LuaLS / LuaLS/lua-language-server

Function assigned to field should be completed as function

Aberta
#1,573 2 comentários 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

enhancement
Linguagem predominante
Lua
Estrelas
4.4k
Forks
442
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

### How are you using the lua-language-server?

Visual Studio Code Extension (sumneko.lua)

### Which OS are you using?

Windows

### What is the issue affecting?

Completion

### Expected Behaviour

When providing an alias for a function in a table, the alias should be treated as a function.

### Actual Behaviour

When providing an alias for a function in a table, the alias is treated as a field and does not get completed as a function. Hover shows that the field is a function, but completion does not agree or complete with parentheses.

![image](https://user-images.githubusercontent.com/61925890/191289632-6b2b52d4-6ff5-472d-bd92-680ed9a84810.png)

### Reproduction steps

1. Use the below code
```lua
---@class myTable
local t = {}

---Does a thing
---@param a integer
---@param b string
---@param c boolean
function t.myFunc(a, b, c) end
t.myAlias = t.myFunc

```
2. Try to get completions for the **function** `t.myAlias`

### Additional Notes

This would be incredibly useful for aliasing a function — something that [luassert](https://github.com/sumneko/lua-language-server/pull/1556) does **a lot**.

### Log File

_No response_

Guia de contribuição

Abrir o guia de contribuição

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Direção de pesquisa

Reproduce the issue in the LuaLS Visual Studio Code extension using the provided t.myFunc and t.myAlias example, then trace the completion and type information handling for the alias. Done means t.myAlias is recognized as a function in completion, offers parentheses, and agrees with the function type shown by hover.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
lua
Domínio
devtools
Tipo de issue
Bug
Dificuldade
4/5
Tempo estimado
3-5 dias
Status de atividade
Estagnada
Clareza
Razoavelmente clara
Facilidade para iniciantes
35/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.