mirror of
https://gitee.com/zhangsken/AndroidIDE.git
synced 2026-10-16 07:49:44 +08:00
fix(editor): reference result is not shown for single reference in the same file
This is caused due to setSeletion(Range) being called on a background thread (fixes #1248).
This commit is contained in:
@@ -600,7 +600,6 @@ public class IDEEditor extends CodeEditor implements IEditor, ILspEditor {
|
||||
final CompletableFuture<ReferenceResult> future,
|
||||
final ReferenceResult result, final Throwable error
|
||||
) {
|
||||
LOG.debug("onFindRefsResult");
|
||||
dismissOnUiThread(flashbar);
|
||||
|
||||
if (result == null || languageClient == null || future.isCancelled() ||
|
||||
@@ -615,15 +614,17 @@ public class IDEEditor extends CodeEditor implements IEditor, ILspEditor {
|
||||
return;
|
||||
}
|
||||
|
||||
if (result.getLocations().size() == 1) {
|
||||
final var loc = result.getLocations().get(0);
|
||||
if (DocumentUtils.isSameFile(loc.getFile(), getFile().toPath())) {
|
||||
setSelection(loc.getRange());
|
||||
return;
|
||||
ThreadUtils.runOnUiThread(() -> {
|
||||
if (result.getLocations().size() == 1) {
|
||||
final var loc = result.getLocations().get(0);
|
||||
if (DocumentUtils.isSameFile(loc.getFile(), getFile().toPath())) {
|
||||
setSelection(loc.getRange());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ThreadUtils.runOnUiThread(() -> languageClient.showLocations(result.getLocations()));
|
||||
languageClient.showLocations(result.getLocations());
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user