Skip to content

Support ---@return <type>? #desc #80

@wfjt

Description

@wfjt

The @return tag uses Ty for second field which doesn't support Opt <type>?, this seems to results in the following behaviour:

---Some func
---@param some? string Optional param parsed correctly
---@return string? #This end up as part of `some` param desc
function M.func(some) end

Yields

M.func({some?})                                                         *M.func*
    Some func

    Parameters: ~
        {some?}  (string)  Optional param parsed correctly
                           @return string? #This end up as part of `some` param desc

This may not be part of EmmyLua spec but lua_ls specific, but considering ---@param name? <type> works I would expect the same for ---@return <type>? #desc. ---@return string|nil #foo works fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions