Skip to content

Commit

Permalink
Closes #1
Browse files Browse the repository at this point in the history
* Added custom errors.
* Updated version number.
  • Loading branch information
DobromirM committed Jan 4, 2022
1 parent d1a4bae commit 9a0ed6f
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 3 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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
}
Expand Down
22 changes: 22 additions & 0 deletions src/main/java/org/swim/annotations/ReconAnnotator.java
Original file line number Diff line number Diff line change
@@ -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();
}
}
}
12 changes: 12 additions & 0 deletions src/main/java/org/swim/annotations/ReconHighlightErrorFilter.java
Original file line number Diff line number Diff line change
@@ -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;
}
}
4 changes: 3 additions & 1 deletion src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<idea-plugin>
<id>org.swim.recon</id>
<name>Recon</name>
<vendor email="[email protected]" url="https://www.swim.ai/">Swim.AI</vendor>
<vendor email="[email protected]" url="https://www.swim.ai/">Swim</vendor>

<description><![CDATA[Recon language support.
Recon is object notation with attributes, like if JSON and XML had a baby.]]>
Expand All @@ -26,6 +26,8 @@
<codeStyleSettingsProvider implementation="org.swim.settings.ReconCodeStyleSettingsProvider"/>
<langCodeStyleSettingsProvider
implementation="org.swim.settings.ReconLanguageCodeStyleSettingsProvider"/>
<annotator language="Recon" implementationClass="org.swim.annotations.ReconAnnotator"/>
<highlightErrorFilter implementation="org.swim.annotations.ReconHighlightErrorFilter"/>
</extensions>

<actions>
Expand Down

0 comments on commit 9a0ed6f

Please sign in to comment.