Pass previous args to autocomplete source function#81
Open
TranquilMarmot wants to merge 1 commit intolimbonaut:masterfrom
Open
Pass previous args to autocomplete source function#81TranquilMarmot wants to merge 1 commit intolimbonaut:masterfrom
TranquilMarmot wants to merge 1 commit intolimbonaut:masterfrom
Conversation
limbonaut
reviewed
Feb 15, 2026
Owner
limbonaut
left a comment
There was a problem hiding this comment.
Nice feature idea. The arg count is a bit fragile - I would add a check at registration.
| ) | ||
| LimboConsole.add_argument_autocomplete_source( | ||
| "spawn", | ||
| 0, |
Owner
There was a problem hiding this comment.
Registers autocomplete callback for index 0 for the second time. Should this be 1 instead?
Comment on lines
+388
to
+396
| if arg_count == 0: | ||
| # No args, call as-is | ||
| argument_values = p_source.call() | ||
| else: | ||
| # Pass in dummy args | ||
| var test_args: PackedStringArray = [] | ||
| test_args.resize(p_argument) | ||
| test_args.fill("") | ||
| argument_values = p_source.callv(test_args) |
Owner
There was a problem hiding this comment.
As I understand it, the argument count for autocomplete callback needs to be either 0 or p_arguments. Should we have a check for arg_count == p_argument at registration?
limbonaut
reviewed
Feb 15, 2026
| if category == "enemy": | ||
| return ["minion", "boss"] | ||
| if category == "weapon": | ||
| return ["sword", "wand"] |
Owner
There was a problem hiding this comment.
Sample code didn't work for me - need to add an else-branch (or fallback return [] at the bottom), or the callback with fail to register.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This lets you do progressive autocomplete based on previous args