use of com.goide.psi.GoConditionalExpr in project go-lang-idea-plugin by go-lang-plugin-org.
the class GoConvertStringToByteQuickFix method applyFix.
@Override
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
PsiElement element = descriptor.getPsiElement();
if (!(element instanceof GoConditionalExpr) || !element.isValid()) {
return;
}
GoConditionalExpr expr = (GoConditionalExpr) element;
GoStringLiteral literal = ContainerUtil.findInstance(Arrays.asList(expr.getLeft(), expr.getRight()), GoStringLiteral.class);
if (literal == null || !isSingleCharLiteral(literal)) {
return;
}
literal.replace(createExpression(project, extractSingleCharFromText(literal)));
}
Aggregations