zeph_commands/handlers/
lsp.rs1use std::future::Future;
7use std::pin::Pin;
8
9use crate::context::CommandContext;
10use crate::{CommandError, CommandHandler, CommandOutput, SlashCategory};
11
12pub struct LspCommand;
14
15impl CommandHandler<CommandContext<'_>> for LspCommand {
16 fn name(&self) -> &'static str {
17 "/lsp"
18 }
19
20 fn description(&self) -> &'static str {
21 "Show LSP context status"
22 }
23
24 fn category(&self) -> SlashCategory {
25 SlashCategory::Debugging
26 }
27
28 fn feature_gate(&self) -> Option<&'static str> {
29 Some("lsp-context")
30 }
31
32 fn handle<'a>(
33 &'a self,
34 ctx: &'a mut CommandContext<'_>,
35 _args: &'a str,
36 ) -> Pin<Box<dyn Future<Output = Result<CommandOutput, CommandError>> + Send + 'a>> {
37 Box::pin(async move {
38 let result = ctx.agent.lsp_status().await?;
39 if result.is_empty() {
40 Ok(CommandOutput::Silent)
41 } else {
42 Ok(CommandOutput::Message(result))
43 }
44 })
45 }
46}