nushell.github.io icon indicating copy to clipboard operation
nushell.github.io copied to clipboard

Outdated external zoxide completer

Open blindFS opened this issue 9 months ago • 2 comments

Some users reported that the config in https://www.nushell.sh/cookbook/external_completers.html#zoxide-completer is no longer working in nu 0.103.

That is because I disabled external completer for arguments of internal commands in https://github.com/nushell/nushell/pull/15086.

IMO, it's not a great idea to resort to the external completer for internals. If we can agree on that, that part of the documents need to be updated then. Maybe just delete that section, I'm not sure.

blindFS avatar Mar 24 '25 05:03 blindFS

IMO, it's not a great idea to resort to the external completer for internals. If we can agree on that, that part of the documents need to be updated then.

We discussed this in the meeting yesterday, and we generally agree this is a good way forward. We would also really like to see spans being passed to internal completers, similar to how external completers work, rather than just a context string.

I think we could also provide a completer (in the cookbook, or maybe in std?) that would allow people to use their external completer for an internal command (similar to the old behavior) if they really wanted to, like so:

def "nu-complete external" [context: string] {
  do $env.config.completions.external.completer ($context | split row " ")
}

# my cool ssh wrapper
def ssh [...rest: string@"nu-complete external"] {
  ^ssh ...$rest
}

ssh <TAB>
# auto-complete results from carapace, in my case

132ikl avatar Mar 27 '25 21:03 132ikl

We discussed this in the meeting yesterday, and we generally agree this is a good way forward. We would also really like to see spans being passed to internal completers, similar to how external completers work, rather than just a context string.

Does that mean another breaking change, or something like splitting string into spans if the argument type is list instead of string?

I think we could also provide a completer (in the cookbook, or maybe in std?) that would allow people to use their external completer for an internal command (similar to the old behavior) if they really wanted to, like so:

def "nu-complete external" [context: string] { do $env.config.completions.external.completer ($context | split row " ") }

my cool ssh wrapper

def ssh [...rest: string@"nu-complete external"] { ^ssh ...$rest }

ssh <TAB>

auto-complete results from carapace, in my case

That's cool, should I add that example to external_completer.md and link it to custom_completions.md?

blindFS avatar Mar 28 '25 02:03 blindFS