private static boolean isSpace(PsiElement element) {
      if (!(element instanceof RegExpChar aChar)) {
        return false;
      }
      return aChar.getType() == RegExpChar.Type.CHAR && aChar.getValue() == ' ';
    }
private static boolean isSpace(PsiElement element)