From 9a0ed6f7002ff813d1f41f2e320ba096d6de2f05 Mon Sep 17 00:00:00 2001 From: Dobromir Marinov Date: Tue, 4 Jan 2022 14:26:21 +0000 Subject: [PATCH] Closes #1 * Added custom errors. * Updated version number. --- build.gradle | 4 ++-- .../org/swim/annotations/ReconAnnotator.java | 22 +++++++++++++++++++ .../ReconHighlightErrorFilter.java | 12 ++++++++++ src/main/resources/META-INF/plugin.xml | 4 +++- 4 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 src/main/java/org/swim/annotations/ReconAnnotator.java create mode 100644 src/main/java/org/swim/annotations/ReconHighlightErrorFilter.java diff --git a/build.gradle b/build.gradle index f5ff94c..8212168 100644 --- a/build.gradle +++ b/build.gradle @@ -14,7 +14,7 @@ apply plugin: 'org.jetbrains.grammarkit' sourceSets.main.java.srcDirs 'src/main/gen' group 'org.swim' -version '1.2.0' +version '1.2.1' repositories { mavenCentral() @@ -27,7 +27,7 @@ dependencies { // See https://github.com/JetBrains/gradle-intellij-plugin/ intellij { - version = '2021.3' + version = '2021.3.1' plugins = ['PsiViewer:213-SNAPSHOT', 'com.intellij.java'] updateSinceUntilBuild = false } diff --git a/src/main/java/org/swim/annotations/ReconAnnotator.java b/src/main/java/org/swim/annotations/ReconAnnotator.java new file mode 100644 index 0000000..08d8f7b --- /dev/null +++ b/src/main/java/org/swim/annotations/ReconAnnotator.java @@ -0,0 +1,22 @@ +package org.swim.annotations; + +import com.intellij.codeInspection.ProblemHighlightType; +import com.intellij.lang.annotation.AnnotationHolder; +import com.intellij.lang.annotation.Annotator; +import com.intellij.lang.annotation.HighlightSeverity; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiErrorElement; +import org.jetbrains.annotations.NotNull; + +public class ReconAnnotator implements Annotator { + @Override + public void annotate(@NotNull PsiElement element, @NotNull AnnotationHolder holder) { + + if (element instanceof PsiErrorElement) { + holder.newAnnotation(HighlightSeverity.ERROR, "Unexpected character") + .range(element.getTextRange()) + .highlightType(ProblemHighlightType.GENERIC_ERROR) + .create(); + } + } +} diff --git a/src/main/java/org/swim/annotations/ReconHighlightErrorFilter.java b/src/main/java/org/swim/annotations/ReconHighlightErrorFilter.java new file mode 100644 index 0000000..a879cc9 --- /dev/null +++ b/src/main/java/org/swim/annotations/ReconHighlightErrorFilter.java @@ -0,0 +1,12 @@ +package org.swim.annotations; + +import com.intellij.codeInsight.highlighting.HighlightErrorFilter; +import com.intellij.psi.PsiErrorElement; +import org.jetbrains.annotations.NotNull; + +public class ReconHighlightErrorFilter extends HighlightErrorFilter { + @Override + public boolean shouldHighlightErrorElement(@NotNull PsiErrorElement element) { + return false; + } +} diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index e3671a5..31d24a1 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -1,7 +1,7 @@ org.swim.recon Recon - Swim.AI + Swim @@ -26,6 +26,8 @@ + +