From 399d614bf2aef496bbeeb9d298729b18757f52e6 Mon Sep 17 00:00:00 2001 From: Daniil Ovchinnikov Date: Thu, 5 Jul 2018 18:39:23 +0300 Subject: [PATCH] [groovy] move left-right for 'for' update expressions (IDEA-188433) --- .../GroovyMoveLeftRightHandler.kt | 20 ++++--------------- .../GroovyMoveLeftRightHandlerTest.groovy | 4 ++++ 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInsight/editorActions/GroovyMoveLeftRightHandler.kt b/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInsight/editorActions/GroovyMoveLeftRightHandler.kt index 3a9c68b1a6f5..f7d173ffeb7b 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInsight/editorActions/GroovyMoveLeftRightHandler.kt +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInsight/editorActions/GroovyMoveLeftRightHandler.kt @@ -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 } -} \ No newline at end of file +} diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/codeInsight/editorActions/GroovyMoveLeftRightHandlerTest.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/codeInsight/editorActions/GroovyMoveLeftRightHandlerTest.groovy index b83c7d162a18..f1c96d88499b 100644 --- a/plugins/groovy/test/org/jetbrains/plugins/groovy/codeInsight/editorActions/GroovyMoveLeftRightHandlerTest.groovy +++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/codeInsight/editorActions/GroovyMoveLeftRightHandlerTest.groovy @@ -114,4 +114,8 @@ class GroovyMoveLeftRightHandlerTest extends LightGroovyTestCase { doTest '1 + 2 + 3' doTest '1 + 2 + 3' } + + void 'test for update'() { + doTest 'for (;; 1, 2, 3) {}', 'for (;; 2, 1, 3) {}' + } }