on master help sign in
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.

commitd534d6470f887440633a82375e24c2bf0be9516d authorNathan Vegdahl <cessen@cessen.com> dateFri 25 Jun 2021, 11:05 (5 years ago) parente8d2f36
1 file changed+4−3
helix-view/src/document.rs+4−3
helix-view/src/document.rs+4−3
@@ -461,13 +461,14 @@ impl Document {
461461
462462 // set the path and try detecting the language
463463 doc.set_path(&path)?;
464− doc.detect_indent_style();
465− doc.line_ending = line_ending;
466−
467464 if let Some(loader) = config_loader {
468465 doc.detect_language(theme, loader);
469466 }
470467
468+ // Detect indentation style and set line ending.
469+ doc.detect_indent_style();
470+ doc.line_ending = line_ending;
471+
471472 Ok(doc)
472473 }
473474