mirror of
https://github.com/neovim/neovim.git
synced 2026-05-05 13:35:02 +00:00
refactor(lsp): replace _provider_value_get with _provider_foreach
Introduce _provider_foreach to iterate over all matching provider capabilities for a given LSP method, handling both static and dynamic registrations. Update diagnostic logic and tests to use the new iteration approach, simplifying capability access and improving consistency across features.
This commit is contained in:
@@ -538,16 +538,16 @@ function M._workspace_diagnostics(opts)
|
||||
end
|
||||
|
||||
for _, client in ipairs(clients) do
|
||||
local identifiers = client:_provider_value_get('workspace/diagnostic', 'identifier')
|
||||
for _, id in ipairs(identifiers) do
|
||||
---@param cap lsp.DiagnosticRegistrationOptions
|
||||
client:_provider_foreach('workspace/diagnostic', function(cap)
|
||||
--- @type lsp.WorkspaceDiagnosticParams
|
||||
local params = {
|
||||
identifier = type(id) == 'string' and id or nil,
|
||||
identifier = cap.identifier,
|
||||
previousResultIds = previous_result_ids(client.id),
|
||||
}
|
||||
|
||||
client:request('workspace/diagnostic', params, handler)
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user