feat(BaseLangDoc): byte to src
This commit is contained in:
@@ -61,6 +61,10 @@ public class JavaLangDoc extends BaseTagLangDoc<PsiDocComment> {
|
||||
try {
|
||||
@Nullable PsiMethod resolve = psiNewExpression.resolveMethod();
|
||||
if (resolve != null) {
|
||||
PsiElement navElement = resolve.getNavigationElement();
|
||||
if (navElement instanceof PsiMethod) {
|
||||
resolve = (PsiMethod) navElement;
|
||||
}
|
||||
return resolveDocPrint(info, resolve);
|
||||
}
|
||||
} catch (Throwable ignore) {
|
||||
|
||||
@@ -14,23 +14,12 @@ public class PsiMethodToPsiDoc {
|
||||
|
||||
@Nullable
|
||||
static PsiDocComment methodSupperNewPropDoc(@NotNull PsiMethod psiMethod) {
|
||||
// .class
|
||||
@Nullable PsiElement navElement;
|
||||
try {
|
||||
navElement = psiMethod.getNavigationElement();
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
if (navElement instanceof PsiMethod) {
|
||||
psiMethod = (PsiMethod) navElement;
|
||||
}
|
||||
|
||||
@Nullable PsiDocComment docComment = psiMethod.getDocComment();
|
||||
if (docComment != null) {
|
||||
return docComment;
|
||||
}
|
||||
|
||||
// supper
|
||||
// supper recursion
|
||||
@Nullable PsiDocComment superDoc = supperMethodDoc(psiMethod);
|
||||
if (superDoc != null) {
|
||||
return superDoc;
|
||||
@@ -60,7 +49,17 @@ public class PsiMethodToPsiDoc {
|
||||
return null;
|
||||
}
|
||||
for (@NotNull PsiMethod superMethod : superMethods) {
|
||||
@Nullable PsiDocComment superDoc = OwnerToPsiDocUtils.methodDoc(superMethod);
|
||||
// .class
|
||||
@Nullable PsiElement navElement;
|
||||
try {
|
||||
navElement = superMethod.getNavigationElement();
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
if (navElement instanceof PsiMethod) {
|
||||
superMethod = (PsiMethod) navElement;
|
||||
}
|
||||
@Nullable PsiDocComment superDoc = OwnerToPsiDocUtils.methodSupperNewPropDoc(superMethod);
|
||||
if (superDoc != null) {
|
||||
return superDoc;
|
||||
}
|
||||
|
||||
@@ -28,6 +28,14 @@ public class NewCallRefToPsiDoc {
|
||||
// ignore
|
||||
}
|
||||
if (resolve instanceof PsiDocCommentOwner) {
|
||||
try {
|
||||
PsiElement navElement = resolve.getNavigationElement();
|
||||
if (navElement instanceof PsiDocCommentOwner) {
|
||||
resolve = navElement;
|
||||
}
|
||||
} catch (Throwable ignore) {
|
||||
// ignore
|
||||
}
|
||||
return OwnerToPsiDocSkip.refDoc(info, ((PsiDocCommentOwner) resolve));
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -176,6 +176,15 @@ public abstract class BaseLangDoc extends EditorLinePainter {
|
||||
|
||||
public static @Nullable <T extends SettingsInfo> String resolveDoc(@NotNull T info,
|
||||
@NotNull PsiElement psiElement) {
|
||||
try {
|
||||
// byte to src
|
||||
PsiElement navElement = psiElement.getNavigationElement();
|
||||
if (navElement != null) {
|
||||
psiElement = navElement;
|
||||
}
|
||||
} catch (Throwable ignore) {
|
||||
// ignore
|
||||
}
|
||||
// support like java <-> kotlin
|
||||
@NotNull Language language = PsiElementTo.language(psiElement);
|
||||
BaseLangDoc lineEnd = LANG_DOC_MAP.get(language.getID());
|
||||
|
||||
Reference in New Issue
Block a user