feat(lsp): move inlay_hint() to vim.lsp (#24130)

Allows to keep more functions hidden and gives a path forward for
further inlay_hint related functions - like applying textEdits.

See https://github.com/neovim/neovim/pull/23984#pullrequestreview-1486624668
This commit is contained in:
Mathias Fußenegger
2023-06-30 11:33:28 +02:00
committed by GitHub
parent d55d7646c1
commit 37079fca58
7 changed files with 60 additions and 53 deletions

View File

@@ -796,19 +796,4 @@ function M.execute_command(command_params)
request('workspace/executeCommand', command_params)
end
--- Enable/disable/toggle inlay hints for a buffer
---@param bufnr (integer) Buffer handle, or 0 for current
---@param enable (boolean|nil) true/false to enable/disable, nil to toggle
function M.inlay_hint(bufnr, enable)
vim.validate({ enable = { enable, { 'boolean', 'nil' } }, bufnr = { bufnr, 'number' } })
local inlay_hint = require('vim.lsp._inlay_hint')
if enable then
inlay_hint.enable(bufnr)
elseif enable == false then
inlay_hint.disable(bufnr)
else
inlay_hint.toggle(bufnr)
end
end
return M