lf- / nix-doc

An interactive Nix documentation tool providing a CLI for function search, a Nix plugin for docs in the REPL, and a ctags implementation for Nix script

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to search for nested functions, like rustPlatform.buildRustPackage

afreakk opened this issue · comments

commented

I tried

nix-doc rustPlatform.buildRustPackage

but it gives me nothing.
Maybe im missing something

commented

@afreakk this tool is too dumb for that 😆

It searches the regex in all defined sets in the given directory, which inherently cannot do that. You can try out the recently added Nix plugin, which may do what you want (it may equally not, because the plugin is not smart enough to work with stuff with sets having __functor and other indirections). These limitations are unfortunately the result of Nix not having a documentation implementation that can cross wrapper functions and this project being, at a fundamental level, a hack that still is usually a vast improvement over the previous situation.

I should add a link to related works in the readme but as I learned after writing this, adding a similar feature to Nix proper died to a bikeshed over what markup language to use for comments, and there was actually a pull request adding it natively in 2018 that didn't get merged. As far as I'm aware, that implementation also had similar limitations.

commented

Update two: The new ctags implementation can also find non-function or nested things, but again, it is not very clever about it :P