Skip to content

Commit 9b995f7

Browse files
VlaDexaJohn Longanecker
authored andcommitted
Enable inlay hints for the supporting servers (nvim-lua#843)
1 parent ac1cb7b commit 9b995f7

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
@@ -288,6 +288,7 @@ require('lazy').setup({
288288
['<leader>r'] = { name = '[R]ename', _ = 'which_key_ignore' },
289289
['<leader>s'] = { name = '[S]earch', _ = 'which_key_ignore' },
290290
['<leader>w'] = { name = '[W]orkspace', _ = 'which_key_ignore' },
291+
['<leader>t'] = { name = '[T]oggle', _ = 'which_key_ignore' },
291292
}
292293
end,
293294
},
@@ -520,6 +521,16 @@ require('lazy').setup({
520521
callback = vim.lsp.buf.clear_references,
521522
})
522523
end
524+
525+
-- The following autocommand is used to enable inlay hints in your
526+
-- code, if the language server you are using supports them
527+
--
528+
-- This may be unwanted, since they displace some of your code
529+
if client and client.server_capabilities.inlayHintProvider and vim.lsp.inlay_hint then
530+
map('<leader>th', function()
531+
vim.lsp.inlay_hint.enable(0, not vim.lsp.inlay_hint.is_enabled())
532+
end, '[T]oggle Inlay [H]ints')
533+
end
523534
end,
524535
})
525536

0 commit comments

Comments
 (0)