nvim: lsp: show help on hover

This commit is contained in:
tastytea 2022-08-13 21:55:59 +02:00
parent 30416dbd26
commit 16623c3ac2
Signed by: tastytea
SSH Key Fingerprint: SHA256:FBkvrOlhq5use1XEttyUGT4bUTDVA1ar9SgIc9P03cM

View File

@ -38,24 +38,31 @@ packer.use {
hi! LspReferenceText cterm=bold ctermbg=red guibg=#633466 hi! LspReferenceText cterm=bold ctermbg=red guibg=#633466
hi! LspReferenceWrite cterm=bold ctermbg=red guibg=#633466 hi! LspReferenceWrite cterm=bold ctermbg=red guibg=#633466
]] ]]
vim.api.nvim_create_augroup('lsp_document_highlight', { vim.api.nvim_create_augroup('config_lsp', { clear = false })
clear = false
})
vim.api.nvim_clear_autocmds({ vim.api.nvim_clear_autocmds({
buffer = bufnr, buffer = bufnr,
group = 'lsp_document_highlight', group = 'config_lsp',
}) })
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, { vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
group = 'lsp_document_highlight', group = 'config_lsp',
buffer = bufnr, buffer = bufnr,
callback = vim.lsp.buf.document_highlight, callback = vim.lsp.buf.document_highlight,
}) })
vim.api.nvim_create_autocmd('CursorMoved', { vim.api.nvim_create_autocmd('CursorMoved', {
group = 'lsp_document_highlight', group = 'config_lsp',
buffer = bufnr, buffer = bufnr,
callback = vim.lsp.buf.clear_references, callback = vim.lsp.buf.clear_references,
}) })
end end
-- show help on hover
if client.resolved_capabilities.hover then
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
group = 'config_lsp',
buffer = bufnr,
callback = vim.lsp.buf.hover,
})
end
end end
-- update client capabilities with completion plugin stuff -- update client capabilities with completion plugin stuff