add tags config fixture test helper
@@ -4,6 +4,7 @@ use std::path::{Path, PathBuf};
use tree_sitter::Language;
use tree_sitter_highlight::HighlightConfiguration;
use tree_sitter_loader::Loader;
+use tree_sitter_tags::TagsConfiguration;
include!("./dirs.rs");
@@ -54,6 +55,14 @@ pub fn get_highlight_config(
result
}
+pub fn get_tags_config(language_name: &str) -> TagsConfiguration {
+ let language = get_language(language_name);
+ let queries_path = get_language_queries_path(language_name);
+ let tags_query = fs::read_to_string(queries_path.join("tags.scm")).unwrap();
+ let locals_query = fs::read_to_string(queries_path.join("locals.scm")).unwrap_or(String::new());
+ TagsConfiguration::new(language, &tags_query, &locals_query).unwrap()
+}
+
pub fn get_test_language(name: &str, parser_code: &str, path: Option<&Path>) -> Language {
let parser_c_path = SCRATCH_DIR.join(&format!("{}-parser.c", name));
if !fs::read_to_string(&parser_c_path)
