nushell / nushell

A new type of shell
https://www.nushell.sh/
MIT License
32.1k stars 1.66k forks source link

tab completion on suggestions stuck on the second element #14152

Open maxim-uvarov opened 3 days ago

maxim-uvarov commented 3 days ago

Describe the bug

When I hit tab, I always get the second completion result, though shift+tab works correctly. The problem is with paths completions and with commands completions. With the history menu ctrl + r there is no problem.

It's a strange bug that appeared only in 0.99.x. Before that on the same config tab for given cases worked correctly.

https://github.com/user-attachments/assets/ce26f58f-16e8-474e-a1f2-3bb093fb24cf

On the same machine in nu -n tab works normally.

On the discord @fdncred pointed out these two commits:

I tried to disable and rename the config shortcut (below), but with no success.

    {
        name: completion_next_menu
        modifier: none
        keycode: tab
        mode: [emacs vi_normal vi_insert]
        event: {
            until: [
                { send: menu name: completion_menu }
                { send: menunext }
                { edit: complete }
            ]
        }
    }

How to reproduce

enter some file path - click tab more than once. @fdncred wasn't able to reproduce the bug both on windows and on Mac.

Expected behavior

I expect tab to scroll through selections

Configuration

key value
version 0.99.1
major 0
minor 99
patch 1
branch
commit_hash 8812072f065be283df3e9a81f3945d0364f2f247
build_os macos-aarch64
build_target aarch64-apple-darwin
rust_version rustc 1.79.0 (129f3b996 2024-06-10)
rust_channel 1.79.0-aarch64-apple-darwin
cargo_version cargo 1.79.0 (ffa9cf99a 2024-06-03)
build_time 2024-10-22 18:30:13 -03:00
build_rust_channel release
allocator mimalloc
features default, sqlite, trash
installed_plugins polars 0.99.0
sholderbach commented 2 days ago

Are any of the other completion options playing into it? What is your $env.config.completions record?

KAAtheWiseGit commented 2 days ago

Yeah, it must be something else in the configuration, because I have an identical keybinding, and it works correctly in Vi mode (Linux, also 0.99.0)

NotTheDr01ds commented 2 days ago

I've seen the issue in 0.98.1 (late builds) - I still haven't updated to 0.99 or 0.99.1. I can't reproduce it now, though.

maxim-uvarov commented 2 days ago

@sholderbach, yes!

$env.config.completions.partial = true breaks completions for me.

if I set to $env.config.completions.partial = false - all works as expected.

Here is my full config just in case:

> $env.config.completions                           
╭────────────────┬────────────────────────╮
│ sort           │ smart                  │
│ case_sensitive │ false                  │
│ quick          │ false                  │
│ partial        │ true                   │
│ algorithm      │ fuzzy                  │
│                │ ╭─────────────┬──────╮ │
│ external       │ │ enable      │ true │ │
│                │ │ max_results │ 100  │ │
│                │ │ completer   │      │ │
│                │ ╰─────────────┴──────╯ │
│ use_ls_colors  │ false                  │
╰────────────────┴────────────────────────╯
sholderbach commented 2 days ago

Mhh, for me it works with partial but I have quick: true and the basic prefix algo.

> $env.config.completions
╭────────────────┬─────────────────────────────────╮
│ sort           │ smart                           │
│ case_sensitive │ false                           │
│ quick          │ true                            │
│ partial        │ true                            │
│ algorithm      │ prefix                          │
│                │ ╭─────────────┬───────────────╮ │
│ external       │ │ enable      │ true          │ │
│                │ │ max_results │ 100           │ │
│                │ │ completer   │ <Closure 398> │ │
│                │ ╰─────────────┴───────────────╯ │
│ use_ls_colors  │ true                            │
╰────────────────┴─────────────────────────────────╯
fdncred commented 2 days ago

Mine is the same as sholderbach's but without the completer closure and it works fine on macos and windows. However, if I set quick to false, it stops working. e.g. I can only tab to 2 places.