aboutsummaryrefslogtreecommitdiff
path: root/helix-core/src/indent.rs
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-03-25 07:53:32 +0000
committerBlaž Hrastnik2021-03-25 07:53:32 +0000
commit8b28bf253394b46d3846710075d635d511dc4879 (patch)
treeaca8a17895c7289c815e55f65eda514616f4f355 /helix-core/src/indent.rs
parenta65395d94beb614bc17301601109042077e55e83 (diff)
Fix broken test.
Diffstat (limited to 'helix-core/src/indent.rs')
-rw-r--r--helix-core/src/indent.rs25
1 files changed, 22 insertions, 3 deletions
diff --git a/helix-core/src/indent.rs b/helix-core/src/indent.rs
index 775bc8ba..7fedb7d3 100644
--- a/helix-core/src/indent.rs
+++ b/helix-core/src/indent.rs
@@ -293,9 +293,28 @@ where
);
let doc = Rope::from(doc);
- let language_config = crate::syntax::LOADER
- .language_config_for_scope("source.rust")
- .unwrap();
+ use crate::syntax::{
+ Configuration, IndentationConfiguration, Lang, LanguageConfiguration, Loader,
+ };
+ use once_cell::sync::OnceCell;
+ let loader = Loader::new(Configuration {
+ language: vec![LanguageConfiguration {
+ scope: "source.rust".to_string(),
+ file_types: vec!["rs".to_string()],
+ language_id: Lang::Rust,
+ highlight_config: OnceCell::new(),
+ //
+ path: "../helix-syntax/languages/tree-sitter-rust".into(),
+ roots: vec![],
+ language_server: None,
+ indent: Some(IndentationConfiguration {
+ tab_width: 4,
+ unit: String::from(" "),
+ }),
+ }],
+ });
+
+ let language_config = loader.language_config_for_scope("source.rust").unwrap();
let highlight_config = language_config.highlight_config(&[]).unwrap();
let syntax = Syntax::new(&doc, highlight_config.clone());
let text = doc.slice(..);