Skip to main content

zoi_cli/cmd/package/
init_lsp.rs

1use anyhow::Result;
2use clap::Parser;
3use colored::Colorize;
4
5#[derive(Parser, Debug)]
6pub struct InitLspCommand {
7    /// Path where the LSP configuration should be initialized
8    #[arg(default_value = ".")]
9    pub path: std::path::PathBuf,
10}
11
12pub fn run(args: InitLspCommand) -> Result<()> {
13    println!(
14        "{} Initializing LSP support in {}...",
15        "::".bold().blue(),
16        args.path.display()
17    );
18
19    crate::pkg::package::init_lsp::setup_lsp_workspace(&args.path)?;
20
21    println!(
22        "{} LSP support initialized. Created .luarc.json and type definitions.",
23        "::".bold().green()
24    );
25    println!(
26        "{} Use 'lua-language-server' for rich autocomplete and documentation.",
27        "Note:".yellow()
28    );
29
30    Ok(())
31}