Option Completion Missing Inside `attrsOf submodule` Body
bug
## Summary
`nixd` knows the options for an `attrsOf submodule` value and completes them after a dotted attr path, but does not offer the same completions inside the equivalent attrset body.
This is reproducible with built-in NixOS options such as `users.users.<name>`.
## Expected Behavior
In this NixOS config:
```nix
{
users.users.alice = {
# cursor here
};
}
```
Triggering completion inside `alice = { ... };` should offer the user submodule options, for example:
```text
isNormalUser
isSystemUser
home
description
extraGroups
shell
packages
openssh
```
Those options are available when completing after the equivalent dotted attr path:
```nix
users.users.alice.
# or
users.users = {
alice.
};
```
## Actual Behavior
Inside the attrset body, completion does not show the relevant submodule options. After the equivalent dotted attr path, completion does show them. So the option information appears to be available, but not applied at the nested attrset body cursor position.
## Reproduction
`flake.nix`:
```nix
{
description = "nixd attrsOf submodule completion reproduction";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11";
};
outputs =
{ nixpkgs, ... }:
{
nixosConfigurations.control = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./configuration.nix
];
};
};
}
```
`configuration.nix`:
```nix
{ ... }:
{
users.users.alice = {
# Trigger completion here
};
}
```
VS Code / Cursor `nixd` config:
```json
{
"nix.enableLanguageServer": true,
"nix.serverPath": [
"nixd",
"--nixos-options-expr",
"(builtins.getFlake \"path:/absolute/path/to/repro\").nixosConfigurations.control.options"
]
}
```
## Option Tree Verification
The evaluated option tree contains the expected submodule fields:
```bash
nix eval --json --impure --expr '
builtins.attrNames (
(builtins.getFlake "path:/absolute/path/to/repro")
.nixosConfigurations.control.options.users.users.type.nestedTypes.elemType
.getSubOptions [ "users" "users" "alice" ]
)
'
```
Returns options including:
```text
createHome
description
enable
extraGroups
group
home
isNormalUser
isSystemUser
openssh
packages
shell
uid
```
This matches the options shown after completing `users.users.alice.`.
## Environment
- `nixd` version: `2.6.4`
- Editor: VS Code / Cursor with `jnoortheen.nix-ide`
- `nixpkgs`: `nixos-25.11`
0 条评论