LuaLS / LuaLS/lua-language-server
feature suggestion: add a notation for callbacks that expects the user to implement
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Lua
- Estrellas
- 4.4k
- Forks
- 442
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
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.
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Empieza trazando cómo se representan las EmmyLua annotations y las definiciones de funciones, y después compáralo con los callbacks de LÖVE mencionados en el issue. Decide la sintaxis de los callbacks y su interacción con las implementaciones del usuario y la finalización de parámetros. Se considera terminado cuando la notación distingue los callbacks de las funciones ordinarias y permite la finalización de los parámetros de los callbacks; no se nombran archivos ni tests.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- lua
- Área
- tooling
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 30/100