From caf4b3e2b0289690b256d48bb532d69f71c10c10 Mon Sep 17 00:00:00 2001 From: Muhammad Date: Sat, 8 Apr 2023 04:45:52 +0100 Subject: [PATCH] Prevent double indentation check for real files. --- helix-view/src/document.rs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs index 967480d3e..4e953e8a1 100644 --- a/helix-view/src/document.rs +++ b/helix-view/src/document.rs @@ -643,7 +643,7 @@ use helix_lsp::{lsp, Client, LanguageServerId, LanguageServerName}; use url::Url; impl Document { - pub fn from( + fn from0( text: Rope, encoding_with_bom_info: Option<(&'static Encoding, bool)>, config: Arc>, @@ -653,7 +653,7 @@ impl Document { let changes = ChangeSet::new(text.slice(..)); let old_state = None; - let mut doc = Self { + Self { id: DocumentId::default(), path: None, encoding, @@ -684,7 +684,15 @@ impl Document { focused_at: std::time::Instant::now(), readonly: false, jump_labels: HashMap::new(), - }; + } + } + + pub fn from( + text: Rope, + encoding_with_bom_info: Option<(&'static Encoding, bool)>, + config: Arc>, + ) -> Self { + let mut doc = Self::from0(text, encoding_with_bom_info, config); doc.detect_indent_and_line_ending(); doc } @@ -722,7 +730,7 @@ impl Document { (Rope::from(line_ending.as_str()), encoding, false) }; - let mut doc = Self::from(rope, Some((encoding, has_bom)), config); + let mut doc = Self::from0(rope, Some((encoding, has_bom)), config); // set the path and try detecting the language doc.set_path(Some(path));