Converted LabelsAnnotator to extra visitor invoked from JetPsiChecker.

This commit is contained in:
Evgeny Gerashchenko
2012-03-29 14:49:07 +04:00
parent f41548a664
commit 0079df05b0
3 changed files with 19 additions and 21 deletions
-1
View File
@@ -124,7 +124,6 @@
<liveTemplateMacro implementation="org.jetbrains.jet.plugin.liveTemplates.macro.JetIterableVariableMacro"/> <liveTemplateMacro implementation="org.jetbrains.jet.plugin.liveTemplates.macro.JetIterableVariableMacro"/>
<liveTemplateMacro implementation="org.jetbrains.jet.plugin.liveTemplates.macro.JetSuggestVariableNameMacro"/> <liveTemplateMacro implementation="org.jetbrains.jet.plugin.liveTemplates.macro.JetSuggestVariableNameMacro"/>
<annotator language="jet" implementationClass="org.jetbrains.jet.plugin.highlighter.LabelsAnnotator"/>
<annotator language="jet" implementationClass="org.jetbrains.jet.plugin.highlighter.JetPsiChecker"/> <annotator language="jet" implementationClass="org.jetbrains.jet.plugin.highlighter.JetPsiChecker"/>
<annotator language="jet" implementationClass="org.jetbrains.jet.plugin.highlighter.DebugInfoAnnotator"/> <annotator language="jet" implementationClass="org.jetbrains.jet.plugin.highlighter.DebugInfoAnnotator"/>
@@ -58,6 +58,7 @@ public class JetPsiChecker implements Annotator {
@Override @Override
public void annotate(@NotNull PsiElement element, @NotNull final AnnotationHolder holder) { public void annotate(@NotNull PsiElement element, @NotNull final AnnotationHolder holder) {
element.accept(new SoftKeywordsHighlightingVisitor(holder)); element.accept(new SoftKeywordsHighlightingVisitor(holder));
element.accept(new LabelsHighlightingVisitor(holder));
if (element instanceof JetFile) { if (element instanceof JetFile) {
JetFile file = (JetFile)element; JetFile file = (JetFile)element;
@@ -29,10 +29,11 @@ import org.jetbrains.jet.lang.psi.JetSimpleNameExpression;
import org.jetbrains.jet.lang.psi.JetVisitorVoid; import org.jetbrains.jet.lang.psi.JetVisitorVoid;
import org.jetbrains.jet.lexer.JetTokens; import org.jetbrains.jet.lexer.JetTokens;
public class LabelsAnnotator implements Annotator { class LabelsHighlightingVisitor extends HighlightingVisitor {
public void annotate(@NotNull PsiElement element, @NotNull final AnnotationHolder holder) { LabelsHighlightingVisitor(AnnotationHolder holder) {
// if (ApplicationManager.getApplication().isUnitTestMode()) return; super(holder);
element.accept(new JetVisitorVoid() { }
@Override @Override
public void visitPrefixExpression(JetPrefixExpression expression) { public void visitPrefixExpression(JetPrefixExpression expression) {
JetSimpleNameExpression operationSign = expression.getOperationReference(); JetSimpleNameExpression operationSign = expression.getOperationReference();
@@ -48,7 +49,4 @@ public class LabelsAnnotator implements Annotator {
holder.createInfoAnnotation(targetLabel, null).setTextAttributes(JetHighlightingColors.LABEL); holder.createInfoAnnotation(targetLabel, null).setTextAttributes(JetHighlightingColors.LABEL);
} }
} }
});
}
} }