LuaLS / LuaLS/lua-language-server
Feature Request: Hide a parameter from the annotation
Nessuno ha ancora preso questa issue.
- Lingua principale
- Lua
- Stelle
- 4.4k
- Fork
- 442
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
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.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia tracciando il modo in cui LuaLS gestisce le annotazioni dei parametri delle funzioni, le dichiarazioni @overload e le chiamate intercettate tramite il metametodo __index di una metatabella. Il lavoro è completato quando LuaLS può nascondere il parametro dati iniettato, spostare gli argomenti visibili e smettere di segnalare un avviso quando i chiamanti forniscono solo hello e world.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- lua
- Ambito
- devtools
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 25/100