Skip to content

Commit 5eea808

Browse files
VlaDexaeunmann
authored andcommitted
Enable inlay hints for the supporting servers (nvim-lua#843)
1 parent bf5f103 commit 5eea808

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

init.lua

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ require('lazy').setup({
294294
['<leader>r'] = { name = '[R]ename', _ = 'which_key_ignore' },
295295
['<leader>s'] = { name = '[S]earch', _ = 'which_key_ignore' },
296296
['<leader>w'] = { name = '[W]orkspace', _ = 'which_key_ignore' },
297+
['<leader>t'] = { name = '[T]oggle', _ = 'which_key_ignore' },
297298
}
298299
end,
299300
},
@@ -526,6 +527,16 @@ require('lazy').setup({
526527
callback = vim.lsp.buf.clear_references,
527528
})
528529
end
530+
531+
-- The following autocommand is used to enable inlay hints in your
532+
-- code, if the language server you are using supports them
533+
--
534+
-- This may be unwanted, since they displace some of your code
535+
if client and client.server_capabilities.inlayHintProvider and vim.lsp.inlay_hint then
536+
map('<leader>th', function()
537+
vim.lsp.inlay_hint.enable(0, not vim.lsp.inlay_hint.is_enabled())
538+
end, '[T]oggle Inlay [H]ints')
539+
end
529540
end,
530541
})
531542

0 commit comments

Comments
 (0)