You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: handlers.rs
    path of file: ./repos/mun/crates/mun_language_server/src
    
    the code of the file until where you have to start completion: use lsp_types::{CompletionContext, CompletionItem, DocumentSymbol};
use mun_syntax::{AstNode, TextSize};

use crate::{from_lsp, state::LanguageServerSnapshot, to_lsp, FilePosition};

/// Computes the document symbols for a specific document. Converts the LSP
/// types to internal formats and calls
/// [`LanguageServerSnapshot::file_structure`] to fetch the symbols in the
/// requested document. Once completed, returns the result converted back to LSP
/// types.
pub(crate) fn handle_document_symbol(
    snapshot: LanguageServerSnapshot,
    params: lsp_types::DocumentSymbolParams,
) -> anyhow::Result<Option<lsp_types::DocumentSymbolResponse>> {
    let file_id = from_lsp::file_id(&snapshot, &params.text_document.uri)?;
    let line_index = snapshot.analysis.file_line_index(file_id)
    
    fn test_build_hierarchy_from_flat_list() {
        #[allow(deprecated)]
        let default_symbol = DocumentSymbol {
            name: "".to_string(),
            detail: None,
            kind: SymbolKind::FILE,
            tags: None,
            deprecated: None,
            range: Range::default(),
            selection_range: Range::default(),
            children: None,
        };

        let list = vec![
            (
                DocumentSymbol {
                    name: "a".to_string(),
                    ..default_symbol.clone()
                },
                None,
            ),
            (
                DocumentSymbol {
                    name: "b".to_string(),
                    ..default_symbol.clone()
                },
                Some(0),
            ),
            (
                DocumentSymbol {
                    name: "c".to_string(),
                    ..default_symbol.clone()
                },
                Some(0),
            ),
            (
                DocumentSymbol {
                    name: "d".to_string(),
                    ..default_symbol.clone()
                },
                Some(1),
            ),
        ];

        assert_eq!(
            build_hierarchy_from_flat_list(list),
            vec![DocumentSymbol {
                name: "a".to_string(),
                children: Some(vec![
                    DocumentSymbol {
                        name: "b".to_string(),
                        children: Some(vec![DocumentSymbol {
                            name: "d".to_string(),
                            ..default_symbol.clone()
                        }]),
                        ..default_symbol.clone()
                    },
                    DocumentSymbol {
                        name: "c".to_string(),
                        ..default_symbol.clone()
                    }
                ]),
                ..default_symbol
            }]
        );
    }