#folding #ast #code-folding

nightly oak-folding

Code folding logic and AST-based region detection for the Oak framework

11 releases

Uses new Rust 2024

0.0.11 Mar 29, 2026
0.0.10 Mar 24, 2026
0.0.4 Feb 14, 2026
0.0.2 Jan 30, 2026

#539 in Math

Download history 28/week @ 2026-01-21 123/week @ 2026-01-28 101/week @ 2026-02-04 309/week @ 2026-02-11 165/week @ 2026-02-18 152/week @ 2026-02-25 134/week @ 2026-03-04 180/week @ 2026-03-11 160/week @ 2026-03-18 112/week @ 2026-03-25 152/week @ 2026-04-01 166/week @ 2026-04-08 204/week @ 2026-04-15 193/week @ 2026-04-22 151/week @ 2026-04-29 128/week @ 2026-05-06

719 downloads per month
Used in 145 crates (2 directly)

MPL-2.0 license

300KB
4.5K SLoC

🚀 oak-folding

Crates.io Documentation

Code Folding Support for Oak Languages — Identify collapsible regions in source code for IDE outline views and editor folding.

🎯 Why oak-folding?

Code folding helps developers manage large files by collapsing sections of code. oak-folding provides a trait-based interface for identifying foldable regions in any Oak-supported language.

✨ Key Features

  • 📁 Folding Provider TraitFoldingProvider for language-specific folding logic
  • 🎯 Folding Range Types — Comments, imports, and custom regions
  • 📍 Precise Ranges — Byte-offset based for accurate folding
  • 🔄 Serde Support — Optional serialization for LSP integration

🏗️ Architecture

  • FoldingRange — Represents a foldable region with optional kind
  • FoldingRangeKind — Comment, Imports, or Region
  • FoldingProvider<L> — Trait for providing folding ranges

🔗 Ecosystem Integration

Used by oak-lsp for textDocument/foldingRange support, IDE extensions for code outline views, and code formatters.

📖 Documentation

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

🤝 Contributing

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

Dependencies

~5–7.5MB
~71K SLoC