diff options
author | NyakoFox <nyakowofox@gmail.com> | 2023-11-25 16:29:54 -0400 |
---|---|---|
committer | NyakoFox <nyakowofox@gmail.com> | 2023-11-25 16:43:37 -0400 |
commit | 5a468a1a41535ff408490595ec694c65f337c6ba (patch) | |
tree | df2fcc6c6e973d13ef51273f2cdc9b372abc4101 /script/core/hover | |
parent | 8c4aca0fb664b7f7e383441e318b000e6cf971de (diff) | |
download | lua-language-server-5a468a1a41535ff408490595ec694c65f337c6ba.zip |
Add raw descriptions
Diffstat (limited to 'script/core/hover')
-rw-r--r-- | script/core/hover/description.lua | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/script/core/hover/description.lua b/script/core/hover/description.lua index 58fb9fbe..75189b06 100644 --- a/script/core/hover/description.lua +++ b/script/core/hover/description.lua @@ -336,7 +336,7 @@ local function tryDocFieldComment(source) end end -local function getFunctionComment(source) +local function getFunctionComment(source, raw) local docGroup = source.bindDocs if not docGroup then return @@ -356,14 +356,14 @@ local function getFunctionComment(source) if doc.type == 'doc.comment' then local comment = normalizeComment(doc.comment.text, uri) md:add('md', comment) - elseif doc.type == 'doc.param' then + elseif doc.type == 'doc.param' and not raw then if doc.comment then md:add('md', ('@*param* `%s` — %s'):format( doc.param[1], doc.comment.text )) end - elseif doc.type == 'doc.return' then + elseif doc.type == 'doc.return' and not raw then if hasReturnComment then local name = {} for _, rtn in ipairs(doc.returns) do @@ -401,13 +401,13 @@ local function getFunctionComment(source) end ---@async -local function tryDocComment(source) +local function tryDocComment(source, raw) local md = markdown() if source.value and source.value.type == 'function' then source = source.value end if source.type == 'function' then - local comment = getFunctionComment(source) + local comment = getFunctionComment(source, raw) md:add('md', comment) source = source.parent end @@ -429,7 +429,7 @@ local function tryDocComment(source) end ---@async -local function tryDocOverloadToComment(source) +local function tryDocOverloadToComment(source, raw) if source.type ~= 'doc.type.function' then return end @@ -438,7 +438,7 @@ local function tryDocOverloadToComment(source) or not doc.bindSource then return end - local md = tryDocComment(doc.bindSource) + local md = tryDocComment(doc.bindSource, raw) if md then return md end @@ -529,7 +529,7 @@ local function tryDocEnum(source) end ---@async -return function (source) +return function (source, raw) if source.type == 'string' then return asString(source) end @@ -539,10 +539,10 @@ return function (source) if source.type == 'field' then source = source.parent end - return tryDocOverloadToComment(source) + return tryDocOverloadToComment(source, raw) or tryDocFieldComment(source) or tyrDocParamComment(source) - or tryDocComment(source) + or tryDocComment(source, raw) or tryDocClassComment(source) or tryDocModule(source) or tryDocEnum(source) |