LuaLS / LuaLS/lua-language-server
Feature Request: Hide a parameter from the annotation
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Lua
- Sterne
- 4.4k
- Forks
- 442
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
I have a table with a metatable assigned to it to implement inheritance. The metatable's __index metamethod intercepts a call to a function on the original table and gets the actual function from the "parent" table and then injects another parameter into the function call.
For example, the user would call the function like this: tbl:Execute("hello", "world") and the function would be implemented like this:
function ParentTable:Execute(data, hello, world)
-- data is a special parameter controlled by the metatable and is given a table value
-- hello is assigned "hello" and world is assigned "world"
end
The problem with this is that VS Code and LuaLS warns the user that they didn't provide a value to data. I have to use @overload to every single method to say you can call this method with just "hello" and "world" arguments provided.
I want to be able to tell LuaLS to completely hide/ignore the data parameter and pretend it doesn't exist; essentially moving all other parameter indexes down by 1 to fill the empty spot, so "hello" is recognized as parameter 1 and "world" as parameter 2.
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 LuaLS Funktionsparameter-Annotationen, @overload-Deklarationen und Aufrufe behandelt, die über die __index-Metamethode einer Metatabelle abgefangen werden. Erledigt ist die Aufgabe, wenn LuaLS den injizierten Datenparameter ausblenden, die sichtbaren Argumente verschieben und keine Warnung mehr ausgeben kann, wenn Aufrufer nur hello und world bereitstellen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- lua
- Bereich
- devtools
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 25/100