-
Notifications
You must be signed in to change notification settings - Fork 88
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
Add support for LSP completion using the surrounding context #1057
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Also adds support for record contracts represented by record static access.
vkleen
approved these changes
Jan 26, 2023
yannham
approved these changes
Jan 26, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Nice trick to get the parent node by just looking on the left, giving a logarithmic time algo at worst.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request adds support for auto-completion based on the context (from a record, type, or contract.)
Case 1
Say we have the following:
With this change, if the contract
SchemaFromNix
, represents a record or dictionary contract, we will get completion corresponding to its fields.Case 2
This will for work not only for basic records, but also for nested records:
Here, we would get a completion based on the fields of
Tf.Config.config.data.dhall.my_dhall_resource
, if it is a record dictionary contract.Case 3
This also includes support for nested record completion based on the context contract.
In this case, we would get completion based on the fields of
Tf.Config.config
, if it is a record or dictionary contract.Additional improvements
1. Adds error recovery if parsing record fields fails
2. Adds support for completion when we have a dictionary contract: say we have the following:
This doesn't get a completion, becuase the dictionary has dynamic fields, but when we do this:
We will get a completion
3. Adds support for contracts represented by variables or static record access (See #998)
Closes #995, Closes #998