Closed flofriday closed 1 year ago
In this example for example we say that there is no such function like exit(Bool)
which is true, however there is exit(Int)
which might be what the user meant. This would be very handy to show the user.
And similar variables could be found by calculating the Levenshtein distance between the unfound variable and (all others?, depending on how slow this is).
Functions with the same name are now being recommended by the interpreter, however similarly named functions or variables are not.
So I added fuzzy suggestions for strings. For functions the scoring function (needed to sort by relavance) is a bit trickier but I thing I have an idea that might work.
Now also implemented for functions.
I am quite pleased with the results so far, however I made some educated guesses I validated with only a handful of examples. So maybe we will have to update them in the future. However, I don't think there is a perfect answer till we have a general AI 😉
It would be lovely if we could suggest another (similar) variable or function if we cannot find the one the user selected.
I think this is especially necessary with our functions as our current error is kinda misleading and we could easily list all functions with the same name but with different signature.
Finding similar variables might be more tricky as we would need to have word distance implementation finding similar words, but it is certainly doable and would be really impressive.