use serde_json::Value;
use tower_lsp::lsp_types::*;

use crate::server::Backend;
mod diagnostics;

pub async fn execute_command(
    backend: &Backend,
    params: ExecuteCommandParams
) -> tower_lsp::jsonrpc::Result<Option<Value>> {
    match params.command.as_str() {
        "publish-diagnostics" => {
            diagnostics::publish_diagnostics(backend, params.arguments).await
        }

        "clear-diagnostics" => {
            diagnostics::clear_diagnostics(backend, params.arguments).await
        }

        _ => {
            Ok(None)
        }
    }
}

