Skip to content

Literal boolean values lead to broken formatting #85

@0xzhzh

Description

@0xzhzh

Related to #69

Putting literal values like false in ---@alias seems to mess up the formatting.

Running lemmy-help on the following:

---@alias Good
---| number   # number
---| function # string

---@alias Bad
---| 'x'    # x
---| false  # false
---| table  # table

---@alias Ugly
---| 'y'    # y
---| `true` # true
---| string # table

---@class Fubar
---@field foo number
---@field bar function

local M = {}
return M

Produces the following output

Good                                                                      *Good*

    Variants: ~



Bad                                                                        *Bad*
    | number   # number
    | function # string

    Variants: ~
        ("x")  x


Ugly                                                                      *Ugly*
    | false  # false
    | table  # table

    Variants: ~
        ("y")   y
        (true)  true


Fubar                                                                    *Fubar*
    | string # table

    Fields: ~
        {foo}  (number)
        {bar}  (function)


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

Am I doing something wrong with my type annotations? I tried both with and without wrapping the boolean value with backticks.

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