That kind of auto completion is very easy to do. The problem is when you have references whose creation site you can't trace statically.
Even in Java and C#, arguably the best languages re: deep IDE integration, there are edge cases where the IDE can't know everything (reflection, for instance), but it still does the trick most of the time.