2016-02-09 112 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);