🐛 Fix shell completions for the fish shell #1069
Open
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.
As described in this discussion #1068, recent changes aimed at sanitizing the help text from rich tags during autocompletion generation (#877) have caused problems with proper generation of autocompletions for fish shell, when rich is installed in the environment. The main culprit most likely being the
rich.Console.print
method that converts the tabs into spaces which results in malformed autocompletes. I propose a different approach to sanitizing the help text, one that allows to perform the removal of tags before the output offormat_completion
gets returned, thus allowing to generate a rich tag-free help text, while still being able to pass it to a formatting-preserving output viaclick.echo
intyper.completion
(basically reverting this part of the source to the way it was before the #877 changes).An example of the current behaviour while using
rich.Console.print
invoked intyper.rich_utils.print_with_rich
:with an example app of the following structure: