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 Vim and Visual Studio Code integrations and intend to support Emacs and Intellij 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 module-wide buf lint as part of your CI process.

Visual Studio Code Visual Studio Marketplace Downloads

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 module-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 or buf.work.yaml in the root of your workspace.

JetBrains IDEs

IntelliJ IDEA, GoLand and other JetBrains IDEs can be configured with a File Watcher that runs buf lint --path on save and optionally surface issues as warnings or errors in your editor.

Make sure buf is installed on your PATH, then configure your buf lint FileWatcher according to JetBrains' documentation using these values:

settingvalue
Programbuf
Argumentslint --path $FilePath$
Working directory$ProjectFileDir$
Output filters$FILE_PATH$:$LINE$:$COLUMN$:$MESSAGE$

buf is executed in your project root, which means buf is configured by the buf.yaml or buf.work.yaml in your project root.

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"