Imported commands cannot be used in extern/command definition completions
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 40.5k
- Forks
- 2.3k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 85
Description
Describe the bug
If you are importing a command (use <module> <command> or using the [<command>] notation), Nushell v0.79.0 will throw an error if you try to use it in an extern or command definition's parameter/flag autocompletion (string@<command>).
How to reproduce
- Create a module that exports a completion command
- Create a module that imports the completion command and exports an extern
- In the extern, write its first parameter like
foo: string@<completion command>
Expected behavior
Nushell should not throw an error if an imported command is used in a parameter/flag autocompletion.
Screenshots
Configuration
| key | value |
|---|---|
| version | 0.79.0 |
| branch | |
| commit_hash | |
| build_os | macos-aarch64 |
| build_target | aarch64-apple-darwin |
| rust_version | rustc 1.68.2 (9eb3afe9e 2023-03-27) (built from a source tarball) |
| cargo_version | cargo 1.68.1 (6feb7c9cf 2023-03-26) |
| build_time | 2023-04-25 20:06:17 +00:00 |
| build_rust_channel | release |
| features | default, zip |
| installed_plugins |
Additional context
Below are the contents of the files surrounding this error:
ssh.completions.nu
export def "nu-complete ssh destination" [] {
open `~/.ssh/config`
| lines
| where $it starts-with `Host `
| each { parse `Host {destination}` }
| flatten
| $in.destination?
| where not ($it | is-empty)
| default []
}
ssh.externs.nu
use ssh.completions.nu `nu-complete ssh destination`
extern ssh [
destination: string@'nu-complete ssh destination'
]
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the error using the provided ssh.completions.nu and ssh.externs.nu examples, focusing on the imported nu-complete ssh destination command used in the extern parameter. Trace the command-resolution path for imported completion commands; done means the extern loads and completion works without an error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, shell
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100