2016-02-09 114 views
0

我想通过使用CARRET位置在我的插件与读取的颜色强调,以纪念的IntelliJ编辑器错误一些文本。有没有办法做到这一点。已经可以获得我需要从ide编辑器标记为错误的位置和文本。这是可能的,请帮助我。IntelliJ IDEA的错误突出

+0

错误高亮显示错误或改变颜色可以使用http://www.jetbrains.org/intellij/完成sdk/docs/tutorials/custom_language_support/annotator.html了解更多信息。 公共类ScalaAnnotator实现注释器{公共无效注释(@NotNull最终PsiElement元件,@NotNull AnnotationHolder保持器){参数PsiElement包含编辑器的所有的细节和由AnnotationHolder则可以使用的TextRange范围=新的TextRange(1作为误差或变化的颜色标记, 9) 注解注解= holder.createInfoAnnotation(范围,NULL); annotation.setTextAttributes(DefaultLanguageHighlighterColors.STATIC_FIELD); –

回答

0

错误高亮可以使用http://www.jetbrains.org/intellij/sdk/docs/tutorials/custom_language_support/annotator.html 更多的信息来完成。

public class ScalaAnnotator implements Annotator { 
     @Override 
    public void annotate(@NotNull final PsiElement element, @NotNull AnnotationHolder holder) { 

参数PsiElement包含了编辑器的所有细节,并通过AnnotationHolder你可以标记为使用

   TextRange range = new TextRange(element2.getTextRange().getStartOffset(), 
         element2.getTextRange().getEndOffset()); 
       Annotation annotation = holder.createInfoAnnotation(range, null); 
       annotation.setTextAttributes(DefaultLanguageHighlighterColors.STATIC_FIELD);