mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-25 14:01:06 +00:00
Add lsp util for inlay-hints and update keymap
This commit is contained in:
parent
bd4668737d
commit
8a24b61aed
2 changed files with 15 additions and 1 deletions
|
|
@ -120,7 +120,7 @@ map("n", "<leader>ud", function() Util.toggle.diagnostics() end, { desc = "Toggl
|
|||
local conceallevel = vim.o.conceallevel > 0 and vim.o.conceallevel or 3
|
||||
map("n", "<leader>uc", function() Util.toggle("conceallevel", false, {0, conceallevel}) end, { desc = "Toggle Conceal" })
|
||||
if vim.lsp.inlay_hint then
|
||||
map("n", "<leader>uh", function() vim.lsp.inlay_hint(0, nil) end, { desc = "Toggle Inlay Hints" })
|
||||
map( "n", "<leader>uh", function() Util.lsp.toggle_inline_hint() end, { desc = "Toggle Inlay Hints" })
|
||||
end
|
||||
map("n", "<leader>uT", function() if vim.b.ts_highlight then vim.treesitter.stop() else vim.treesitter.start() end end, { desc = "Toggle Treesitter Highlight" })
|
||||
|
||||
|
|
|
|||
|
|
@ -122,4 +122,18 @@ function M.format(opts)
|
|||
end
|
||||
end
|
||||
|
||||
---@param bufnr? number
|
||||
function M.toggle_inline_hint(bufnr)
|
||||
bufnr = bufnr or 0
|
||||
if vim.fn.has("nvim-0.10") then
|
||||
if vim.lsp.inlay_hint.is_enabled() then
|
||||
vim.lsp.inlay_hint.enable(bufnr, false)
|
||||
else
|
||||
vim.lsp.inlay_hint.enable(bufnr, true)
|
||||
end
|
||||
else
|
||||
vim.lsp.inlay_hint(bufnr, nil)
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue