nushell / nushell/nushell

File/Directory auto completion failed after execute custom command within an overlay.

Open
#6,522 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A:completions category:bug
Dominant language
Rust
Stars
40.5k
Forks
2.3k
Avg merge
1d 19h
Merged PRs (30d)
85

Description

Describe the bug

It's a little hard to express, please see the reproduce steps.

How to reproduce
  1. create two files, test.nu, test-env.nu.
# test.nu
export alias gt = overlay use test-env.nu
# test-env.nu
export def-env tt () {
    cd /tmp
}
  1. run use test.nu *, so alias gt is introduced
  2. run gt, to activate overlay test-env
  3. run tt, then the current directory is changed to /tmp.
  4. then we can see the path auto completion is broken..
Expected behavior

Auto completion should work as expected

Screenshots

asciicast

Configuration
key value
version 0.68.0
branch
commit_hash b0e5723a68d77b42d756879ab7773fdee81f8924
build_os macos-x86_64
build_target x86_64-apple-darwin
rust_version rustc 1.63.0 (4b91a6ea7 2022-08-08)
rust_channel stable-x86_64-apple-darwin
cargo_version cargo 1.63.0 (fd9c4297c 2022-07-01)
pkg_version 0.68.0
build_time 2022-09-06 20:01:28 +00:00
build_rust_channel release
features database, dataframe, default, trash, which, zip
installed_plugins
Additional context

It only happened when using alias with overlay use.
If I use overlay use directly, the auto completion works fine.
Or if I use use, the auto completion also works.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue using the test.nu and test-env.nu files and the overlay use, alias, def-env, and path-completion steps described above. Start by tracing how the gt alias activates the overlay and how tt changes the current directory, then compare this with direct overlay use and use. Done means path auto completion works after the aliased overlay command and directory change.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.