Initial stubs for Psi checker and tests for it
This commit is contained in:
@@ -22,5 +22,6 @@
|
|||||||
<lang.parserDefinition language="jet" implementationClass="org.jetbrains.jet.lang.parsing.JetParserDefinition"/>
|
<lang.parserDefinition language="jet" implementationClass="org.jetbrains.jet.lang.parsing.JetParserDefinition"/>
|
||||||
<lang.commenter language="jet" implementationClass="org.jetbrains.jet.plugin.JetCommenter"/>
|
<lang.commenter language="jet" implementationClass="org.jetbrains.jet.plugin.JetCommenter"/>
|
||||||
<annotator language="jet" implementationClass="org.jetbrains.jet.lang.annotations.SoftKeywordsAnnotator"/>
|
<annotator language="jet" implementationClass="org.jetbrains.jet.lang.annotations.SoftKeywordsAnnotator"/>
|
||||||
|
<annotator language="jet" implementationClass="org.jetbrains.jet.lang.annotations.JetPsiChecker"/>
|
||||||
</extensions>
|
</extensions>
|
||||||
</idea-plugin>
|
</idea-plugin>
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package org.jetbrains.jet.lang.annotations;
|
||||||
|
|
||||||
|
import com.intellij.lang.annotation.AnnotationHolder;
|
||||||
|
import com.intellij.lang.annotation.Annotator;
|
||||||
|
import com.intellij.psi.PsiElement;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.jet.lang.psi.JetProperty;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author abreslav
|
||||||
|
*/
|
||||||
|
public class JetPsiChecker implements Annotator {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void annotate(@NotNull PsiElement element, @NotNull AnnotationHolder holder) {
|
||||||
|
if (element instanceof JetProperty) {
|
||||||
|
JetProperty property = (JetProperty) element;
|
||||||
|
holder.createErrorAnnotation(property.getNameIdentifier(), "Specify either type or value");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
val <error descr="Specify either type or value">foo</error>
|
||||||
|
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package org.jetbrains.jet.parsing;
|
||||||
|
|
||||||
|
import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
|
||||||
|
import com.intellij.openapi.application.PathManager;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author abreslav
|
||||||
|
*/
|
||||||
|
public class JetPsiCheckerTest extends LightDaemonAnalyzerTestCase {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getTestDataPath() {
|
||||||
|
return getHomeDirectory() + "/idea/testData";
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String getHomeDirectory() {
|
||||||
|
return new File(PathManager.getResourceRoot(JetParsingTest.class, "/org/jetbrains/jet/parsing/JetParsingTest.class")).getParentFile().getParentFile().getParent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testFoo() throws Exception {
|
||||||
|
doTest("/checker/Properties.jet", true, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user