MCPcopy Create free account
hub / github.com/ChrisFeldmeier/OpenCodeRust / flatten_document_symbol

Function flatten_document_symbol

crates/opencode-lsp/src/lib.rs:777–802  ·  view source on GitHub ↗
(
    symbol: &lsp_types::DocumentSymbol,
)

Source from the content-addressed store, hash-verified

775
776#[allow(deprecated)]
777fn flatten_document_symbol(
778 symbol: &lsp_types::DocumentSymbol,
779) -> Vec<lsp_types::SymbolInformation> {
780 let mut result = vec![];
781
782 result.push(lsp_types::SymbolInformation {
783 name: symbol.name.clone(),
784 kind: symbol.kind,
785 tags: symbol.tags.clone(),
786 deprecated: symbol.deprecated,
787 location: lsp_types::Location {
788 uri: path_to_uri(&std::path::PathBuf::new())
789 .unwrap_or_else(|_| lsp_types::Uri::from_str("file:///").unwrap()),
790 range: symbol.selection_range,
791 },
792 container_name: symbol.detail.clone(),
793 });
794
795 if let Some(children) = &symbol.children {
796 for child in children {
797 result.extend(flatten_document_symbol(child));
798 }
799 }
800
801 result
802}
803
804pub struct LspClientRegistry {
805 clients: RwLock<HashMap<String, Arc<LspClient>>>,

Callers 1

document_symbolMethod · 0.85

Calls 3

path_to_uriFunction · 0.85
newFunction · 0.85
cloneMethod · 0.45

Tested by

no test coverage detected