pub struct CommandSpec {
pub id: CommandId,
pub name: String,
pub kind: CommandKind,
pub doc: String,
pub args_schema: Vec<ArgSpec>,
pub source: SourceLocation,
pub latency_class: LatencyClass,
}Expand description
Metadata + the actual implementation of a registered command. Stored in
the CommandRegistry.
Fields§
§id: CommandIdThe id the registry minted at registration; unique per process.
name: StringThe canonical, namespaced name (motion:word-forward,
operator:delete, ex:write, action:…). The key for
CommandRegistry::id_by_name;
user-typed aliases are resolved to it by the front-end.
kind: CommandKindWhich dispatcher path handles it.
doc: StringThe help text shown by :describe-command, :apropos and
completion.
args_schema: Vec<ArgSpec>Per-positional-argument metadata (DESIGN.md §B.1). Lifted from
the per-kind spec (MotionSpec.args_schema,
ExCommandSpec.args_schema, …) at registration time so callers
can introspect arg shape without knowing the registration kind.
Used by :describe-command, palette form rendering, and missing-
arg prompts.
source: SourceLocationWhere this command was registered (DESIGN.md §5.11). Captured
via #[track_caller] for built-ins, by the plugin host for
plugin-registered commands, by the config loader for
user-registered commands. The field is pub for read access
(introspection), but the only writers are the trusted
pub(crate) insert_* registry methods – there is no public
API that takes a SourceLocation parameter.
latency_class: LatencyClassLatency class declaration (DESIGN.md §5.2.5). Surfaced by
:describe-command; future cancellation / deadline
machinery reads this to set per-call budgets. v1 is purely
declarative – no runtime enforcement yet.
Trait Implementations§
Source§impl Clone for CommandSpec
impl Clone for CommandSpec
Source§fn clone(&self) -> CommandSpec
fn clone(&self) -> CommandSpec
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CommandSpec
impl Debug for CommandSpec
Source§impl Introspectable for CommandSpec
impl Introspectable for CommandSpec
Source§fn kind_label(&self) -> &'static str
fn kind_label(&self) -> &'static str
"command", "key",
"option", "event", "mode", "buffer".Source§fn identifier(&self) -> String
fn identifier(&self) -> String
"ex:write", "j",
"editor.line-numbers".Source§fn doc(&self) -> &str
fn doc(&self) -> &str
(no documentation) placeholder).