Skip to content

Latest commit

 

History

History
69 lines (47 loc) · 2.06 KB

README.md

File metadata and controls

69 lines (47 loc) · 2.06 KB

Protobuf Language Server

pbls is a Language Server for protobuf.

Features

  • Diagnostics (from protoc)
  • Goto Definition (for fields and imports)
  • Document/Workspace Symbols
  • Completion (keywords, imports, types, and options)
  • Find References

Prerequisites

Ensure protoc is on your $PATH.

Installation

cargo install --git https://git.sr.ht/~rrc/pbls

Ensure the cargo binary path (usually ~/.cargo/bin) is on $PATH. Finally, configure pbls in your editor.

Configuration

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.

Logging

Set the environment variable RUST_LOG to one of ERROR, WARN, INFO, DEBUG, or TRACE. See env_logger for more details.

Editor Setup

This assumes that pbls and protoc are on your $PATH.

Helix

# ~/.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"]}

Similar Projects