Lutra/crates/engine/src/cmd/app.rs
danny 13c76d3046 M3.3: engine wiring for Phpactor and diagnostics
- One Phpactor per open project on its own session thread, started when
  the toolchain is ready; ordered document sync from buffer.edit and the
  pump; lspStatus, diagnosticsChanged, diagnostics.list, lsp.status,
  lsp.restart; app.quit stops the server synchronously.
- Phpactor 2026.06.25.0 on Windows: keep-alive $/lutra/tick (its event
  loop only runs on stdin input), in-process diagnostics and a polling
  watcher through initializationOptions (amphp subprocesses fail), 500 ms
  shutdown timeout.
- Editor lint extension (underlines, gutter dots, hover; tokens only) and
  a Problems tab in the bottom panel; problems.open Mod+Alt+P.
- Tests: engine tests against the fake server (incl. sync proptest), an
  ignored real-Phpactor test, a TCP test, Vitest for lint and Problems.
- Docs: architecture, gaps G6, parity (Inspections 4% est.), ui-parity,
  roadmap, ROADMAP.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 18:58:32 +02:00

55 lines
1.6 KiB
Rust

//! Application commands: `app.about` and `app.quit`.
use serde_json::{Value, json};
use crate::{Command, CommandSpec, Effect, EngineError, Outcome, State};
/// Product name shown in the About window and window titles.
pub const PRODUCT_NAME: &str = "Lutra";
/// Product slogan.
pub const SLOGAN: &str = "An otterly perfect IDE";
/// `app.about`: returns the product name, version and slogan.
pub struct About;
impl Command for About {
fn spec(&self) -> &CommandSpec {
&CommandSpec {
id: "app.about",
label: "About Lutra",
menu_path: Some("Help/About Lutra"),
default_shortcut: None,
params: "none; returns { name, version, slogan }",
}
}
fn run(&self, _state: &mut State, _params: Value) -> Result<Outcome, EngineError> {
Ok(Outcome::value(json!({
"name": PRODUCT_NAME,
"version": env!("CARGO_PKG_VERSION"),
"slogan": SLOGAN,
})))
}
}
/// `app.quit`: asks the host to quit the application.
pub struct Quit;
impl Command for Quit {
fn spec(&self) -> &CommandSpec {
&CommandSpec {
id: "app.quit",
label: "Quit",
menu_path: Some("File/Quit"),
default_shortcut: Some("Mod+Q"),
params: "none; returns null and the effect quit",
}
}
fn run(&self, state: &mut State, _params: Value) -> Result<Outcome, EngineError> {
crate::cmd::terminal::close_all(state);
crate::lsp::shutdown_now(state);
Ok(Outcome::effect(Effect::Quit))
}
}