[groovy] move left-right for 'for' update expressions (IDEA-188433)

This commit is contained in:
Daniil Ovchinnikov
2018-07-05 18:41:23 +03:00
parent fdc7a4cefd
commit 399d614bf2
2 changed files with 8 additions and 16 deletions
@@ -1,23 +1,10 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.plugins.groovy.codeInsight.editorActions
import com.intellij.codeInsight.editorActions.moveLeftRight.MoveElementLeftRightHandler
import com.intellij.psi.PsiElement
import com.intellij.psi.util.PsiTreeUtil.getChildrenOfAnyType
import org.jetbrains.plugins.groovy.lang.psi.api.GrExpressionList
import org.jetbrains.plugins.groovy.lang.psi.api.auxiliary.GrListOrMap
import org.jetbrains.plugins.groovy.lang.psi.api.auxiliary.modifiers.GrModifierList
import org.jetbrains.plugins.groovy.lang.psi.api.auxiliary.modifiers.annotation.GrAnnotationArgumentList
@@ -46,6 +33,7 @@ class GroovyMoveLeftRightHandler : MoveElementLeftRightHandler() {
is GrTypeArgumentList -> element.typeArgumentElements
is GrTypeParameterList -> element.typeParameters
is GrVariableDeclaration -> element.variables
is GrExpressionList -> element.expressions.toTypedArray()
else -> PsiElement.EMPTY_ARRAY
}
}
}
@@ -114,4 +114,8 @@ class GroovyMoveLeftRightHandlerTest extends LightGroovyTestCase {
doTest '<caret>1 + 2 + 3'
doTest '1 + <caret>2 + 3'
}
void 'test for update'() {
doTest 'for (;; <caret>1, 2, 3) {}', 'for (;; 2, <caret>1, 3) {}'
}
}