Skip to content

Commit

Permalink
fix(kotlin): don't pass unrequested parameters to suggestion methods
Browse files Browse the repository at this point in the history
This is a temporary fix and the implementation should extend the annotated method system.
  • Loading branch information
Citymonstret committed Jan 18, 2024
1 parent 8544a3f commit 841b824
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,9 @@ private class KotlinSuggestionProvider<C>(
override fun suggestionsFuture(context: CommandContext<C>, input: CommandInput): CompletableFuture<Iterable<Suggestion>> {
return coroutineScope.future(coroutineContext) {
try {
if (kFunction.valueParameters[1].type.classifier == String::class) {
if (kFunction.valueParameters.isEmpty()) {
kFunction.callSuspend(instance)
} else if (kFunction.valueParameters[1].type.classifier == String::class) {
kFunction.callSuspend(instance, context, input.lastRemainingToken())
} else {
kFunction.callSuspend(instance, context, input)
Expand Down

0 comments on commit 841b824

Please sign in to comment.