Skip to content

bufbuild/vscode-buf

Repository files navigation

Buf for Visual Studio Code

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.

Features

  • 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 .proto files 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.

Preview features

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.

Getting Started

This extension requires Visual Studio Code 1.95 or newer (or editors compatible with VS Code 1.95+ APIs).

  1. Install the latest version via the VS Code marketplace.
  2. Start editing .proto files!

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.

Commands

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 build with 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 init at the root of each VS Code workspace. This creates a buf.yaml file to help users get started with Buf modules and workspaces.

  • List available breaking change detection rules: runs buf config ls-breaking-rules at 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-rules at 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 prune at the root of each VS Code workspace and prunes unused dependencies from the buf.lock file(s).

  • Update module dependencies: runs buf dep update at the root of each VS Code workspace and updates the dependencies in the buf.lock file(s).

  • Generate: runs buf generate at the root of each VS Code workspace and generates code based on the buf.gen.yaml file(s).

  • Show Buf Output: shows the extension output channel.

Community and Support

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.

Legal

Offered under the Apache 2 license.

About

Visual Studio Code integration for Buf.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Contributors 23