Description
I am new to prompt_toolkit. After stuggling to get the readline module to do what I needed, I was very happy to find prompt_toolkit.
What I am trying to do is completion for filenames. I have written my own Completer subclass, because I need to handle completion for tokens other than filenames. Everything is working well, except for one problem, relating to filenames:
- Suppose I am looking for completions in a directory which contains a directory xyd, and no other files whose names begin with xy.
- The user types x, and my completer is used, resulting in the command line showing xyd/
- I need to get rid of that . What I would like to happen is for xyd/ to be displayed, and then for an entry of to allow for completion using the filenames in xyd/.
I have searched the docs, StackOverflow, and even consulted ChatGPT, to no avail*. So while I would appreciate any advice on how to do what I need using the existing API, I suspect it might not be possible. Which leads to a feature request: A way to control the entering of a space following the selected completion. Something along the lines of a Completion parameter, e.g. separator_after_completion. For example, if separator_after_completion were None, then a space would be inserted as usual. A callable value would take the completion as input, and return the text to be output as a separator. So for my use case, I would test the completion for a terminal /, return '' (empty string) if a / is present, ' ' (space) otherwise.
- ChatGPT made a long series of wrong suggestions, many of which simply hallucinated parameters to Completer() or Completion() that just do not exist.