Skip to content

Union type with string literals not recognized with double quotes #22

@mfussenegger

Description

@mfussenegger

Thanks for the work on vimcats.

It looks like there's a small issue with union types using string literals that
use double quotes.

For example with:

local M = {}

---Hello
---
---@param x "foo"|"bar"
function M.name(x)
  print(x)
end

return M

With vimcats 1.1.0 the generated docs look like:

M.name()                                                                *M.name*


vim:tw=78:ts=8:noet:ft=help:norl:

Changing the literals to use single quote: ---@param x 'foo'|'bar' makes it work:

M.name({x})                                                             *M.name*
    Hello


    Parameters: ~
        {x}  ("foo"|"bar")


vim:tw=78:ts=8:noet:ft=help:norl:

Given that the union type examples in https://luals.github.io/wiki/annotations/
use double quotes I think it would be great if both variants worked.

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