From d37bac00bd8c05b92b159f0f0c4ab334c5a14593 Mon Sep 17 00:00:00 2001 From: Isaac Mills Date: Thu, 5 Jun 2025 09:22:26 -0600 Subject: [PATCH] Make atomic_save not configurable via editor config --- helix-core/src/editor_config.rs | 11 ----------- helix-view/src/document.rs | 4 +--- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/helix-core/src/editor_config.rs b/helix-core/src/editor_config.rs index 00206ca6b..714f577c5 100644 --- a/helix-core/src/editor_config.rs +++ b/helix-core/src/editor_config.rs @@ -34,7 +34,6 @@ pub struct EditorConfig { // pub spelling_language: Option, pub trim_trailing_whitespace: Option, pub insert_final_newline: Option, - pub atomic_save: Option, pub max_line_length: Option, } @@ -160,13 +159,6 @@ impl EditorConfig { "false" => Some(false), _ => None, }); - let atomic_save = pairs - .get("atomic_save") - .and_then(|value| match value.as_ref() { - "true" => Some(true), - "false" => Some(false), - _ => None, - }); // This option is not in the spec but is supported by some editors. // let max_line_length = pairs @@ -180,7 +172,6 @@ impl EditorConfig { encoding, trim_trailing_whitespace, insert_final_newline, - atomic_save, max_line_length, } } @@ -314,7 +305,6 @@ mod test { [docs/**.txt] insert_final_newline = true - atomic_save = true "#; assert_eq!( @@ -336,7 +326,6 @@ mod test { EditorConfig { indent_style: Some(IndentStyle::Spaces(4)), insert_final_newline: Some(true), - atomic_save: Some(true), ..Default::default() } ); diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs index 4f9308ad5..d020368ed 100644 --- a/helix-view/src/document.rs +++ b/helix-view/src/document.rs @@ -1917,9 +1917,7 @@ impl Document { /// Whether the document should write it's contents to a backup file, then rename that backup to the target file when saving. This prevents data loss if the editor is interupted while writing the file, but may confuse some file watching/hot reloading programs. pub fn atomic_save(&self) -> bool { - self.editor_config - .atomic_save - .unwrap_or_else(|| self.config.load().atomic_save) + self.config.load().atomic_save } /// Whether the document should trim whitespace preceding line endings on save.