From 74d276e76e488c0a6e2593a8adf46c8230e25bc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Porras=20Campo?= Date: Thu, 5 Sep 2024 06:49:03 +0200 Subject: [PATCH] fix: Adapt resolveCodeAction to handle timeout and interrupted exception Adapt resolveCodeAction to handle timeout and interrupted exception to follow the usual pattern in the codebase (TimeoutException -> log warning giving the time constraint, InterruptedException -> interrupt thread and log error). --- .../codeactions/CodeActionMarkerResolution.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/org.eclipse.lsp4e/src/org/eclipse/lsp4e/operations/codeactions/CodeActionMarkerResolution.java b/org.eclipse.lsp4e/src/org/eclipse/lsp4e/operations/codeactions/CodeActionMarkerResolution.java index f2dfe167f..3820522dc 100644 --- a/org.eclipse.lsp4e/src/org/eclipse/lsp4e/operations/codeactions/CodeActionMarkerResolution.java +++ b/org.eclipse.lsp4e/src/org/eclipse/lsp4e/operations/codeactions/CodeActionMarkerResolution.java @@ -99,8 +99,14 @@ public void run(IMarker marker) { } } } - } catch (ExecutionException | TimeoutException | InterruptedException ex) { - LanguageServerPlugin.logError(ex); + } catch (TimeoutException e) { + LanguageServerPlugin.logWarning( + "Could resolve code actions due to timeout after 2 seconds in `textDocument/resolveCodeAction`", e); //$NON-NLS-1$ + } catch (ExecutionException e) { + LanguageServerPlugin.logError(e); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + LanguageServerPlugin.logError(e); } }