feat(commandline): autocomplete suggestions + inventory-based registry
Type-as-you-go suggestion popup above the input that filters known command names by substring (so `LEADER` surfaces both LEADER and MLEADER). Up / Down navigates the list, Enter dispatches the highlighted entry, clicking a row dispatches directly. Esc on a non-empty input clears the buffer instead of escalating to command-cancel. The name corpus comes from `inventory::submit!` blocks placed next to each `CadCommand` impl rather than a hand-maintained static list. Adding a new interactive command means dropping one `inventory::submit!` line in its own module file — the autocomplete picks it up at the next compile. 98 submissions seeded across 60 module files; `command::all_registered_command_names()` flattens them at runtime. One-shot dispatch arms in `app/commands.rs` (NEW, OPEN, SAVE, UNDO, …) don't have a `CadCommand` impl and are therefore absent from autocomplete by design. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
4124cb2689
commit
05ea31aa2a
67 changed files with 507 additions and 2 deletions
|
|
@ -58,3 +58,7 @@ impl CadCommand for PasteCommand {
|
|||
self.wires.iter().map(|w| w.translated(delta)).collect()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ── Autocomplete registry ─────────────────────────────────
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["PASTECLIP", "PC"] }); // PasteCommand
|
||||
|
|
|
|||
|
|
@ -1102,3 +1102,16 @@ impl CadCommand for ArcCSLCommand {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ── Autocomplete registry ─────────────────────────────────
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["ARC_3P"] }); // Arc3PCommand
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["ARC_CSA"] }); // ArcCSACommand
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["ARC_CSL"] }); // ArcCSLCommand
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["A", "ARC"] }); // ArcCommand
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["ARC_SCA"] }); // ArcSCACommand
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["ARC_SCE"] }); // ArcSCECommand
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["ARC_SCL"] }); // ArcSCLCommand
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["ARC_SEA"] }); // ArcSEACommand
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["ARC_SED"] }); // ArcSEDCommand
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["ARC_SER"] }); // ArcSERCommand
|
||||
|
|
|
|||
|
|
@ -184,3 +184,7 @@ impl CadCommand for AttdefCommand {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ── Autocomplete registry ─────────────────────────────────
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["ATTDEF"] }); // AttdefCommand
|
||||
|
|
|
|||
|
|
@ -910,3 +910,12 @@ impl CadCommand for CircleTTTCommand {
|
|||
None
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ── Autocomplete registry ─────────────────────────────────
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["CIRCLE_2P"] }); // Circle2PCommand
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["CIRCLE_3P"] }); // Circle3PCommand
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["CIRCLE_CD"] }); // CircleCDCommand
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["C", "CIRCLE"] }); // CircleCommand
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["CIRCLE_TTR"] }); // CircleTTRCommand
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["CIRCLE_TTT"] }); // CircleTTTCommand
|
||||
|
|
|
|||
|
|
@ -132,3 +132,7 @@ fn make_donut(cx: f64, cy: f64, inner_r: f64, outer_r: f64) -> EntityType {
|
|||
p.vertices = vec![v0, v1];
|
||||
EntityType::LwPolyline(p)
|
||||
}
|
||||
|
||||
|
||||
// ── Autocomplete registry ─────────────────────────────────
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["DO", "DONUT"] }); // DonutCommand
|
||||
|
|
|
|||
|
|
@ -532,3 +532,9 @@ fn line_wire(from: Vec3, to: Vec3) -> WireModel {
|
|||
fill_tris: vec![],
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ── Autocomplete registry ─────────────────────────────────
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["ELLIPSE_ARC"] }); // EllipseArcCommand
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["ELLIPSE_AXIS"] }); // EllipseAxisCommand
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["EL", "ELLIPSE"] }); // EllipseCommand
|
||||
|
|
|
|||
|
|
@ -423,3 +423,9 @@ impl CadCommand for BoundaryCommand {
|
|||
CmdResult::Cancel
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ── Autocomplete registry ─────────────────────────────────
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["BOUNDARY"] }); // BoundaryCommand
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["GRADIENT"] }); // GradientCommand
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["H", "HATCH"] }); // HatchCommand
|
||||
|
|
|
|||
|
|
@ -161,3 +161,7 @@ impl CadCommand for HatcheditCommand {
|
|||
CmdResult::Cancel
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ── Autocomplete registry ─────────────────────────────────
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["HATCHEDIT", "HE"] }); // HatcheditCommand
|
||||
|
|
|
|||
|
|
@ -94,3 +94,7 @@ impl CadCommand for LineCommand {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ── Autocomplete registry ─────────────────────────────────
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["L", "LINE"] }); // LineCommand
|
||||
|
|
|
|||
|
|
@ -157,3 +157,7 @@ fn build_mline(pts: &[Vec3], scale: f64, closed: bool, style_name: &str) -> Enti
|
|||
mline.style_name = style_name.to_string();
|
||||
EntityType::MLine(mline)
|
||||
}
|
||||
|
||||
|
||||
// ── Autocomplete registry ─────────────────────────────────
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["ML", "MLINE"] }); // MlineCommand
|
||||
|
|
|
|||
|
|
@ -55,3 +55,7 @@ impl CadCommand for PointCommand {
|
|||
None
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ── Autocomplete registry ─────────────────────────────────
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["PO", "POINT"] }); // PointCommand
|
||||
|
|
|
|||
|
|
@ -321,3 +321,7 @@ impl CadCommand for PlineCommand {
|
|||
))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ── Autocomplete registry ─────────────────────────────────
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["PL", "PLINE"] }); // PlineCommand
|
||||
|
|
|
|||
|
|
@ -173,3 +173,8 @@ impl CadCommand for XLineCommand {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ── Autocomplete registry ─────────────────────────────────
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["RAY"] }); // RayCommand
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["CONSTRUCTIONLINE", "XL", "XLINE"] }); // XLineCommand
|
||||
|
|
|
|||
|
|
@ -133,3 +133,7 @@ fn make_revcloud(pts: &[Vec3], arc_len: f64) -> EntityType {
|
|||
p.vertices = vertices;
|
||||
EntityType::LwPolyline(p)
|
||||
}
|
||||
|
||||
|
||||
// ── Autocomplete registry ─────────────────────────────────
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["REVCLOUD"] }); // RevCloudCommand
|
||||
|
|
|
|||
|
|
@ -633,3 +633,12 @@ fn edge_poly_params(a: Vec3, b: Vec3, sides: u32) -> Option<(Vec3, f32, f32)> {
|
|||
let sa = angle_xy(center, a);
|
||||
Some((center, vr, sa))
|
||||
}
|
||||
|
||||
|
||||
// ── Autocomplete registry ─────────────────────────────────
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["POLY_C"] }); // PolyCCommand
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["POL", "POLY", "POLYGON"] }); // PolyCommand
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["POLY_E"] }); // PolyECommand
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["RECT_CEN"] }); // RectCenCommand
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["REC", "RECT", "RECTANG"] }); // RectCommand
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["RECT_ROT"] }); // RectRotCommand
|
||||
|
|
|
|||
|
|
@ -118,3 +118,7 @@ impl CadCommand for SplineCommand {
|
|||
))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ── Autocomplete registry ─────────────────────────────────
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["SPL", "SPLINE"] }); // SplineCommand
|
||||
|
|
|
|||
|
|
@ -59,3 +59,7 @@ impl CadCommand for UngroupCommand {
|
|||
vec![]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ── Autocomplete registry ─────────────────────────────────
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["UG", "UNGROUP"] }); // UngroupCommand
|
||||
|
|
|
|||
|
|
@ -82,3 +82,7 @@ impl CadCommand for AreaCommand {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ── Autocomplete registry ─────────────────────────────────
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["AREA"] }); // AreaCommand
|
||||
|
|
|
|||
|
|
@ -77,3 +77,7 @@ impl CadCommand for DistCommand {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ── Autocomplete registry ─────────────────────────────────
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["DI", "DIST"] }); // DistCommand
|
||||
|
|
|
|||
|
|
@ -295,3 +295,8 @@ fn arc_span_rad(start: f64, end: f64) -> f64 {
|
|||
span
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ── Autocomplete registry ─────────────────────────────────
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["DIV", "DIVIDE"] }); // DivideCommand
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["ME", "MEASURE"] }); // MeasureCommand
|
||||
|
|
|
|||
|
|
@ -34,3 +34,7 @@ impl CadCommand for IdCommand {
|
|||
CmdResult::Cancel
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ── Autocomplete registry ─────────────────────────────────
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["ID"] }); // IdCommand
|
||||
|
|
|
|||
|
|
@ -79,3 +79,7 @@ impl CadCommand for LayMatchCommand {
|
|||
vec![]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ── Autocomplete registry ─────────────────────────────────
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["LAYMATCH", "LAYMCH"] }); // LayMatchCommand
|
||||
|
|
|
|||
|
|
@ -189,3 +189,7 @@ impl AlignCommand {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ── Autocomplete registry ─────────────────────────────────
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["AL", "ALIGN"] }); // AlignCommand
|
||||
|
|
|
|||
|
|
@ -467,3 +467,8 @@ impl CadCommand for BreakAtPointCommand {
|
|||
CmdResult::Cancel
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ── Autocomplete registry ─────────────────────────────────
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["BAP", "BREAKATPOINT"] }); // BreakAtPointCommand
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["BR", "BREAK"] }); // BreakInteractiveCommand
|
||||
|
|
|
|||
|
|
@ -1706,3 +1706,8 @@ impl CadCommand for ChamferCommand {
|
|||
CmdResult::Cancel
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ── Autocomplete registry ─────────────────────────────────
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["CHA", "CHAMFER"] }); // ChamferCommand
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["F", "FILLET"] }); // FilletCommand
|
||||
|
|
|
|||
|
|
@ -237,3 +237,7 @@ fn try_join_arcs(arcs: &[&(Handle, &EntityType)]) -> Option<(Vec<Handle>, Vec<En
|
|||
fn vec3_xz_to_v3(v: Vec3, z: f64) -> Vector3 {
|
||||
Vector3::new(v.x as f64, v.y as f64, z)
|
||||
}
|
||||
|
||||
|
||||
// ── Autocomplete registry ─────────────────────────────────
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["J", "JOIN"] }); // JoinCommand
|
||||
|
|
|
|||
|
|
@ -500,3 +500,7 @@ fn lengthen_spline(spl: &SplineEnt, pick_pt: Vec3, mode: &LenMode) -> Option<Ent
|
|||
Some(EntityType::Spline(bspline_to_spline(&right, spl)))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ── Autocomplete registry ─────────────────────────────────
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["LEN", "LENGTHEN"] }); // LengthenCommand
|
||||
|
|
|
|||
|
|
@ -714,3 +714,7 @@ impl CadCommand for OffsetCommand {
|
|||
CmdResult::Cancel
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ── Autocomplete registry ─────────────────────────────────
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["O", "OFFSET"] }); // OffsetCommand
|
||||
|
|
|
|||
|
|
@ -138,3 +138,7 @@ pub fn apply_pedit(entity: &mut EntityType, op: &PeditOp) -> bool {
|
|||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ── Autocomplete registry ─────────────────────────────────
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["PE", "PEDIT"] }); // PeditCommand
|
||||
|
|
|
|||
|
|
@ -206,3 +206,8 @@ pub fn apply_insert_inverse_transform(entity: &mut EntityType, session: &RefEdit
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ── Autocomplete registry ─────────────────────────────────
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["REFCLOSE"] }); // RefCloseCommand
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["REFEDIT"] }); // RefEditPickCommand
|
||||
|
|
|
|||
|
|
@ -200,3 +200,7 @@ pub fn apply_spline_op(doc: &mut acadrust::CadDocument, handle: acadrust::Handle
|
|||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ── Autocomplete registry ─────────────────────────────────
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["SPE", "SPLINEDIT"] }); // SplineditCommand
|
||||
|
|
|
|||
|
|
@ -2457,3 +2457,8 @@ impl CadCommand for ExtendCommand {
|
|||
CmdResult::Cancel
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ── Autocomplete registry ─────────────────────────────────
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["EX", "EXTEND"] }); // ExtendCommand
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["TR", "TRIM"] }); // TrimCommand
|
||||
|
|
|
|||
|
|
@ -89,3 +89,7 @@ impl CadCommand for MatchPropCommand {
|
|||
vec![]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ── Autocomplete registry ─────────────────────────────────
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["MA", "MATCHPROP"] }); // MatchPropCommand
|
||||
|
|
|
|||
|
|
@ -60,3 +60,7 @@ impl CadCommand for SelectObjectsCommand {
|
|||
vec![]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ── Autocomplete registry ─────────────────────────────────
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["AR", "ARRAY", "ARRAYPATH", "ARRAYPOLAR", "ARRAYRECT", "BLOCK", "CC", "CO", "COPY", "COPYCLIP", "CUTCLIP", "CX", "E", "ERASE", "EXPLODE", "G", "GROUP", "LAYFRZ", "LAYLCK", "LAYMCUR", "LAYOFF", "LAYULK", "M", "MI", "MIRROR", "MOVE", "RO", "ROTATE", "SC", "SCALE", "SS", "STRETCH", "X"] }); // SelectObjectsCommand
|
||||
|
|
|
|||
Loading…
Reference in a new issue