diff options
-rw-r--r-- | script/core/hover/description.lua | 6 | ||||
-rw-r--r-- | test/crossfile/hover.lua | 39 |
2 files changed, 45 insertions, 0 deletions
diff --git a/script/core/hover/description.lua b/script/core/hover/description.lua index c96aaae3..a0508cf9 100644 --- a/script/core/hover/description.lua +++ b/script/core/hover/description.lua @@ -206,6 +206,9 @@ local function getBindEnums(source, docGroup) for _, doc in ipairs(docGroup) do if doc.type == 'doc.param' then local name = doc.param[1] + if name == '...' then + name = '...(param)' + end if mark[name] then goto CONTINUE end @@ -215,6 +218,9 @@ local function getBindEnums(source, docGroup) for _, rtn in ipairs(doc.returns) do returnIndex = returnIndex + 1 local name = rtn.name and rtn.name[1] or ('return #%d'):format(returnIndex) + if name == '...' then + name = '...(return)' + end if mark[name] then goto CONTINUE end diff --git a/test/crossfile/hover.lua b/test/crossfile/hover.lua index c6991d8f..827c440c 100644 --- a/test/crossfile/hover.lua +++ b/test/crossfile/hover.lua @@ -1181,3 +1181,42 @@ function f(x: number, y: number, ...: number) 3. ...number ```]] } + +TEST { + { + path = 'a.lua', + content = [[ + ---@param p 'a1' | 'a2' + ---@param ... 'a3' | 'a4' + ---@return 'r1' | 'r2' ret1 + ---@return 'r3' | 'r4' ... + local function <?f?>(p, ...) end + ]] + }, + hover = [[ +```lua +function f(p: 'a1'|'a2', ...'a3'|'a4') + -> ret1: 'r1'|'r2' + 2. ...'r3'|'r4' +``` + +--- + +```lua +p: + | 'a1' + | 'a2' + +...(param): + | 'a3' + | 'a4' + +ret1: + | 'r1' + | 'r2' + +...(return): + | 'r3' + | 'r4' +```]] +} |