pub fn merge_code_file_summaries(
document_id: DocumentId,
path: Option<PathBuf>,
language: EditorLanguage,
version: DocumentVersion,
summaries: &[CodeFileSummary],
) -> CodeFileSummaryExpand description
Merges symbol and edge payloads under caller-supplied document metadata.
Symbols deduplicate by name, kind, and selection range. For duplicates the strongest source wins: Tree-sitter, LSP, SCIP, ctags, then lexical. Results sort by selection start/source/name and receive fresh positional one-based IDs. Edges from all summaries sort by kind/from/to and deduplicate exactly; their IDs are not remapped to the newly assigned symbol IDs.
ยงExamples
use ailloli_ui_editor::{code::merge_code_file_summaries, CodeFileSummary, CodeSymbol, DocumentId, DocumentVersion, EditorLanguage, SymbolId, SymbolKind, SymbolSource};
fn summary(source: SymbolSource) -> CodeFileSummary {
CodeFileSummary { document_id: DocumentId(1), path: None, language: EditorLanguage::Rust, version: DocumentVersion(0), symbols: vec![CodeSymbol { id: SymbolId(99), name: "f".into(), kind: SymbolKind::Function, language: EditorLanguage::Rust, range: 0..1, selection_range: 0..1, parent: None, signature: None, docs: None, source }], edges: vec![] }
}
let merged = merge_code_file_summaries(DocumentId(7), None, EditorLanguage::Rust, DocumentVersion(3), &[summary(SymbolSource::Lexical), summary(SymbolSource::Lsp)]);
assert_eq!(merged.symbols.len(), 1);
assert_eq!((merged.symbols[0].id, merged.symbols[0].source), (SymbolId(1), SymbolSource::Lsp));