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

Take the ancestor path into account when env-completing from uncles. #1661

Merged
merged 5 commits into from
Oct 5, 2023

Conversation

jneem
Copy link
Member

@jneem jneem commented Sep 30, 2023

Consider the following input, which I think follows a pretty common pattern:

{ foo = { bar = { ba‸ } } } | { foo.bar.baz | default = 1 }

(with denoting the cursor). This will use env completion, getting possible completions from the parent nodes in the AST, along with the "great-uncle" node {foo.bar.baz | default = 1}. So we should offer the bar completion because it's defined in the parent record. But we should also include baz as a completion because our great-uncle defines foo.bar.baz and our path relative to our grandparent is foo.bar.

This PR implements some extra path tracking when traversing the parent chain, adding these extra completions.

As an extra small thing, it discards completions if their only occurence is at the cursor itself. This prevents us from offering ba as a completion in the example above.

@github-actions github-actions bot temporarily deployed to pull request September 30, 2023 04:08 Inactive
@github-actions github-actions bot temporarily deployed to pull request October 2, 2023 16:38 Inactive
@jneem jneem requested review from yannham and vkleen October 2, 2023 17:40
@github-actions github-actions bot temporarily deployed to pull request October 2, 2023 17:44 Inactive
@jneem jneem requested a review from Radvendii October 2, 2023 18:16
@github-actions github-actions bot temporarily deployed to pull request October 2, 2023 22:18 Inactive
@jneem jneem added this pull request to the merge queue Oct 5, 2023
Merged via the queue into master with commit cc8f4e0 Oct 5, 2023
5 checks passed
@jneem jneem deleted the completion-parent-paths branch October 5, 2023 00:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants