mansion

Crates.iomansion
lib.rsmansion
version0.0.1
created_at2025-11-08 13:14:56.173791+00
updated_at2025-11-08 13:14:56.173791+00
descriptionCode analyzer
homepagehttps://raphamorim.io/boo
repositoryhttps://github.com/raphamorim/boo
max_upload_size
id1922850
size132,501
Raphael Amorim (raphamorim)

documentation

https://github.com/raphamorim/boo#readme

README

Mansion

A language-agnostic code analysis library that provides LSP-like functionality without the LSP protocol.

Overview

mansion allows you to analyze source code by providing it as a string and performing various operations similar to what Language Server Protocols (LSPs) do, such as:

  • Diagnostics: Parse code and find syntax errors
  • Symbol extraction: Find all functions, structs, types, etc. with full signatures
  • Symbol lookup: Find symbols at specific positions
  • Completions: Get completion suggestions
  • Formatting: Validate and format code

Rust Support:

  • Hover information
  • Type inference
  • Go to definition
  • Find references
  • Signature help

Supported Languages

  • Rust: Uses rust-analyzer's syntax parser (ra_ap_syntax) for robust parsing and analysis

Usage

use mansion::{mansion, Position};
use mansion::rust::Rustmansion;

fn main() {
    let mansion = Rustmansion::new();

    // Parse and check for errors
    let source = r#"
        fn main() {
            println!("Hello, world!");
        }
    "#;

    let diagnostics = mansion.diagnostics(source);
    if diagnostics.is_empty() {
        println!("No errors!");
    }

    // Find all symbols
    let symbols = mansion.symbols(source).unwrap();
    for symbol in symbols {
        println!("{:?}: {}", symbol.kind, symbol.name);
    }

    // Find symbol at a specific position
    let position = Position { line: 2, column: 12 };
    if let Some(symbol) = mansion.symbol_at_position(source, position).unwrap() {
        println!("Found: {}", symbol.name);
    }
}

Running Examples

cargo run --example basic

Running Tests

cargo test -p mansion
Commit count: 0

cargo fmt