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

nixpkgs completion and goto only work in lists #471

Closed
ibrokemypie opened this issue Apr 28, 2024 · 4 comments
Closed

nixpkgs completion and goto only work in lists #471

ibrokemypie opened this issue Apr 28, 2024 · 4 comments
Labels
enhancement New feature or request libnixf:sema Semantic analysis in libnixf

Comments

@ibrokemypie
Copy link

If I write the following, nixd will autosuggest package names, include docs about them and allow me to jump to their definitions:

{pkgs}:
{
  asdf = with pkgs; [asdf];
}

However, if I write something like below, none of these features work anymore

{pkgs}:
{
  asdf = pkgs.asdf;
}

No idea why this is happening, it feels like a bug but it could be a misconfiguration, I do not know.

@inclyc
Copy link
Member

inclyc commented Apr 28, 2024

bool nixd::havePackageScope(const Node &N, const VariableLookupAnalysis &VLA,

This is not a bug nor misconfiguration, but an un-implemented feature.

For a long time C++ part in this project has only one developer, so there is no complex 'idiom' matching stuff implemented. Thus nixd currently only provides package information, by stupid with pkgs; arrays, it even not check whether pkgs is actually nixpkgs or not.

@inclyc
Copy link
Member

inclyc commented Apr 28, 2024

Note: previously (version 1.x) nixd will perform precise eval, allowing end-users do any kind of 'goto-def', but requires some configuration stuff.

Then people complained:

"I don't want to configure nixd each project"

"other lsps work out of box!"

So let's do less configuration, but 'eval' will not be very precise. That's somehow a trade-off result.

@inclyc
Copy link
Member

inclyc commented Apr 28, 2024

In conclusion I do think 'ExprSelect' like (pkgs.) should be implemented, but this is hard with incremental eval, and not yet landed.

@inclyc inclyc added the enhancement New feature or request label Apr 28, 2024
@inclyc inclyc changed the title nixpkgs completion and goto only work in arrays nixpkgs completion and goto only work in lists Apr 28, 2024
@inclyc inclyc added the libnixf:sema Semantic analysis in libnixf label Apr 28, 2024
@inclyc
Copy link
Member

inclyc commented Jul 17, 2024

Fixed in #544

@inclyc inclyc closed this as completed Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request libnixf:sema Semantic analysis in libnixf
Projects
None yet
Development

No branches or pull requests

2 participants