The VS Code Buf extension helps you work with Protocol Buffers files in a much more intuitive way, adding semantic syntax highlighting, navigation, formatting, documentation and diagnostic hovers, and integrations with Buf commands.
- Code navigation and documentation hovers: Jump to or quickly glance a message or service's definition.
- Autocompletion: Get code completion as you type through IntelliSense.
- Formatting: Formats
.protofiles on-save. - Syntax highlighting: Code styling that provides clarity on Protobuf keywords and identifiers.
- Diagnostics: Get highlights and feedback on build and lint errors as you code.
This extension doesn't stop at editing: open the Command Palette (Ctrl/Cmd+Shift+P)
to quickly run common buf tasks such as buf generate. See the full list of commands for more.
This extension requires Visual Studio Code 1.95 or newer (or editors compatible with VS Code 1.95+ APIs).
- Install the latest version via the VS Code marketplace.
- Start editing
.protofiles!
This extension does not require you to have the Buf CLI already installed. By default, the extension uses
the Buf CLI from your system $PATH. If buf isn't found on your $PATH, the extension automatically
downloads and installs the latest version to its own storage directory.
A full list of Command Palette commands provided by this extension:
-
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 buildwith optional user input for the build output file. If the build output is specified by the user, it will be created at the root of each VS Code workspace. -
Init: runs
buf config initat the root of each VS Code workspace. This creates abuf.yamlfile to help users get started with Buf modules and workspaces. -
List available breaking change detection rules: runs
buf config ls-breaking-rulesat the root of each VS Code workspace and provides a list of available breaking change detection rules in a VS Code editor window. -
List available lint rules: runs
buf config ls-lint-rulesat the root of each VS Code workspace and provides a list of available lint rules in a VS Code editor window. -
Prune module dependencies: runs
buf dep pruneat the root of each VS Code workspace and prunes unused dependencies from thebuf.lockfile(s). -
Update module dependencies: runs
buf dep updateat the root of each VS Code workspace and updates the dependencies in thebuf.lockfile(s). -
Generate: runs
buf generateat the root of each VS Code workspace and generates code based on thebuf.gen.yamlfile(s). -
Show Buf Output: shows the extension output channel.
Feedback is welcome and appreciated! For feature requests, bugs, or questions, please file an issue.
If you're looking for help and/or discussion around Protobuf, best practices, etc., join us on Slack.
Offered under the Apache 2 license.
