use tower_lsp::lsp_types::*;

use crate::{server::LspServer, utils::get_language_id_by_uri};

mod sv;
mod vhdl;

impl LspServer {
    pub fn document_symbol(&self, params: DocumentSymbolParams) -> Option<DocumentSymbolResponse> {
        let uri = &params.text_document.uri;
        let language_id = get_language_id_by_uri(uri);
        match language_id.as_str() {
            "vhdl" => vhdl::document_symbol(
                self,
                &params
            ),
            "verilog" | "systemverilog" => sv::document_symbol(
                self,
                &params
            ),
            _ => None
        }
    }
}
