Reputation: 292
I want to mark some texts in intellij editor as error by underlining with read colour in my plugin using carret position. is there any way to do it. already i can get position and text which i need to mark as error from ide editor. is this possible please help me.
Upvotes: 0
Views: 576
Reputation: 292
Error highlighting can be done using http://www.jetbrains.org/intellij/sdk/docs/tutorials/custom_language_support/annotator.html for more information.
public class ScalaAnnotator implements Annotator {
@Override
public void annotate(@NotNull final PsiElement element, @NotNull AnnotationHolder holder) {
parameter PsiElement contains all details of editor and by AnnotationHolder you can mark as error or change colour using
TextRange range = new TextRange(element2.getTextRange().getStartOffset(),
element2.getTextRange().getEndOffset());
Annotation annotation = holder.createInfoAnnotation(range, null);
annotation.setTextAttributes(DefaultLanguageHighlighterColors.STATIC_FIELD);
Upvotes: 1