From d534d6470f887440633a82375e24c2bf0be9516d Mon Sep 17 00:00:00 2001 From: Nathan Vegdahl Date: Fri, 25 Jun 2021 11:05:42 -0700 Subject: Detect file language before file indent style. Fixes #378. The issue was that because indent style detection ran before language detection, there was no language indent style to fall back on if indent style detection failed, so it would just default to 2 spaces. --- helix-view/src/document.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'helix-view') diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs index 66a67468..dcacdb5e 100644 --- a/helix-view/src/document.rs +++ b/helix-view/src/document.rs @@ -461,13 +461,14 @@ impl Document { // set the path and try detecting the language doc.set_path(&path)?; - doc.detect_indent_style(); - doc.line_ending = line_ending; - if let Some(loader) = config_loader { doc.detect_language(theme, loader); } + // Detect indentation style and set line ending. + doc.detect_indent_style(); + doc.line_ending = line_ending; + Ok(doc) } -- cgit v1.2.3-70-g09d2