Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export function location #128

Open
infinisil opened this issue May 24, 2024 · 1 comment
Open

Export function location #128

infinisil opened this issue May 24, 2024 · 1 comment

Comments

@infinisil
Copy link
Collaborator

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.

@hsjobeki
Copy link
Collaborator

hsjobeki commented Jun 10, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants