vscode-bazel icon indicating copy to clipboard operation
vscode-bazel copied to clipboard

[Feature request] Add option to filter CodeLens links in BUILD files

Open rossc719g opened this issue 1 year ago • 2 comments

TL;DR: It would be really nice to have a way to filter the displayed CodeLens links.

In BUILD files, there are often extra hidden rules defined by rules.

For example, if you use:

load("@bazel_skylib//rules:build_test.bzl", "build_test")

build_test(
  name="foo"
  ...
)

You get the expected Test //whatever:foo link, but you also get Build //whatever:foo_0__deps.

And if you have functions in a .bzl file that create multiple sub-rules, the list of links can quickly get very long, and end up wider than the available space, and the UI does not let you scroll right if your file content is not that wide. (Incidentally, it would be nice to wrap these long lines of links, but that is a separate FR)

Ideally, it would just honor the existing Bazel › Command Line: Query Expression option for these links as well. But it would be fine to have a similar option specifically for the CodeLens links if that is deemed to be nicer.

Thoughts?

rossc719g avatar Jul 21 '23 22:07 rossc719g

This would be really nice to have both for the CodeLens links but also for the side bar tree.

The Idea plugin has this trough the no-ide tag. https://ij.bazel.build/docs/tags.html#no-ide

Something similar could be very nice. Alternatively just a setting to add filter by name.

What something like this be a welcome change for the maintainers?

KrauseStefan avatar Apr 25 '24 11:04 KrauseStefan

This would be really nice to have both for the CodeLens links but also for the side bar tree. [...] Alternatively just a setting to add filter by name.

For the side bar / the "Bazel Build Targets" tree, there is already the setting bazel.commandLine.queryExpression. I guess you could write a Bazel query to filter out no-ide tagged targets?

vogelsgesang avatar Apr 25 '24 15:04 vogelsgesang