Integrate with other tools

Code editors

buf produces structured machine readable error output for build, lint, and breaking change errors which integrate with IDEs, scripts, and other tools.

We currently provide integration with Vim, Visual Studio Code, and JetBrains IDEs, and we may support other editors in the future. Contact us if you are interested in any of these, or others not already listed here.

Vim

Vim integration for linting is available using the ALE lint engine via the vim-buf plugin.

To use Vim integration buf must be installed. Using vim-plug, add this to your .vimrc:

Plug 'dense-analysis/ale'
Plug 'bufbuild/vim-buf'
let g:ale_linters = {
\   'proto': ['buf-lint',],
\}
let g:ale_lint_on_text_changed = 'never'
let g:ale_linters_explicit = 1

The extension runs buf lint --path on save and reveals errors on a per-file basis. To detect package-level problems, be sure to run a workspace-wide buf lint as part of your CI process.

Visual Studio Code

The Visual Studio Code extension can be downloaded from the in-editor extension browser under the name "Buf" or manually via the extension page. You need to have buf installed to use it.

Our Buf extension currently supports linting your .proto files. It runs buf lint --path on save and reveals errors on a per-file basis. To detect package-level problems, be sure to run a workspace-wide buf lint as part of your CI process.

buf is executed in the root of your workspace, which means buf is configured by the buf.yaml there.

JetBrains IDEs

The plugin for all IntelliJ-based IDEs is available on the JetBrains Plugin Marketplace.

You can install it from the settings window of your IDE. The plugin supports linting and formatting for your .proto files, as well as navigation, syntax highlighting, and more.

EditorConfig suggestions

If you use EditorConfig files to enforce consistent styles in your code, we recommend these settings for your .proto files:

[*.proto]
indent_size = 2
indent_style = space
insert_final_newline = true

These settings aren't semantically meaningful in Protobuf but are commonly used throughout the ecosystem.

Formatting options

buf supports these formatting options (passed using the --error-format flag) to support other integrations:

path/to/file.proto:1:10:syntax value must be "proto2" or "proto3"
path/to/file.proto(1,10) : error COMPILE : syntax value must be "proto2" or "proto3"`
{"path":"path/to/file.proto","start_line":1,"start_column":10,"end_line":1,"end_column":10,"type":"COMPILE","message":"syntax value must be \"proto2\" or \"proto3\""}