Skip to content

VectorCraft: An open-source, vector art tool written by scratch in pure Rust

Keyboard Shortcuts: importMatches.list answers an unknown parameter key with an error

dotCooCoo8c889279f839
diff --git a/crates/engine/src/cmd/importmatches.rs b/crates/engine/src/cmd/importmatches.rs
index fcadf8cbb..d227b84ed 100644
--- a/crates/engine/src/cmd/importmatches.rs
+++ b/crates/engine/src/cmd/importmatches.rs
@@ -45,7 +45,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Import Matches",
[],
None,
- "{kind?: name|key|modifiers, query?: text in the name, target or label (any case)} the matches the user confirmed when importing other apps' files (shortcut sets), kept with the preferences → [{kind, name, target, label?}] (target \"\": no equivalent)",
+ "{kind?: name|key|modifiers, query?: text (in the name, target or label; any case)} the matches the user confirmed when importing other apps' files (shortcut sets), kept with the preferences → [{kind, name, target, label?}] (target \"\": no equivalent)",
always,
list
),
diff --git a/crates/engine/src/tests_shortcutset.rs b/crates/engine/src/tests_shortcutset.rs
index bc14cf864..6b9952c31 100644
--- a/crates/engine/src/tests_shortcutset.rs
+++ b/crates/engine/src/tests_shortcutset.rs
@@ -224,3 +224,17 @@ fn read_shows_what_earlier_imports_matched() {
let mods = json!([{"value": 0, "count": 1, "mods": ""}, {"value": 64, "count": 1, "mods": "Cmd"}, {"value": 80, "count": 1}]);
assert_eq!(r["codes"]["modifiers"], mods);
}
+
+#[test]
+fn the_commands_take_only_the_keys_they_describe() {
+ // The control channel, MCP and the CLI check params against the description (#1442).
+ for (id, every_key) in [
+ ("shortcutSet.read", json!({"path": "/x/a.kys", "data": "", "dataBase64": "", "name": "a.kys"})),
+ ("importMatches.list", json!({"kind": "name", "query": "undo"})),
+ ("importMatches.set", json!({"matches": []})),
+ ("importMatches.reset", json!({"kind": "key"})),
+ ] {
+ check_params(id, &every_key).unwrap();
+ assert!(check_params(id, &json!({"qeury": "undo"})).is_err(), "{id}");
+ }
+}