oxalica/nil

`pack_bindings` action unavailable unless nested attrset already exists

montchr opened this issue · 0 comments

When the cursor (marked by |) is on one of the inputs attributes [edit: or one of its direct children?], I would expect the pack_bindings code action to be available:

{
  inp|uts.nixos-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
  inputs.nix|os-stable.url = "github:NixOS/nixpkgs/nixos-23.11";
  inputs.nix|pkgs.follows = "nixos-unstable";

  outputs = _: { };
}

But pack_bindings only becomes available when the cursor is on an existing nested attrset form:

{
  inputs.nixos-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
  inputs.nixos-stable.url = "github:NixOS/nixpkgs/nixos-23.11";
  inputs.nixpkgs.follows = "nixos-unstable";
  inp|uts = { };

  outputs = _: { };
}

That is fine in the minimal example. But when there are many attrs I would like to act upon, it becomes more difficult (for example, when dealing with the nested attributes of many inputs.<name> attributes).

This behavior is especially strange to me because I have a sense that this changed some time in the past few months. Though it is also very possible that I am mistaken.

If it matters, I am using the nil flake package within Emacs+Eglot.