From c62b62ee0c0fb980d96089d546388efd70fc6ebe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Sat, 13 Aug 2022 03:45:38 +0800 Subject: fix #1446 --- changelog.md | 1 + script/parser/luadoc.lua | 10 +++++++++- test/hover/init.lua | 1 - 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index 13153b60..147946f4 100644 --- a/changelog.md +++ b/changelog.md @@ -7,6 +7,7 @@ * `FIX` [#1428](https://github.com/sumneko/lua-language-server/issues/1428) * `FIX` [#1430](https://github.com/sumneko/lua-language-server/issues/1430) * `FIX` [#1431](https://github.com/sumneko/lua-language-server/issues/1431) +* `FIX` [#1446](https://github.com/sumneko/lua-language-server/issues/1446) ## 3.5.2 `2022-8-1` diff --git a/script/parser/luadoc.lua b/script/parser/luadoc.lua index ea6d7654..4393e23d 100644 --- a/script/parser/luadoc.lua +++ b/script/parser/luadoc.lua @@ -1697,7 +1697,15 @@ local function bindDoc(source, binded) if not source.bindDocs then source.bindDocs = {} end - source.bindDocs[#source.bindDocs+1] = doc + source.bindDocs[#source.bindDocs + 1] = doc + if source.args then + for _, arg in ipairs(source.args) do + if arg[1] == doc.param[1] then + bindDocWithSource(doc, arg) + break + end + end + end end elseif doc.type == 'doc.vararg' then if source.type == '...' then diff --git a/test/hover/init.lua b/test/hover/init.lua index 6a4b5399..6d58f051 100644 --- a/test/hover/init.lua +++ b/test/hover/init.lua @@ -2137,7 +2137,6 @@ function test2() 3. integer ]] -do return end TEST [[ ---@param x number ---@return boolean -- cgit v1.2.3