-
Notifications
You must be signed in to change notification settings - Fork 103
Suggest function in unknown extension function errors #1280
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
Merged
Conversation
This file contains hidden or 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
Signed-off-by: Adrian Palacios <accorell@amazon.com>
Signed-off-by: Adrian Palacios <accorell@amazon.com>
Signed-off-by: Adrian Palacios <accorell@amazon.com>
Signed-off-by: Adrian Palacios <accorell@amazon.com>
john-h-kastner-aws
approved these changes
Oct 21, 2024
#[error("`{0}` is not a valid function")] | ||
UnknownFunction(ast::Name), | ||
#[error("`{id}` is not a valid function")] | ||
UnknownFunction { |
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.
Leaving a note for other reviewers: while including the fields directly on the variant isn't generally our convention, the ToASTErrorKind
enum is not publicly exported, and other variants on the enum use the same setyle.
Signed-off-by: Adrian Palacios <accorell@amazon.com>
Signed-off-by: Adrian Palacios <accorell@amazon.com>
Signed-off-by: Adrian Palacios <accorell@amazon.com>
792637f
to
62dc8ce
Compare
john-h-kastner-aws
approved these changes
Oct 22, 2024
shaobo-he-aws
approved these changes
Oct 22, 2024
4 tasks
john-h-kastner-aws
approved these changes
Oct 22, 2024
john-h-kastner-aws
approved these changes
Oct 23, 2024
4 tasks
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.
Description of changes
This PR extends unknown function errors with a hint that suggests the closest function from the ones available based on the fuzzy string matching algorithm used to make similar suggestions. With this change, the example in #332 now also shows the help message
Did you mean `ip`?
in its diagnostics.Resolves #332
Callouts
This PR does not deal with #246, a similar request for methods instead of functions. But I'm planning on fixing it right after this one's cleared.
Checklist for requesting a review
The change in this PR is (choose one, and delete the other options):
cedar-policy
.I confirm that this PR (choose one, and delete the other options):
I confirm that
cedar-spec
(choose one, and delete the other options):I confirm that
docs.cedarpolicy.com
(choose one, and delete the other options):