mirror of
https://github.com/helix-editor/helix.git
synced 2025-01-19 21:47:07 +04:00
Remove language-server configuration in integration tests
This change removes language server configuration from the default languages.toml config for integration tests. No integration-tests currently depend on the availability of a language server but if any future test needs to, it may provide a language server configuration by passing an override into the `test_syntax_conf` helper. Language-servers in integration tests cause false-positive failures when running integration tests in GitHub Actions CI. The Windows runner appears to have `clangd` installed and all OS runners have the `R` binary installed but not the `R` language server package. If a test file created by `tempfile::NamedTempFile` happens to have a file extension of `r`, the test will most likely fail because the R language server will fail to start and will become a broken pipe, meaning that it will fail to shutdown within the timeout, causing a false-positive failure. This happens surprisingly often in practice. Language servers (especially rust-analyzer) also emit unnecessary log output when initializing, which this change silences.
This commit is contained in:
parent
1243db11a5
commit
313579d27c
@ -143,9 +143,27 @@ pub async fn test_key_sequence_with_input_text<T: Into<TestCase>>(
|
||||
|
||||
/// Generates language configs that merge in overrides, like a user language
|
||||
/// config. The argument string must be a raw TOML document.
|
||||
///
|
||||
/// By default, language server configuration is dropped from the languages.toml
|
||||
/// document. If a language-server is necessary for a test, it must be explicitly
|
||||
/// added in `overrides`.
|
||||
pub fn test_syntax_conf(overrides: Option<String>) -> helix_core::syntax::Configuration {
|
||||
let mut lang = helix_loader::config::default_lang_config();
|
||||
|
||||
for lang_config in lang
|
||||
.as_table_mut()
|
||||
.expect("Expected languages.toml to be a table")
|
||||
.get_mut("language")
|
||||
.expect("Expected languages.toml to have \"language\" keys")
|
||||
.as_array_mut()
|
||||
.expect("Expected an array of language configurations")
|
||||
{
|
||||
lang_config
|
||||
.as_table_mut()
|
||||
.expect("Expected language config to be a TOML table")
|
||||
.remove("language-server");
|
||||
}
|
||||
|
||||
if let Some(overrides) = overrides {
|
||||
let override_toml = toml::from_str(&overrides).unwrap();
|
||||
lang = helix_loader::merge_toml_values(lang, override_toml, 3);
|
||||
@ -236,7 +254,6 @@ pub fn new_readonly_tempfile() -> anyhow::Result<NamedTempFile> {
|
||||
Ok(file)
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct AppBuilder {
|
||||
args: Args,
|
||||
config: Config,
|
||||
@ -244,6 +261,17 @@ pub struct AppBuilder {
|
||||
input: Option<(String, Selection)>,
|
||||
}
|
||||
|
||||
impl Default for AppBuilder {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
args: Args::default(),
|
||||
config: Config::default(),
|
||||
syn_conf: test_syntax_conf(None),
|
||||
input: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl AppBuilder {
|
||||
pub fn new() -> Self {
|
||||
AppBuilder::default()
|
||||
|
Loading…
Reference in New Issue
Block a user