Show successfully requested code actions after a failed request (#13156)

When requesting code actions from multiple LSP servers,
rather than bailing as soon as an error is encountered,
instead log the error and then keep going so that successful
requests can be presented to the user.
This commit is contained in:
Ian Hobson 2025-03-21 15:10:24 +01:00 committed by GitHub
parent 1dee64f7ec
commit 1c9a5bd366
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -745,9 +745,12 @@ pub fn code_action(cx: &mut Context) {
cx.jobs.callback(async move {
let mut actions = Vec::new();
// TODO if one code action request errors, all other requests are ignored (even if they're valid)
while let Some(mut lsp_items) = futures.try_next().await? {
actions.append(&mut lsp_items);
while let Some(output) = futures.next().await {
match output {
Ok(mut lsp_items) => actions.append(&mut lsp_items),
Err(err) => log::error!("while gathering code actions: {err}"),
}
}
let call = move |editor: &mut Editor, compositor: &mut Compositor| {