mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-07-16 04:14:37 +02:00
fix(lsp): fix inlay hints for older nightlies. See #2007
This commit is contained in:
parent
6ac331b588
commit
8baf9b5459
2 changed files with 13 additions and 12 deletions
|
@ -53,14 +53,17 @@ function M.diagnostics()
|
|||
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)
|
||||
---@param buf? number
|
||||
---@param value? boolean
|
||||
function M.inlay_hints(buf, value)
|
||||
local ih = vim.lsp.buf.inlay_hint or vim.lsp.inlay_hint
|
||||
if type(ih) == "function" then
|
||||
ih(buf, value)
|
||||
elseif type(ih) == "table" and ih.enable then
|
||||
if value == nil then
|
||||
value = not ih.is_enabled(buf)
|
||||
end
|
||||
ih.enable(buf, value)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue