aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Vegdahl2021-06-25 18:05:42 +0000
committerBenoƮt Cortier2021-06-26 00:27:43 +0000
commitd534d6470f887440633a82375e24c2bf0be9516d (patch)
tree66da6b3bae2128613be2846aaddd8a08bf0cdfdf
parente8d2f3612fd975fe7225a23e5a7fa5810a2576ee (diff)
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.
-rw-r--r--helix-view/src/document.rs7
1 files changed, 4 insertions, 3 deletions
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)
}