After sourcing fish completions, autocomplete a bazel command, note how the shell hangs while the completion script parses the output of various bazel invocations.
Source fish completions, try to autocomplete bazel info --.
sw_vers
ProductName: Mac OS X
ProductVersion: 10.15.7
BuildVersion: 19H2
fish --version
fish, version 3.1.2
bazel info release?release 3.3.0
Issue requesting fish completions: https://github.com/bazelbuild/bazel/issues/5088
Initial implementation: https://github.com/bazelbuild/bazel/pull/11450/files
Note bash completions and zsh completions don't have the same issue: bash completions invoke bazel at build time, and generate a completion script from that, and zsh completions support caching.
cc @tmandry @akirabaruah
Seems like the simplest way to speed things up is to generate fish completions at build time like we do for bash. I'm happy to make that change, if needed - should be able to do so by the end of this weekend.
Took a bit longer than expected, but I've put up PR #12249 to generate the fish completion script at build time. Sourcing the generated file is significantly faster (~200ms vs. ~3s on my machine), while maintaining the same functionality as before.
Here's an example script (bazel.fish.gz) built at d69744dca68f8258762d53a01d8dca3afb7ed2ac + PR #12249 for convenience. @uri-canva let me know if it works for you if you get a chance - thanks!
Since we no longer have to parse strings in fish itself, the fix for this issue might supersede these:
Yes, have tested https://github.com/bazelbuild/bazel/pull/12249 and I can build it, and it solves all 5 issues! Thanks for the quick response.
Most helpful comment
Yes, have tested https://github.com/bazelbuild/bazel/pull/12249 and I can build it, and it solves all 5 issues! Thanks for the quick response.