pub fn index_symbols_with_fallback(
document: &Document,
ctags: &mut CtagsSymbolIndexer,
) -> CodeFileSummaryExpand description
Indexes with Tree-sitter-first Rust fallback when available.
With tree_sitter, Rust first uses its parser and returns immediately if at
least one symbol was found; parser failure or an empty result falls back to
ctags. Other languages, and all builds without that feature, use ctags
directly. Ctags errors are suppressed by its trait implementation.
ยงExamples
use ailloli_ui_editor::{index_symbols_with_fallback, CtagsSymbolIndexer, Document, DocumentId, EditorLanguage, SymbolSource};
use ailloli_ui_text::TextBuffer;
let document = Document::new(DocumentId(1), TextBuffer::from_string("function run() {}")) .with_language(EditorLanguage::JavaScript);
let mut ctags = CtagsSymbolIndexer::from_json_lines(r#"{"name":"run","kind":"function","line":1}"#);
assert_eq!(index_symbols_with_fallback(&document, &mut ctags).symbols[0].source, SymbolSource::Ctags);