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.
pull/380/head
Nathan Vegdahl 3 years ago committed by Benoît Cortier
parent e8d2f3612f
commit d534d6470f

@ -461,13 +461,14 @@ impl Document {
// set the path and try detecting the language // set the path and try detecting the language
doc.set_path(&path)?; doc.set_path(&path)?;
doc.detect_indent_style();
doc.line_ending = line_ending;
if let Some(loader) = config_loader { if let Some(loader) = config_loader {
doc.detect_language(theme, loader); doc.detect_language(theme, loader);
} }
// Detect indentation style and set line ending.
doc.detect_indent_style();
doc.line_ending = line_ending;
Ok(doc) Ok(doc)
} }

Loading…
Cancel
Save