I'm developing a custom scala like langauge plugin. Implementing "References and resolve" from http://confluence.jetbrains.com/display/IDEADEV/Developing+Custom+Language+Plugins+for+IntelliJ+IDEA#DevelopingCustomLanguagePluginsforIntelliJIDEA-ReferencesandResolve now. I'm trying to understand how to do that for a "proper" language. I checked Scala, GoSu and others but not sure I can understand what exactly is going on there. Explanation from the guide is following: "Resolving references means the ability to go from the usage of an element (access of a variable, call of a method and so on) to the declaration of the element". So I did what it said. I tried to find declaration of the element in current scope, then went one level up, and up and so on. Here is what I ended up with https://gist.github.com/dubik/a9bb09efa5b6d6f211c7 . Am I doing it in a right way?