LuaLS / LuaLS/lua-language-server
feature suggestion: add a notation for callbacks that expects the user to implement
Nobody has claimed this yet.
- Dominant language
- Lua
- Stars
- 4.4k
- Forks
- 442
- PR merge metrics
- No merged PRs in 30d
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing how EmmyLua annotations and function definitions are represented, then compare that with the LÖVE callbacks named in the issue. Decide the callback syntax and its interaction with user implementations and parameter completion. Done means the notation distinguishes callbacks from ordinary functions and enables completion for callback parameters; no files or tests are named.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100