lua-language-server
lua-language-server copied to clipboard
Add a shortcut annotation for adding a `nil,string` return type to functions (`@error`)
Returning of errors from Lua functions is often done by returning nil + error message (nil,string):
---@return table
---@overload fun(): nil, string
local function doSomething()
but this syntax can get complex when function takes parameters, or has other overloads. An old solution from LDoc was to use a @error annotation - I propose to add something similar to LuaLS.