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
"nix repl" cannot tab-complete names that contain a dash ('-') #1756
Comments
@dtzWill Are you talking about |
|
I came here to report this, now that nix 2 has hit unstable, and It's significantly more of a usability problem than I would have expected at first, due to the combination of dashes commonly occurring as word separators in identifiers and big nested collections like For example, if I want to find emacs packages related to Haskell it's natural to do:
At which point the completion engine notices that every possibility continues with a dash, so it fills that in for me, giving me this:
:( The only way I can see what I want is to delete enough characters so that there are other maatches that don't start with |
Quick testing shows that https://github.com/dtzWill/nix/tree/fix/nix-repl-hyphen resolves your immediate problem. It's what my quick idea for fixing this was but not sure if it has any negative consequences. (in particular dtzWill@cd317fb) |
dtzWill@cd317fb is such a minor change, and does seem to solve the problem. What is the potential downside of merging it? |
Yeah, this is pretty annoying given that the convention for attribute names seems to be moving towards |
I just updated to nix 2.1.3 from nixos-unstable, but still have the issue that any variable names with "-" in them stops all auto-completion (updated with The issue is actually much more painful then described because it stops auto-completion of items in a derivation with a "-" in its name. So, |
The recently-merged move to editline (or whichever)
addresses this problem!
So hopefully in a release or two this'll be fixed by default :).
Otherwise you may want to use a copy built from latest master,
but it's safer to wait for it to reach a stable release.
…On Tue, 04 Dec 2018 17:14:10 -0800, Pfalzgraf Martin ***@***.***> wrote:
I just updated to nix 2.1.3 from nixos-unstable, but still have the issue that any variable names with "-" in them stops all auto-completion (updated with `nix-channel --update; nix-env -iA nixpkgs.nix`).
The issue is actually much more painful then described because it stops auto-completion of items in a derivation with a "-" in its name. So, `pkgs.nodePackages.nodejs-8_x.<tab><tab>` returns nothing. The only workaround I have found is to chain `let`s like this, `let t = pkgs.nodejs-8_x in t.<tab><tab>` so I can inspect derivations.
--
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
#1756 (comment) part: text/html
|
The Problem
Consider default.nix:
Pointing nix-repl at this, completions are as follows:
a
aaa-
Essentially completion here is same as if no input was entered (since linenoise completion callback breaks at dashes on our behalf.)
This is unfortunate (too many suggestions) but not incorrect.
aaa-b
This is just wrong :(.
Linenoise, linenoise-ng, readline?
AFAICT this behavior is the same when using linenoise or linenoise-ng, but does not occur in readline-based
nix-repl
.Solution?
Not sure if there's an easy answer-- perhaps we can punt on linenoise breaking things for us entirely (instead of teaching it how to kinda parse Nix expressions) and handle this in our completion callback?
I'm not sure what other edge cases might be problematic... I suppose spaces after a "dot" should be ignored...? (readline gets this "wrong" as well)
Anyway it doesn't need to be perfect of course but I think a reasonable goal is to reasonably auto-complete the sorts of expressions/attributes commonly used in nixpkgs.
The text was updated successfully, but these errors were encountered: