fix(JavaLangDoc): skipSign not effect in when ☑ // Java
This commit is contained in:
@@ -24,6 +24,7 @@ import io.github.linwancen.plugin.show.java.doc.NewDoc;
|
||||
import io.github.linwancen.plugin.show.java.doc.ParamDoc;
|
||||
import io.github.linwancen.plugin.show.java.doc.PsiMethodToPsiDoc;
|
||||
import io.github.linwancen.plugin.show.java.line.OwnerToPsiDocSkip;
|
||||
import io.github.linwancen.plugin.show.java.line.SkipUtils;
|
||||
import io.github.linwancen.plugin.show.lang.base.BaseTagLangDoc;
|
||||
import io.github.linwancen.plugin.show.lang.base.DocFilter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -80,6 +81,9 @@ public class JavaLangDoc extends BaseTagLangDoc<PsiDocComment> {
|
||||
|
||||
@Override
|
||||
public @Nullable <T extends SettingsInfo> String resolveDocPrint(@NotNull T info, @NotNull PsiElement resolve) {
|
||||
if (SkipUtils.skipSign(info, resolve)) {
|
||||
return null;
|
||||
}
|
||||
@Nullable String resolveDocPrint = super.resolveDocPrint(info, resolve);
|
||||
if (resolveDocPrint != null) {
|
||||
return resolveDocPrint;
|
||||
@@ -147,7 +151,7 @@ public class JavaLangDoc extends BaseTagLangDoc<PsiDocComment> {
|
||||
if (element instanceof PsiWhiteSpace && sb.length() > 0) {
|
||||
return true;
|
||||
}
|
||||
PsiElement[] children = element.getChildren();
|
||||
@NotNull PsiElement[] children = element.getChildren();
|
||||
if (children.length > 0) {
|
||||
if (children.length >= 3) {
|
||||
DocFilter.addHtml(sb, children[children.length - 2].getText());
|
||||
@@ -167,7 +171,7 @@ public class JavaLangDoc extends BaseTagLangDoc<PsiDocComment> {
|
||||
if (value != null) {
|
||||
DocFilter.addHtml(tagStrBuilder, value.getText());
|
||||
} else {
|
||||
PsiElement[] dataElements = tag.getDataElements();
|
||||
@NotNull PsiElement[] dataElements = tag.getDataElements();
|
||||
if (dataElements.length > 0) {
|
||||
DocFilter.addHtml(tagStrBuilder, dataElements[0].getText());
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ public class ScalaLangDoc extends JavaLangDoc {
|
||||
@NotNull PsiElement resolve) {
|
||||
if (resolve instanceof PsiDocCommentOwner) {
|
||||
@NotNull PsiDocCommentOwner psiDocCommentOwner = (PsiDocCommentOwner) resolve;
|
||||
return OwnerToPsiDocSkip.refDocWithOutSkip(info, psiDocCommentOwner);
|
||||
return OwnerToPsiDocSkip.refDocWithOutSkip(psiDocCommentOwner);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -55,8 +55,8 @@ public class ScalaLangDoc extends JavaLangDoc {
|
||||
@Override
|
||||
protected <T extends SettingsInfo> String descDoc(@NotNull T info, @NotNull PsiDocComment psiDocComment) {
|
||||
@NotNull PsiElement[] elements = psiDocComment.getChildren();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (PsiElement element : elements) {
|
||||
@NotNull StringBuilder sb = new StringBuilder();
|
||||
for (@NotNull PsiElement element : elements) {
|
||||
if (!(element instanceof PsiDocTag)) {
|
||||
sb.append(element.getText());
|
||||
}
|
||||
@@ -70,7 +70,7 @@ public class ScalaLangDoc extends JavaLangDoc {
|
||||
@NotNull PsiDocTag[] tags = psiDocComment.findTagsByName("@" + name);
|
||||
for (@NotNull PsiDocTag tag : tags) {
|
||||
if (tag instanceof ScDocTag) {
|
||||
ScDocTag scDocTag = (ScDocTag) tag;
|
||||
@NotNull ScDocTag scDocTag = (ScDocTag) tag;
|
||||
String doc = scDocTag.getCommentDataText();
|
||||
DocFilter.addHtml(tagStrBuilder, doc);
|
||||
}
|
||||
|
||||
@@ -36,7 +36,8 @@ public class NewCallRefToPsiDoc {
|
||||
} catch (Throwable ignore) {
|
||||
// ignore
|
||||
}
|
||||
return OwnerToPsiDocSkip.refDoc(info, ((PsiDocCommentOwner) resolve));
|
||||
@NotNull PsiDocCommentOwner psiDocCommentOwner = (PsiDocCommentOwner) resolve;
|
||||
return OwnerToPsiDocSkip.refDoc(info, psiDocCommentOwner);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -17,22 +17,14 @@ public class OwnerToPsiDocSkip {
|
||||
|
||||
@Nullable
|
||||
public static <T extends SettingsInfo> PsiDocComment refDoc(@NotNull T info,
|
||||
@Nullable PsiDocCommentOwner docOwner) {
|
||||
return SkipUtils.skipDoc(info, refDocWithOutSkip(info, docOwner));
|
||||
@NotNull PsiDocCommentOwner docOwner) {
|
||||
return SkipUtils.skipDoc(info, refDocWithOutSkip(docOwner));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static <T extends SettingsInfo> PsiDocComment refDocWithOutSkip(@NotNull T info,
|
||||
@Nullable PsiDocCommentOwner docOwner) {
|
||||
if (docOwner == null) {
|
||||
return null;
|
||||
}
|
||||
if (SkipUtils.skipSign(info, docOwner)) {
|
||||
return null;
|
||||
}
|
||||
@Nullable PsiDocComment docComment = docOwner instanceof PsiMethod
|
||||
public static <T extends SettingsInfo> PsiDocComment refDocWithOutSkip(@NotNull PsiDocCommentOwner docOwner) {
|
||||
return docOwner instanceof PsiMethod
|
||||
? PsiMethodToPsiDoc.methodSupperNewPropDoc(((PsiMethod) docOwner))
|
||||
: docOwner.getDocComment();
|
||||
return docComment;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,14 +11,14 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
class SkipUtils {
|
||||
public class SkipUtils {
|
||||
|
||||
private SkipUtils() {}
|
||||
|
||||
static <T extends SettingsInfo> boolean skipSign(@NotNull T info, PsiElement psiElement) {
|
||||
public static <T extends SettingsInfo> boolean skipSign(@NotNull T info, PsiElement psiElement) {
|
||||
@Nullable String text = psiName(info, psiElement);
|
||||
if (text == null) {
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
return DocSkip.skipSign(info, text);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user