Skip to content

Commit a24063c

Browse files
authored
Enable inlay hints for the supporting servers (nvim-lua#843)
1 parent 1a8f65f commit a24063c

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
@@ -286,6 +286,7 @@ require('lazy').setup({
286286
['<leader>r'] = { name = '[R]ename', _ = 'which_key_ignore' },
287287
['<leader>s'] = { name = '[S]earch', _ = 'which_key_ignore' },
288288
['<leader>w'] = { name = '[W]orkspace', _ = 'which_key_ignore' },
289+
['<leader>t'] = { name = '[T]oggle', _ = 'which_key_ignore' },
289290
}
290291
end,
291292
},
@@ -518,6 +519,16 @@ require('lazy').setup({
518519
callback = vim.lsp.buf.clear_references,
519520
})
520521
end
522+
523+
-- The following autocommand is used to enable inlay hints in your
524+
-- code, if the language server you are using supports them
525+
--
526+
-- This may be unwanted, since they displace some of your code
527+
if client and client.server_capabilities.inlayHintProvider and vim.lsp.inlay_hint then
528+
map('<leader>th', function()
529+
vim.lsp.inlay_hint.enable(0, not vim.lsp.inlay_hint.is_enabled())
530+
end, '[T]oggle Inlay [H]ints')
531+
end
521532
end,
522533
})
523534

0 commit comments

Comments
 (0)