-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
emmylua_doc_cli
: Does not render union with comments as parameter type.
#134
Comments
My support for param integers does not include negative numbers, |
Thanks. FYI removing Input: ---Called when a construction unit wants to "use his nano beams".
---
---@param unitID integer
---@param unitDefID integer
---@param action
---| CMD.REPAIR # Repair
---| CMD.RECLAIM # Reclaim
---| CMD.RESTORE # Restore
---| CMD.RESURRECT # Resurrect
---| CMD.CAPTURE # Capture
---@return boolean actionAllowed
function SyncedCallins:AllowBuilderHoldFire(unitID, unitDefID, action) end Output: ### SyncedCallins.AllowBuilderHoldFire
---
```lua
function SyncedCallins.AllowBuilderHoldFire(
unitID: integer,
unitDefID: integer,
action: ()
) -> actionAllowed boolean
``` |
In the latest commit, I have supported negative numbers as a type. |
Sorry I should have included ---Command constants.
---
---@enum CMD
CMD = {
---@type 40
REPAIR = nil,
---@type 90
RECLAIM = nil,
---@type 110
RESTORE = nil,
---@type 125
RESURRECT = nil,
---@type 130
CAPTURE = nil,
} I have not tested your change yet, but I will. |
It seems that luals treats each enum member as a type. Currently, I do not support this. |
It doesn't handle this well either: LuaLS/lua-language-server#3104 But it seems like the correct annotation. |
I've updated to a union of input: ---Called when a construction unit wants to "use his nano beams".
---
---@param unitID integer
---@param unitDefID integer
---@param action -1|CMD
---
---One of the following:
--- - `-1` build,
--- - `CMD.REPAIR` repair,
--- - `CMD.RECLAIM` reclaim,
--- - `CMD.RESTORE` restore,
--- - `CMD.RESURRECT` resurrect, or
--- - `CMD.CAPTURE` capture.
---@return boolean actionAllowed
function SyncedCallins:AllowBuilderHoldFire(unitID, unitDefID, action) end output: ## methods
### SyncedCallins.AllowBuilderHoldFire
```lua
function SyncedCallins.AllowBuilderHoldFire(
unitID: integer,
unitDefID: integer,
action
) -> actionAllowed boolean Called when a construction unit wants to "use his nano beams". Alternatively if I parenthesize type as function SyncedCallins.AllowBuilderHoldFire(
unitID: integer,
unitDefID: integer,
action: unknown
) -> actionAllowed boolean |
Ah, I think this is a general problem with using a literal type in a union. ---@return ("left"|"right"|false) position `"left"` or `"right"` when dual screen is enabled, otherwise `false`.
function Spring.GetMiniMapDualScreen() end See there is no ```lua
function Spring.GetMiniMapDualScreen() -> position ("left"|"right")
```
@return `position` - `"left"` or `"right"` when dual screen is enabled, otherwise `false`. |
Input:
Output:
The text was updated successfully, but these errors were encountered: