Skip to content

@field doesn't to work for tables #2976

@47rooks

Description

@47rooks

How are you using the lua-language-server?

Visual Studio Code Extension (sumneko.lua)

Which OS are you using?

Windows

What is the issue affecting?

Completion, Other

Expected Behaviour

When using the table while coding I want to see the field names and their descriptions in a table which is pushed from the host program. These are various useful globals, though I'll have other examples with class instance values.

Actual Behaviour

When I mouse over or type the table name I can only see the placeholder field names and values but no description.
So I see this in the editor:

(global) FlxG: {
    height: nil,
    width: nil,
}
@table FlxG

Reproduction steps

Define a Lua file.
In my case this is really just a doc file to provide Lua completion doc in VSCode when coding to call function and use values from the host program. So I define a .lua file like:

--- Read access to global values from Flixel.
--- @field width number The width of the game window.
--- @field height number The height of the game window.
--- @table
FlxG = {
    width = nil,
    height = nil
}

This syntax comes from LDoc examples but I have tried variations - none successful. For example I have tried dropping the @table tag but that makes no difference.

Additional Notes

This is very similar to #2960 but I'm not sure whether they are identical or not. I don't get the error message seen in that issue.

Also, I note that while LDoc documents just '--' on lines after the first I find that the VSCode extension does not recognise that format. So I have to use a third '-' on all lines.

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