chore: @NotNull and try
This commit is contained in:
@@ -170,7 +170,7 @@ public class JavaLangDoc extends BaseTagLangDoc<PsiDocComment> {
|
|||||||
@Nullable PsiDocTagValue value = tag.getValueElement();
|
@Nullable PsiDocTagValue value = tag.getValueElement();
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
DocFilter.addHtml(tagStrBuilder, value.getText());
|
DocFilter.addHtml(tagStrBuilder, value.getText());
|
||||||
} else {
|
} else {
|
||||||
@NotNull PsiElement[] dataElements = tag.getDataElements();
|
@NotNull PsiElement[] dataElements = tag.getDataElements();
|
||||||
if (dataElements.length > 0) {
|
if (dataElements.length > 0) {
|
||||||
DocFilter.addHtml(tagStrBuilder, dataElements[0].getText());
|
DocFilter.addHtml(tagStrBuilder, dataElements[0].getText());
|
||||||
|
|||||||
@@ -5,7 +5,13 @@ import com.intellij.json.psi.JsonStringLiteral;
|
|||||||
import com.intellij.openapi.project.Project;
|
import com.intellij.openapi.project.Project;
|
||||||
import com.intellij.openapi.vfs.VirtualFile;
|
import com.intellij.openapi.vfs.VirtualFile;
|
||||||
import com.intellij.patterns.PlatformPatterns;
|
import com.intellij.patterns.PlatformPatterns;
|
||||||
import com.intellij.psi.*;
|
import com.intellij.psi.PsiClass;
|
||||||
|
import com.intellij.psi.PsiElement;
|
||||||
|
import com.intellij.psi.PsiField;
|
||||||
|
import com.intellij.psi.PsiReference;
|
||||||
|
import com.intellij.psi.PsiReferenceContributor;
|
||||||
|
import com.intellij.psi.PsiReferenceProvider;
|
||||||
|
import com.intellij.psi.PsiReferenceRegistrar;
|
||||||
import com.intellij.psi.util.PsiTreeUtil;
|
import com.intellij.psi.util.PsiTreeUtil;
|
||||||
import com.intellij.util.ProcessingContext;
|
import com.intellij.util.ProcessingContext;
|
||||||
import io.github.linwancen.plugin.show.java.doc.PsiClassUtils;
|
import io.github.linwancen.plugin.show.java.doc.PsiClassUtils;
|
||||||
@@ -38,28 +44,33 @@ public class JsonJumpJava extends PsiReferenceContributor {
|
|||||||
@Override
|
@Override
|
||||||
public @NotNull PsiReference[] getReferencesByElement(@NotNull PsiElement element,
|
public @NotNull PsiReference[] getReferencesByElement(@NotNull PsiElement element,
|
||||||
@NotNull ProcessingContext context) {
|
@NotNull ProcessingContext context) {
|
||||||
@Nullable JsonProperty jsonProp = PsiTreeUtil.getParentOfType(
|
try {
|
||||||
element, JsonProperty.class, true);
|
@Nullable JsonProperty jsonProp = PsiTreeUtil.getParentOfType(
|
||||||
if (jsonProp == null) {
|
element, JsonProperty.class, true);
|
||||||
return PsiReference.EMPTY_ARRAY;
|
if (jsonProp == null) {
|
||||||
}
|
return PsiReference.EMPTY_ARRAY;
|
||||||
VirtualFile virtualFile = element.getContainingFile().getVirtualFile();
|
}
|
||||||
if (virtualFile == null) {
|
VirtualFile virtualFile = element.getContainingFile().getVirtualFile();
|
||||||
return PsiReference.EMPTY_ARRAY;
|
if (virtualFile == null) {
|
||||||
}
|
return PsiReference.EMPTY_ARRAY;
|
||||||
|
}
|
||||||
|
|
||||||
@NotNull Project project = element.getProject();
|
@NotNull Project project = element.getProject();
|
||||||
@NotNull List<PsiField> psiFields = new ArrayList<>();
|
@NotNull List<PsiField> psiFields = new ArrayList<>();
|
||||||
@NotNull List<PsiField> tips = new ArrayList<>();
|
@NotNull List<PsiField> tips = new ArrayList<>();
|
||||||
@NotNull PsiClass[] psiClasses = PsiClassUtils.encClass(virtualFile, project);
|
@NotNull PsiClass[] psiClasses = PsiClassUtils.encClass(virtualFile, project);
|
||||||
@NotNull List<String> jsonPath = jsonPath(jsonProp);
|
@NotNull List<String> jsonPath = jsonPath(jsonProp);
|
||||||
put(project, psiFields, tips, psiClasses, jsonPath, jsonPath.size() - 1);
|
put(project, psiFields, tips, psiClasses, jsonPath, jsonPath.size() - 1);
|
||||||
|
|
||||||
@NotNull List<PsiReference> list = new ArrayList<>();
|
@NotNull List<PsiReference> list = new ArrayList<>();
|
||||||
for (@NotNull PsiField psiField : psiFields) {
|
for (@NotNull PsiField psiField : psiFields) {
|
||||||
list.add(new JsonRef<>(element, psiField, tips));
|
list.add(new JsonRef<>(element, psiField, tips));
|
||||||
|
}
|
||||||
|
return list.toArray(PsiReference.EMPTY_ARRAY);
|
||||||
|
} catch (Throwable e) {
|
||||||
|
LOG.error("JsonJumpJava.register catch Throwable but log to record.", e);
|
||||||
}
|
}
|
||||||
return list.toArray(PsiReference.EMPTY_ARRAY);
|
return PsiReference.EMPTY_ARRAY;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public class ConfFileInitListener implements DumbService.DumbModeListener, Proje
|
|||||||
public void exitDumbMode() {
|
public void exitDumbMode() {
|
||||||
try {
|
try {
|
||||||
@NotNull Project[] projects = ProjectManager.getInstance().getOpenProjects();
|
@NotNull Project[] projects = ProjectManager.getInstance().getOpenProjects();
|
||||||
for (Project project : projects) {
|
for (@NotNull Project project : projects) {
|
||||||
PROJECT_LOAD_MAP.computeIfAbsent(project, k -> {
|
PROJECT_LOAD_MAP.computeIfAbsent(project, k -> {
|
||||||
ConfCache.loadAll(project);
|
ConfCache.loadAll(project);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ public class RustLangDoc extends BaseLangDoc {
|
|||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
protected <T extends SettingsInfo> String resolveDocPrint(@NotNull T info, @NotNull PsiElement resolve) {
|
protected <T extends SettingsInfo> String resolveDocPrint(@NotNull T info, @NotNull PsiElement resolve) {
|
||||||
String s = super.resolveDocPrint(info, resolve);
|
@Nullable String s = super.resolveDocPrint(info, resolve);
|
||||||
if (s != null && s.startsWith("!")) {
|
if (s != null && s.startsWith("!")) {
|
||||||
return s.substring(1);
|
return s.substring(1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ public abstract class BaseLangDoc extends EditorLinePainter {
|
|||||||
}
|
}
|
||||||
@NotNull String cutDoc = DocFilter.cutDoc(s, info, true);
|
@NotNull String cutDoc = DocFilter.cutDoc(s, info, true);
|
||||||
@NotNull String filterDoc = DocFilter.filterDoc(cutDoc, info.globalSettings, info.projectSettings);
|
@NotNull String filterDoc = DocFilter.filterDoc(cutDoc, info.globalSettings, info.projectSettings);
|
||||||
String trimDoc = filterDoc.trim();
|
@NotNull String trimDoc = filterDoc.trim();
|
||||||
if (trimDoc.isEmpty()) {
|
if (trimDoc.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user