Skip to content

Commit ed07757

Browse files
sebthomrubenporras
authored andcommitted
fix: prevent stuck "Loading..." hover
1 parent ae840f6 commit ed07757

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

org.eclipse.lsp4e/src/org/eclipse/lsp4e/operations/hover/FocusableBrowserInformationControl.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ public void setInput(@Nullable Object input) {
162162
if (input instanceof AsyncHtmlHoverInput async) {
163163
this.currentAsyncToken = async.token;
164164
super.setInput(styleHtml(async.placeholderHtml));
165-
async.future.whenComplete((html, ex) -> UI.getDisplay().asyncExec(() -> {
165+
async.future.whenComplete((html, ex) -> UI.runOnUIThread(() -> {
166166
if (getShell() == null || getShell().isDisposed()) {
167167
return;
168168
}
@@ -172,14 +172,15 @@ public void setInput(@Nullable Object input) {
172172
}
173173
if (ex != null) {
174174
LanguageServerPlugin.logError(ex);
175-
dispose();
175+
super.setInput(
176+
"Unexpected error: " + ex.getClass().getSimpleName() + ": " + ex.getLocalizedMessage()); //$NON-NLS-1$ //$NON-NLS-2$
176177
return;
177178
}
178179
if (html != null && !html.isBlank()) {
179180
super.setInput(styleHtml(html));
180181
} else {
181182
// No content from LS; hide placeholder
182-
dispose();
183+
super.setInput(""); //$NON-NLS-1$
183184
}
184185
}));
185186
return;

0 commit comments

Comments
 (0)