Skip to content

behrangsa/zed-sieve

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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
└── .gitignore

Features

✨ 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

Install via Zed Extensions

  1. Open Zed
  2. Press Cmd+Shift+P (macOS) or Ctrl+Shift+P (Linux/Windows)
  3. Type "Extensions" and select "Extensions: Install Extension"
  4. Search for "Sieve" and install

Manual Installation

  1. Clone this repository:
    git clone https://github.com/yourusername/zed-sieve
    cd zed-sieve
  2. Open Zed
  3. Press Cmd+Shift+X (macOS) or Ctrl+Shift+X (Linux/Windows)
  4. Click the Install Dev Extension button and select the repo directory
  5. 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
  6. 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

  1. Clone this repository:

    git clone https://github.com/yourusername/zed-sieve
    cd zed-sieve
  2. Run tests:

    # Extension server tests
    cargo check
    cargo test
  3. Build Extension:

    cargo build

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. 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:

  • expire action for message expiration
  • currentdate test for time-based filtering
  • Enhanced date/time operations
  • Custom flag management

License

MIT License - see LICENSE for details.

Support


Built with ❤️ for the Zed editor community

About

Zed LSP Extension for Sieve

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 82.5%
  • Tree-sitter Query 17.5%