This commit is contained in:
hrsh7th
2021-08-09 13:35:15 +09:00
parent f0cf347720
commit d7ecc096e5

View File

@@ -22,17 +22,20 @@ float.show = function(self, e)
float.close.stop() float.close.stop()
local documentation = config.get().documentation local documentation = config.get().documentation
if not documentation then
return
end
-- update buffer content if needed. -- update buffer content if needed.
if not self.entry or e.id ~= self.entry.id then if not self.entry or e.id ~= self.entry.id then
self.entry = e
self.buf = vim.api.nvim_create_buf(true, true)
vim.api.nvim_buf_set_option(self.buf, 'bufhidden', 'wipe')
local documents = e:get_documentation() local documents = e:get_documentation()
if #documents == 0 then if #documents == 0 then
return self:close() return self:close()
end end
self.entry = e
self.buf = vim.api.nvim_create_buf(false, true)
vim.api.nvim_buf_set_option(self.buf, 'bufhidden', 'wipe')
vim.lsp.util.stylize_markdown(self.buf, documents, { vim.lsp.util.stylize_markdown(self.buf, documents, {
max_width = documentation.maxwidth, max_width = documentation.maxwidth,
max_height = documentation.maxheight, max_height = documentation.maxheight,