use crate::{server::LspServer, utils::get_language_id_by_uri};
use tower_lsp::lsp_types::*;

pub mod keyword;
pub mod feature;
pub mod sys_tasks;
pub mod directives;

pub use sys_tasks::provide_vlog_sys_tasks_completions;

mod vhdl;
mod sv;

impl LspServer {
    pub fn completion(&self, params: CompletionParams) -> Option<CompletionResponse> {        
        let language_id = get_language_id_by_uri(&params.text_document_position.text_document.uri);
        match language_id.as_str() {
            "vhdl" => vhdl::completion(
                self,
                &params
            ),

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