bazel-contrib / vscode-bazel

Bazel support for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=BazelBuild.vscode-bazel
Apache License 2.0
244 stars 79 forks source link

feat: Extend CodeLens to build and run more targets #404

Closed cramertj closed 4 months ago

cramertj commented 4 months ago

Previously, _binary targets could only be run, _test taregets could only be tested, and all other targets could only be built. This change allows all targets to be built and all non-_library targets to be run.

Additionally, this change shortens the names of the targets in codelens, as otherwise the additional commands caused a lot of clutter: Run //foo/bar/baz:flubber Build //foo/bar/baz:flubber etc.

Example after change: bazel-vscode-screenshot

BEGIN_COMMIT_OVERRIDE feat(codelens): Extend CodeLens to build and run more targets END_COMMIT_OVERRIDE

cameron-martin commented 4 months ago

Can you fix the lint errors too?

romannikov commented 4 months ago
  1. Could you please hide repeated target names?
  2. Could you please add a command to copy a target to a clipboard? command is already defined. It'll look like as a first command in the commands array:
    commands.push({
    commandString: "bazel.copyTargetToClipboard",
    name: "Copy",
    });

    Many thanks!

cameron-martin commented 4 months ago

@romannikov These sound like good changes, but also quite separate from this change. I'd be happy to accept these changes in separate PRs though.

romannikov commented 4 months ago

@romannikov These sound like good changes, but also quite separate from this change. I'd be happy to accept these changes in separate PRs though.

I'll happy to send these changes in a follow up pull request, since this one will be committed.