const fs = require('fs');
const path = require('path');

/**
 * Rust LSP adapter — rust-analyzer.
 *
 * Installed through rustup as a toolchain component. System-mode only.
 */
class RustAdapter {
  constructor(cwd = process.cwd()) { this.cwd = cwd; }

  get name() { return 'rust'; }
  get label() { return 'Rust (rust-analyzer)'; }
  get binary() { return 'rust-analyzer'; }
  get installMode() { return 'system'; }

  installCommand() { return 'rustup component add rust-analyzer'; }
  verifyCommand() { return 'rust-analyzer --version'; }
  claudePluginId() { return 'rust-analyzer-lsp@claude-plugins-official'; }

  static detect(cwd = process.cwd()) {
    return fs.existsSync(path.join(cwd, 'Cargo.toml'));
  }
}

module.exports = RustAdapter;
