refactor(nvim): use non-deprecated apis for inlay hints
All checks were successful
Check Formatting of Files / Check-Formatting (push) Successful in 1m8s

This commit is contained in:
Price Hiller 2024-05-09 23:47:27 -05:00
parent 4a73c88dc9
commit faac33bd56
Signed by: Price
GPG Key ID: C3FADDE7A8534BEB

View File

@ -24,14 +24,14 @@ local function on_attach(client, bufnr)
vim.api.nvim_create_autocmd("InsertEnter", { vim.api.nvim_create_autocmd("InsertEnter", {
buffer = bufnr, buffer = bufnr,
callback = function() callback = function()
vim.lsp.inlay_hint.enable(bufnr, true) vim.lsp.inlay_hint.enable(true, { bufnr = bufnr })
end, end,
group = lsp_augroup, group = lsp_augroup,
}) })
vim.api.nvim_create_autocmd("InsertLeave", { vim.api.nvim_create_autocmd("InsertLeave", {
buffer = bufnr, buffer = bufnr,
callback = function() callback = function()
vim.lsp.inlay_hint.enable(bufnr, false) vim.lsp.inlay_hint.enable(false, { bufnr = bufnr })
end, end,
group = lsp_augroup, group = lsp_augroup,
}) })
@ -230,12 +230,8 @@ return {
{ {
"<leader>lh", "<leader>lh",
function() function()
local curr_buf = vim.api.nvim_get_current_buf() local kwargs = { buf = vim.api.nvim_get_current_buf() }
if vim.diagnostic.is_disabled(curr_buf) then vim.diagnostic.enable(not vim.diagnostic.is_enabled(kwargs), kwargs)
vim.diagnostic.enable(curr_buf)
else
vim.diagnostic.disable(curr_buf)
end
end, end,
desc = "LSP: Toggle Diagnostics in Current Buffer", desc = "LSP: Toggle Diagnostics in Current Buffer",
}, },
@ -267,7 +263,8 @@ return {
{ {
"<leader>ll", "<leader>ll",
function() function()
vim.lsp.inlay_hint.enable(0, not vim.lsp.inlay_hint.is_enabled(0)) local kwargs = { bufnr = 0 }
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled(kwargs), kwargs)
end, end,
desc = "LSP: Toggle Inlay Hints", desc = "LSP: Toggle Inlay Hints",
}, },