LuaLS / LuaLS/lua-language-server
feature suggestion: add a notation for callbacks that expects the user to implement
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Lua
- Sterne
- 4.4k
- Forks
- 442
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
There exist some callbacks in the LÖVE framework, like love.conf, love.draw and some others, and there is currently no way in EmmyLua to note that they are callbacks rather than normal functions, and that a new definition of the same function is an implementation rather than a new overload.
Current Behavior
No way to indicate that this is a callback instead of a normal function definition.
-- In the API definition.
---xxx
---@param t string
function callback(t) end
-- In user code
function callback(t)
t:$
end
There is no completion based on the type of the parameter or ...
Suggested Behavior
Add a new notation for callbacks so when user is defining a new implementation, they can get completion on the parameters. This is especially useful when the parameter is extremely complex (for an example, see love.conf)
-- In the API definition.
---@callback
---xxx
---@param t string
callback = nil
-- In the user code
function callback(t)
t:$
end
I am totally open to the specific syntax, and I think what is really important is to have a syntax for them.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne damit, nachzuverfolgen, wie EmmyLua annotations und Funktionsdefinitionen dargestellt werden, und vergleiche das dann mit den im Issue genannten LÖVE-Callbacks. Entscheide über die Callback-Syntax und ihre Interaktion mit Benutzerimplementierungen und der Parametervervollständigung. Fertig ist die Aufgabe, wenn die Notation Callbacks von gewöhnlichen Funktionen unterscheidet und die Vervollständigung für Callback-Parameter ermöglicht; es werden keine Dateien oder Tests genannt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- lua
- Bereich
- tooling
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 30/100