Lutra/crates/engine/src/cmd/mod.rs
danny 02922eb89d A1: layout.get/layout.set keep the editor tab layout per project; editor.tabs.preview setting
The tab layout of the open project lives in <data_dir>/layout/<project-id>.json
(written atomically, 256 KiB cap both ways, a broken file reads as null),
never in webview storage. New bool setting editor.tabs.preview (default on).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:22:42 +01:00

129 lines
4.1 KiB
Rust

//! Built-in commands, one module per area.
mod app;
mod buffer;
pub mod deploy;
mod deploy_remote;
mod file;
pub mod git;
pub mod git_blame;
pub mod git_chunks;
pub mod git_ignore;
pub mod git_lines;
pub mod git_log;
pub mod git_merge;
pub mod git_remote;
pub mod git_stash;
pub mod goto;
mod layout;
mod lsp_assist;
mod lsp_diagnostics;
mod lsp_nav;
mod params;
mod project;
mod recovery;
pub mod search;
mod settings;
pub mod syntax;
pub mod terminal;
pub mod theme;
pub mod toolchain;
pub mod ui;
use crate::{EngineError, Registry};
/// Registers every built-in command.
///
/// # Errors
/// Returns [`EngineError::Internal`] if two commands share an id.
pub fn register_builtins(registry: &mut Registry) -> Result<(), EngineError> {
registry.register(Box::new(app::About))?;
registry.register(Box::new(app::Quit))?;
registry.register(Box::new(project::Open))?;
registry.register(Box::new(project::OpenDialog))?;
registry.register(Box::new(project::Close))?;
registry.register(Box::new(project::Children))?;
registry.register(Box::new(file::Open))?;
registry.register(Box::new(file::Save))?;
registry.register(Box::new(file::SaveAll))?;
registry.register(Box::new(buffer::Get))?;
registry.register(Box::new(buffer::Edit))?;
registry.register(Box::new(buffer::Close))?;
registry.register(Box::new(recovery::List))?;
registry.register(Box::new(recovery::Restore))?;
registry.register(Box::new(recovery::Discard))?;
registry.register(Box::new(settings::List))?;
registry.register(Box::new(settings::Get))?;
registry.register(Box::new(settings::Set))?;
registry.register(Box::new(settings::Reset))?;
registry.register(Box::new(theme::List))?;
registry.register(Box::new(theme::Current))?;
registry.register(Box::new(theme::Select))?;
registry.register(Box::new(theme::Import))?;
registry.register(Box::new(theme::SystemPreference))?;
registry.register(Box::new(ui::RegisterCommands))?;
registry.register(Box::new(search::Find))?;
registry.register(Box::new(search::Cancel))?;
registry.register(Box::new(goto::Status))?;
registry.register(Box::new(goto::File))?;
registry.register(Box::new(goto::Class))?;
registry.register(Box::new(goto::Symbol))?;
registry.register(Box::new(syntax::OutlineCommand))?;
registry.register(Box::new(toolchain::Status))?;
registry.register(Box::new(toolchain::DownloadPhpactor))?;
registry.register(Box::new(buffer::List))?;
registry.register(Box::new(terminal::Create))?;
registry.register(Box::new(terminal::Input))?;
registry.register(Box::new(terminal::Resize))?;
registry.register(Box::new(terminal::Close))?;
lsp_diagnostics::register(registry)?;
lsp_assist::register(registry)?;
lsp_nav::register(registry)?;
git::register(registry)?;
git_lines::register(registry)?;
git_blame::register(registry)?;
git_log::register(registry)?;
git_remote::register(registry)?;
git_merge::register(registry)?;
git_stash::register(registry)?;
git_chunks::register(registry)?;
git_ignore::register(registry)?;
deploy::register(registry)?;
layout::register(registry)?;
Ok(())
}
/// The id lists of every module that registers built-in commands, one entry
/// per module. Each module keeps its own list next to its commands, so new
/// commands in different modules never touch the same lines.
#[cfg(test)]
pub(crate) const BUILTIN_COMMAND_IDS: &[&[&str]] = &[
app::COMMAND_IDS,
buffer::COMMAND_IDS,
deploy::COMMAND_IDS,
deploy_remote::COMMAND_IDS,
file::COMMAND_IDS,
git::COMMAND_IDS,
git_blame::COMMAND_IDS,
git_chunks::COMMAND_IDS,
git_ignore::COMMAND_IDS,
git_lines::COMMAND_IDS,
git_log::COMMAND_IDS,
git_merge::COMMAND_IDS,
git_remote::COMMAND_IDS,
git_stash::COMMAND_IDS,
goto::COMMAND_IDS,
layout::COMMAND_IDS,
lsp_assist::COMMAND_IDS,
lsp_diagnostics::COMMAND_IDS,
lsp_nav::COMMAND_IDS,
project::COMMAND_IDS,
recovery::COMMAND_IDS,
search::COMMAND_IDS,
settings::COMMAND_IDS,
syntax::COMMAND_IDS,
terminal::COMMAND_IDS,
theme::COMMAND_IDS,
toolchain::COMMAND_IDS,
ui::COMMAND_IDS,
];