Trait SymbolIndexer

Source
pub trait SymbolIndexer {
    // Required method
    fn index_document(&mut self, document: &Document) -> CodeFileSummary;
}
Expand description

Synchronous interface for indexing one document into a complete summary.

Implementations decide error handling; built-in ctags’ trait implementation is intentionally infallible and returns an empty summary on runner failures.

§Examples

use ailloli_ui_editor::{Document, DocumentId, EditorLanguage, LexicalRustSymbolIndexer, SymbolIndexer};
use ailloli_ui_text::TextBuffer;
let document = Document::new(DocumentId(1), TextBuffer::from_string("fn run() {}")) .with_language(EditorLanguage::Rust);
assert_eq!(LexicalRustSymbolIndexer.index_document(&document).symbols[0].name, "run");

Required Methods§

Source

fn index_document(&mut self, document: &Document) -> CodeFileSummary

Indexes the document snapshot synchronously.

§Examples
use ailloli_ui_editor::{Document, DocumentId, EditorLanguage, LexicalRustSymbolIndexer, SymbolIndexer};
use ailloli_ui_text::TextBuffer;
let document = Document::new(DocumentId(1), TextBuffer::from_string("struct App;")) .with_language(EditorLanguage::Rust);
let summary = LexicalRustSymbolIndexer.index_document(&document);
assert_eq!(summary.symbols.len(), 1);

Implementors§

Source§

impl SymbolIndexer for CtagsSymbolIndexer

Produces an empty metadata-preserving summary on any ctags runner error.

Source§

impl SymbolIndexer for LexicalRustSymbolIndexer

Delegates to the lexical Rust summarizer.

Source§

impl SymbolIndexer for TreeSitterRustSymbolIndexer

Parses Rust and returns a deterministic local symbol graph.