mirror of
https://github.com/zed-industries/zed.git
synced 2026-06-01 03:14:56 +07:00
migrator: Remove text thread settings migration (#52889)
Since this was just removing unused keys, but behavior isn't broken if they are there. So we can just leave them as-is Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Release Notes: - N/A Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de> Co-authored-by: MrSubidubi <dev@bahn.sh>
This commit is contained in:
parent
02e8914fe0
commit
224ce68200
3 changed files with 2 additions and 142 deletions
|
|
@ -316,9 +316,3 @@ pub(crate) mod m_2026_03_23 {
|
|||
|
||||
pub(crate) use keymap::KEYMAP_PATTERNS;
|
||||
}
|
||||
|
||||
pub(crate) mod m_2026_03_31 {
|
||||
mod settings;
|
||||
|
||||
pub(crate) use settings::remove_text_thread_settings;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,29 +0,0 @@
|
|||
use anyhow::Result;
|
||||
use serde_json::Value;
|
||||
|
||||
use crate::migrations::migrate_settings;
|
||||
|
||||
pub fn remove_text_thread_settings(value: &mut Value) -> Result<()> {
|
||||
migrate_settings(value, &mut migrate_one)
|
||||
}
|
||||
|
||||
fn migrate_one(obj: &mut serde_json::Map<String, Value>) -> Result<()> {
|
||||
// Remove `agent.default_view`
|
||||
if let Some(agent) = obj.get_mut("agent") {
|
||||
if let Some(agent_obj) = agent.as_object_mut() {
|
||||
agent_obj.remove("default_view");
|
||||
}
|
||||
}
|
||||
|
||||
// Remove `edit_predictions.enabled_in_text_threads`
|
||||
if let Some(edit_predictions) = obj.get_mut("edit_predictions") {
|
||||
if let Some(edit_predictions_obj) = edit_predictions.as_object_mut() {
|
||||
edit_predictions_obj.remove("enabled_in_text_threads");
|
||||
}
|
||||
}
|
||||
|
||||
// Remove top-level `slash_commands`
|
||||
obj.remove("slash_commands");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
@ -247,7 +247,6 @@ pub fn migrate_settings(text: &str) -> Result<Option<String>> {
|
|||
migrations::m_2026_03_16::SETTINGS_PATTERNS,
|
||||
&SETTINGS_QUERY_2026_03_16,
|
||||
),
|
||||
MigrationType::Json(migrations::m_2026_03_31::remove_text_thread_settings),
|
||||
];
|
||||
run_migrations(text, migrations)
|
||||
}
|
||||
|
|
@ -941,7 +940,8 @@ mod tests {
|
|||
"foo": "bar"
|
||||
},
|
||||
"edit_predictions": {
|
||||
}
|
||||
"enabled_in_text_threads": false,
|
||||
}
|
||||
}"#,
|
||||
),
|
||||
);
|
||||
|
|
@ -4480,109 +4480,4 @@ mod tests {
|
|||
),
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_remove_text_thread_settings() {
|
||||
assert_migrate_with_migrations(
|
||||
&[MigrationType::Json(
|
||||
migrations::m_2026_03_31::remove_text_thread_settings,
|
||||
)],
|
||||
r#"{
|
||||
"agent": {
|
||||
"default_model": {
|
||||
"provider": "anthropic",
|
||||
"model": "claude-sonnet"
|
||||
},
|
||||
"default_view": "text_thread"
|
||||
},
|
||||
"edit_predictions": {
|
||||
"mode": "eager",
|
||||
"enabled_in_text_threads": true
|
||||
},
|
||||
"slash_commands": {
|
||||
"cargo_workspace": {
|
||||
"enabled": true
|
||||
}
|
||||
}
|
||||
}"#,
|
||||
Some(
|
||||
r#"{
|
||||
"agent": {
|
||||
"default_model": {
|
||||
"provider": "anthropic",
|
||||
"model": "claude-sonnet"
|
||||
}
|
||||
},
|
||||
"edit_predictions": {
|
||||
"mode": "eager"
|
||||
}
|
||||
}"#,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_remove_text_thread_settings_only_default_view() {
|
||||
assert_migrate_with_migrations(
|
||||
&[MigrationType::Json(
|
||||
migrations::m_2026_03_31::remove_text_thread_settings,
|
||||
)],
|
||||
r#"{
|
||||
"agent": {
|
||||
"default_model": "claude-sonnet",
|
||||
"default_view": "thread"
|
||||
}
|
||||
}"#,
|
||||
Some(
|
||||
r#"{
|
||||
"agent": {
|
||||
"default_model": "claude-sonnet"
|
||||
}
|
||||
}"#,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_remove_text_thread_settings_only_slash_commands() {
|
||||
assert_migrate_with_migrations(
|
||||
&[MigrationType::Json(
|
||||
migrations::m_2026_03_31::remove_text_thread_settings,
|
||||
)],
|
||||
r#"{
|
||||
"slash_commands": {
|
||||
"cargo_workspace": {
|
||||
"enabled": true
|
||||
}
|
||||
},
|
||||
"vim_mode": true
|
||||
}"#,
|
||||
Some(
|
||||
r#"{
|
||||
"vim_mode": true
|
||||
}"#,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_remove_text_thread_settings_none_present() {
|
||||
assert_migrate_with_migrations(
|
||||
&[MigrationType::Json(
|
||||
migrations::m_2026_03_31::remove_text_thread_settings,
|
||||
)],
|
||||
r#"{
|
||||
"agent": {
|
||||
"default_model": {
|
||||
"provider": "anthropic",
|
||||
"model": "claude-sonnet"
|
||||
}
|
||||
},
|
||||
"edit_predictions": {
|
||||
"mode": "eager"
|
||||
}
|
||||
}"#,
|
||||
None,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue