Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fuzzy autocompletion improvements for shell integration #11644

Closed
gorakhargosh opened this issue Jun 25, 2020 · 3 comments
Closed

Fuzzy autocompletion improvements for shell integration #11644

gorakhargosh opened this issue Jun 25, 2020 · 3 comments
Labels
area-EngProd Bazel CI, infrastructure, bootstrapping, release, and distribution tooling P3 We're not considering working on this, but happy to review a PR. (No assignee) stale Issues or PRs that are stale (no activity for 30 days) team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website type: feature request

Comments

@gorakhargosh
Copy link

gorakhargosh commented Jun 25, 2020

Description of the problem / feature request:

Feature Request:

The shell autocompletion feature for any shell can offload fuzzy completion
of bazel targets to fzf. Consider installing fzf
(go get -u github.com/junegunn/fzf) and run the following
command to see how it works:

bazel test $(bazel query '...' --output label | fzf)

Some visuals:
Test
Benchmark

Could you please integrate the following with
the shell autocompletion scripts if possible?

# individual test selection
$ bazel test $(bazel query 'kind(".*_test", ...)' --output label | fzf)

# individual benchmark selection
$ bazel run --config=release $(bazel query 'kind(".*_binary", filter(".*_benchmark", ...))' --output label | fzf)

# run a selected binary
$ bazel run $(bazel query 'kind(".*_binary", ...)' --output label | fzf)

It'd be wild if the autocompletion scripts did this automatically.
Perhaps by adding key bindings for bazel targets too.

Example key sequences for absolute target path completion:

$ bazel run --config=release //<tab:fzf-complete-binary-target> //<tab:fzf-complete-binary-target>

$ bazel test --config=tsan //<tab:fzf-complete-test-target> //<tab:fzf-complete-test-target>

Example key sequences for relative target path completion:

$ bazel run --config=release <tab:fzf-complete-binary-target-below-current-directory> <tab:fzf-complete-binary-target-below-current-directory>

$ bazel test --config=tsan <tab:fzf-complete-test-target-below-current-directory> <tab:fzf-complete-test-target>

where each target selection list also contains //package/path/... and ... as options to select.

Feature requests: what underlying problem are you trying to solve with this feature?

I've used Bazel for several years and my number 1 feature
request would be making it super convenient for users to use bazel
without having to remember or type large paths. This improves user efficiency.
Multiply that by the number of users and you have a much faster workforce.
It's likely this may also cause people to create fine-grained Bazel dependency
graphs.

Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

Not a bug but a productivity enhancement.

What operating system are you running Bazel on?

Linux, Mac OS X.

What's the output of bazel info release?

release 3.3.0

If bazel info release returns "development version" or "(@non-git)", tell us how you built Bazel.

N/A

What's the output of git remote get-url origin ; git rev-parse master ; git rev-parse HEAD ?

N/A

Have you found anything relevant by searching the web?

Another feature request for adding fish shell integration for Bazel.
#11450

Any other information, logs, or outputs that you want to share?

N/A

@jin jin added area-EngProd Bazel CI, infrastructure, bootstrapping, release, and distribution tooling team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website type: feature request labels Jun 29, 2020
@srsudar
Copy link

srsudar commented Jan 14, 2021

What kind of speed do you get with bazel query? Are those gifs real-time?

I have a completion that just uses ripgrep to look at BUILD files and matches the name attribute. I know that some projects rely on dynamic rules where that is insufficient and your approach would be better. Every time that I use query it has been slow so I haven't bothered to add support for it.

With my ripgrep approach I have a script that generates directories I want to search. That then is fed to the fzf command and limits the search scope, which makes it quite fast.

I found working with bazel slightly tedious before adding fzf. I agree that it is a monumental improvement to the workflow.

@philwo philwo added the P3 We're not considering working on this, but happy to review a PR. (No assignee) label Feb 8, 2021
@github-actions
Copy link

Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 2+ years. It will be closed in the next 14 days unless any other activity occurs or one of the following labels is added: "not stale", "awaiting-bazeler". Please reach out to the triage team (@bazelbuild/triage) if you think this issue is still relevant or you are interested in getting the issue resolved.

@github-actions github-actions bot added the stale Issues or PRs that are stale (no activity for 30 days) label Apr 26, 2023
@github-actions
Copy link

This issue has been automatically closed due to inactivity. If you're still interested in pursuing this, please reach out to the triage team (@bazelbuild/triage). Thanks!

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-EngProd Bazel CI, infrastructure, bootstrapping, release, and distribution tooling P3 We're not considering working on this, but happy to review a PR. (No assignee) stale Issues or PRs that are stale (no activity for 30 days) team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website type: feature request
Projects
None yet
Development

No branches or pull requests

4 participants