mirror of https://github.com/helix-editor/helix
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
parent
3366db0afb
commit
8961ae1dc6
|
@ -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() {
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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()
|
|
||||||
}
|
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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")
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue