Oak Structure
Hierarchical document structure and outline provider for the Oak ecosystem.
🎯 Overview
Oak Structure provides the tools to build a hierarchical representation of a document's logical components. It is used to power "Outline" views, "Breadcrumbs", and "Document Symbols" in modern IDEs, allowing users to quickly see and navigate the structure of their code.
✨ Features
- Hierarchical Representation: Supports nested items (e.g., methods inside classes).
- Universal Roles: Uses
UniversalElementRolefor cross-language compatibility. - Selection Ranges: Distinguishes between the full range of an item and its clickable name/identifier range.
- LSP Ready: Fully compatible with
textDocument/documentSymbol. - Benchmarked: Designed to match the quality and performance of IntelliJ's Structure View.
🚀 Quick Start
Creating a StructureItem:
use StructureItem;
use UniversalElementRole;
let item = StructureItem ;
📋 Examples
Implementing a Structure Provider
use ;
use RedNode;
use MyLanguage;
;
🏗️ Integration
Oak Structure is a core component for:
- Oak LSP: Provides the data for document symbols and breadcrumbs.
- Oak Navigation: Often used as the entry point for navigating complex files.
- IDE Outline Views: Powers the sidebar navigation in various editors.
📊 Performance
- Efficient Tree Mapping: Optimized for converting deep ASTs into human-readable structure trees.
- Memory Efficient: Uses a flattened representation where possible to minimize allocations.
🤝 Contributing
Contributions are welcome! Please feel free to submit issues or pull requests.
Oak Structure - Visualizing the logical architecture of your code 🚀