mirror of
https://github.com/neovim/neovim.git
synced 2026-09-12 17:11:02 +00:00
feat(lsp): support workspace/foldingRange/refresh #41780
Problem: Servers cannot request refreshing stale LSP folding ranges after a project-wide change. Solution: Advertise `workspace.foldingRange.refreshSupport` and re-request folding ranges for active buffers when handling `workspace/foldingRange/refresh`. AI-assisted
This commit is contained in:
committed by
GitHub
parent
0a844adc13
commit
8e0045f43a
@@ -289,6 +289,26 @@ function State:foldclose(kind, winid)
|
||||
end)
|
||||
end
|
||||
|
||||
--- |lsp-handler| for the method `workspace/foldingRange/refresh`
|
||||
---
|
||||
--- Refresh requests are sent by the server to indicate a project-wide change
|
||||
--- that requires all folding ranges to be re-requested by the client.
|
||||
---@param ctx lsp.HandlerContext
|
||||
---@internal
|
||||
function M.on_refresh(err, _, ctx)
|
||||
if err then
|
||||
return vim.NIL
|
||||
end
|
||||
|
||||
for _, state in pairs(State.active) do
|
||||
if state.client_state[ctx.client_id] then
|
||||
state:refresh(ctx.client_id)
|
||||
end
|
||||
end
|
||||
|
||||
return vim.NIL
|
||||
end
|
||||
|
||||
---@param kind lsp.FoldingRangeKind
|
||||
---@param winid? integer
|
||||
function M.foldclose(kind, winid)
|
||||
|
||||
Reference in New Issue
Block a user