proto.md

 1---
 2title: Proto
 3description: "Configure Proto language support in Zed, including language servers, formatting, and debugging."
 4---
 5
 6# Proto
 7
 8Proto/proto3 (Protocol Buffers definition language) support is available through the [Proto extension](https://github.com/zed-industries/zed/tree/main/extensions/proto).
 9
10- Tree-sitter: [coder3101/tree-sitter-proto](https://github.com/coder3101/tree-sitter-proto)
11- Language Servers: [protobuf-language-server](https://github.com/lasorda/protobuf-language-server)
12
13<!--
14TBD: Clarify which language server(s) to use / Feature support.
15
16## Setup
17
18### Install protobuf-language-server
19
20Install protobuf-language-server and make sure it's in your PATH:
21
22```
23go install github.com/lasorda/protobuf-language-server@latest
24which protobuf-language-server
25```
26
27### Install ProtoLS
28
29Install protols and make sure it's in your PATH:
30
31```
32cargo install protols
33which protols
34```
35
36## Configuration
37
38```json [settings]
39"lsp": {
40  "protobuf-language-server": {
41    "binary": {
42      "path": "protols"
43    }
44  }
45}
46```
47
48## Formatting
49
50ProtoLS supports formatting if you have `clang-format` installed.
51
52```sh
53# MacOS:
54brew install clang-format
55# Ubuntu
56sudo apt-get install clang-format
57# Fedora
58sudo dnf install clang-tools-extra
59```
60
61To customize your formatting preferences, create a `.clang-format` file, e.g.:
62
63```clang-format
64IndentWidth: 4
65ColumnLimit: 120
66```
67
68Or you can have zed directly invoke `clang-format` by specifying it as a [formatter](https://zed.dev/docs/reference/all-settings#formatter) in your settings:
69
70```json [settings]
71  "languages": {
72    "Proto": {
73      "format_on_save": "on",
74      "tab_size": 4,
75      "formatter": {
76        "external": {
77          "command": "clang-format",
78          "arguments": ["-style={IndentWidth: 4, ColumnLimit: 0}"]
79        }
80      }
81    },
82  }
83```
84-->