diff --git a/src/org/ice1000/julia/lang/editing/julia-annotator.kt b/src/org/ice1000/julia/lang/editing/julia-annotator.kt index 49c2d6d8..e5b519c5 100644 --- a/src/org/ice1000/julia/lang/editing/julia-annotator.kt +++ b/src/org/ice1000/julia/lang/editing/julia-annotator.kt @@ -208,8 +208,12 @@ $JULIA_DOC_SURROUNDING } JuliaSymbolKind.FunctionParameter -> holder.createInfoAnnotation(element, null) .textAttributes = JuliaHighlighter.FUNCTION_PARAMETER - JuliaSymbolKind.TypeName -> holder.createInfoAnnotation(element, null) - .textAttributes = JuliaHighlighter.TYPE_NAME + JuliaSymbolKind.TypeName -> { + if (element.isAbstractTypeRef) holder.createInfoAnnotation(element, null) + .textAttributes = JuliaHighlighter.ABSTRACT_TYPE_NAME + holder.createInfoAnnotation(element, null) + .textAttributes = JuliaHighlighter.TYPE_NAME + } JuliaSymbolKind.KeywordParameterName -> holder.createInfoAnnotation(element, null) .textAttributes = JuliaHighlighter.KEYWORD_ARGUMENT else -> { @@ -220,8 +224,12 @@ $JULIA_DOC_SURROUNDING .textAttributes = JuliaHighlighter.CONST_NAME element.isTypeNameRef -> holder.createInfoAnnotation(element, null) .textAttributes = JuliaHighlighter.TYPE_NAME - element.isAbstractTypeRef -> holder.createInfoAnnotation(element, null) - .textAttributes = JuliaHighlighter.ABSTRACT_TYPE_NAME + element.isSuperTypeExpr -> { + val attr = if (element.isAbstractTypeRef) JuliaHighlighter.ABSTRACT_TYPE_NAME + else JuliaHighlighter.TYPE_NAME + holder.createInfoAnnotation(element, null) + .textAttributes = attr + } element.isModuleNameRef -> holder.createInfoAnnotation(element, null) .textAttributes = JuliaHighlighter.MODULE_NAME element.isQuoteCall -> holder.createInfoAnnotation(element.parent diff --git a/src/org/ice1000/julia/lang/psi/julia-navigation.kt b/src/org/ice1000/julia/lang/psi/julia-navigation.kt index c27e4178..4debc5da 100644 --- a/src/org/ice1000/julia/lang/psi/julia-navigation.kt +++ b/src/org/ice1000/julia/lang/psi/julia-navigation.kt @@ -63,10 +63,10 @@ class JuliaGotoDeclarationHandler : GotoDeclarationHandler { JuliaSymbolKind.ApplyFunctionName -> { if (juliaSymbol.text in IGNORED) return null val executor = Executors.newCachedThreadPool() - var result: Array? = null + val result: MutableCollection = arrayListOf() val future = executor.submit { try { - ReadAction.compute?, Throwable> { + ReadAction.compute { project.languageServer.searchFunctionsByName(juliaSymbol.text)?.let { ret -> if (ret.startsWith("__INTELLIJ__")) return@let null val unescaped = StringEscapeUtils.unescapeJava(ret.trim('"')) @@ -82,12 +82,11 @@ class JuliaGotoDeclarationHandler : GotoDeclarationHandler { val psiFile = PsiManager.getInstance(project).findFile(vf) ?: return@mapNotNull null val elem = psiFile.findElementAt(psiOffset + 1) ?: return@mapNotNull null PsiTreeUtil.getNonStrictParentOfType(elem, JuliaCompactFunction::class.java, JuliaFunction::class.java) - }.toTypedArray().also { result = it } + }.toTypedArray().also { result.addAll(it) } } catch (e: Exception) { e.printStackTrace() - result } - } ?: result + } } } catch (e: Exception) { e.printStackTrace() @@ -95,7 +94,8 @@ class JuliaGotoDeclarationHandler : GotoDeclarationHandler { } return try { future?.get(5000, TimeUnit.MILLISECONDS) - result + result.addAll(JuliaTypeDeclarationIndex.findElementsByName(project, juliaSymbol.text)) + result.toTypedArray() } catch (ignored: Throwable) { null }