Proto
Proto/proto3 (Protocol Buffers definition language) support is available through the Proto extension.
- Tree-sitter: coder3101/tree-sitter-proto
- Language Servers: protobuf-language-server
Setup
There are two available language server implementations for Protobuf: Pick one and follow the installation instructions below.
Install protobuf-language-server
Install protobuf-language-server and make sure it's in your PATH:
go install github.com/lasorda/protobuf-language-server@latest
which protobuf-language-server
Install ProtoLS
Install protols and make sure it's in your PATH:
cargo install protols
which protols
Configuration
"lsp": {
"protobuf-language-server": {
"binary": {
"path": "protols"
}
}
}
Formatting
ProtoLS supports formatting if you have clang-format installed.
# MacOS:
brew install clang-format
# Ubuntu
sudo apt-get install clang-format
# Fedora
sudo dnf install clang-tools-extra
To customize your formatting preferences, create a .clang-format file, e.g.:
IndentWidth: 4
ColumnLimit: 120
Or you can have gram directly invoke clang-format by specifying it as a formatter in your settings:
"languages": {
"Proto": {
"format_on_save": "on",
"tab_size": 4,
"formatter": {
"external": {
"command": "clang-format",
"arguments": ["-style={IndentWidth: 4, ColumnLimit: 0}"]
}
}
},
}