Skip to content

Commit

Permalink
[WIP] Keep content assist popup open even if user input has no matches
Browse files Browse the repository at this point in the history
WIP, DONT MERGE

Fixes: #2260
Signed-off-by: Simeon Andreev <simeon.danailov.andreev@gmail.com>
  • Loading branch information
trancexpress committed Sep 11, 2024
1 parent adbbaa6 commit 6600fb8
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -371,9 +371,11 @@ public void run() {
}
fFilterOffset= offset;

if (proposals != null && !proposals.isEmpty())
if (proposals != null && !proposals.isEmpty()) {
setProposals(proposals, fIsFilteredSubset);
else {
} else if (fContentAssistant.isShowEmptyList() && !shouldHideOnNoProposals(event, offset)) {
setProposals(Collections.emptyList(), false);
} else {
hide();
if (fContentAssistant.isAutoActivation() && offset > 0 && event != null) {
try {
Expand Down Expand Up @@ -2026,4 +2028,13 @@ public void setSorter(ICompletionProposalSorter sorter) {
void sortProposals(final List<ICompletionProposal> proposals) {
proposals.sort(fSorter::compare);
}

private static boolean shouldHideOnNoProposals(DocumentEvent event, int offset) {
try {
char c= event.getDocument().getChar(offset - 1);
return c == ' ';
} catch (BadLocationException e) {
return true;
}
}
}

0 comments on commit 6600fb8

Please sign in to comment.