Open infinisil opened 6 months ago
A 100% correct solution needs access to the evaluator and the ast including the comments.
(At least i am not aware how a generic solution that doesnt predict the structure of i.e. nixpkgs/lib/*.nix files)
A solution that works with "file convention" may work with static analysis only. But nixpkgs isnt that strict (yet).
An example:
let
/** Documentation is here */
result = { myFunction = x: x; };
in
mapAttrs' (name: value: nameValuePair ("foo_" + name) value ) result
In nixpkgs we sometimes have wrapping functions, and sometimes we dynamically create the binding.
Nixpkgs currently uses some hacky Nix code to figure out the locations of functions, when nixdoc would have a really easy time to export this information, which would then allow removing the hacks.