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 flags not tab-completing unless string is empty #460

Merged
merged 1 commit into from
Sep 9, 2023

Conversation

Pablete1234
Copy link
Contributor

Currently trying to tab complete flag arguments only works if the string is empty, example:

/command -f will work
/command -f va will not suggest "value" or anything else.

This is because it attempts to parse the value of the flag instead of trying to suggest. I'm unsure as to why the if for directSuggestions only will enter if the value is empty, when given a size of 1 you know for sure it's going to be a direct-suggest. This if was last edited by myself in #428, where i added the size == 1 condition, it apparently seems like that ==1 should be the whole condition.

Additionally, it solves #459 (tests were breaking otherwise).

I've removed the argument-pruning that was occurring in array types, as the tests broke the moment i modified the if. They were working out of pure luck, we remove all args except the last, then it attempts to parse the remaining -- with the array parser (and nothing is consumed due to it being flag-yielding and the next param starting with -) meaning it goes to the next argument (the flag) and ends up suggesting. That stopped working when i modified the if so that the last arg is always direct parsed, as we were still in the parent param (array) not the child (flag).

Simply deleting the code that prunes the params solves the issue properly: when there's multiple params it'll parse them normally, they'll consume until the - due to flag-yielding, and the child node (flags) will take it from there.

@jpenilla jpenilla changed the base branch from master to 1.9.0-dev September 9, 2023 06:41
@jpenilla jpenilla linked an issue Sep 9, 2023 that may be closed by this pull request
@jpenilla jpenilla merged commit 07f7174 into Incendo:1.9.0-dev Sep 9, 2023
1 check passed
@Pablete1234 Pablete1234 deleted the fix-flag-suggestion branch September 9, 2023 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Array autocompletion does not respect flag-yielding
2 participants