Change file's package to match directory: add space after package keyword if needed

#KT-39604 Fixed
This commit is contained in:
Toshiaki Kameyama
2020-07-14 12:21:04 +09:00
committed by Ilya Kirillov
parent 1ce39222e3
commit 1188f4617a
5 changed files with 17 additions and 0 deletions
@@ -137,6 +137,7 @@ public class KtPackageDirective extends KtModifierListOwnerStub<KotlinPlaceHolde
PsiElement keyword = getPackageKeyword();
if (keyword != null) {
addAfter(newExpression, keyword);
addAfter(psiFactory.createWhiteSpace(), keyword);
return;
}
@@ -0,0 +1,5 @@
{
"mainFile": "com/example/test.kt",
"inspectionClass": "org.jetbrains.kotlin.idea.refactoring.move.changePackage.PackageDirectoryMismatchInspection",
"fix": "Change file's package to 'com.example'"
}
@@ -78,6 +78,11 @@ public class MultiFileLocalInspectionTestGenerated extends AbstractMultiFileLoca
runTest("idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToNonDefaultPackageFromRoot/changeToNonDefaultPackageFromRoot.test");
}
@TestMetadata("reconcilePackageWithDirectory/changeToNonDefaultPackageFromRootWithPackageKeyword/changeToNonDefaultPackageFromRootWithPackageKeyword.test")
public void testReconcilePackageWithDirectory_changeToNonDefaultPackageFromRootWithPackageKeyword_ChangeToNonDefaultPackageFromRootWithPackageKeyword() throws Exception {
runTest("idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/changeToNonDefaultPackageFromRootWithPackageKeyword/changeToNonDefaultPackageFromRootWithPackageKeyword.test");
}
@TestMetadata("reconcilePackageWithDirectory/innerClass/innerClass.test")
public void testReconcilePackageWithDirectory_innerClass_InnerClass() throws Exception {
runTest("idea/testData/multiFileLocalInspections/reconcilePackageWithDirectory/innerClass/innerClass.test");