mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-104469 Groovy: remove line feed from method call if necessary during removing parameters
This commit is contained in:
+10
-2
@@ -186,7 +186,7 @@ public class GrArgumentListImpl extends GroovyPsiElementImpl implements GrArgume
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiElement addAfter(@NotNull PsiElement element, PsiElement anchor) throws IncorrectOperationException {
|
||||
public PsiElement addAfter(@NotNull PsiElement element, @Nullable PsiElement anchor) throws IncorrectOperationException {
|
||||
if (element instanceof GrExpression || element instanceof GrNamedArgument) {
|
||||
final boolean insertComma = getAllArguments().length != 0;
|
||||
|
||||
@@ -215,12 +215,20 @@ public class GrArgumentListImpl extends GroovyPsiElementImpl implements GrArgume
|
||||
if (element instanceof GrExpression || element instanceof GrNamedArgument) {
|
||||
ASTNode prev = TreeUtil.skipElementsBack(child.getTreePrev(), TokenSets.WHITE_SPACES_OR_COMMENTS);
|
||||
if (prev != null && prev.getElementType() == mCOMMA) {
|
||||
final ASTNode pprev = prev.getTreePrev();
|
||||
if (pprev != null && TokenSets.WHITE_SPACES_SET.contains(pprev.getElementType())) {
|
||||
super.deleteChildInternal(pprev);
|
||||
}
|
||||
super.deleteChildInternal(prev);
|
||||
}
|
||||
else {
|
||||
ASTNode next = TreeUtil.skipElements(child.getTreeNext(), TokenSets.WHITE_SPACES_OR_COMMENTS);
|
||||
if (next != null && next.getElementType() == mCOMMA) {
|
||||
deleteChildInternal(next);
|
||||
final ASTNode nnext = next.getTreeNext();
|
||||
if (nnext != null && TokenSets.WHITE_SPACES_SET.contains(nnext.getElementType())) {
|
||||
super.deleteChildInternal(nnext);
|
||||
}
|
||||
super.deleteChildInternal(next);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
@@ -253,6 +253,10 @@ public class ChangeSignatureTest extends ChangeSignatureTestCase {
|
||||
doTest(null, 'a\'bc', null, [], [], false)
|
||||
}
|
||||
|
||||
void testLineFeedInCommandArgs() {
|
||||
doTest(new SimpleInfo(1))
|
||||
}
|
||||
|
||||
|
||||
private PsiType createType(String typeText) {
|
||||
return JavaPsiFacade.getElementFactory(project).createTypeByFQClassName(typeText, GlobalSearchScope.allScope(project));
|
||||
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
def fo<caret>o(def a, def b) {
|
||||
print b
|
||||
}
|
||||
|
||||
foo 'abc',
|
||||
'cde'
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
def foo(def b) {
|
||||
print b
|
||||
}
|
||||
|
||||
foo 'cde'
|
||||
Reference in New Issue
Block a user