LuaLS / LuaLS/lua-language-server

Function assigned to field should be completed as function

Offen
#1,573 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

enhancement
Vorherrschende Sprache
Lua
Sterne
4.4k
Forks
442
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
lua
Bereich
devtools
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.