Fix  "Open Type Hierarchy"

This pull request fixes a bug with "Open Type Hierarchy" and improves support for Scala objects.

@dragos I'll rebase as soon as ca4451bbb2d49765fe0b0be5de61c735c8fbd7e0 is merged to master.