Description
Describe the bug
Tab completion is essential for being productive in the repl.
When an expression does not evaluate, tab completion just "ends" without any indication that something went wrong, as if it's an empty attribute set or a primitive value.
This always confuses me for a short amount of time, until I realise that I need to hit enter to see the error.
Please don't stall my brain.
Steps To Reproduce
$ nix repl ~/nixpkgs
nix-repl> n = nixos {}
nix-repl> n.to<TAB>
n.toplevel
nix-repl> n.toplevel<TAB>
n.toplevel
nix-repl> n.toplevel<TAB>
n.toplevel
nix-repl> n.toplevel<ENTER>
error:
Failed assertions:
- The ‘fileSystems’ option does not specify your root file system.
- You must set the option ‘boot.loader.grub.devices’ or 'boot.loader.grub.mirroredBoots' to make the system bootable.
Expected behavior
In my experience with bash completing Nix attribute paths, it's tricky to get them right, so that they balance laziness and minimal completion steps.
It seems that the missing piece here is just to allow printing the error, or actively print the error.
While it's possible to go overboard and have more intricate rules that complete more faster, that runs the risk of producing the error too soon, before the user realises which attribute they entered. Hence the 2 s below.
$ nix repl ~/nixpkgs
nix-repl> n = nixos {}
nix-repl> n.to<TAB>
n.toplevel
nix-repl> n.toplevel<TAB>
error:
Failed assertions:
- The ‘fileSystems’ option does not specify your root file system.
- You must set the option ‘boot.loader.grub.devices’ or 'boot.loader.grub.mirroredBoots' to make the system bootable.
nix-env --version
output
Additional context
Priorities
Add 👍 to issues you find important.