From e39fba474ab432265c9af4a66e2a1764cd0ca1d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Tue, 5 Jan 2021 11:47:27 +0800 Subject: hover: tail comments may be cutted --- changelog.md | 2 ++ script/core/hover/description.lua | 6 +++++- test/hover/init.lua | 7 +++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 8f5a3bdf..b519d3f5 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,8 @@ # changelog ## 1.11.0 +* `CHG` completion: improve performance of workspace words +* `FIX` hover: tail comments may be cutted * `FIX` runtime errors ## 1.10.0 diff --git a/script/core/hover/description.lua b/script/core/hover/description.lua index 570dec3f..cd24b013 100644 --- a/script/core/hover/description.lua +++ b/script/core/hover/description.lua @@ -94,7 +94,11 @@ local function getBindComment(source, docGroup, base) continue = true lines = {} end - lines[#lines+1] = doc.comment.text:sub(2) + if doc.comment.text:sub(1, 1) == '-' then + lines[#lines+1] = doc.comment.text:sub(2) + else + lines[#lines+1] = doc.comment.text + end elseif doc == base then break else diff --git a/test/hover/init.lua b/test/hover/init.lua index 5b3acded..832ce50c 100644 --- a/test/hover/init.lua +++ b/test/hover/init.lua @@ -1510,3 +1510,10 @@ local v: C { x: string, } ]] + +TEST [[ +local --测试 +]] +[[ +local x: any +]] -- cgit v1.2.3