Provide completions for Nushell #1064
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR provides completions for
zandzi. Nushell no longer uses external completers for internal commands since v0.103 (release notes), so people's old external Zoxide completers won't work anymore.This completer uses the options
completion_algorithm: "prefix", positional: false.positionalwas deprecated in 0.104 in favor ofcompletion_algorithm: "substring". However, I chose not to use thesubstringalgorithm because it won't work in older versions of Nushell. Also, this completer will probably end up being updated in a few Nushell releases anyway (some improvements to Nushell's completers are planned).This completer also looks a little weird if you type in multiple arguments. If you type in
z /foo bar<TAB>, all the completions you see will have everything up to and including the first/foostripped. It's not great, but it's needed because custom completers in Nushell can't currently choose which span they want to replace. Without it, if your first result upon typingz /foo bar<TAB>were/foo/bar, hitting Enter would replace your command line withz /foo /foo/bar, which is incorrect.