on master help sign in
Fix broken test.
commit8b28bf253394b46d3846710075d635d511dc4879 authorBlaž Hrastnik <blaz@mxxn.io> dateThu 25 Mar 2021, 16:53 (6 years ago) parenta65395d
2 files changed+23−4
helix-core/src/indent.rs+22−3 helix-core/src/syntax.rs+1−1
helix-core/src/indent.rs+22−3
@@ -293,9 +293,28 @@ where
293293 );
294294
295295 let doc = Rope::from(doc);
296− let language_config = crate::syntax::LOADER
297− .language_config_for_scope("source.rust")
298− .unwrap();
296+ use crate::syntax::{
297+ Configuration, IndentationConfiguration, Lang, LanguageConfiguration, Loader,
298+ };
299+ use once_cell::sync::OnceCell;
300+ let loader = Loader::new(Configuration {
301+ language: vec![LanguageConfiguration {
302+ scope: "source.rust".to_string(),
303+ file_types: vec!["rs".to_string()],
304+ language_id: Lang::Rust,
305+ highlight_config: OnceCell::new(),
306+ //
307+ path: "../helix-syntax/languages/tree-sitter-rust".into(),
308+ roots: vec![],
309+ language_server: None,
310+ indent: Some(IndentationConfiguration {
311+ tab_width: 4,
312+ unit: String::from(" "),
313+ }),
314+ }],
315+ });
316+
317+ let language_config = loader.language_config_for_scope("source.rust").unwrap();
299318 let highlight_config = language_config.highlight_config(&[]).unwrap();
300319 let syntax = Syntax::new(&doc, highlight_config.clone());
301320 let text = doc.slice(..);
helix-core/src/syntax.rs+1−1
@@ -14,7 +14,7 @@ use serde::{Deserialize, Serialize};
1414
1515#[derive(Serialize, Deserialize)]
1616pub struct Configuration {
17− language: Vec<LanguageConfiguration>,
17+ pub language: Vec<LanguageConfiguration>,
1818}
1919
2020// largely based on tree-sitter/cli/src/loader.rs