Description
Is your feature request related to a problem? Please describe.
Using Nix, especially working on Nixpkgs, involves an awful lot of grepping over the Nixpkgs code to find definitions. It would be great to have it in the editor instead.
Describe the solution you'd like
I think there are some pretty simple heuristics that would work for the majority of cases here:
-
If the entire file is a function expression, heuristics can be used:
pkgs
andlib
have obvious assumed referents, and an argument that matches a Nixpkgs attribute could be assumed to come fromcallPackage
; there might be some subtleties around ecosystem‐specificcallPackage
functions here, but it should at least work reliably for things inpkgs/by-name
. (There’s also things like NixOS tests which don’t have this exact form but have a similar predictable structure, but that’s probably not very important for a basic implementation of this feature.) -
In a flake
outputs
definition,nixpkgs
(and perhaps variants likenixpkgs-‹version›
) could be assumed to match the structure of the Nixpkgs flake. -
support completions for lib #495
lib.‹name›
could be treated equivalently for Nixpkgs library definitions. -
Option definitions can be inferred in the same way they are for completion, though
home-manager
options suggested innixosConfigurations
and vice-versa #486 complicates this in the case where there’s ambiguity.
This could also enable documentation‐on‐hover for these (nixdoc for library functions, description
/longDescription
/etc. for packages, and the native option documentation), which would be fantastic!
Describe alternatives you've considered
Continue getting really fast at using ripgrep :)
Activity