From 7aacad3270c89fdc89e4cbcbf61b1769ea69bd13 Mon Sep 17 00:00:00 2001 From: Douglas <32344964+NotTheDr01ds@users.noreply.github.com> Date: Thu, 12 Dec 2024 11:50:28 -0500 Subject: [PATCH] Set empty `ENV_CONVERSIONS` record by default (#14566) # Description With Windows Path case-insensitivity in place, we no longer need an `ENV_CONVERSIONS` for `PATH`, as the `nu_engine::env::convert_env_values()` handles it automatically. This PR: * Removes the default `ENV_CONVERSIONS` for path from `default_env.nu` * Sets `ENV_CONVERSIONS` to an empty record (so it can be `merge`'d) in `main()` instead # User-Facing Changes No behavioral changes - Users will now have an empty `ENV_CONVERSIONS` at startup by default, but the behavior should not change. # Tests + Formatting - :green_circle: `toolkit fmt` - :green_circle: `toolkit clippy` - :green_circle: `toolkit test` - :green_circle: `toolkit test stdlib` # After Submitting --- crates/nu-utils/src/default_files/default_env.nu | 7 ------- src/main.rs | 7 ++++++- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/crates/nu-utils/src/default_files/default_env.nu b/crates/nu-utils/src/default_files/default_env.nu index 2e2d66f0bc..66b442ce7a 100644 --- a/crates/nu-utils/src/default_files/default_env.nu +++ b/crates/nu-utils/src/default_files/default_env.nu @@ -39,10 +39,3 @@ $env.PROMPT_COMMAND_RIGHT = $env.PROMPT_COMMAND_RIGHT? | default {|| ([$last_exit_code, (char space), $time_segment] | str join) } - -$env.ENV_CONVERSIONS = { - "PATH": { - from_string: { |s| $s | split row (char esep) | path expand --no-symlink } - to_string: { |v| $v | path expand --no-symlink | str join (char esep) } - } -} diff --git a/src/main.rs b/src/main.rs index 1c82e58851..7d39aef02b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -24,7 +24,7 @@ use nu_cli::gather_parent_env_vars; use nu_lsp::LanguageServer; use nu_path::canonicalize_with; use nu_protocol::{ - engine::EngineState, report_shell_error, ByteStream, Config, IntoValue, PipelineData, + engine::EngineState, record, report_shell_error, ByteStream, Config, IntoValue, PipelineData, ShellError, Span, Spanned, Type, Value, }; use nu_std::load_standard_library; @@ -285,6 +285,11 @@ fn main() -> Result<()> { ); perf!("$env.config setup", start_time, use_color); + engine_state.add_env_var( + "ENV_CONVERSIONS".to_string(), + Value::test_record(record! {}), + ); + start_time = std::time::Instant::now(); if let Some(include_path) = &parsed_nu_cli_args.include_path { let span = include_path.span;