public static boolean isClearHighlights(@NotNull Editor editor) {
    if (editor instanceof EditorWindow) editor = ((EditorWindow)editor).getDelegate();

    RangeHighlighter[] highlighters = ((HighlightManagerImpl)HighlightManager.getInstance(editor.getProject())).getHighlighters(editor);
    int caretOffset = editor.getCaretModel().getOffset();
    for (RangeHighlighter highlighter : highlighters) {
      if (highlighter.getTextRange().grown(1).contains(caretOffset)) {
        return true;
      }
    }
    return false;
  }
public static boolean isClearHighlights(@NotNull Editor editor)