-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Completion of filenames containing # does not quote them #6741
Comments
Hi all, I suppose there are a few solutions here. In this context, the parsing code in lex.rs unconditionally handles nushell/crates/nu-parser/src/lex.rs Lines 318 to 343 in 3782483
As @lheckemann suggests, ensuring that filenames containing Another option to make the parser and file completion consistent here would be to ensure that On my own machine with zsh, it seems that preceding whitespace is required for commenting: > ls#maybe_comment
zsh: command not found: ls#maybe_comment which obviously differs from current nu behavior: > ls#maybe_comment
{runs the `ls` command} I think I like @lheckemann's approach more, but am curious if people think there's a need to stay consistent with how other shells do things. Played around a bit with the second approach (more than anything just to practice Rust), so I could also clean that up and submit a PR as well. Thanks for any thoughts! 1By "whitespace" I mean at least nushell/crates/nu-parser/src/lex.rs Lines 344 to 346 in 3782483
|
I think to make this unambiguous in this case we should be adding the quotes when selecting the particular suggestion from the completion as @lheckemann suggests. But your point @jake-albert about maybe being a bit more strict about tokenization for comments might be worth thinking about with the parser going forward (cc @jntrnr). As comments are load-bearing in nushell for integrated documentation they should behave properly in most contexts. |
If changing the language to make the hash symbol less commenty is on the table, I'm all for it! I use Nix a lot, and its new CLI uses |
# Description Fixes #6741. Autocompleting a dir/file named something like foo#bar will now complete to \`foo#bar\`
Describe the bug
Completing filenames containing a
#
will result in a command containing an unescaped #, which ends earlier than intended/expected.How to reproduce
touch "file#foo"
rm file
and press tabExpected behavior
Complete
file
to something that correctly references the file, such as"file#foo"
.Screenshots
Configuration
Additional context
No response
The text was updated successfully, but these errors were encountered: