Skip to content
This repository has been archived by the owner on Jan 25, 2024. It is now read-only.

add autocomplete via evaluation #65

Closed

Conversation

aaronjanse
Copy link
Member

Summary & Motivation

This allows users to auto-complete based on evaluation. This is especially helpful for selecting from attribute sets.

This PR prioritizes existing static analysis completions over completions provided by the evaluator, since existing functionality is known to work well.

Auto-complete for the evaluator shows up immediately after pressing the period key. This does not work for the static builtins. I looked into changing that, but I think it would require enough effort to warrant a separate (but still small) PR.

Further context

This depends upon graceful error handling in rnix-parser. I've been testing this PR with nix-community/rnix-parser#34 (see the comments this PR adds to the Cargo.toml for details on patching rnix-parser while developing).

@aaronjanse aaronjanse added the enhancement New feature or request label Nov 16, 2021
@aaronjanse aaronjanse requested a review from Ma27 November 16, 2021 07:17
@@ -43,12 +43,23 @@ impl Expr {
/// rnix::SyntaxNode isn't recognized, we don't get tooling for its children.
pub fn parse(node: SyntaxNode, scope: Gc<Scope>) -> Result<Self, EvalError> {
let range = Some(node.text_range());
let recurse_box = |node| Expr::parse(node, scope.clone()).map(|x| Box::new(x));
let recurse_gc = |node| Expr::parse(node, scope.clone()).map(|x| Gc::new(x));
// We don't want to use ? because that would make a parent fail
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to move this into a separate PR

@aaronjanse
Copy link
Member Author

To minimize confusion, I'll close this PR then re-open it when its dependency PRs are merged

@aaronjanse aaronjanse closed this Nov 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant