Zed Sieve Extension
A comprehensive Language Server Protocol extension for Zed that provides intelligent editing support for the Sieve email filtering language (RFC 5228) with enhanced support for Proton Mail's advanced features.
Repo structure
zed-sieve/
├── extension.toml # Zed extension configuration
├── src/ # Extension source code
│ └── extension.rs # Main extension implementation
├── grammars/ # Tree-sitter grammars for Sieve language (Auto-Generated by Zed during install)
├── languages/ # Language configuration
│ └── sieve/
│ ├── highlights.scm # Syntax highlighting queries
│ └── config.toml # Language-specific settings
├── docs/ # Documentation
│ ├── installation.md
│ ├── configuration.md
│ └── features.md
├── examples/ # Example configurations
│ └── settings.json
├── Cargo.toml # Rust extension config
├── README.md # Installation and usage instructions
├── LICENSE
└── .gitignoreFeatures
✨ Language Support
- Complete RFC 5228 compliance - Full support for the Sieve base specification
- Proton Mail extensions - Advanced features like
expire,currentdate, and more - Tree-sitter grammar - Precise syntax highlighting and code structure
- Language Server Protocol - Rich editing experience with diagnostics, completion, and hover info
🎯 Editor Features
- Syntax Highlighting - Beautiful, accurate highlighting for all Sieve constructs
- Code Completion - Smart completions for tests, actions, tags, and extensions
- Type any Sieve command to see available completions
- Trigger with
:for tag completions - Context-aware suggestions based on cursor position
- Error Diagnostics - Real-time syntax error detection and reporting
- Real-time syntax validation
- Missing semicolon detection
- Invalid command highlighting
- Extension requirement checking
- Hover Documentation - Inline help for Sieve commands and extensions
- Command description
- Parameter information
- Usage examples
- Extension requirements
- Auto-formatting - Consistent code style and indentation
- Comment Support - Both line (
#) and block (/* */) comments
🚀 Sieve Language Coverage
- Core Tests:
address,allof,anyof,envelope,exists,header,not,size,true,false - Core Actions:
discard,fileinto,keep,redirect,reject,stop - Extensions:
body,copy,date,regex,vacation,variables,relational, and more - Proton Features:
expire,currentdate, advanced date operations, custom filters
Installation
Prerequisites
- Zed editor (latest version)
- Rust (for extension compilation)
Install via Zed Extensions
- Open Zed
- Press
Cmd+Shift+P(macOS) orCtrl+Shift+P(Linux/Windows) - Type "Extensions" and select "Extensions: Install Extension"
- Search for "Sieve" and install
Manual Installation
- Clone this repository:
git clone https://github.com/yourusername/zed-sieve cd zed-sieve - Open Zed
- Press
Cmd+Shift+X(macOS) orCtrl+Shift+X(Linux/Windows) - Click the
Install Dev Extensionbutton and select the repo directory - Configure Zed for Sieve extension:
# Merge Zed configs for Sieve extension (To project only) jq -s '.[0] * .[1]' .zed/settings.json ~/.config/zed/settings.json > .zed/settings.json # OR Merge Zed configs for Sieve extension (To global) jq -s '.[0] * .[1]' .zed/settings.json ~/.config/zed/settings.json > .config/zed/settings.json - Restart Zed (optional)
Usage
File Types
The extension automatically activates for files with these extensions:
.sieve- Standard Sieve scripts.sv- Alternative Sieve extension
Configuration
Extension Options
protonExtensions: Enable Proton Mail specific features (default: true)strictMode: Enforce RFC 5228 compliance only (default: false)
Development
Building from Source
Clone this repository:
git clone https://github.com/yourusername/zed-sieve cd zed-sieveRun tests:
# Extension server tests cargo check cargo testBuild Extension:
cargo build
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
RFC 5228 Compliance
This extension implements the complete Sieve specification:
- ✅ Base language (RFC 5228)
- ✅ Body extension (RFC 5173)
- ✅ Copy extension (RFC 3894)
- ✅ Date extension (RFC 5260)
- ✅ Environment extension (RFC 5183)
- ✅ Regex extension (draft-ietf-sieve-regex)
- ✅ Variables extension (RFC 5229)
- ✅ Vacation extension (RFC 5230)
- ✅ Relational extension (RFC 5231)
Proton Mail Extensions
Additional support for Proton's advanced features:
expireaction for message expirationcurrentdatetest for time-based filtering- Enhanced date/time operations
- Custom flag management
License
MIT License - see LICENSE for details.
Support
- Issues: GitHub Issues
- Documentation: Sieve RFC 5228
- Proton Help: Proton Sieve Documentation
Built with ❤️ for the Zed editor community