Skip to content

missing @nodiscard in doc.json exports #3348

@haithium

Description

@haithium

How are you using the lua-language-server?

Command Line

Which OS are you using?

Linux

What is the issue affecting?

Annotations

Expected Behaviour

When exporting docs with lua-language-server --doc, function-level tags like @nodiscard should be included in the generated doc.json.

Actual Behaviour

Function-level tags like @nodiscard are missing from the generated doc.json.

Reproduction steps

  1. Create a Lua file, e.g., Set.lua, with a function using @nodiscard:

    ---@class Set
    local Set = {}
    
    ---Return true if the set has no elements
    ---@return boolean
    ---@nodiscard
    function Set:isempty() end
  2. Run lua-language-server --doc Set.lua in the project directory.

  3. Open the generated doc.json.

  4. Observe that the @nodiscard tag is not included.

Additional Notes

// doc.json
[
  // ...
  {
    // ...
    "fields": [
      {
        "async": false,
        "deprecated": false,
        "desc": "Return true if the set has no elements",
        "extends": {
          "args": [
            {
              "finish": [6, 8],
              "name": "self",
              "start": [6, 8],
              "type": "self",
              "view": "Set"
            }
          ],
          "desc": "Return true if the set has no elements",
          "finish": [6, 26],
          "rawdesc": "Return true if the set has no elements",
          "returns": [
            {
              "type": "function.return",
              "view": "boolean"
            }
          ],
          "start": [6, 0],
          "type": "function",
          "view": "(method) Set:isempty()\n  -> boolean"
        },
        "file": ".",
        "finish": [6, 20],
        "name": "isempty",
        "rawdesc": "Return true if the set has no elements",
        "start": [6, 9],
        "type": "setmethod",
        "view": "function",
        "visible": "public"
      }
    ],
    "name": "Set",
    "type": "type",
    "view": "Set"
  }
]

Log File

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions