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):
[x] A bug fix or other functionality change requiring a patch to cedar-policy.
I confirm that this PR (choose one, and delete the other options):
[x] Updates the "Unreleased" section of the CHANGELOG with a description of my change (required for major/minor version bumps).
I confirm that cedar-spec (choose one, and delete the other options):
[x] Does not require updates because my change does not impact the Cedar formal model or DRT infrastructure.
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):