Skip to content

Conversation

@Pablete1234
Copy link
Contributor

@Pablete1234 Pablete1234 commented Jan 29, 2023

Ever since the fix for #190 was merged (#414), all parsers would be treated as greedy if they were the last parser on the command, one of the argument parsers that heavily suffered from this was duration, here's how it looks like:

image
This is due to duration parser suggesting letters if the last char is not a letter, since the input was 5s , it attempts to suggest [input] + "d" etc, leaving these weird suggestions.

The change makes it so if there's an ambiguity about what to do with the last parser (ie: there's only one parser left, but there's more than one string left in the queue) it will let it get parsed, and observes what's left in the command queue after the parse. If the parser consumed all strings, then it's free to suggest the whole string with spaces, otherwise, it is understood that the parser is non-greedy, and the leftover text is not part of the command, and as such, should suggest nothing:

image

Tested with greedy arguments and seems to work just fine too.

Signed-off-by: Pablo Herrera <pabloherrerapalacio@gmail.com>
@Pablete1234 Pablete1234 force-pushed the greedy-suggestions-fix branch from f505172 to a926fd7 Compare January 29, 2023 18:06
Signed-off-by: Pablo Herrera <pabloherrerapalacio@gmail.com>
@jpenilla jpenilla changed the base branch from master to 1.9.0-dev February 22, 2023 03:23
@jpenilla jpenilla changed the title Fix greedy suggestions working on nongreedy parsers Fix last argument always being treated as greedy in suggestions Feb 22, 2023
@jpenilla jpenilla merged commit 1c8552a into Incendo:1.9.0-dev Feb 22, 2023
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.

2 participants