summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-07-15 23:48:13 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-07-15 23:48:13 +0800
commit7d546aeb0c78d2790a583809ceabfa620fdbde3c (patch)
treeb1d6ad821dcb23af83908fd5ecabd43337fe6650 /script
parent82d716ccaa8ebab931fd2328faa4f4c5a76eb99a (diff)
downloadlua-language-server-7d546aeb0c78d2790a583809ceabfa620fdbde3c.zip
resolve #1230
show enums for variables
Diffstat (limited to 'script')
-rw-r--r--script/core/hover/description.lua16
1 files changed, 12 insertions, 4 deletions
diff --git a/script/core/hover/description.lua b/script/core/hover/description.lua
index 32a0a798..e32d204c 100644
--- a/script/core/hover/description.lua
+++ b/script/core/hover/description.lua
@@ -349,15 +349,23 @@ local function getFunctionComment(source)
end
local function tryDocComment(source)
+ local md = markdown()
if source.type == 'function' then
local comment = getFunctionComment(source)
- if comment then
- return comment
- end
+ md:add('md', comment)
source = source.parent
end
local comment = lookUpDocComments(source)
- return comment
+ md:add('md', comment)
+ if source.type == 'doc.alias' then
+ local enums = buildEnumChunk(source, source.alias[1], guide.getUri(source))
+ md:add('lua', enums)
+ end
+ local result = md:string()
+ if result == '' then
+ return nil
+ end
+ return result
end
local function tryDocOverloadToComment(source)