nix-community / rnix-lsp

WIP Language Server for Nix! [maintainer=@aaronjanse]
MIT License
708 stars 41 forks source link

enable tooling within lambda bodies #66

Closed aaronjanse closed 2 years ago

aaronjanse commented 2 years ago

This minimally implements parsing of lambdas, just enough to allow climb_expr to look inside a lambda's body. Although the evaluator in this PR doesn't understand lambda arguments, existing fallback to static analysis still allows goto-definition for arguments.

Because many Nix files are lambdas, this PR will significantly increase the number of files that evaluation tooling will be work on.

For example:

{ hello }:

# basic tooling now works here
rec {
    foo.bar = 13;
    xyz = foo;
    bbb = hello;
    abc = xyz.bar;
}.xyz.bar
aaronjanse commented 2 years ago

Hmm, actually this seems to not work as well as I hoped. I'll debug

aaronjanse commented 2 years ago

Ah okay, I think this PR is fine. I just need to rewrite some of the error handling in attribute set parsing, since it's failing too eagerly

aaronjanse commented 2 years ago

We should figure out #68 before considering this PR

aaronjanse commented 2 years ago

This PR exposes some evaluator UI issues, so I'm closing it for now. I'll re-open it once we figure out when to show hover values and fix error handling in the parser