Revert "settings: Remove version
field migration" (#33729)
- Reverts zed-industries/zed#33711 I think we should just make this a breaking change with v0.194.x. Forwards compatibility is hard, we should build abstractions that make this easier (next time). See also: - https://github.com/zed-industries/zed/pull/33372 Release Notes: - N/A
This commit is contained in:
parent
8d894dd1df
commit
6b06685723
3 changed files with 218 additions and 0 deletions
|
@ -152,6 +152,10 @@ pub fn migrate_settings(text: &str) -> Result<Option<String>> {
|
|||
migrations::m_2025_06_16::SETTINGS_PATTERNS,
|
||||
&SETTINGS_QUERY_2025_06_16,
|
||||
),
|
||||
(
|
||||
migrations::m_2025_06_25::SETTINGS_PATTERNS,
|
||||
&SETTINGS_QUERY_2025_06_25,
|
||||
),
|
||||
(
|
||||
migrations::m_2025_06_27::SETTINGS_PATTERNS,
|
||||
&SETTINGS_QUERY_2025_06_27,
|
||||
|
@ -258,6 +262,10 @@ define_query!(
|
|||
SETTINGS_QUERY_2025_06_16,
|
||||
migrations::m_2025_06_16::SETTINGS_PATTERNS
|
||||
);
|
||||
define_query!(
|
||||
SETTINGS_QUERY_2025_06_25,
|
||||
migrations::m_2025_06_25::SETTINGS_PATTERNS
|
||||
);
|
||||
define_query!(
|
||||
SETTINGS_QUERY_2025_06_27,
|
||||
migrations::m_2025_06_27::SETTINGS_PATTERNS
|
||||
|
@ -1081,6 +1089,77 @@ mod tests {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_remove_version_fields() {
|
||||
assert_migrate_settings(
|
||||
r#"{
|
||||
"language_models": {
|
||||
"anthropic": {
|
||||
"version": "1",
|
||||
"api_url": "https://api.anthropic.com"
|
||||
},
|
||||
"openai": {
|
||||
"version": "1",
|
||||
"api_url": "https://api.openai.com/v1"
|
||||
}
|
||||
},
|
||||
"agent": {
|
||||
"version": "2",
|
||||
"enabled": true,
|
||||
"preferred_completion_mode": "normal",
|
||||
"button": true,
|
||||
"dock": "right",
|
||||
"default_width": 640,
|
||||
"default_height": 320,
|
||||
"default_model": {
|
||||
"provider": "zed.dev",
|
||||
"model": "claude-sonnet-4"
|
||||
}
|
||||
}
|
||||
}"#,
|
||||
Some(
|
||||
r#"{
|
||||
"language_models": {
|
||||
"anthropic": {
|
||||
"api_url": "https://api.anthropic.com"
|
||||
},
|
||||
"openai": {
|
||||
"api_url": "https://api.openai.com/v1"
|
||||
}
|
||||
},
|
||||
"agent": {
|
||||
"enabled": true,
|
||||
"preferred_completion_mode": "normal",
|
||||
"button": true,
|
||||
"dock": "right",
|
||||
"default_width": 640,
|
||||
"default_height": 320,
|
||||
"default_model": {
|
||||
"provider": "zed.dev",
|
||||
"model": "claude-sonnet-4"
|
||||
}
|
||||
}
|
||||
}"#,
|
||||
),
|
||||
);
|
||||
|
||||
// Test that version fields in other contexts are not removed
|
||||
assert_migrate_settings(
|
||||
r#"{
|
||||
"language_models": {
|
||||
"other_provider": {
|
||||
"version": "1",
|
||||
"api_url": "https://api.example.com"
|
||||
}
|
||||
},
|
||||
"other_section": {
|
||||
"version": "1"
|
||||
}
|
||||
}"#,
|
||||
None,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_flatten_context_server_command() {
|
||||
assert_migrate_settings(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue