mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:19:59 +07:00
[qodana] Skip text extraction in Exporter for non-readable PSI elements
Add error when a message is not provided when convertation to SARIF occurs (cherry picked from commit fcfd75b8c37077a775308387ff262847141579ec) IJ-MR-169937 GitOrigin-RevId: 72d449292d268f42d5284f4af194a87b89f691eb
This commit is contained in:
committed by
intellij-monorepo-bot
parent
1f55555bbb
commit
f9be0360d0
@@ -11,6 +11,7 @@ import com.intellij.codeInspection.util.InspectionMessage;
|
||||
import com.intellij.lang.annotation.Annotation;
|
||||
import com.intellij.lang.annotation.Annotation.QuickFixInfo;
|
||||
import com.intellij.lang.annotation.HighlightSeverity;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.colors.CodeInsightColors;
|
||||
import com.intellij.openapi.util.Couple;
|
||||
import com.intellij.openapi.util.NlsContexts;
|
||||
@@ -58,7 +59,13 @@ public final class ProblemDescriptorUtil {
|
||||
|
||||
public static @NotNull String extractHighlightedText(@Nullable TextRange range, @Nullable PsiElement psiElement) {
|
||||
if (psiElement == null || !psiElement.isValid()) return "";
|
||||
CharSequence fileText = psiElement.getContainingFile().getViewProvider().getDocument().getImmutableCharSequence();
|
||||
PsiFile file = psiElement.getContainingFile();
|
||||
// file doesn't have contents, i.e., it's a dir or package
|
||||
if (file == null) return "";
|
||||
Document doc = file.getViewProvider().getDocument();
|
||||
// doc may represent a binary file, i.e., image
|
||||
if (doc == null) return "";
|
||||
CharSequence fileText = doc.getImmutableCharSequence();
|
||||
TextRange elementRange = psiElement.getTextRange();
|
||||
CharSequence elementSequence;
|
||||
if (elementRange == null) {
|
||||
|
||||
Reference in New Issue
Block a user