Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default nushell config break tab-completion for PATH #2699

Open
mcheshkov opened this issue Oct 3, 2024 · 0 comments
Open

Default nushell config break tab-completion for PATH #2699

mcheshkov opened this issue Oct 3, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@mcheshkov
Copy link

Describe the bug

After installing mise with nushell intergation through mise activate nu tab-completions of executables breaks.

To Reproduce

  1. Use this recipe: https://mise.jdx.dev/getting-started.html#nushell
  2. Start new nushell
  3. Input any executable prefix and hit tab
  4. nushell shows NO RECORDS FOUND

Expected behavior

nushell should show actual list of executables even with mise installed

mise doctor output

version: 2024.9.13 linux-x64 (0f290f0 2024-09-29)
activated: yes
shims_on_path: no

build_info:
  Target: x86_64-unknown-linux-gnu
  Features: DEFAULT, NATIVE_TLS, OPENSSL
  Built: Sun, 29 Sep 2024 19:15:23 +0000
  Rust Version: rustc 1.81.0 (eeb90cda1 2024-09-04)
  Profile: release

shell:
  nu
  0.98.0

dirs:
  data: ~/.local/share/mise
  config: ~/.config/mise
  cache: ~/.cache/mise
  state: ~/.local/state/mise
  shims: ~/.local/share/mise/shims

config_files:

backends:
  cargo
  core
  go
  npm
  pipx
  spm
  ubi
  vfox

plugins:

toolset:

env_vars:
  MISE_SHELL=nu

settings:
  activate_aggressive = false
  all_compile = false
  always_keep_download = false
  always_keep_install = false
  asdf = true
  asdf_compat = false
  cache_prune_age = "30d"
  cargo_binstall = true
  ci = false
  color = true
  debug = false
  disable_default_shorthands = false
  disable_hints = []
  disable_tools = []
  experimental = false
  go_default_packages_file = "~/.default-go-packages"
  go_download_mirror = "https://dl.google.com/go"
  go_repo = "https://github.com/golang/go"
  go_set_gopath = false
  go_set_goroot = true
  go_skip_checksum = false
  http_timeout = 30
  jobs = 4
  legacy_version_file = true
  legacy_version_file_disable_tools = []
  libgit2 = true
  log_level = "info"
  not_found_auto_install = true
  paranoid = false
  pipx_uvx = false
  plugin_autoupdate_last_check_duration = "7d"
  python_default_packages_file = "~/.default-python-packages"
  python_pyenv_repo = "https://github.com/pyenv/pyenv.git"
  python_venv_auto_create = false
  quiet = false
  raw = false
  trace = false
  trusted_config_paths = []
  use_versions_host = true
  verbose = false
  vfox = false
  yes = false

  [node]

  [ruby]
  default_packages_file = "~/.default-gems"
  ruby_build_repo = "https://github.com/rbenv/ruby-build.git"
  ruby_install = false
  ruby_install_repo = "https://github.com/postmodern/ruby-install.git"

  [status]
  missing_tools = "if_other_versions_installed"
  show_env = false
  show_tools = false
No warnings found
No problems found

Additional context

It seems that issue is coming from list vs string mismatch in PATH value
Without mise activated

~> $env.PATH
╭───┬────────────────────────────────────────────────────────────╮
│ 0 │ /var/home/mcheshkov/.cargo/bin                             │
│ 1 │ /var/home/mcheshkov/.local/bin                             │
│ 2 │ /var/home/mcheshkov/bin                                    │
│ 3 │ /usr/local/bin                                             │
│ 4 │ /usr/local/sbin                                            │
│ 5 │ /usr/bin                                                   │
│ 6 │ /usr/sbin                                                  │
│ 7 │ /var/home/mcheshkov/.local/share/JetBrains/Toolbox/scripts │
╰───┴────────────────────────────────────────────────────────────╯

With mise

~> $env.PATH
/var/home/mcheshkov/.cargo/bin:/var/home/mcheshkov/.local/bin:/var/home/mcheshkov/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/var/home/mcheshkov/.local/share/JetBrains/Toolbox/scripts

I managed to make it working by patching mise.nu like this

--- ./mise.nu.bak	2024-10-03 16:08:12.934663763 +0300
+++ ./mise.nu	2024-10-03 16:31:25.529762205 +0300
@@ -37,7 +37,8 @@
 def --env "update-env" [] {
   for $var in $in {
     if $var.op == "set" {
-      load-env {($var.name): $var.value}
+      let from_string = (($env.ENV_CONVERSIONS | default {from_string: {echo $in}} $var.name | get $var.name).from_string)
+      load-env {($var.name): (do $from_string $var.value)}
     } else if $var.op == "hide" {
       hide-env $var.name
     }

Here's original issue and comment, where I picked up that solution
#589 (comment)

Here's nushell docs about ENV_CONVERSIONS
https://www.nushell.sh/book/environment.html#environment-variable-conversions

@mcheshkov mcheshkov added the bug Something isn't working label Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant