Proposal Wiki (Tips): Colorizer LSP Hover
aspeddro opened this issue · 0 comments
aspeddro commented
Great plugin @norcalli
Using vim.lsp.buf.hover()
to colorizer menu.
Tested in Neovim 0.5.1
vim.lsp.handlers['textDocument/hover'] = (function(_, result)
local handler = function(_, result)
if result then
local lines = vim.split(result.contents.value, '\n')
local bufnr = vim.lsp.util.open_floating_preview(lines, 'markdown', { border = 'rounded' })
require('colorizer').highlight_buffer(bufnr, nil, vim.list_slice(lines, 2, #lines), 0, require('colorizer').get_buffer_options(0))
end
end
return handler
end)()
Note: Passing a table with all the rows, colorizer doesn't work
-- lines = {'```lua', 'field c.green: string = "#C3E88D"', '```' }
require('colorizer').highlight_buffer(bufnr, nil, lines, 0, require('colorizer').get_buffer_options(0))