-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Open
Labels
A:aliasIssues around support for command aliases, touches parser and name resolutionIssues around support for command aliases, touches parser and name resolutionA:completionsIssues related to tab completionIssues related to tab completioncategory:bugSomething isn't workingSomething isn't workingpanic
Description
Describe the bug
i started playing with the zk note manager and did the following
- define the notebook location with
let-env ZK_NOTEBOOK_DIR = ($env.XDG_DATA_HOME | path join "zk" "notes")- initialize a notebook at that location with
zk init $env.ZK_NOTEBOOK_DIR- add some notes in there
✔️ this works fine
now i want to track this notebook and all the files in there from outside the directory, with an alias
Note
one can control agitrepo from anywhere withgit -C /path/to/repo/
alias "zk git" = git -C $env.ZK_NOTEBOOK_DIRallowing me to run things like
> zk git status
> zk git push❌ this is where i get the bug when trying to autocomplete...
How to reproduce
✔️ a failing case
Note
see the full recording here
- run
RUST_BACKTRACE=full nu - define the location of the notebook with
let-env ZK_NOTEBOOK_DIR = "/tmp/notes" - get my notes with
git clone https://github.com/amtoine/notes.git $env.ZK_NOTEBOOK_DIR=> i have trouble reproducing all this without azkrepo and its the easiest way for you to test this without installingzkand setuping that yourself 👀 - define the problematic alias with
alias "zk git" = git -C $env.ZK_NOTEBOOK_DIR - start typing
zk git add(with the space at the end) - try to autocomplete with
TAB - see the error
thread 'main' panicked at 'Can't create a Span whose end < start, start=18446744073709551601, end=11', /home/amtoine/.local/share/cargo/git/checkouts/reedline-e42026a78d91c510/03fdb00/src/completion/base.rs:18:9
stack backtrace:
0: 0x5557f1550aa5 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h3155a8c966b4beb5
1: 0x5557f0a0a90e - core::fmt::write::h062c617411b691df
2: 0x5557f1549345 - std::io::Write::write_fmt::hb61fdf1275c61e1c
3: 0x5557f1550875 - std::sys_common::backtrace::print::hca896ae22beb06cb
4: 0x5557f15525ff - std::panicking::default_hook::{{closure}}::h0b5eeed5cf36ab5f
5: 0x5557f155236a - std::panicking::default_hook::h8932b573145a321b
6: 0x5557f1552c90 - std::panicking::rust_panic_with_hook::h4b1447a24e3e94f8
7: 0x5557f1552a24 - std::panicking::begin_panic_handler::{{closure}}::h8701da9995a3820c
8: 0x5557f1550fbc - std::sys_common::backtrace::__rust_end_short_backtrace::hb696c5ed02a01598
9: 0x5557f1552772 - rust_begin_unwind
10: 0x5557f09a1fc3 - core::panicking::panic_fmt::h8aa706a976963c88
11: 0x5557f1409a92 - reedline::completion::base::Span::new::h3ef46a4fb9a23ed6
12: 0x5557f0b2fad8 - <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold::h2d8ef5a70f3f1e14
13: 0x5557f0b5f157 - <core::iter::adapters::chain::Chain<A,B> as core::iter::traits::iterator::Iterator>::fold::h120d4b42ea24dba6
14: 0x5557f0b1ee0b - <alloc::vec::Vec<T,A> as alloc::vec::spec_extend::SpecExtend<T,I>>::spec_extend::hf4b6e2c7473f5154
15: 0x5557f0b1aa0f - <alloc::vec::Vec<T> as alloc::vec::spec_from_iter_nested::SpecFromIterNested<T,I>>::from_iter::h41daa9ab7ac710b4
16: 0x5557f0b33f10 - nu_cli::completions::command_completions::CommandCompletion::complete_commands::hf862d7ecab2110fd
17: 0x5557f0b34c5a - <nu_cli::completions::command_completions::CommandCompletion as nu_cli::completions::base::Completer>::fetch::hfbc18cdf8f5d07ac
18: 0x5557f0b5744d - nu_cli::completions::completer::NuCompleter::process_completion::h5b9173ae5eb6902d
19: 0x5557f0b58ec5 - nu_cli::completions::completer::NuCompleter::completion_helper::h74006487c0954b3a
20: 0x5557f0b5a6a3 - <nu_cli::completions::completer::NuCompleter as reedline::completion::base::Completer>::complete::h7304d0962ffcd565
21: 0x5557f1412b28 - <reedline::menu::columnar_menu::ColumnarMenu as reedline::menu::Menu>::update_values::h957ad31630cb7291
22: 0x5557f140dec1 - reedline::engine::Reedline::handle_editor_event::h471b4d2f3d0ae982
23: 0x5557f140c023 - reedline::engine::Reedline::read_line::h24f5b3febb8cfbe1
24: 0x5557f0b47022 - nu_cli::repl::evaluate_repl::h12fcbf68f26aea86
25: 0x5557f0b07215 - nu::run::run_repl::h4a8e4d5940d5fe53
26: 0x5557f0b148c2 - nu::main::hb81ab15bd17a3a48
27: 0x5557f0b14fbe - std::sys_common::backtrace::__rust_begin_short_backtrace::hda4b16f4ec94ce29
28: 0x5557f0b160de - std::rt::lang_start::{{closure}}::h3ae7a51bc1763457
29: 0x5557f1542d1b - std::rt::lang_start_internal::hcd7e45acd25ab5ab
30: 0x5557f0b14ec5 - main
31: 0x7fa75d63c790 - <unknown>
32: 0x7fa75d63c84a - __libc_start_main
33: 0x5557f09c7635 - _start
34: 0x0 - <unknown>
❌ a case without any error
Note
see the full recording here
the exact same thing but with
alias "zk git" = git -C /tmp/notesat step 4
Expected behavior
i expected nu not to panick, regardless of the alias being defined with git -C <string> or git -C $env.<variable> 😋
Screenshots
No response
Configuration
| key | value |
|---|---|
| version | 0.75.1 |
| branch | main |
| commit_hash | f3ee8b5 |
| build_os | linux-x86_64 |
| build_target | x86_64-unknown-linux-gnu |
| rust_version | rustc 1.66.1 (90743e729 2023-01-10) |
| rust_channel | 1.66.1-x86_64-unknown-linux-gnu |
| cargo_version | cargo 1.66.1 (ad779e08b 2023-01-10) |
| pkg_version | 0.75.1 |
| build_time | 2023-02-19 11:38:06 +01:00 |
| build_rust_channel | release |
| features | database, default, trash, which, zip |
| installed_plugins | gstat |
Additional context
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A:aliasIssues around support for command aliases, touches parser and name resolutionIssues around support for command aliases, touches parser and name resolutionA:completionsIssues related to tab completionIssues related to tab completioncategory:bugSomething isn't workingSomething isn't workingpanic