oxalica / nil

NIx Language server, an incremental analysis assistant for writing in Nix.
Apache License 2.0
1.28k stars 39 forks source link

Option-completion in inlined modules? #103

Open Ma27 opened 1 year ago

Ma27 commented 1 year ago

While a lot of modules are in their own files, it's also possible to inline them in e.g. a flake.nix:

{
  description = "foobar";
  outputs = { self, nixpkgs, ... }: {
    nixosModules.default = { lib, ... }: {
      services.|
    };
  };
}

Right now (as of 97abe7d3d48721d4e0fcc1876eea83bb4247825b) there's no completion for option-names at the |-symbol in the example above. A similar case can be observed when using imports or mkMerge:

{ lib, ... }: {
  imports = [
    ({ config, ... }: {
      # no completion in here
    })
  ];
}
{ lib, ... }: {
  services = lib.mkMerge [{
    # no completion in here
  }];
}
oxalica commented 12 months ago
```nix
{
  description = "foobar";
  outputs = { self, nixpkgs, ... }: {
    nixosModules.default = { lib, ... }: {
      services.|
    };
  };
}
{ lib, ... }: {
  imports = [
    ({ config, ... }: {
      # no completion in here
    })
  ];
}

These are doable, I think. But some extra work should be done to correctly handle recursive types.

{ lib, ... }: {
  services = lib.mkMerge [{
    # no completion in here
  }];
}

This is a dup of #104.