For the current this means the somethin will raise a type error
const something = ...
console.log(somethin)
However the current error is
error:
┌─ demo.tsx:799:12
│
799 │ const a = not_found
│ ^^^^^^^^^ Could not find variable 'not_found' in scope
It would be better for the error to include possible alternatives that are in scope:
error:
┌─ demo.tsx:799:12
│
799 │ const a = not_found
│ ^^^^^^^^^ Could not find variable 'not_found' in scope
│
| Did you mean `found` or `is_found`
I started on this, but didn't finish. You can add the possible fields to the TypeCheckerError::CouldNotFindType, use the levenshtein crate to find similar names and parents_iter().map(|env| env.variables) to find some similar variables names (+ same for types)
When a variable name cannot be found an error is raised
For the current this means the
somethin
will raise a type errorHowever the current error is
It would be better for the error to include possible alternatives that are in scope:
I started on this, but didn't finish. You can add the
possible
fields to theTypeCheckerError::CouldNotFindType
, use thelevenshtein
crate to find similar names andparents_iter().map(|env| env.variables)
to find some similar variables names (+ same for types)https://github.com/kaleidawave/ezno/blob/5191329edd448c364914917297bef2846527b91b/checker/src/diagnostics.rs#L293-L298
https://github.com/kaleidawave/ezno/blob/5191329edd448c364914917297bef2846527b91b/checker/Cargo.toml#L40