Skip to content

stackb/bazel-stack-vscode

 
 

Repository files navigation

bazel-stack-vscode

Bazel Support for Visual Studio Code.

Bazel Stack VSCode

Documentation

https://stackb.github.io/bazel-stack-vscode/

Basic Features:

  • bazel and starlark files (BUILD, .bazel, WORKSPACE, *.bzl, .star, *.sky):

  • bazelrc files (*.bazelrc):

    • syntax highlighting
    • hover to get flag reference & links to bazel docs / bazel codesearch
    • completion for all 834 available flags by command (includes undocumented flags).
  • launch.bazelrc file (a file where you can stash frequently executed commands):

    • syntax highlighting
    • hover over command name to get a "codelens" (click to run the command)
    • repeat previous command for iterative development (shift+ctrl+space)
    • custom problem matcher for rules_go output

Build File Formatting

1-format

Build File Linting Diagnostics

1-lint

Hover Symbols to Get Inline Documentation

1-rulehover

Hover Symbols to Get Documentation Links

1-bazeldoc

Hover Flags to Get Inline Documentation

1-flaghover

Includes all 834 flags (including undocumented options)

Flag Autocomplete

1-flag-completion

Use the ' ' (space) or '=' (equals) to commit choice and continue typing

Launch File Codelens

1-launch

Keep a launch.bazelrc file for common (or uncommonly used) commands. Click the "codelens" to run it.

Repeat the last command with shift+ctrl+space.

NOTE: the directory where the launch.bazelrc file determines the working directory for the shell. Typically you'll put this next to your WORKSPACE file.

Advanced Features:

The advanced features are available with a Bzl subscription. Sign-up on the website or within the vscode extension. Read more about advanced features on the documentation site.


Github Rate Limits: This extension makes requests to the github v3 API. If you experience errors due to rate limits, export GITHUB_TOKEN={MY_PERSONAL_TOKEN} and relaunch vscode to get higher rate limits.

NOTE: portions of this extension were adapted from https://github.com/bazelbuild/vscode-bazel (Apache 2.0).