NightrainsRbx / RobloxLsp

Roblox Luau Language Server based on Lua by sumneko.
https://devforum.roblox.com/t/roblox-lsp-full-intellisense-for-roblox-and-luau/717745
MIT License
214 stars 51 forks source link

@param in doc comments overwrites luau type annotation #192

Closed medallyon closed 2 years ago

medallyon commented 2 years ago

Currently when writing doc comments for functions, annotating types for @param tags seems quite limited. Consider the following snippet:

-- Concatenate two tables together.
--- @param t1 The first table to concatenate.
--- @param t2 { [string]: true } The first table to concatenate.
local function concatTable(t1: { [string]: true }, t2: { [string]: true }): { [string]: true }
    local t = {}
    for _, v in pairs(t1) do
        table.insert(t, v)
    end
    for _, v in pairs(t2) do
        table.insert(t, v)
    end
    return t
end

This results in the following function description: image

When leaving the out the @param type, it should display the inline type annotation for the parameter in the function signature.

NightrainsRbx commented 2 years ago

Doc comments are incompatible with Luau, if your intention is to use Moonwave, use multiline comments, Roblox LSP doesn't actually uses Moonwave but it uses EmmyLua