PM: merge H4 string and path settings controls, live assist settings
Some checks are pending
ci / ci (macos-15) (push) Waiting to run
ci / ci (ubuntu-24.04) (push) Waiting to run
ci / ci (windows-2025) (push) Waiting to run

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
danny 2026-10-25 13:20:26 +01:00
commit e969f6497c
19 changed files with 1149 additions and 41 deletions

View file

@ -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}"
);

View file

@ -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 {

View file

@ -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