nix-community / nixd

Nix language server, based on nix libraries [maintainer=@inclyc]
https://github.com/nix-community/nixd
GNU Lesser General Public License v3.0
711 stars 24 forks source link

nixd: url prefetching #461

Open inclyc opened 2 months ago

inclyc commented 2 months ago

Provide URL prefetchers. Automatically fill hash section.

fetchurl {

}
Origami404 commented 1 week ago

Should this feature be implemented as a "code action" that requires manual triggering? The files to be downloaded may be quite large.

inclyc commented 1 week ago

Should this feature be implemented as a "code action" that requires manual triggering? The files to be downloaded may be quite large.

Yes. I'd like to do this in Code Lens, with workspace/executeCommand

inclyc commented 1 week ago

https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_codeLens

inclyc commented 4 days ago

@MangoIV https://github.com/nix-community/nixd/issues/536#issue-2375239352

offer to augment the passed attribute set with the hash computed from prefetching it.

Note that things like fetchFromGithub are actually FODs, not just "fetchers", and require some evaluation. I'm currently on design-review about how to balance between evaluation and fetching by idioms.

I also searched nixpkgs and see there are quite some expressions like:

fetchFromGitHub {
  rev = "v${version}";
}

And thus "version" needs to be evaluated. And...

finalAttrs.version may needs some cross-file analysis.