Skip to content

Commit

Permalink
Hide the popup in async mode when there are no completions left
Browse files Browse the repository at this point in the history
Fix bug a introduced in 78fc9f6 that
prevented the popup from closing when there are were completions left.

In addition, create the variable stillComputing earlier so that it can
be reused.
  • Loading branch information
rubenporras authored and mickaelistria committed Apr 24, 2023
1 parent 4fc8a17 commit be9ac16
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,10 @@ private void computeAndPopulateProposals(int offset, Consumer<List<ICompletionPr
if (offset != fInvocationOffset || fComputedProposals != requestSpecificProposals) {
return;
}
boolean stillComputing= fComputedProposals.contains(computingProposal);
if (autoInsert
&& !autoActivated
&& !fComputedProposals.contains(computingProposal)
&& !stillComputing
&& fComputedProposals.size() == 1
&& remaining.get() == 0
&& canAutoInsert(fComputedProposals.get(0))) {
Expand All @@ -256,18 +257,17 @@ && canAutoInsert(fComputedProposals.get(0))) {
}
return;
}
if (!fComputedProposals.contains(computingProposal) && callback != null) {
if (!stillComputing && callback != null) {
callback.accept(fComputedProposals);
} else {
boolean stillComputing= fComputedProposals.contains(computingProposal);
boolean hasProposals= (stillComputing && fComputedProposals.size() > 1)
|| (!stillComputing && !fComputedProposals.isEmpty());

if ((autoActivated && hasProposals) || !autoActivated) {
setProposals(fComputedProposals, false);
displayProposals(true);
} else if (isValid(fProposalShell) && !fProposalShell.isVisible() && remaining.get() == 0) {
hide(); // we only tear down if the popup is not visible.
} else if (isValid(fProposalShell) && fProposalShell.isVisible() && remaining.get() == 0) {

This comment has been minimized.

Copy link
@rubenporras

rubenporras May 22, 2023

Author Contributor

@mickaelistria , after going to the code again, I think now this was mistake. hide() was stopping the timer that I want to fix now, not just hiding the popup.
I will test again tomorrow, but I think the condition should be reverted in my new PR.

This comment has been minimized.

Copy link
@mickaelistria

mickaelistria May 22, 2023

Contributor

If you prefer to revert it, then please submit a revert PR with explanation of the regression it has introduced; as it was merged during 4.28 development, it's safer to merge a revert of this patch than to author new code.

hide(); // we only tear down if the popup is visible.
}
}
});
Expand Down

0 comments on commit be9ac16

Please sign in to comment.