diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-06-09 00:44:28 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-06-09 00:44:28 +0800 |
commit | c481991fee74022dd261fab3bd5f07f472b9f9ac (patch) | |
tree | 1b676b41e80be6922eda6fbadafaca5a3c1c21f9 /script/provider | |
parent | 38484bc7546869604751274f21de9f46ca8faf9a (diff) | |
download | lua-language-server-c481991fee74022dd261fab3bd5f07f472b9f9ac.zip |
update config
Diffstat (limited to 'script/provider')
-rw-r--r-- | script/provider/markdown.lua | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/script/provider/markdown.lua b/script/provider/markdown.lua index 6b7d24c8..de24e314 100644 --- a/script/provider/markdown.lua +++ b/script/provider/markdown.lua @@ -15,6 +15,7 @@ function mt:add(language, text) if not text then return self end + assert(type(text) == 'string') self._cacheResult = nil if type(text) == 'table' then self[#self+1] = { @@ -40,7 +41,15 @@ function mt:splitLine() return self end -function mt:string() +function mt:emptyLine() + self._cacheResult = nil + self[#self+1] = { + type = 'emptyline', + } + return self +end + +function mt:string(nl) if self._cacheResult then return self._cacheResult end @@ -59,6 +68,11 @@ function mt:string() lines[#lines+1] = '' lines[#lines+1] = '---' end + elseif obj.type == 'emptyline' then + if #lines > 0 + and lines[#lines] ~= '' then + lines[#lines+1] = '' + end elseif obj.type == 'markdown' then concat(obj.markdown) else @@ -101,7 +115,7 @@ function mt:string() end end - local result = table.concat(lines, '\n') + local result = table.concat(lines, nl or '\n') self._cacheResult = result return result end |