Skip to content

Commit 05db191

Browse files
VlaDexadarren-omori
authored andcommitted
Enable inlay hints for the supporting servers (nvim-lua#843)
1 parent 8faf899 commit 05db191

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
},
@@ -521,6 +522,16 @@ require('lazy').setup({
521522
callback = vim.lsp.buf.clear_references,
522523
})
523524
end
525+
526+
-- The following autocommand is used to enable inlay hints in your
527+
-- code, if the language server you are using supports them
528+
--
529+
-- This may be unwanted, since they displace some of your code
530+
if client and client.server_capabilities.inlayHintProvider and vim.lsp.inlay_hint then
531+
map('<leader>th', function()
532+
vim.lsp.inlay_hint.enable(0, not vim.lsp.inlay_hint.is_enabled())
533+
end, '[T]oggle Inlay [H]ints')
534+
end
524535
end,
525536
})
526537

0 commit comments

Comments
 (0)