modifier list intention: ensure range is valid (IDEA-142333)

This commit is contained in:
Anna Kozlova
2015-07-07 14:55:16 +03:00
parent 303edac35e
commit e299d71332
4 changed files with 37 additions and 1 deletions
@@ -87,7 +87,7 @@ abstract class ModifierIntention extends Intention implements LowPriorityAction
final PsiElement sibling = modifierList.getNextSibling();
if (sibling instanceof PsiWhiteSpace) {
sibling.replace(whitespace);
CodeStyleManager.getInstance(project).reformatRange(member, modifierList.getTextOffset() + 1,
CodeStyleManager.getInstance(project).reformatRange(member, modifierList.getTextOffset(),
modifierList.getNextSibling().getTextOffset());
}
}
@@ -0,0 +1 @@
public class Te<caret>st {}
@@ -0,0 +1,34 @@
/*
* Copyright 2000-2015 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.
*/
package com.siyeh.ipp.modifiers;
import com.siyeh.IntentionPowerPackBundle;
import com.siyeh.ipp.IPPTestCase;
public class MakePackageLocalIntentionTest extends IPPTestCase {
public void testInDefaultPackage() { doTest(); }
@Override
protected String getRelativePath() {
return "modifiers/make_local";
}
@Override
protected String getIntentionName() {
return IntentionPowerPackBundle.message("make.package.private.intention.name");
}
}