agent: Add Burn Mode setting migrator (#31718)
Follow-up https://github.com/zed-industries/zed/pull/31470. Release Notes: - N/A
This commit is contained in:
parent
5462e199fb
commit
9cf6be2057
3 changed files with 126 additions and 0 deletions
|
@ -144,6 +144,10 @@ pub fn migrate_settings(text: &str) -> Result<Option<String>> {
|
|||
migrations::m_2025_05_08::SETTINGS_PATTERNS,
|
||||
&SETTINGS_QUERY_2025_05_08,
|
||||
),
|
||||
(
|
||||
migrations::m_2025_05_29::SETTINGS_PATTERNS,
|
||||
&SETTINGS_QUERY_2025_05_29,
|
||||
),
|
||||
];
|
||||
run_migrations(text, migrations)
|
||||
}
|
||||
|
@ -238,6 +242,10 @@ define_query!(
|
|||
SETTINGS_QUERY_2025_05_08,
|
||||
migrations::m_2025_05_08::SETTINGS_PATTERNS
|
||||
);
|
||||
define_query!(
|
||||
SETTINGS_QUERY_2025_05_29,
|
||||
migrations::m_2025_05_29::SETTINGS_PATTERNS
|
||||
);
|
||||
|
||||
// custom query
|
||||
static EDIT_PREDICTION_SETTINGS_MIGRATION_QUERY: LazyLock<Query> = LazyLock::new(|| {
|
||||
|
@ -785,4 +793,65 @@ mod tests {
|
|||
),
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_preferred_completion_mode_migration() {
|
||||
assert_migrate_settings(
|
||||
r#"{
|
||||
"agent": {
|
||||
"preferred_completion_mode": "max",
|
||||
"enabled": true
|
||||
}
|
||||
}"#,
|
||||
Some(
|
||||
r#"{
|
||||
"agent": {
|
||||
"preferred_completion_mode": "burn",
|
||||
"enabled": true
|
||||
}
|
||||
}"#,
|
||||
),
|
||||
);
|
||||
|
||||
assert_migrate_settings(
|
||||
r#"{
|
||||
"agent": {
|
||||
"preferred_completion_mode": "normal",
|
||||
"enabled": true
|
||||
}
|
||||
}"#,
|
||||
None,
|
||||
);
|
||||
|
||||
assert_migrate_settings(
|
||||
r#"{
|
||||
"agent": {
|
||||
"preferred_completion_mode": "burn",
|
||||
"enabled": true
|
||||
}
|
||||
}"#,
|
||||
None,
|
||||
);
|
||||
|
||||
assert_migrate_settings(
|
||||
r#"{
|
||||
"other_section": {
|
||||
"preferred_completion_mode": "max"
|
||||
},
|
||||
"agent": {
|
||||
"preferred_completion_mode": "max"
|
||||
}
|
||||
}"#,
|
||||
Some(
|
||||
r#"{
|
||||
"other_section": {
|
||||
"preferred_completion_mode": "max"
|
||||
},
|
||||
"agent": {
|
||||
"preferred_completion_mode": "burn"
|
||||
}
|
||||
}"#,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue