private void addVariable(PsiElement element,
                           @Nullable TextRange textRange,
                           PsiElement selectedElement,
                           TemplateBuilderImpl builder) {
    if (element == selectedElement) {
      Expression expression = createTemplateExpression(myElementToRename);
      builder.replaceElement(element, getRangeToRename(element), PRIMARY_VARIABLE_NAME, expression, shouldStopAtLookupExpression(expression));
    }
    else {
      builder.replaceElement(element, Objects.requireNonNullElseGet(textRange, () -> getRangeToRename(element)), OTHER_VARIABLE_NAME,
                             PRIMARY_VARIABLE_NAME, false);
    }
  }
private void addVariable(PsiElement element,
                           @Nullable TextRange textRange,
                           PsiElement selectedElement,
                           TemplateBuilderImpl builder)