Code editors
The Buf CLI 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're 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.
Note
The Buf CLI is executed in the root of your workspace, which means it's 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:
These settings aren't semantically meaningful in Protobuf but are commonly used throughout the ecosystem.
Formatting options
The Buf CLI supports these formatting options (passed using the --error-format
flag) to support other integrations: