Generates a hierarchical document symbol tree for LSP code outline/navigation.
Processes declarations (functions, structs, enums, etc.) into nested symbols,
preserving parent-child relationships like functions with their variables,
structs with their fields, and traits with their methods.