fix(lsp): prevent double <text> for cached plaintext markup

This commit is contained in:
Folke Lemaitre 2021-07-05 00:39:46 +02:00
parent c6226bd6c9
commit 910967e5af
No known key found for this signature in database
GPG Key ID: 707FE6FEB82F7984

View File

@ -810,16 +810,16 @@ function M.convert_input_to_markdown_lines(input, contents)
-- If it's plaintext, then wrap it in a <text></text> block -- If it's plaintext, then wrap it in a <text></text> block
-- Some servers send input.value as empty, so let's ignore this :( -- Some servers send input.value as empty, so let's ignore this :(
input.value = input.value or '' local value = input.value or ''
if input.kind == "plaintext" then if input.kind == "plaintext" then
-- wrap this in a <text></text> block so that stylize_markdown -- wrap this in a <text></text> block so that stylize_markdown
-- can properly process it as plaintext -- can properly process it as plaintext
input.value = string.format("<text>\n%s\n</text>", input.value or "") value = string.format("<text>\n%s\n</text>", value)
end end
-- assert(type(input.value) == 'string') -- assert(type(value) == 'string')
list_extend(contents, split_lines(input.value)) list_extend(contents, split_lines(value))
-- MarkupString variation 2 -- MarkupString variation 2
elseif input.language then elseif input.language then
-- Some servers send input.value as empty, so let's ignore this :( -- Some servers send input.value as empty, so let's ignore this :(