override fun getGotoDeclarationTargets()

in src/main/kotlin/com/github/mkartashev/hserr/java/MyGotoDeclarationHandler.kt [21:45]


    override fun getGotoDeclarationTargets(
        sourceElement: PsiElement?,
        offset: Int,
        editor: Editor
    ): Array<PsiElement>? {
        val project = editor.project
        if (sourceElement?.elementType is HsErrTokenType && project != null) {
            val text = sourceElement.text
            val addr = parseAsAddress(text)
            if (addr != null) {
                return null
//                return getLocationByAddr(project, sourceElement.containingFile, addr)
            } else {
                val name = text
                    .replace('/', '.')// java/lang/Object
                    .substringBefore('(')
                    .substringBefore("\$\$") // ...Class$$Lambda...
                    .substringBefore('$')
                if (isJavaPluginAvailable && SourceVersion.isName(name)) {
                    return getSymbolByName(project, name)
                }
            }
        }
        return null
    }