The VS Code Buf extension helps you work with Protocol Buffers files in a much more intuitive way, adding smart syntax highlighting, navigation, formatting, documentation and diagnostic hovers, and integrations with Buf commands.
- Code navigation - Go-to definition and documentation insets for
.proto
symbols. - Syntax highlighting - Protobuf specific color and styling of code.
- Code editing - Formatting via
buf format
and annotations and hovers based onbuf lint
andbuf breaking
. - Documentation hovers - Documentation for definitions when hovering a reference.
- Buf command support - Execution of
buf
CLI commands via the Command Palette.
Install the latest version via the VS Code marketplace.
By default, the extension will use your locally-installed version of buf
on your system
$PATH
. However, you don't have to install buf
- the extension can manage and install it
for you based on the buf.commandLine.path and buf.commandLine.version
configurations:
buf.commandLine.path |
buf.commandLine.version |
|
---|---|---|
Default: Use buf from the system $PATH . |
{empty} | {empty} |
Use the latest released version of buf and check for updates on extension activation. |
{empty} | latest |
Use buf at specified path. |
User specified path | {empty} |
Install and use the specified version of buf . |
{empty} | User specified semver version |
Use buf at specified path and display an error message. |
User specified path | User specified semver version |
This extension contributes the following configuration settings.
Default: null
The path to a specific install of Buf to use. Relative paths are supported and are relative to the VS Code workspace root.
Default: null
Specific version (e.g. 'v1.53.0') of Buf release to download and install.
Default: true
Automatically restart the Buf Language Server (up to 4 times) if it crashes.
Default: true
Enable hover features provided by the language server.
Default: true
Enable Buf Language Server features.
Default: false
Enable debug logs in output channels.
Default: text
Buf Language Server log format.
Default: git
The strategy to use when checking breaking changes against a specific reference.
Default: refs/remotes/origin/HEAD
The Git reference to check breaking changes against. This is only compatible when buf.checks.breaking.againstStrategy
is set to git
, otherwise it is ignored.
This extension contributes the following commands to the Command Palette.
- Install CLI: installs the
buf
CLI based onbuf.commandLine.path
andbuf.commandLine.version
configurations and then attempts to start the language server. - Update CLI: updates the
buf
CLI based onbuf.commandLine.path
andbuf.commandLine.version
configurations and then attempts to start the language server.
- Start Buf Language Server: starts the Buf Language Server. If the Buf Language Server is already running, it will stop and then start it.
- Stop Buf Language Server: stops the Buf Language Server. If the Buf Language Server is not currently running, then it is a no-op.
- Build: runs
buf build
with an optional user input for the build output. - Init: runs
buf config init
at the root of each VS Code workspace. This creates abuf.yaml
file to help users get started with Buf modules and workspaces. - List available breaking change detection rules: lists the breaking change detection rules that are available.
- List available lint rules: lists the lint rules that are available.
- Prune module dependencies: prunes unused dependencies from the
buf.lock
at the root of each VS Code workspace. - Update module dependencies: updates the dependencies in
buf.lock
at the root of each VS Code workspace. - Generate: runs
buf generate
at the root of each VS Code workspace. - List module files: lists the Protobuf definition files for the Buf module/workspace at the root of each VS Code workspace.
- Price of BSR paid plans: provides the pricing information for Buf Schema Registry (BSR) for each VS Code workspace.
- Module stats: provides Buf module/workspace stats at the root of each VS Code workspace.
- Show Buf Output: shows the extension output channel
Offered under the Apache 2 license.