fix(disable): disable inline hints by default

This commit is contained in:
Bruno Carlin 2025-02-11 15:23:05 +01:00
parent 83bb18fdd1
commit 78a73ded25

View file

@ -41,11 +41,7 @@ vim.keymap.set('n', '<space>dl', '<cmd>lua vim.diagnostic.setloclist()<CR>', opt
vim.api.nvim_create_autocmd('LspAttach', {
group = vim.api.nvim_create_augroup('UserLspConfig', {}),
callback = function(ev)
-- Enable inlay hints
local client = vim.lsp.get_client_by_id(ev.data.client_id)
if client.server_capabilities.inlayHintProvider then
vim.lsp.inlay_hint.enable(true, { bufnr = ev.buf })
end
-- Enable completion triggered by <c-x><c-o>
vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc'
@ -63,9 +59,11 @@ vim.api.nvim_create_autocmd('LspAttach', {
vim.keymap.set('n', '<space>wl', function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end, opts)
if client.server_capabilities.inlayHintProvider then
vim.keymap.set('n', '<space>i', function()
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled())
end, opts)
end
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, opts)
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, opts)
vim.keymap.set({ 'n', 'v' }, '<space>ca', vim.lsp.buf.code_action, opts)