feat: Revamp preview window

Please see README diff for details and implications.
This commit is contained in:
hedy
2023-11-01 21:04:26 +08:00
parent a7324dd3c9
commit d78d94218a
4 changed files with 76 additions and 117 deletions

View File

@@ -1,4 +1,5 @@
local so = require 'symbols-outline'
local soconfig = require 'symbols-outline.config'
local util = vim.lsp.util
local M = {}
@@ -28,7 +29,6 @@ function M.show_hover()
---@diagnostic disable-next-line: param-type-mismatch
function(_, result, _, config)
if not (result and result.contents) then
-- return { 'No information available' }
return
end
local markdown_lines = util.convert_input_to_markdown_lines(
@@ -36,10 +36,12 @@ function M.show_hover()
)
markdown_lines = util.trim_empty_lines(markdown_lines)
if vim.tbl_isempty(markdown_lines) then
-- return { 'No information available' }
return
end
return util.open_floating_preview(markdown_lines, 'markdown', config)
-- FIXME
local bufnr, winnr = util.open_floating_preview(markdown_lines, 'markdown', config)
local winhi = 'Normal:' .. soconfig.options.preview_bg_highlight
vim.api.nvim_win_set_option(winnr, 'winhighlight', winhi)
end
)
end