complgen icon indicating copy to clipboard operation
complgen copied to clipboard

[FR] <PATH> behaviour inconsistent with non-complgen path completion

Open degnbol opened this issue 10 months ago • 4 comments

<PATH> completes paths in a basic way that isn't identical to path completion for commands where completion isn't made with complgen. I'm using zsh. It ignores zstyle settings related to e.g. ignoring case and adding a space after filename completion.

As a side note, I see that _path_files is being called in the code so I tried redefining <PATH>, e.g. for ignoring case:

<PATH@zsh> ::= {{{ _path_files -M 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' }}}

The -M flag seems to be ignored. I'm able to have other flags work, e.g. -F for ignoring patterns. This might be an issue with my setup somehow and not related to complgen.

Thanks for the great project btw, I'm playing around with a (very heuristic) help text parser that goes well with this.

degnbol avatar Mar 25 '24 03:03 degnbol

I appreciate reporting! Will definitely take a look as soon as I find some time

adaszko avatar Mar 27 '24 07:03 adaszko

Could you please post the output of complgen version and the minimal .usage file that triggers the behavior? TIA

adaszko avatar Apr 01 '24 08:04 adaszko

complgen version 0df6f4d9a1

And simply a file ~/.config/complgen/minimal.usage with contents: minimal <PATH>;

I just double checked to make sure, and without the file minimal <TAB> completes file ignoring case etc. (default completion for unknown command is filepath, at least in my setup), while placing the file completes it in a case sensitive manner.

Hope this helps, I can provide Zsh configs if needed.

degnbol avatar Apr 02 '24 02:04 degnbol

Hi, sorry for a late reply.

Are you using JIT or AOT mode?

Adding completions under zsh ultimately boils down to calling compadd -A, so it should be respecting all zstyles.

Perhaps you would be willing to contribute a test case for this issue? Tests under e2e/zsh are a starting point JIT/AOT, depending on your context.

Thanks for the great project btw, I'm playing around with a (very heuristic) help text parser that goes well with this.

Take a look at complgen scrape -- I'd be very happy to accept PRs.

adaszko avatar Jun 15 '24 10:06 adaszko