mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-27 11:19:02 +02:00
fix(lsp): detect if using nvim-0.10 and use new inlay_hint.enable method (#2007)
* Detect if using nvim 0.10 and use new inlay_hint.enable method * Add lsp util for inlay-hints and update keymap * Remove the need to check vim version * Support older nightly builds * Move inlay_hint toggle in Util.toggle --------- Co-authored-by: Gary Murray <gamurray@fanatics.com>
This commit is contained in:
parent
68ff818a5b
commit
6853b785d9
3 changed files with 14 additions and 3 deletions
|
@ -53,6 +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)
|
||||
end
|
||||
end
|
||||
|
||||
setmetatable(M, {
|
||||
__call = function(m, ...)
|
||||
return m.option(...)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue