Prevent double indentation check for real files.

pull/6652/head
Muhammad 2 years ago
parent c301792ff7
commit caf4b3e2b0
No known key found for this signature in database
GPG Key ID: 6667F8D7694B5CCF

@ -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<dyn DynAccess<Config>>,
@ -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<dyn DynAccess<Config>>,
) -> 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));

Loading…
Cancel
Save