elvish icon indicating copy to clipboard operation
elvish copied to clipboard

[FR] Completions directory on Linux

Open ajeetdsouza opened this issue 2 years ago • 4 comments

Bash, fish, and zsh all have a completions directory on Linux, where applications can add their completion files. Does Elvish have anything similar? If not, consider this a feature request.

  • Bash: /usr/share/bash-completion/completions/
  • Fish: /usr/share/fish/completions/
  • Zsh: /usr/share/zsh/vendor-completions/

ajeetdsouza avatar Jun 25 '22 12:06 ajeetdsouza

Completion files can be installed like other modules into a global module search directory (https://elv.sh/ref/command.html#module-search-directories).

There is no automatic discovery of completion files though; the user would have to import them manually with use.

xiaq avatar Jun 25 '22 17:06 xiaq

Would it be feasible to implement automatic discovery of completion files?

ajeetdsouza avatar Jun 25 '22 17:06 ajeetdsouza

Would it be feasible to implement automatic discovery of completion files?

Yes, but it probably requires some discussion over a period of several months to determine if the pro's outweigh the con's. At this time Elvish does not automatically import any module other than builtin. So one con is that automatically importing completion modules is behavior different than for non-completion modules. On the other hand, interactive command completion modules are fundamentally different from non-completion modules and it might be friendlier to automatically import them. On the other hand, a completion module can contain arbitrary Elvish code -- not just command completion code. And thus auto-importing completion modules could be abused to bypass the usual requirement to use a module. That could, perhaps, be mitigated by putting completion modules in a special namespace that isn't searched when resolving an interactive command.

krader1961 avatar Jun 28 '22 01:06 krader1961