use crate::utils::get_language_id_by_uri;
use crate::server::LspServer;

#[allow(unused)]
use log::info;

use tower_lsp::lsp_types::*;

pub mod feature;
mod sv;
mod vhdl;

impl LspServer {
    pub fn goto_definition(&self, params: GotoDefinitionParams) -> Option<GotoDefinitionResponse> {
        let language_id = get_language_id_by_uri(&params.text_document_position_params.text_document.uri);
        match language_id.as_str() {
            "vhdl" => vhdl::goto_vhdl_definition(
                self,
                &params
            ),

            "verilog" | "systemverilog" => sv::goto_definition(
                self,
                &params
            ),
            
            _ => None
        }
    }
}