clutcher / bh

Issue tracker for Better Highlights Intellij IDEA plugin
7 stars 0 forks source link

Wikilink not working inside Javadoc comment #48

Closed clutcher closed 1 year ago

clutcher commented 1 year ago

In example below wikilink is not highlighted and Go to reference doesn't work.

/**
 * [[LinkingExample]]
 */
clutcher commented 1 year ago

Investigation: Javadoc is instance of PsiDocCommentImpl, which uses gerReference implmentation from LazyParseablePsiElement, which always returns null instead of WikilinkReference.

To fix highlighting could be used manual resolving in Annotator, for example:

private static PsiReference[] getReferencesFromElement(@NotNull PsiElement element) {
    if (element instanceof PsiDocCommentBase) {
        // [[PsiDocComment]] for JavaDoc implementation always returns null in getReferences().
        // So we need to manually resolve references.
        return ReferenceProvidersRegistry.getReferencesFromProviders(element);
    }
     return element.getReferences();
}

To fix "go to reference" more investigation required.

clutcher commented 1 year ago

Fixed in 2023.7.0