diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-08-18 21:37:41 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-08-18 21:37:41 +0800 |
commit | 907bbbe0925e49f7b347cb81c20159f20dd98854 (patch) | |
tree | fd4210478cc77de8efc02b3783f48960e4ab7243 /script | |
parent | 5e36ce84e925f9c6e8eeeb3f9406b68dc6feaba6 (diff) | |
download | lua-language-server-907bbbe0925e49f7b347cb81c20159f20dd98854.zip |
cleanup markdown
Diffstat (limited to 'script')
-rw-r--r-- | script/core/completion.lua | 14 | ||||
-rw-r--r-- | script/core/hover/description.lua | 6 | ||||
-rw-r--r-- | script/core/hover/label.lua | 1 | ||||
-rw-r--r-- | script/provider/markdown.lua | 4 | ||||
-rw-r--r-- | script/provider/provider.lua | 8 |
5 files changed, 19 insertions, 14 deletions
diff --git a/script/core/completion.lua b/script/core/completion.lua index ba480451..d4f77368 100644 --- a/script/core/completion.lua +++ b/script/core/completion.lua @@ -197,7 +197,7 @@ local function buildDesc(source) md:add('md', hover.description) md:splitLine() md:add('lua', getSnip(source)) - return md:string() + return md end local function buildFunction(results, source, value, oop, data) @@ -385,13 +385,15 @@ local function checkModule(ast, word, offset, results) }, }, id = stack(function () + local md = markdown() + md:add('md', lang.script('COMPLETION_IMPORT_FROM', ('[%s](%s)'):format( + workspace.getRelativePath(uri), + uri + ))) + md:add('md', buildDesc(targetSource)) return { detail = buildDetail(targetSource), - description = lang.script('COMPLETION_IMPORT_FROM', ('[%s](%s)'):format( - workspace.getRelativePath(uri), - uri - )) - .. '\n' .. buildDesc(targetSource), + description = md, --additionalTextEdits = buildInsertRequire(ast, originUri, stemName), } end) diff --git a/script/core/hover/description.lua b/script/core/hover/description.lua index b58a08b7..afeb1bb9 100644 --- a/script/core/hover/description.lua +++ b/script/core/hover/description.lua @@ -50,7 +50,7 @@ local function asStringInRequire(source, literal) table.sort(shows) local md = markdown() md:add('md', table.concat(shows, '\n')) - return md:string() + return md end end end @@ -68,7 +68,7 @@ local function asStringView(source, literal) end local md = markdown() md:add('txt', view) - return md:string() + return md end end @@ -314,7 +314,7 @@ local function getFunctionComment(source) local md = markdown() md:add('md', comments) md:add('lua', enums) - return md:string() + return md end local function tryDocComment(source) diff --git a/script/core/hover/label.lua b/script/core/hover/label.lua index 0d2bcf6f..a29cf672 100644 --- a/script/core/hover/label.lua +++ b/script/core/hover/label.lua @@ -5,7 +5,6 @@ local buildTable = require 'core.hover.table' local infer = require 'core.infer' local vm = require 'vm' local util = require 'utility' -local searcher = require 'core.searcher' local lang = require 'language' local config = require 'config' local files = require 'files' diff --git a/script/provider/markdown.lua b/script/provider/markdown.lua index c5765571..5e564a40 100644 --- a/script/provider/markdown.lua +++ b/script/provider/markdown.lua @@ -4,6 +4,10 @@ mt.__name = 'markdown' mt._splitLine = false +function mt:__tostring() + return self:string() +end + local function checkSplitLine(self) if not self._splitLine then return diff --git a/script/provider/provider.lua b/script/provider/provider.lua index c416e748..aebf733e 100644 --- a/script/provider/provider.lua +++ b/script/provider/provider.lua @@ -445,7 +445,7 @@ proto.on('textDocument/completion', function (params) return t end)(), documentation = res.description and { - value = res.description, + value = tostring(res.description), kind = 'markdown', }, } @@ -455,7 +455,7 @@ proto.on('textDocument/completion', function (params) if resolved then item.detail = resolved.detail item.documentation = resolved.description and { - value = resolved.description, + value = tostring(resolved.description), kind = 'markdown', } end @@ -491,7 +491,7 @@ proto.on('completionItem/resolve', function (item) end item.detail = resolved.detail or item.detail item.documentation = resolved.description and { - value = resolved.description, + value = tostring(resolved.description), kind = 'markdown', } or item.documentation item.additionalTextEdits = resolved.additionalTextEdits and (function () @@ -545,7 +545,7 @@ proto.on('textDocument/signatureHelp', function (params) parameters = parameters, activeParameter = result.index - 1, documentation = result.description and { - value = result.description, + value = tostring(result.description), kind = 'markdown', }, } |