mirror of
https://github.com/neovim/neovim.git
synced 2025-12-15 19:05:40 +00:00
feat(lsp)!: vim.lsp.inlay_hint.get(), enable(), is_enabled() #25512
refactor!: `vim.lsp.inlay_hint()` -> `vim.lsp.inlay_hint.enable()` Problem: The LSP specification allows inlay hints to include tooltips, clickable label parts, and code actions; but Neovim provides no API to query for these. Solution: Add minimal viable extension point from which plugins can query for inlay hints in a range, in order to build functionality on top of. Possible Next Steps --- - Add `virt_text_idx` field to `vim.fn.getmousepos()` return value, for usage in mappings of `<LeftMouse>`, `<C-LeftMouse>`, etc
This commit is contained in:
@@ -24,6 +24,7 @@ local lsp = {
|
||||
buf = require('vim.lsp.buf'),
|
||||
diagnostic = require('vim.lsp.diagnostic'),
|
||||
codelens = require('vim.lsp.codelens'),
|
||||
inlay_hint = require('vim.lsp.inlay_hint'),
|
||||
semantic_tokens = semantic_tokens,
|
||||
util = util,
|
||||
|
||||
@@ -2439,13 +2440,6 @@ function lsp.with(handler, override_config)
|
||||
end
|
||||
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 lsp.inlay_hint(bufnr, enable)
|
||||
return require('vim.lsp.inlay_hint')(bufnr, enable)
|
||||
end
|
||||
|
||||
--- Helper function to use when implementing a handler.
|
||||
--- This will check that all of the keys in the user configuration
|
||||
--- are valid keys and make sense to include for this handler.
|
||||
|
||||
Reference in New Issue
Block a user