nvim: lsp: Add support for inlay hints
Make sure to disable inlay hints by default. It seems to be quite bug ridden at the moment. However, we add a key mapping to toggle inlay hints.
This commit is contained in:
parent
12a925d203
commit
31c9213c0a
1 changed files with 7 additions and 2 deletions
|
@ -50,15 +50,16 @@ local lsp_augroup_id = vim.api.nvim_create_augroup("LSP", { clear = true })
|
|||
local lsp_key_mappings = {
|
||||
{ "definitionProvider" , 'n', 'pd' , '<cmd>lua PeekDefinition()<CR>' },
|
||||
{ "definitionProvider" , 'n', 'gd' , '<cmd>lua vim.lsp.buf.definition()<CR>' },
|
||||
{ "declarationProvider" , 'n', 'gD' , '<cmd>lua vim.lsp.buf.declaration()<CR>' },
|
||||
--{ "declarationProvider" , 'n', 'gD' , '<cmd>lua vim.lsp.buf.declaration()<CR>' },
|
||||
{ "typeDefinitionProvider" , 'n', '<C-k>' , '<cmd>lua vim.lsp.buf.type_definition()<CR>' },
|
||||
{ "referencesProvider" , 'n', 'gr' , '<cmd>lua vim.lsp.buf.references()<CR>' },
|
||||
{ "implementationProvider" , 'n', 'gi' , '<cmd>lua vim.lsp.buf.implementation()<CR>' },
|
||||
{ "implementationProvider" , 'n', 'gD' , '<cmd>lua vim.lsp.buf.implementation()<CR>' },
|
||||
{ "documentSymbolProvider" , 'n', '1gd' , '<cmd>lua vim.lsp.buf.document_symbol()<CR>' },
|
||||
{ "workspaceSymbolProvider", 'n', '1gD' , '<cmd>lua vim.lsp.buf.workspace_symbol()<CR>' },
|
||||
{ "hoverProvider" , 'n', '<Leader>k', '<cmd>lua vim.lsp.buf.hover()<CR>' },
|
||||
{ "signatureHelpProvider" , 'n', '<Leader>S', '<cmd>lua vim.lsp.buf.signature_help()<CR>' },
|
||||
{ "renameProvider" , 'n', 'gR' , '<cmd>lua vim.lsp.buf.rename()<CR>' },
|
||||
{ "inlayHintProvider" , 'n', 'gi' , '<cmd>lua vim.lsp.buf.inlay_hint(0, nil)<CR>' },
|
||||
|
||||
{ "documentRangeFormattingProvider", 'x', 'gq', '<cmd>lua vim.lsp.buf.format({async=true})<CR>' },
|
||||
{ "documentFormattingProvider" , 'n', 'gq', '<cmd>lua vim.lsp.buf.format({async=true})<CR>' },
|
||||
|
@ -192,6 +193,10 @@ local on_attach = function(client, bufnr)
|
|||
callback = vim.lsp.buf.clear_references,
|
||||
})
|
||||
end
|
||||
|
||||
if client.server_capabilities.inlayHintProvider then
|
||||
vim.lsp.buf.inlay_hint(bufnr, false)
|
||||
end
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
|
|
Loading…
Reference in a new issue