@Nullable
  public static TextRange getWordOrLexemeSelectionRange(@NotNull Editor editor, int cursorOffset,
                                                         @NotNull CharCondition isWordPartCondition) {
    return getWordOrLexemeSelectionRange(editor, editor.getDocument().getImmutableCharSequence(), cursorOffset, isWordPartCondition);
  }
@Nullable
  public static TextRange getWordOrLexemeSelectionRange(@NotNull Editor editor, int cursorOffset,
                                                         @NotNull CharCondition isWordPartCondition)