oaks

Crates.iooaks
lib.rsoaks
version0.0.1
created_at2025-10-22 11:33:24.345566+00
updated_at2026-01-23 05:38:36.338802+00
descriptionUnified parser combinator library and IDE feature facade.
homepage
repository
max_upload_size
id1895515
size88,826
FuckQQ (fqq)

documentation

README

Oaks Ecosystem

Crates.io Documentation

A unified, language-agnostic framework for building modern IDE features, compilers, and language tools in Rust.

🎯 Overview

oaks is a high-level facade and orchestration layer for the entire Oak ecosystem. It provides a decoupled, trait-based architecture for building common editor features like hovers, folding, navigation, and semantic highlighting. Inspired by IntelliJ's PSI and the Language Server Protocol (LSP), Oaks makes it easy to add advanced IDE support to any programming language.

🏗️ Ecosystem Components

The Oak ecosystem consists of several specialized libraries:

  • oak-core: Foundational primitives, green/red trees, and incremental parsing.
  • oak-lsp: Lightweight LSP-compatible types and LanguageService traits.
  • oak-vfs: Virtual File System abstraction for memory and disk-based storage.
  • oak-highlight: Rule-based syntax highlighting engine.
  • oak-pretty-print: Advanced code formatting and document construction.
  • oak-hover: Documentation hovers and tooltips.
  • oak-folding: Code folding range provider.
  • oak-navigation: Go-to-definition and find-references support.
  • oak-structure: Hierarchical document outline and breadcrumbs.
  • oak-symbols: Workspace and document symbol indexing.
  • oak-semantic-tokens: Precise semantic syntax highlighting.
  • oak-semantic-search: Vector-based semantic code search.
  • oak-visualize: AST and graph visualization algorithms.
  • oak-mcp: Model Context Protocol (MCP) integration for AI agents.

🚀 Quick Start

To build a language service using Oaks:

use oaks::{MemoryVfs, LanguageServiceBuilder};
use oak_rust::RustService; // Example language implementation

#[tokio::main]
async fn main() {
    // 1. Initialize Virtual File System
    let vfs = MemoryVfs::new();
    vfs.write_file("file:///main.rs", "fn main() { }".to_string());

    // 2. Build the Language Service
    let service = LanguageServiceBuilder::new(Arc::new(vfs))
        .with_hover(MyHoverProvider::new())
        .with_folding(MyFoldingProvider::new())
        .build();

    // 3. Use the service
    let hover = service.hover("file:///main.rs", Position::new(0, 5)).await;
}

✨ Key Concepts

Language-Agnostic Design

Oaks is designed to be completely independent of any specific programming language. By implementing the Language trait from oak-core, you can plug any language into the Oaks ecosystem.

Virtual File System (VFS)

The Vfs trait provides a unified way to access source code, whether it's stored on disk, in memory, or provided by a remote client. This allows Oaks features to work consistently across different environments.

Decoupled Features

Each IDE feature (hover, folding, etc.) is defined as a separate trait. This allows you to implement features incrementally and mix-and-match them as needed.

🔧 Integration with LSP

Oaks provides first-class support for the Language Server Protocol. You can easily convert an Oaks LanguageService into a full-featured LSP server using oak-lsp.

use oak_lsp::LspServer;

let lsp_server = LspServer::new(my_oaks_service);
lsp_server.run().await?;

📊 Performance

  • Incremental Processing: Built-in support for incremental updates ensures low latency even for large projects.
  • Parallel Analysis: Designed for multi-threaded execution to leverage modern hardware.
  • Memory Efficient: Shared green trees and compact data structures minimize memory overhead.

🤝 Contributing

Contributions are welcome! Please feel free to submit issues or pull requests.


Oaks - Empowering the next generation of language tools 🚀

Commit count: 0

cargo fmt