public static @NotNull TextRange getValueRange(@NotNull PsiLiteralExpression expression) {
    if (expression instanceof PsiLanguageInjectionHost) {
      return ((PsiLanguageInjectionHost)expression).createLiteralTextEscaper().getRelevantTextRange();
    }
    // Normally, we go to the previous branch. Probably third-party implementations or ClsLiteralExpressionImpl may reach here
    if (expression.isTextBlock()) {
      throw new UnsupportedOperationException();
    }
    // avoid calling PsiLiteralExpression.getValue(): it allocates new string, it returns null for invalid escapes
    int length = expression.getTextLength();
    final PsiType type = expression.getType();
    boolean isQuoted = PsiTypes.charType().equals(type) || type != null && type.equalsToText(CommonClassNames.JAVA_LANG_STRING);
    return isQuoted ? new TextRange(1, Math.max(1, length - 1)) : TextRange.from(0, length);
  }
public static @NotNull TextRange getValueRange(@NotNull PsiLiteralExpression expression)