private static boolean isAfterUnclosedStringLiteral(@NotNull PsiErrorElement element) {
    PsiElement prevLeaf = PsiTreeUtil.prevCodeLeaf(element);
    if (prevLeaf instanceof PsiJavaToken token) {
      IElementType type = token.getTokenType();
      if (type == JavaTokenType.STRING_LITERAL) {
        String text = token.getText();
        if (text.length() == 1 || !StringUtil.endsWithChar(text, '"')) {
          return true;
        }
      }
      else if (type == JavaTokenType.CHARACTER_LITERAL) {
        String text = token.getText();
        if (text.length() == 1 || !StringUtil.endsWithChar(text, '\'')) {
          return true;
        }
      }
      else if (type == JavaTokenType.STRING_TEMPLATE_END) {
        String text = token.getText();
        if (text.length() == 1 || !StringUtil.endsWithChar(text, '"')) {
          return true;
        }
      }
    }
    return false;
  }
private static boolean isAfterUnclosedStringLiteral(@NotNull PsiErrorElement element)