LuaLS / LuaLS/lua-language-server

Function assigned to field should be completed as function

Aperta
#1,573 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

enhancement
Lingua principale
Lua
Stelle
4.4k
Fork
442
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

### 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_

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
lua
Ambito
devtools
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.