on master help sign in
Fix broken test.
8b28bf2Blaž Hrastnik
helix-core/src/indent.rs+22−3
@@ -293,9 +293,28 @@ where
293 );
293 );
294
294
295 let doc = Rope::from(doc);
295 let doc = Rope::from(doc);
296− let language_config = crate::syntax::LOADER
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+
297− .language_config_for_scope("source.rust")
317+ let language_config = loader.language_config_for_scope("source.rust").unwrap();
298− .unwrap();
299 let highlight_config = language_config.highlight_config(&[]).unwrap();
318 let highlight_config = language_config.highlight_config(&[]).unwrap();
300 let syntax = Syntax::new(&doc, highlight_config.clone());
319 let syntax = Syntax::new(&doc, highlight_config.clone());
301 let text = doc.slice(..);
320 let text = doc.slice(..);
helix-core/src/syntax.rs+1−1
@@ -14,7 +14,7 @@ use serde::{Deserialize, Serialize};
14
14
15#[derive(Serialize, Deserialize)]
15#[derive(Serialize, Deserialize)]
16pub struct Configuration {
16pub struct Configuration {
17− language: Vec<LanguageConfiguration>,
17+ pub language: Vec<LanguageConfiguration>,
18}
18}
19
19
20// largely based on tree-sitter/cli/src/loader.rs
20// largely based on tree-sitter/cli/src/loader.rs