Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] always show the custom lookup #19

Merged
merged 2 commits into from
Nov 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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