H4: string and path settings controls, live completion and tooltip settings
- Settings dialog: every string setting gets a text field with in-place
hints (quotes or spaces around a path, control characters, length);
keys ending in path/executable also get "Browse…" through the dialog
plugin's native picker (new desktop IPC pick_file). git.executable
from M4.1 gets the control without UI changes.
- settings.open {section?, query?} for agents and live checks.
- New keys editor.completion.autoPopup, editor.completion.delayMs and
editor.hover.delayMs; the assist module reads them live through
CodeMirror compartments.
- Tests: engine settings test, control/engine key lists, Vitest for the
controls and the live wiring. Docs: architecture, ui-parity, parity
Settings row, gaps.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
b0f8550aeb
commit
197d5b7d27
19 changed files with 1149 additions and 41 deletions
|
|
@ -203,7 +203,10 @@ fn settings_changes_stream_and_persist() {
|
|||
"phpactor.autoDownload": true,
|
||||
"editor.autosave.onBlur": true,
|
||||
"editor.autosave.onTabSwitch": true,
|
||||
"editor.autosave.idleSeconds": 15
|
||||
"editor.autosave.idleSeconds": 15,
|
||||
"editor.completion.autoPopup": true,
|
||||
"editor.completion.delayMs": 0,
|
||||
"editor.hover.delayMs": 350
|
||||
}),
|
||||
"{r}"
|
||||
);
|
||||
|
|
|
|||
|
|
@ -248,6 +248,33 @@ pub const DEFS: &[Def] = &[
|
|||
description_key: "settings.editor.autosave.idleSeconds.description",
|
||||
section: "editor",
|
||||
},
|
||||
Def {
|
||||
key: "editor.completion.autoPopup",
|
||||
kind: Kind::Bool,
|
||||
default: DefaultValue::Bool(true),
|
||||
label_key: "settings.editor.completion.autoPopup.label",
|
||||
description_key: "settings.editor.completion.autoPopup.description",
|
||||
section: "editor",
|
||||
},
|
||||
Def {
|
||||
key: "editor.completion.delayMs",
|
||||
kind: Kind::Int { min: 0, max: 2000 },
|
||||
default: DefaultValue::Int(0),
|
||||
label_key: "settings.editor.completion.delayMs.label",
|
||||
description_key: "settings.editor.completion.delayMs.description",
|
||||
section: "editor",
|
||||
},
|
||||
Def {
|
||||
key: "editor.hover.delayMs",
|
||||
kind: Kind::Int {
|
||||
min: 100,
|
||||
max: 3000,
|
||||
},
|
||||
default: DefaultValue::Int(350),
|
||||
label_key: "settings.editor.hover.delayMs.label",
|
||||
description_key: "settings.editor.hover.delayMs.description",
|
||||
section: "editor",
|
||||
},
|
||||
];
|
||||
|
||||
/// Looks a known setting up by key.
|
||||
|
|
@ -631,6 +658,40 @@ mod tests {
|
|||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn assist_defaults_and_validation() {
|
||||
let mut s = Settings::in_memory();
|
||||
assert_eq!(s.get("editor.completion.autoPopup"), Some(json!(true)));
|
||||
assert_eq!(s.get("editor.completion.delayMs"), Some(json!(0)));
|
||||
assert_eq!(s.get("editor.hover.delayMs"), Some(json!(350)));
|
||||
assert_eq!(s.set("editor.completion.autoPopup", json!(false)), Ok(true));
|
||||
assert!(matches!(
|
||||
s.set("editor.completion.autoPopup", json!("false")),
|
||||
Err(SetError::Invalid(_))
|
||||
));
|
||||
for (key, min, max) in [
|
||||
("editor.completion.delayMs", 0, 2000),
|
||||
("editor.hover.delayMs", 100, 3000),
|
||||
] {
|
||||
assert!(s.set(key, json!(min)).is_ok(), "{key}");
|
||||
assert_eq!(s.get(key), Some(json!(min)));
|
||||
assert_eq!(s.set(key, json!(max)), Ok(true), "{key}");
|
||||
for bad in [json!(min - 1), json!(max + 1), json!(500.5), json!("500")] {
|
||||
assert!(
|
||||
matches!(s.set(key, bad), Err(SetError::Invalid(_))),
|
||||
"{key}"
|
||||
);
|
||||
}
|
||||
let info = serde_json::to_value(def(key).unwrap().info()).unwrap();
|
||||
assert_eq!(info["type"], json!("int"));
|
||||
assert_eq!(
|
||||
(info["min"].clone(), info["max"].clone()),
|
||||
(json!(min), json!(max))
|
||||
);
|
||||
assert_eq!(info["section"], json!("editor"));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn every_default_is_valid() {
|
||||
for d in DEFS {
|
||||
|
|
|
|||
|
|
@ -52,7 +52,10 @@ fn list_describes_the_c2_keys_with_catalog_keys_only() {
|
|||
"phpactor.autoDownload",
|
||||
"editor.autosave.onBlur",
|
||||
"editor.autosave.onTabSwitch",
|
||||
"editor.autosave.idleSeconds"
|
||||
"editor.autosave.idleSeconds",
|
||||
"editor.completion.autoPopup",
|
||||
"editor.completion.delayMs",
|
||||
"editor.hover.delayMs"
|
||||
]
|
||||
);
|
||||
for s in list.as_array().unwrap() {
|
||||
|
|
@ -118,7 +121,10 @@ fn get_set_reset_and_events() {
|
|||
"phpactor.autoDownload": true,
|
||||
"editor.autosave.onBlur": true,
|
||||
"editor.autosave.onTabSwitch": true,
|
||||
"editor.autosave.idleSeconds": 15
|
||||
"editor.autosave.idleSeconds": 15,
|
||||
"editor.completion.autoPopup": true,
|
||||
"editor.completion.delayMs": 0,
|
||||
"editor.hover.delayMs": 350
|
||||
})
|
||||
);
|
||||
let out = e
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue