InputPanel.java 文件源码

java
阅读 35 收藏 0 点赞 0 评论 0

项目:intellij-plugin-v4 作者:
public void annotateErrorsInPreviewInputEditor(SyntaxError e) {
    Editor editor = getInputEditor();
    if ( editor==null ) return;
    MarkupModel markupModel = editor.getMarkupModel();

    int a, b; // Start and stop index
    RecognitionException cause = e.getException();
    if ( cause instanceof LexerNoViableAltException ) {
        a = ((LexerNoViableAltException) cause).getStartIndex();
        b = ((LexerNoViableAltException) cause).getStartIndex()+1;
    }
    else {
        Token offendingToken = (Token) e.getOffendingSymbol();
        a = offendingToken.getStartIndex();
        b = offendingToken.getStopIndex()+1;
    }
    final TextAttributes attr = new TextAttributes();
    attr.setForegroundColor(JBColor.RED);
    attr.setEffectColor(JBColor.RED);
    attr.setEffectType(EffectType.WAVE_UNDERSCORE);
    RangeHighlighter highlighter =
        markupModel.addRangeHighlighter(a,
                                        b,
                                        ERROR_LAYER, // layer
                                        attr,
                                        HighlighterTargetArea.EXACT_RANGE);
    highlighter.putUserData(SYNTAX_ERROR, e);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号