proto.md

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