Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'helix-core/tests/indent.rs')
-rw-r--r--helix-core/tests/indent.rs18
1 files changed, 8 insertions, 10 deletions
diff --git a/helix-core/tests/indent.rs b/helix-core/tests/indent.rs
index ab733f93..faf845c0 100644
--- a/helix-core/tests/indent.rs
+++ b/helix-core/tests/indent.rs
@@ -1,9 +1,8 @@
use helix_core::{
indent::{indent_level_for_line, treesitter_indent_for_pos, IndentStyle},
- syntax::{config::Configuration, Loader},
+ syntax::{Configuration, Loader},
Syntax,
};
-use helix_stdx::rope::RopeSliceExt;
use ropey::Rope;
use std::{ops::Range, path::PathBuf, process::Command};
@@ -35,7 +34,7 @@ fn test_treesitter_indent_rust_helix() {
.unwrap();
let files = String::from_utf8(files.stdout).unwrap();
- let ignored_files = [
+ let ignored_files = vec![
// Contains many macros that tree-sitter does not parse in a meaningful way and is otherwise not very interesting
"helix-term/src/health.rs",
];
@@ -44,7 +43,6 @@ fn test_treesitter_indent_rust_helix() {
if ignored_files.contains(&file) {
continue;
}
- #[allow(clippy::single_range_in_vec_init)]
let ignored_lines: Vec<Range<usize>> = match file {
"helix-term/src/application.rs" => vec![
// We can't handle complicated indent rules inside macros (`json!` in this case) since
@@ -188,26 +186,26 @@ fn test_treesitter_indent(
lang_scope: &str,
ignored_lines: Vec<std::ops::Range<usize>>,
) {
- let loader = Loader::new(indent_tests_config()).unwrap();
+ let loader = Loader::new(indent_tests_config());
// set runtime path so we can find the queries
let mut runtime = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"));
runtime.push("../runtime");
std::env::set_var("HELIX_RUNTIME", runtime.to_str().unwrap());
- let language = loader.language_for_scope(lang_scope).unwrap();
- let language_config = loader.language(language).config();
+ let language_config = loader.language_config_for_scope(lang_scope).unwrap();
let indent_style = IndentStyle::from_str(&language_config.indent.as_ref().unwrap().unit);
+ let highlight_config = language_config.highlight_config(&[]).unwrap();
let text = doc.slice(..);
- let syntax = Syntax::new(text, language, &loader).unwrap();
- let indent_query = loader.indent_query(language).unwrap();
+ let syntax = Syntax::new(text, highlight_config, std::sync::Arc::new(loader)).unwrap();
+ let indent_query = language_config.indent_query().unwrap();
for i in 0..doc.len_lines() {
let line = text.line(i);
if ignored_lines.iter().any(|range| range.contains(&(i + 1))) {
continue;
}
- if let Some(pos) = line.first_non_whitespace_char() {
+ if let Some(pos) = helix_core::find_first_non_whitespace_char(line) {
let tab_width: usize = 4;
let suggested_indent = treesitter_indent_for_pos(
indent_query,