Skip to content
Merged
Show file tree
Hide file tree
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 @@ -87,7 +87,7 @@ public MethodSuggestionProvider(
@SuppressWarnings("rawtypes")
public static @NonNull CompletableFuture<Iterable<@NonNull Suggestion>> mapSuggestions(final @NonNull Object input) {
if (input instanceof CompletableFuture) {
return mapSuggestions((CompletableFuture) input);
return mapFuture((CompletableFuture) input);
}
return CompletableFuture.completedFuture(mapCompleted(input));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Stream;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.incendo.cloud.CommandManager;
Expand Down Expand Up @@ -94,6 +95,7 @@ void testSuggestions(final @NonNull Object instance) {
named("set source", new TestClassSet()),
named("stream source", new TestClassStream()),
named("iterable source", new TestClassIterable()),
named("list future source", new TestClassFutureList()),
named("string list source", new TestClassListString()),
named("source with CommandInput injected", new TestClassCommandInput()),
named("source with injected value", new TestInjectedValue())
Expand Down Expand Up @@ -156,6 +158,17 @@ public static final class TestClassListString {
}
}

public static final class TestClassFutureList {

@Suggestions("suggestions")
public @NonNull CompletableFuture<@NonNull Iterable<@NonNull Suggestion>> suggestions(
final @NonNull CommandContext<TestCommandSender> context,
final @NonNull String input
) {
return CompletableFuture.completedFuture(Collections.singletonList(Suggestion.suggestion("foo")));
}
}

public static final class TestClassCommandInput {

@Suggestions("suggestions")
Expand Down