Skip to content

Commit

Permalink
Merge pull request #19 from evolvedbinary/fix/custom-always
Browse files Browse the repository at this point in the history
[fix] always show the custom lookup
  • Loading branch information
adamretter authored Nov 18, 2023
2 parents 6dea832 + 5c54d09 commit 82081f7
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@

import java.awt.*;
import java.util.List;
import java.util.stream.Collectors;

/**
* TEI-Completer
Expand Down Expand Up @@ -90,12 +91,19 @@ public String getDescription() {
public List<CIValue> filterAttributeValues(final List<CIValue> list, final WhatPossibleValuesHasAttributeContext context) {
if (context != null) {
final AutoCompleteSuggestions<AutoComplete> autoCompleteSuggestions = getAutoCompleteSuggestions(context);

if(autoCompleteSuggestions != null) {
list.addAll(autoCompleteSuggestions.getSuggestions());
List<CIValue> spacePrefixedList = autoCompleteSuggestions.getSuggestions().stream().map(ciValue -> {
ciValue.setValue(" " + ciValue.getValue());
return ciValue;
}).collect(Collectors.toList());

list.addAll(spacePrefixedList);
}
if(autoCompleteSuggestions != null && autoCompleteSuggestions.getSuggestions().size() == 0) {

if(autoCompleteSuggestions != null) {
// the value needs to be prefixed with a space character to bump it to the top of the list
list.add(new CustomCIValue(" Custom lookup...", this, autoCompleteSuggestions.autoCompleteContext));
list.add(new CustomCIValue("\uD83D\uDC49 Custom lookup...", this, autoCompleteSuggestions.autoCompleteContext));
}

}
Expand Down

0 comments on commit 82081f7

Please sign in to comment.