pbls is a Language Server for protobuf.
pbls was originally hosted at https://git.sr.ht/~rrc/pbls, but was moved to https://github.com/rcorre/pbls ease contribution.
The sourcehut repo is maintained as a mirror.
- Diagnostics (from
protoc) - Goto Definition (for fields and imports)
- Document/Workspace Symbols
- Completion (keywords, imports, types, and options)
- Find References
Ensure protoc is on your $PATH.
cargo install --git https://github.com/rcorre/pbls
Ensure the cargo binary path (usually ~/.cargo/bin) is on $PATH.
Finally, configure pbls in your editor.
Create a file named ".pbls.toml" at your workspace root, and specify the proto import paths that are passed to the -I/--proto_path flag of protoc.
These can be absolute, or local to the workspace.
Make sure to include the "well known" types ("google/protobuf/*.proto").
This is often "/usr/include" on a unix system.
proto_paths=["some/workspace/path", "/usr/include"]If this is omitted, pbls will make a best-effort attempt to add local include paths.
In general, prefer explicitly specifying paths.
Set the environment variable RUST_LOG to one of ERROR, WARN, INFO, DEBUG, or TRACE.
See env_logger for more details.
This assumes that pbls and protoc are on your $PATH.
# ~/.config/helix/languages.toml
[language-server.pbls]
command = "pbls"
[[language]]
name = "protobuf"
language-servers = ['pbls']
# Unrelated to pbls, you may want to use clang-format as a formatter
formatter = { command = "clang-format" , args = ["--assume-filename=a.proto"]}You can also enable pbls in other languages, allowing you to search for protobuf messages without having a protobuf file open:
# ~/.config/helix/languages.toml
# Search for protobuf symbols in C++ files using <space>S
[[language]]
name = "cpp"
language-servers = [ "clangd", { name = "pbls", only-features = ["workspace-symbols"] } ]