diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-02-22 17:50:36 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-02-22 17:50:36 +0800 |
commit | 063c5df95d74c8ba53dc5c38de9b57be30a3ef07 (patch) | |
tree | 19addea2dd376dafdf24c8eac9376a14b79a2363 /script/provider | |
parent | c8b027715e2e39fdeebbb115a25fb8f052d97722 (diff) | |
download | lua-language-server-063c5df95d74c8ba53dc5c38de9b57be30a3ef07.zip |
fix #403 improve class hover
Diffstat (limited to 'script/provider')
-rw-r--r-- | script/provider/markdown.lua | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/script/provider/markdown.lua b/script/provider/markdown.lua index ca76ec89..ceaedfdb 100644 --- a/script/provider/markdown.lua +++ b/script/provider/markdown.lua @@ -2,10 +2,27 @@ local mt = {} mt.__index = mt mt.__name = 'markdown' +mt._splitLine = false + +local function checkSplitLine(self) + if not self._splitLine then + return + end + self._splitLine = nil + if #self == 0 then + return + end + + self[#self+1] = '---' +end + function mt:add(language, text) if not text or #text == 0 then return end + + checkSplitLine(self) + if language == 'md' then if self._last == 'md' then self[#self+1] = '' @@ -14,6 +31,7 @@ function mt:add(language, text) else self[#self+1] = ('```%s\n%s\n```'):format(language, text) end + self._last = language end @@ -21,6 +39,10 @@ function mt:string() return table.concat(self, '\n') end +function mt:splitLine() + self._splitLine = true +end + return function () return setmetatable({}, mt) end |