Update assistant to agent in settings and keymaps (#29943)

Closes #ISSUE

Release Notes:

- Agent Beta: Renamed the top-level `assistant` settings key to `agent`.
A migration for existing settings files is included.
- Agent Beta: Moved the `assistant::ToggleFocus`,
`assistant::ToggleModelSelector`, and `assistant::OpenRulesLibrary`
actions to the `agent` namespace. Existing keymaps that mention these
actions by their old names will continue to work.

---------

Co-authored-by: Max <max@zed.dev>
This commit is contained in:
Cole Miller 2025-05-05 21:02:56 -04:00 committed by GitHub
parent 34e10e4e56
commit bdd911f89e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 191 additions and 58 deletions

View file

@ -136,6 +136,10 @@ pub fn migrate_settings(text: &str) -> Result<Option<String>> {
migrations::m_2025_04_23::SETTINGS_PATTERNS,
&SETTINGS_QUERY_2025_04_23,
),
(
migrations::m_2025_05_05::SETTINGS_PATTERNS,
&SETTINGS_QUERY_2025_05_05,
),
];
run_migrations(text, migrations)
}
@ -222,6 +226,10 @@ define_query!(
SETTINGS_QUERY_2025_04_23,
migrations::m_2025_04_23::SETTINGS_PATTERNS
);
define_query!(
SETTINGS_QUERY_2025_05_05,
migrations::m_2025_05_05::SETTINGS_PATTERNS
);
// custom query
static EDIT_PREDICTION_SETTINGS_MIGRATION_QUERY: LazyLock<Query> = LazyLock::new(|| {
@ -581,7 +589,7 @@ mod tests {
Some(
r#"
{
"assistant": {
"agent": {
"profiles": {
"custom": {
"name": "Custom",
@ -619,7 +627,7 @@ mod tests {
Some(
r#"
{
"assistant": {
"agent": {
"profiles": {
"custom": {
"name": "Custom",
@ -655,7 +663,24 @@ mod tests {
}
}
"#,
None,
Some(
r#"
{
"agent": {
"profiles": {
"custom": {
"name": "Custom",
"tools": {
"diagnostics": true,
"find_path": true,
"read_file": true
}
}
}
}
}
"#,
),
)
}
@ -679,7 +704,7 @@ mod tests {
Some(
r#"
{
"assistant": {
"agent": {
"profiles": {
"default": {
"tools": {
@ -694,4 +719,28 @@ mod tests {
),
);
}
#[test]
fn test_rename_assistant() {
assert_migrate_settings(
r#"{
"assistant": {
"foo": "bar"
},
"edit_predictions": {
"enabled_in_assistant": false,
}
}"#,
Some(
r#"{
"agent": {
"foo": "bar"
},
"edit_predictions": {
"enabled_in_text_threads": false,
}
}"#,
),
);
}
}