Skip to content

Type to search extensions

Textproto

v0.1.0

Support for Protocol Buffers text format (.textproto, .txtpb, .textpb, .pbtxt)

Updated 1 year ago
38k downloads 2 stars Repository ↗

Zed Textproto Extension

Language support for Protocol Buffers text format (textproto) in the Zed editor.

Features

  • Syntax highlighting for .textproto, .txtpb, .textpb, and .pbtxt files
  • 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:

  1. Open Zed
  2. Go to Extensions (cmd+shift+x / ctrl+shift+x)
  3. Search for "Textproto"
  4. Click Install

Development Installation

To install the development version:

  1. Clone this repository:

    git clone https://github.com/mikn/zed-textproto.git
    cd zed-textproto
  2. Build the extension:

    cargo build --release
  3. In Zed, open the command palette (cmd+shift+p / ctrl+shift+p)

  4. Run "zed: install dev extension"

  5. 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" } or field < 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]: true

Development

Requirements

  • Rust (for building the extension)
  • Zed editor

Building from Source

# Clone the repository
git clone https://github.com/mikn/zed-textproto.git
cd zed-textproto

# Build the extension
cargo build --release

Project 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 queries

Grammar

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

ZedExt An unofficial community project. Not affiliated with Zed Industries.

Data from Zed’s extension registry and GitHub · updated