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.
fix(carapace example): update invariant
Using previous invariant can sometimes be incorrect.
See:
https://github.com/carapace-sh/carapace/blob/09b28a62d9ce4acbade91bc967cee173454407c1/internal/common/message.go#L92-L114
With the new completers stuff that recently came out, I tried to first use these recipes, but found they were sometimes not working... especially for nix commands when it runs into db error:
If we try and apply documented recipe to the first element, it does not work:
This is because the
valueliterally includes the chars"at beginning at end. I am not sure exactly how it happens, but we could fix the recipe in this instance by wrapping the check with quotes.--but this is not very good for things like the
cargo -1example, which is not output with quotes. A more reliable solution is to use thedisplaycolumn. According to this code:https://github.com/carapace-sh/carapace/blob/09b28a62d9ce4acbade91bc967cee173454407c1/internal/common/message.go#L92-L114
the
displaycolumn will always at least start-with "ERR".Therefore, let us update this example to be more robust and use a better heuristic :).
p.s. I hope to also add docs/examples for the new completion methods and stuffs after this :)