mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-25 14:01:06 +00:00
Move inlay_hint toggle in Util.toggle
This commit is contained in:
parent
fe28ebb855
commit
26c09bbb39
3 changed files with 12 additions and 12 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
|
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" })
|
map("n", "<leader>uc", function() Util.toggle("conceallevel", false, {0, conceallevel}) end, { desc = "Toggle Conceal" })
|
||||||
if vim.lsp.buf.inlay_hint or vim.lsp.inlay_hint then
|
if vim.lsp.buf.inlay_hint or vim.lsp.inlay_hint then
|
||||||
map( "n", "<leader>uh", function() Util.lsp.toggle_inline_hint() end, { desc = "Toggle Inlay Hints" })
|
map( "n", "<leader>uh", function() Util.toggle.inlay_hints() end, { desc = "Toggle Inlay Hints" })
|
||||||
end
|
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" })
|
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,15 +122,4 @@ function M.format(opts)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param bufnr? number
|
|
||||||
function M.toggle_inline_hint(bufnr)
|
|
||||||
bufnr = bufnr or 0
|
|
||||||
local inlay_hint = vim.lsp.buf.inlay_hint or vim.lsp.inlay_hint
|
|
||||||
if inlay_hint.enable then
|
|
||||||
vim.lsp.inlay_hint.enable(bufnr, not inlay_hint.is_enabled())
|
|
||||||
else
|
|
||||||
vim.lsp.inlay_hint(bufnr, nil)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,17 @@ function M.diagnostics()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---@param bufnr? number
|
||||||
|
function M.inlay_hints(bufnr)
|
||||||
|
bufnr = bufnr or 0
|
||||||
|
local inlay_hint = vim.lsp.buf.inlay_hint or vim.lsp.inlay_hint
|
||||||
|
if inlay_hint.enable then
|
||||||
|
vim.lsp.inlay_hint.enable(bufnr, not inlay_hint.is_enabled())
|
||||||
|
else
|
||||||
|
vim.lsp.inlay_hint(bufnr, nil)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
setmetatable(M, {
|
setmetatable(M, {
|
||||||
__call = function(m, ...)
|
__call = function(m, ...)
|
||||||
return m.option(...)
|
return m.option(...)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue