Consistently use `helix_core::config::default_{lang,config}_loader`

This avoids using any custom configuration in a user-defined
`languages.toml` config for the syntax test cases. The test cases should
only use the builtin `languages.toml` config.

Also the xtask crate reimplemented `default_lang_loader` and
`default_lang_config`. These functions are replaced with calls into
`helix_core`.
pull/13644/head
Michael Davis 2025-05-29 09:53:12 -04:00
parent 3366db0afb
commit 8961ae1dc6
No known key found for this signature in database
5 changed files with 3 additions and 17 deletions

View File

@ -964,7 +964,7 @@ mod test {
use super::*; use super::*;
use crate::{Rope, Transaction}; use crate::{Rope, Transaction};
static LOADER: Lazy<Loader> = Lazy::new(|| crate::config::user_lang_loader().unwrap()); static LOADER: Lazy<Loader> = Lazy::new(crate::config::default_lang_loader);
#[test] #[test]
fn test_textobject_queries() { fn test_textobject_queries() {

View File

@ -129,7 +129,7 @@ pub fn lang_features() -> Result<String, DynError> {
cols.push("Default language servers".to_owned()); cols.push("Default language servers".to_owned());
md.push_str(&md_table_heading(&cols)); md.push_str(&md_table_heading(&cols));
let config = helpers::lang_config(); let config = helix_core::config::default_lang_config();
let mut langs = config let mut langs = config
.language .language

View File

@ -1,7 +1,6 @@
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use crate::path; use crate::path;
use helix_core::syntax::{self, config::Configuration as LangConfig};
use helix_term::health::TsFeature; use helix_term::health::TsFeature;
/// Get the list of languages that support a particular tree-sitter /// Get the list of languages that support a particular tree-sitter
@ -37,12 +36,3 @@ pub fn find_files(dir: &Path, filename: &str) -> Vec<PathBuf> {
.flatten() .flatten()
.collect() .collect()
} }
pub fn lang_config() -> LangConfig {
let text = std::fs::read_to_string(path::lang_config()).unwrap();
toml::from_str(&text).unwrap()
}
pub fn syn_loader() -> syntax::Loader {
syntax::Loader::new(lang_config()).unwrap()
}

View File

@ -22,7 +22,7 @@ pub mod tasks {
use helix_core::syntax::LanguageData; use helix_core::syntax::LanguageData;
let languages_to_check: HashSet<_> = languages.collect(); let languages_to_check: HashSet<_> = languages.collect();
let loader = crate::helpers::syn_loader(); let loader = helix_core::config::default_lang_loader();
for (_language, lang_data) in loader.languages() { for (_language, lang_data) in loader.languages() {
if !languages_to_check.is_empty() if !languages_to_check.is_empty()
&& !languages_to_check.contains(&lang_data.config().language_id) && !languages_to_check.contains(&lang_data.config().language_id)

View File

@ -22,7 +22,3 @@ pub fn ts_queries() -> PathBuf {
pub fn themes() -> PathBuf { pub fn themes() -> PathBuf {
runtime().join("themes") runtime().join("themes")
} }
pub fn lang_config() -> PathBuf {
project_root().join("languages.toml")
}