Skip to content

Conversation

@bkolb
Copy link
Contributor

@bkolb bkolb commented Sep 22, 2025

This change modifies the BazelBuildCodeLensProvider to create a target picker in case there is more than one target per category (Copy/Build/Run/Test).

The motivation is to provide a better and more user-friendly experience when working with macros in BUILD files. When a macro generates multiple targets, you could run into situations where not all actions were visible anymore.

Copy link
Collaborator

@cbandera cbandera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this contribution! I have tested it locally and it works fine. I like this new interactive approach much more then the previous "workaround" with sorting.

Nevertheless, I suggest to improve on the implementation further before merging this to master. See the following comments

@bkolb bkolb force-pushed the feature/multilineCodeLense branch from 4a0ab35 to b55a3fb Compare September 25, 2025 12:38
@bkolb
Copy link
Contributor Author

bkolb commented Sep 25, 2025

Thank you for your feedback. I will work on your comments and post a new version soon. The one I just pushed has an issue that I need to fix.

@bkolb bkolb force-pushed the feature/multilineCodeLense branch 2 times, most recently from 1b63371 to b0a63d4 Compare September 25, 2025 14:56
@bkolb
Copy link
Contributor Author

bkolb commented Sep 25, 2025

Can I get another round of review, please?

Copy link
Collaborator

@cbandera cbandera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adressing my last set of review comments. The functionality is still given and works fine locally.

Here is a next set of (opinionated) findings with the goal of improving code quality.
(Note that I am not a maintainer, so feel free to take it as a suggestion or ignore as long as none of the maintainers performs a review 😉 )

@bkolb bkolb force-pushed the feature/multilineCodeLense branch from b0a63d4 to 77f8dbd Compare September 28, 2025 15:53
@bkolb
Copy link
Contributor Author

bkolb commented Sep 28, 2025

OK. I pushed again. Let me know what you think.
It would also be nice to get a review from @cameron-martin, @vogelsgesang or any other maintainer :-)

@cbandera
Copy link
Collaborator

cbandera commented Oct 9, 2025

For the record: I like the latest version a lot and would also be interested in the thoughts of @cameron-martin 😃

@cbandera
Copy link
Collaborator

cbandera commented Nov 9, 2025

Hi @bkolb do you mind updating your branch with the latest changes from upstream to resolve the merge conflicts? Thanks in advance!

@bkolb bkolb force-pushed the feature/multilineCodeLense branch from 77f8dbd to faf3594 Compare November 10, 2025 12:49
@bkolb
Copy link
Contributor Author

bkolb commented Nov 10, 2025

done

@EdSchouten
Copy link

@cameron-martin PTAL!

@EdSchouten
Copy link

@cbandera What's left for us to drag this across the finish line?

@cbandera
Copy link
Collaborator

I didn't test it again after the last merge with master. (And am on mobile only right now)
But primarily it's a review from one of the maintainers in order to get it merged...

@cbandera
Copy link
Collaborator

Tested again locally and it still works fine. I'd be happy to see this in the next release :)

@cameron-martin cameron-martin changed the title feat(codelens): Show picker for multiple targets (#476) feat(codelens): Show picker for multiple targets Nov 21, 2025
// If the command adapter was unspecified, it means this command is being
// invoked via the command palatte. Provide quickpick build targets for
// the user to choose from.
const quickPick = await showDynamicQuickPick({
Copy link
Collaborator

@cameron-martin cameron-martin Nov 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not using showDynamicQuickPick any more here looks like a regression. Possibly an issue with merging with #465?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, I should have checked for that. The invocation has moved to L55 but is not using the new showDynamicQuickPick. Requires fixing.

await bazelTestTarget(quickPick);
}
return;
const selectedAdapter = await selectSingleTarget(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again here possibly the same regression.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but requires fixing in the same location: L55

@bkolb
Copy link
Contributor Author

bkolb commented Nov 23, 2025

Ok. I can look at it. How can I test that it works? Is there a test for it?

@cbandera
Copy link
Collaborator

There are unittests for it, but none at integration level. You can test it manually by running the "Bazel: Build Target" command from the command palette. The dynamic quick pick is a future intended for large workspaces, where waiting for the inital query that loads the results of //... will take too long. So what dynamic quick pick will do is that as soon as the user starts typing a label, the running query will get interrupted and started again with the refined scope. E.g. lets say you start typing //my_pkg/ab then the query would restart with querying //my_pkg/... in order to produce a results list quicker for the scope that is of interest to the user.

For testing you can have a look at the debug panel while starting the extension via the launch configuration and interactively trying out the described feature. You should see that multiple queries are exectued instead of just the initial one.
Of course if you bring back the dynamic quick pick, please also double check that your intended functionality (from the code lens, not the command panel) still works, (although I assume it shouldnt break it....)

@bkolb bkolb force-pushed the feature/multilineCodeLense branch from faf3594 to ce9ce2f Compare November 25, 2025 14:09
@bkolb
Copy link
Contributor Author

bkolb commented Nov 25, 2025

Done. PTAL

@cameron-martin
Copy link
Collaborator

Done. PTAL

Please see the failing CI run.

@bkolb bkolb force-pushed the feature/multilineCodeLense branch from ce9ce2f to f903884 Compare November 26, 2025 09:57
@bkolb
Copy link
Contributor Author

bkolb commented Nov 26, 2025

I run the formatter.

This change modifies the BazelBuildCodeLensProvider to create a target
picker in case there is more than one target per category
(Copy/Build/Run/Test).

The motivation is to provide a better and more user-friendly experience
when working with macros in BUILD files. When a macro generates multiple
targets, you could run into situations where not all actions were
visible anymore.
@bkolb bkolb force-pushed the feature/multilineCodeLense branch from f903884 to 06659f0 Compare November 26, 2025 12:53
@cameron-martin cameron-martin merged commit 7aa2304 into bazel-contrib:master Nov 26, 2025
1 check passed
@bkolb
Copy link
Contributor Author

bkolb commented Nov 26, 2025

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants