But you need some user testing, and maybe some ML.
I mean, the machine needs to train enough to know that when the user types "string.len" they really mean "size(string)" and it can't just follow the alphabet anymore.
Of course then you have to deal with the case where the suggestion is subtly wrong (e.g. amount.add(increment) was intended to mutate the amount, while Number.plus is a pure function) and the programmer might not spot it, if they were unfamiliar with the correct usage in the first place. Now we are firmly in research territory, I think.
1. Do it in the cloud somewhere. You probably want to do this anyway so you can learn from everyone.
2. Now you can't indefinitely keep everyone's code in the cloud (as kite is learning), so you take the most common use cases and privacy minded coders can download those to their desktop.
3. Of course languages are constantly evolving so the "cloud archive" will always be live and learning from everyone
By the way, you would "learn" a mapping when someone searches for "len, length, .len" and so on but they finally settle on "size" so you would have the input and the correctly labeled target from people's code. You do have to watch them programming in practice though.
For the subtle variations, it would hopefully give you a list of suggestions in order of usage.
In 5 years, once average computers are very fast, you will get something like.
len -> did you mean size()
based on the fact that so many other people have entered that.
I am sure there are other ideas besides that haven't even occurred to us.