kaleidawave / ezno

A fast and correct TypeScript type checker and compiler with additional experiments
https://kaleidawave.github.io/posts/introducing-ezno/
MIT License
2.55k stars 47 forks source link

List possible variables, types, properties and imports when cannot find reference #180

Closed vHugoObject closed 3 months ago

vHugoObject commented 3 months ago

For #166. A get_closest function was added using the levenshtein crate. This function is used to create a list of possible variables, types, properties and imports when a cannot find reference error is raised. The specification tests have been updated to reflect the new error message. I would like to note that in the code, there are currently two functions that can be used to raise a cannot find reference error for properties: PropertyDoesNotExist and ExcessProperty. My pull request only makes changes to the PropertyDoesNotExist. ExcessProperty would need lifetime annotations for a "possibles" variables, which would have required a bigger revision of the TypeCheckWarning enum.

kaleidawave commented 3 months ago

Awesome! Thanks for the changes, all looks good. Especially for going the extra mile to add suggestions for properties and files.

Clippy error seems to be caused by new Rust update, so will ignore for now.

In the future may change the testing and diagnostics but won't fuss about that for now.