Skip to content

Render @alias tags? #11

@FreeMasen

Description

@FreeMasen

When building up some more complicated doc comments (for example a function that takes or returns a callback) it is much easier to use an alias for example

---@alias SourceFn fun():string|nil,string|nil
---
---@param callback SourceFn
local function some_function(callback)
end

would render with some_function(callback:SourceFn) but no link to SourceFn

This is complicated further when trying to use tables

---@alias SendFn fun(chunk:string):string|nil,string|nil
---@alias Sender { send: SendFn }

---@param sender Sender
local function some_function(sender)
end

similarly this would render as some_function(sender: Sender) which doesn't provide enough context to be helpful. It would be nice to have these aliases rendered as part of the document's output.

note: I've started using aliases because the inline emmylua syntax for something like ---@param sender {send: fun(chunk:string):string|nil,string|nil reports the following error

ERROR:root:./path/to/source.lua: l.1: invalid @param tag: @param {send: fun(chunk:string):string|nil,string|nil

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