introduce functional variable: allow comments (IDEA-174183)

This commit is contained in:
Anna Kozlova
2017-06-09 16:51:20 +03:00
parent 1bf8d3d7a8
commit 404fe68c03
4 changed files with 18 additions and 1 deletions
@@ -60,7 +60,7 @@ public class IntroduceFunctionalVariableHandler extends IntroduceVariableHandler
showErrorMessage(project , editor, message);
return;
}
PsiElement anchorStatement = RefactoringUtil.getParentStatement(elements[0], false);
PsiElement anchorStatement = elements[0] instanceof PsiComment ? elements[0] : RefactoringUtil.getParentStatement(elements[0], false);
PsiElement tempContainer = checkAnchorStatement(project, editor, anchorStatement);
if (tempContainer == null) return;