From c650ba4e7218705ba15f83aac3c0c7b444fc7523 Mon Sep 17 00:00:00 2001 From: Peter Tripp Date: Thu, 14 Nov 2024 16:25:37 +0000 Subject: [PATCH] docs: Proto formatter example (#20677) --- docs/src/languages/proto.md | 38 +++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/docs/src/languages/proto.md b/docs/src/languages/proto.md index 90689615c28156c4d18477590d8e2c530d5ed495..934080a1d7119def0a0a2ef65e4efc14e1f08f4b 100644 --- a/docs/src/languages/proto.md +++ b/docs/src/languages/proto.md @@ -3,3 +3,41 @@ Proto/proto3 (Protocol Buffers definition language) support is available natively in Zed. - Tree Sitter: [coder3101/tree-sitter-proto](https://github.com/coder3101/tree-sitter-proto) +- Language Server: [protols](https://github.com/coder3101/protols) + +## Formatting + +ProtoLS supports formatting if you have `clang-format` installed. + +```sh +# 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.: + +```clang-format +IndentWidth: 4 +ColumnLimit: 120 +``` + +Or you can have zed directly invoke `clang-format` by specifying it as a [formatter](https://zed.dev/docs/configuring-zed#formatter) in your settings: + +```json + "languages": { + "Proto": { + "format_on_save": "on", + "tab_size": 4, + "formatter": { + "external": { + "command": "clang-format", + "arguments": ["-style={IndentWidth: 4, ColumnLimit: 0}"] + } + } + }, + } +```