chore: @NotNull and try
This commit is contained in:
@@ -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,6 +44,7 @@ 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) {
|
||||||
|
try {
|
||||||
@Nullable JsonProperty jsonProp = PsiTreeUtil.getParentOfType(
|
@Nullable JsonProperty jsonProp = PsiTreeUtil.getParentOfType(
|
||||||
element, JsonProperty.class, true);
|
element, JsonProperty.class, true);
|
||||||
if (jsonProp == null) {
|
if (jsonProp == null) {
|
||||||
@@ -60,6 +67,10 @@ public class JsonJumpJava extends PsiReferenceContributor {
|
|||||||
list.add(new JsonRef<>(element, psiField, tips));
|
list.add(new JsonRef<>(element, psiField, tips));
|
||||||
}
|
}
|
||||||
return list.toArray(PsiReference.EMPTY_ARRAY);
|
return list.toArray(PsiReference.EMPTY_ARRAY);
|
||||||
|
} catch (Throwable e) {
|
||||||
|
LOG.error("JsonJumpJava.register catch Throwable but log to record.", e);
|
||||||
|
}
|
||||||
|
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