Skip to content

Autocomplete paths properly #5683

Closed
Closed

Description

@charleschege

Related problem

The new releases of nu with engine-q doesn't handle directory commands as conveniently as previous version like 0.41.

For example, using version 0.41.0 to handle a directory called FooBar , on Ubuntu 20.04

  1. Using autocomplete adds a ./ prefix when you press tab to autocomplete Foo into full directory name FooBar but when using version 0.60+ only the FooBar full name is autocompleted with no ./ added prefix thereby on pressing enter an error occurs since nushell thinks it's executing a binary
Error: nu::shell::external_command (link)

  × External command
   ╭─[entry #2:1:1]
 1 │ FooBar/
   · ────────┬────────
   ·         ╰── can't run executable
   ╰────
  help: Permission denied (os error 13)
  1. Version before engine-q like 0.41.0 are able to understand what constitutes a directory so just typing FooBar or FooBar/ nushell will switch to the directory but on version 0.60+ this will return an error since it thinks binary execution is happening
Error: nu::shell::external_command (link)

  × External command
   ╭─[entry #3:1:1]
 1 │ FooBar
   · ────────┬───────
   ·         ╰── can't run executable
   ╰────
  help: No such file or directory (os error 2)

Describe the solution you'd like

With new versions of nushell, reintroduce this convenience like:

  1. Add a ./ prefix on autocompleting a directory
  2. Nushell should be able to detect a directory and switch to it on pressing enter even if the directory name does not have a ./ prefix or / suffix on the directory name

Describe alternatives you've considered

No response

Additional context and details

No response

Activity

  1. added
    polish
    A:completions
    on May 30, 2022
  2. fdncred commented on May 30, 2022

    @fdncred
    Contributor

    We recently had a PR that reversed this. It used to append ./ or .\ in places and it took it off. IIRC, the reason for it was because the completions wouldn't work right. You couldn't do ls Foo<tab> you had to do ls ./Foo<tab>. So, one may be able to find that PR and fix it in a different way.

  3. added this to the v0.86.0 milestone on Oct 3, 2023
  4. added a commit that references this issue on Dec 14, 2023
    0c6176e
  5. added a commit that references this issue on Feb 2, 2024
    5c15a4d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A:completionspolish

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions