@Override protected void processIntention(@NotNull PsiElement element) throws IncorrectOperationException { if (!(element instanceof JSStatement)) { return; } final JSStatement statement = (JSStatement) element; final JSElement parent = (JSElement) element.getParent(); final String text = element.getText(); String newText; if (parent.getLastChild() instanceof PsiComment) { newText = '{' + text + "\n}"; } else { newText = '{' + text + '}'; } JSElementFactory.replaceStatement(statement, newText); }