Open pzmarzly opened 9 months ago
I have missed the docs part that says about ~/.fig/autocomplete/build
directory. So ignore most of my post. Still, could we have a machine-wide /usr/share/fig/autocomplete/build
?
I like this idea. Shouldn't be too difficult to add a machine-wide completion spec directory, in addition to ~/.fig/autocomplete/build
I like the idea of a "fig path" like FPATH in zsh, we could load completions from these locations in order:
~/.fig-autocomplete
$XDG_DATA_HOME/fig-autocomplete
or ~/.local/share/fig-autocomplete
/usr/share/fig-autocomplete
Sanity checks
Feature Details
Currently Fig and Inshellisense both use withfig/autocomplete for completion specs. These are just TS files that compile to JS (and from what I see, could be compiled to JSON as well with no loss in functionality).
This "big repo" approach worked great for increasing adoption of TS types, in form of DefinitelyTyped repo. But at some point, it became more beneficial to let maintainers of various packages to ship their own type definitions together with their packages. So now many maintainers of JS packages ship type definitions as part of their JS package.
I'd like to see the same thing happen here. Many popular .deb / .rpm files that care a lot about UX already have structure like:
/usr/bin/mycli
- actual binary/usr/share/doc/mycli
- GNU docs/usr/share/locale/../LC_MESSAGES/mycli.mo
/usr/share/man/man1/mycli.1.gz
- man docs/usr/share/bash-completion/completions/mycli
/usr/share/zsh/site-functions/_mycli
I suspect some will want to also ship their own autocomplete specs. I would imagine this could be something like
/usr/share/fig-autocomplete/mycli.json
. Then Fig could scan this directory at startup and load the definitions. If some spec was present both in/usr/share/fig-autocomplete
and in withfig/autocomplete repo, Fig should choose/usr/share/fig-autocomplete
.What benefits would that have?