use of com.jetbrains.python.psi.PyExpressionStatement in project intellij-community by JetBrains.
the class ReplaceListComprehensionsQuickFix method applyFix.
@Override
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
PsiElement expression = descriptor.getPsiElement();
if (expression instanceof PyTupleExpression) {
PyElementGenerator elementGenerator = PyElementGenerator.getInstance(project);
PyExpressionStatement statement = elementGenerator.createFromText(LanguageLevel.forElement(expression), PyExpressionStatement.class, "(" + expression.getText() + ")");
expression.replace(statement.getExpression());
}
}
Aggregations