prompt-toolkit / python-prompt-toolkit

Library for building powerful interactive command line applications in Python
https://python-prompt-toolkit.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
9.1k stars 717 forks source link

How to display errors raised in `Completer` class, in `Validator` bar? #1856

Open GhostOps77 opened 3 months ago

GhostOps77 commented 3 months ago

Is there a way to send the exception object that's raised in Completer class, to the Validator class of the same prompt, so that the errors raised during the autocomplete operation can be displayed in the Validator bar as well?

Idk if this is a very niche request. And I hope this doesn't require to do any kind of complex stuff like monkeypatching, etc.

Idk how to resolve this even with a shared context object, because the Validator runs before the Completer class most of the time. And that's not suitable to display the error that's raised in the previous iteration in the next iteration which won't make sense at all.