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

auto-complete default value for option #512

Open
KiaraGrouwstra opened this issue May 28, 2024 · 4 comments
Open

auto-complete default value for option #512

KiaraGrouwstra opened this issue May 28, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@KiaraGrouwstra
Copy link

KiaraGrouwstra commented May 28, 2024

Is your feature request related to a problem? Please describe.
with #415 we got an auto-complete for options based on their example values.
some options lack such an example tho, leaving us without an auto-complete option.

Describe the solution you'd like
allow an option's default value as an auto-complete option.

Describe alternatives you've considered
complete the value manually.

@inclyc
Copy link
Member

inclyc commented May 28, 2024

allow an option's default value as an auto-complete option.

Previously I'd like to use the default as an auto-complete options. However, these values I think might be somehow different than example, and I think example is better.

Because: literalExpression in example, that's technically easier to evaluate than raw nix expressions in default.

some options lack such an example tho, leaving us without an auto-complete option.

I think the correct solution is to add such missing examples, agree?

@inclyc inclyc added the enhancement New feature or request label May 28, 2024
@KiaraGrouwstra
Copy link
Author

i think a lot of the time we're using options we don't control directly, like the ones in nixpkgs or home-manager.
that applies for example when new users are configuring their system: they might not immediately be submitting patches to the upstream yet, while i think they might already benefit from LSP features making it easier for them to configure their system.

fair point on example being easier to evaluate tho. 🙈

@inclyc
Copy link
Member

inclyc commented May 28, 2024

being easier to evaluate tho.

In current architecture designed in nixd, there are only values obtained from nix evaluator, not the raw expression. Thus, for example, if the default field is an attrset, or an lambda, should we evaluate it deeply?

If so, will it recurse infinitely ? In nix language there is indeed some values infinitely loop with other values, but there are no deterministic way to detect though.

So in my opinion literalExpression is the best practice!

@KiaraGrouwstra
Copy link
Author

hm, i guess i don't know a lot about this - i was thinking most of the time the default values might not be very complicated. so maybe i should ask: what does deeply evaluating a value like an attrset or a lambda mean here?

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

No branches or pull requests

2 participants