We are still fighting several bugs related to tab completion. For some of them, we narrowed down the problem to an issue with argcomplete and mad a bug report there. Here is a summary:
1) "./fast-downward.py $DOWNWARD_BENCHMARKS/<tab>" will not generate any suggestions on zsh.
The reason is that we use the argcomplete FilesCompleter here which in turn forwards the call to bash. This call fails for a reason we could not identify. The completion works in bash but this is not due to the FilesCompleter working there but because the crash leading to a fall-back in bash which happens to complete file names.
Related bug report: https://github.com/kislyuk/argcomplete/issues/502
SO question: https://stackoverflow.com/q/78978949/892961
2) "./fast-downward.py ~/<tab>" replaces "~/" with "\~/" on zsh.
The reason here is that paths starting with ~ are generated as suggestions and then handed off to the zsh function "_describe" which should display them to the user. On that level, the suggestions are escaped, so for example spaces in paths are correctly escaped. There are options to _describe that prevent escaping for a specific prefix but place in the code where _describe is called is a general part of argcomplete. First of all, we cannot modify this code and second, the code doesn't know which arguments are paths and which prefix they use.
Related bug report: https://github.com/kislyuk/argcomplete/issues/503
3) "python3 ./fast-downward.py x y --translate-options <tab>" generates all suggestions twice on zsh (not sure about bash).
This might be related to some preprocessing that zsh does. The completion is done twice, once for "python3 ./fast-downward.py" and once for "./fast-downward.py". It is not clear if the problem lies with argcomplete, zsh, or some combination of it.
Related bug report: https://github.com/kislyuk/argcomplete/issues/505
4) "python3 fast-downward.py /e<TAB>" makes "/e" disappear
This is related to point 3) above and has something to do with the fact that argcomplete tries to detect if the completion uses python in the call, or calls the script directly. The call uses Python, but this is not recognized correctly, so it tries to detect if the called script is a Python script. Since the script is given as "fast-downward.py" not "./fast-downward.py" and the current working directory is not on the PATH, this also fails and no suggestions are generated.
Related bug report: https://github.com/kislyuk/argcomplete/issues/504
5) "./fast-downward.py x y --internal-plan-file <tab>" produces no suggestions
Here, we explicitly exit the search component with an exit code of 1 to fall back to the default behavior of generating file names. But this is not consistently supported by argcomplete. It looks like we have no good way to distinguish "please display no suggestions" from "please use the default completer at this point". We can configure one of the choices but not use one for some situations and the other for other situations. Cases where it looks like this is working at the moment are actually caused by other bugs.
For me, the problems in 1) and 2) are annoying enough that the offset any benefit from the completion in other contexts, so I would not activate tab completion as long as those issues are there. The question is how we want to proceed now and what we should do with the code changes in the pull request. It would be sad to lose them but at the same time, they don't seem ready to merge and it is not clear how we can get them ready.
|