#semantic-tokens #lsp #highlighting

oak-semantic-tokens

Semantic syntax highlighting and token classification for the Oak framework

10 releases

Uses new Rust 2024

new 0.0.11 Mar 29, 2026
0.0.10 Mar 24, 2026
0.0.4 Feb 18, 2026
0.0.1 Jan 23, 2026

#888 in Text editors


Used in oak-rbq

MPL-2.0 license

325KB
5K SLoC

🚀 oak-semantic-tokens

Crates.io Documentation

Semantic Tokens for Oak Languages — LSP-compatible semantic syntax highlighting for precise code coloring.

🎯 Why oak-semantic-tokens?

Semantic tokens go beyond syntax highlighting by understanding the meaning of identifiers — distinguishing between function calls, variable references, type names, and more.

✨ Key Features

  • 🎨 Semantic Token Type — LSP-compatible with delta encoding
  • 📊 Provider TraitSemanticTokensProvider for language-specific highlighting
  • 🔧 Line Map Integration — Works with oak-vfs::LineMap for position conversion
  • ⚡ Efficient Encoding — Delta-based encoding minimizes data transfer
  • 🔄 Serde Support — Optional serialization for LSP integration

🏗️ Architecture

  • SemanticToken — LSP-compatible token with delta encoding
  • SemanticTokensProvider<L> — Trait for providing semantic tokens

LSP Compatibility

Matches LSP's SemanticTokens specification with delta encoding, token types, and modifiers via legend indices.

🔗 Ecosystem Integration

Used by oak-lsp for textDocument/semanticTokens support, IDE extensions for enhanced highlighting, and code analysis tools.

📖 Documentation

For usage examples and API details, see the API documentation.

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Dependencies

~7–10MB
~110K SLoC