Think about a translator for fig.io completions?
iandol opened this issue · 7 comments
There is some company trying to monetise completions for teams (thus they have more resources etc.), and their tool uses spec files for completions (MIT licensed I think) written in typescript:
https://fig.io/docs/getting-started
Potentially, making use of these may ease the burden on you to keep spec files up-to-date, but would require a translator from their files to your yaml ones. By the way thanks a ton for this, it really makes it easier for end-users to tweak completions!!!
Quite possible, but it won't include most of the completions itself - just the command structure.
carapace-bin includes an export (carapace <COMPLETER> export
) that should work as well for that (at least for the more statically structured commands).
The aim of this though is less providing a collection of specs but rather a simple method to define completions where a compiled completer is a bit excessive (mainly due to its size).
This includes user defined completions without the need for (much) programming knowledge and most of all plugin support like this.
I've considered script interpreters like tengo but yaml
(json
, toml
is fine as well) with little script snippets seems to be the best middle ground for this.
$(command)
is currently executed in a sh
shell though so i might have to rethink that a bit for windows. But it is probably best to have a powershell variant of the spec anyway since it differs too much from linux/mac.
related jakeswenson/autocomplete#1
Thanks, I realise your aim for your spec files are more for ad-hoc customisation rather than the core mechanism to store the completions. I was I suppose just thinking aloud as to how you may reduce some of your maintenance burden as a single developer by some how tapping into this funded source of completion data. Your tool is really invaluable especially for Elvish users, so thank you so much!
So with microsoft/inshellisense#78 and carapace-sh/carapace-bridge#150 fig completions can now be invoked.
The lexer in inshellisense is quite primitive at the moment so it's not really usable for now, but maybe that will improve in the future.
Super, and thank you for such a brilliant tool! I don't quite understand from the inshellisense page as it doesn't support elvish, but I think you mean you can provide the bridge?
Yes, since inshellisense uses fig under the hood the completions can now be invoked with inshellisense complete "mycmd args..."
.
It's not very usable at the moment though. The lexer in inshellisense is pretty basic and can't handle spaces and quotes yet.
A lot of the completion also doesn't really work well (even file completion still has some major issues).
Had another look at this a while ago and there were some specifics that make a conversion a bit cumbersome.
Quality of the fig completions isn't that great anyway, so there isn't much advantage to writing them from scratch.
Closing this since there is a bridge now and soon an implicit one as well.