Fix code actions migration (#40303)
Closes #40270 Release Notes: - Fixed an issue with the settings migration to flatten `code_actions` format steps where comments would cause enabled code actions to be omitted from the migrated settings. If you were effected, restoring the settings file backup and allowing the migration to re-run will result in a valid settings file - Fixed an issue where automated settings and keymap file updates would occasionally assume 4-space indentation
This commit is contained in:
@@ -33,6 +33,7 @@ pub type EditorconfigProperties = ec4rs::Properties;
|
||||
use crate::{
|
||||
ActiveSettingsProfileName, FontFamilyName, IconThemeName, LanguageSettingsContent,
|
||||
LanguageToSettingsMap, SettingsJsonSchemaParams, ThemeName, VsCodeSettings, WorktreeId,
|
||||
infer_json_indent_size,
|
||||
merge_from::MergeFrom,
|
||||
parse_json_with_comments,
|
||||
settings_content::{
|
||||
@@ -637,7 +638,7 @@ impl SettingsStore {
|
||||
|
||||
let mut key_path = Vec::new();
|
||||
let mut edits = Vec::new();
|
||||
let tab_size = self.json_tab_size();
|
||||
let tab_size = infer_json_indent_size(&text);
|
||||
let mut text = text.to_string();
|
||||
update_value_in_json_text(
|
||||
&mut text,
|
||||
@@ -650,10 +651,6 @@ impl SettingsStore {
|
||||
edits
|
||||
}
|
||||
|
||||
pub fn json_tab_size(&self) -> usize {
|
||||
2
|
||||
}
|
||||
|
||||
/// Sets the default settings via a JSON string.
|
||||
///
|
||||
/// The string should contain a JSON object with a default value for every setting.
|
||||
@@ -1540,9 +1537,9 @@ mod tests {
|
||||
})
|
||||
},
|
||||
r#"{
|
||||
"tabs": {
|
||||
"git_status": true
|
||||
}
|
||||
"tabs": {
|
||||
"git_status": true
|
||||
}
|
||||
}
|
||||
"#
|
||||
.unindent(),
|
||||
@@ -1557,9 +1554,9 @@ mod tests {
|
||||
.unindent(),
|
||||
|settings| settings.title_bar.get_or_insert_default().show_branch_name = Some(true),
|
||||
r#"{
|
||||
"title_bar": {
|
||||
"show_branch_name": true
|
||||
}
|
||||
"title_bar": {
|
||||
"show_branch_name": true
|
||||
}
|
||||
}
|
||||
"#
|
||||
.unindent(),
|
||||
@@ -1584,7 +1581,7 @@ mod tests {
|
||||
.unindent(),
|
||||
r#" { "editor.tabSize": 37 } "#.to_owned(),
|
||||
r#"{
|
||||
"tab_size": 37
|
||||
"tab_size": 37
|
||||
}
|
||||
"#
|
||||
.unindent(),
|
||||
@@ -1637,9 +1634,9 @@ mod tests {
|
||||
.unindent(),
|
||||
r#"{ "workbench.editor.decorations.colors": true }"#.to_owned(),
|
||||
r#"{
|
||||
"tabs": {
|
||||
"git_status": true
|
||||
}
|
||||
"tabs": {
|
||||
"git_status": true
|
||||
}
|
||||
}
|
||||
"#
|
||||
.unindent(),
|
||||
@@ -1655,11 +1652,11 @@ mod tests {
|
||||
.unindent(),
|
||||
r#"{ "editor.fontFamily": "Cascadia Code, 'Consolas', Courier New" }"#.to_owned(),
|
||||
r#"{
|
||||
"buffer_font_fallbacks": [
|
||||
"Consolas",
|
||||
"Courier New"
|
||||
],
|
||||
"buffer_font_family": "Cascadia Code"
|
||||
"buffer_font_fallbacks": [
|
||||
"Consolas",
|
||||
"Courier New"
|
||||
],
|
||||
"buffer_font_family": "Cascadia Code"
|
||||
}
|
||||
"#
|
||||
.unindent(),
|
||||
@@ -1695,16 +1692,16 @@ mod tests {
|
||||
.get_or_insert_default()
|
||||
.enabled = Some(true);
|
||||
});
|
||||
assert_eq!(
|
||||
pretty_assertions::assert_str_eq!(
|
||||
actual,
|
||||
r#"{
|
||||
"git": {
|
||||
"git": {
|
||||
"inline_blame": {
|
||||
"enabled": true
|
||||
"enabled": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"#
|
||||
"#
|
||||
.unindent()
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user