Zed Textproto Extension
Language support for Protocol Buffers text format (textproto) in the Zed editor.
Features
- Syntax highlighting for
.textproto,.txtpb,.textpb, and.pbtxtfiles - Bracket matching for
{},<>, and[]pairs - Auto-indentation for nested messages
- Code outline navigation for fields
- Comment support (
#style line comments)
Installation
From Zed Extensions (Coming Soon)
Once published, you'll be able to install directly from Zed:
- Open Zed
- Go to Extensions (cmd+shift+x / ctrl+shift+x)
- Search for "Textproto"
- Click Install
Development Installation
To install the development version:
Clone this repository:
git clone https://github.com/mikn/zed-textproto.git cd zed-textprotoBuild the extension:
cargo build --releaseIn Zed, open the command palette (cmd+shift+p / ctrl+shift+p)
Run "zed: install dev extension"
Select the cloned repository directory
Supported Syntax
The extension supports all Protocol Buffers text format features:
- Field assignments:
name: "value" - Nested messages:
field { nested: "value" }orfield < nested: "value" > - Repeated fields:
values: [1, 2, 3] - Comments:
# This is a comment - Numbers: Decimal, hexadecimal (
0xFF), octal (0755), floating point - Strings: With escape sequences
- Extension fields:
[com.example.extension]: "value" - Any type fields:
[type.googleapis.com/package.Type] { ... }
Example
# Example configuration
name: "MyService"
timeout_seconds: 30
server_config {
host: "localhost"
port: 8080
features: ["auth", "logging", "metrics"]
}
[com.example.custom_option]: trueDevelopment
Requirements
Building from Source
# Clone the repository
git clone https://github.com/mikn/zed-textproto.git
cd zed-textproto
# Build the extension
cargo build --releaseProject Structure
zed-textproto/
├── extension.toml # Extension manifest
├── Cargo.toml # Rust dependencies
├── src/
│ └── lib.rs # Extension implementation
└── languages/
└── textproto/
├── config.toml # Language configuration
├── highlights.scm # Syntax highlighting queries
├── brackets.scm # Bracket matching rules
├── indents.scm # Indentation rules
└── outline.scm # Symbol outline queriesGrammar
This extension uses the tree-sitter-textproto grammar for parsing.
License
MIT License - see LICENSE file for details
Contributing
Contributions are welcome! Please feel free to submit issues or pull requests.
Acknowledgments
- Tree-sitter grammar by PorterAtGoogle
- Protocol Buffers text format specification