I've heard LightTable is doing something like this, but never had a time to properly evaluate it and see for myself.
Also, JetBrains' IDEs (IntelliJ IDEA, PyCharm, etc.) are notorious to have good understanding of code semantics, both out of the box and through plugin system.