J2K: Idea doesn't proposed to insert imports on copy-paste if explicit import was inserted
#KT-8738 Fixed
This commit is contained in:
+2
-2
@@ -97,14 +97,14 @@ public class ConvertJavaCopyPastePostProcessor : CopyPastePostProcessor<TextBloc
|
|||||||
rangeMarker.setGreedyToLeft(true)
|
rangeMarker.setGreedyToLeft(true)
|
||||||
rangeMarker.setGreedyToRight(true)
|
rangeMarker.setGreedyToRight(true)
|
||||||
|
|
||||||
|
KotlinCopyPasteReferenceProcessor().processReferenceData(project, targetFile, bounds.start, referenceData.toTypedArray())
|
||||||
|
|
||||||
explicitImports.forEach { fqName ->
|
explicitImports.forEach { fqName ->
|
||||||
targetFile.resolveImportReference(fqName).firstOrNull()?.let {
|
targetFile.resolveImportReference(fqName).firstOrNull()?.let {
|
||||||
ImportInsertHelper.getInstance(project).importDescriptor(targetFile, it)
|
ImportInsertHelper.getInstance(project).importDescriptor(targetFile, it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
KotlinCopyPasteReferenceProcessor().processReferenceData(project, targetFile, bounds.start, referenceData.toTypedArray())
|
|
||||||
|
|
||||||
return rangeMarker.range
|
return rangeMarker.range
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
import java.io.File
|
||||||
|
|
||||||
|
class C {
|
||||||
|
private fun memberFun(file: File) {
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
jvmStatic public fun main(args: Array<String>) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
<selection>class C {
|
||||||
|
public static void main(String[] args) { }
|
||||||
|
private void memberFun(File file) {}
|
||||||
|
}</selection>
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
<caret>
|
||||||
+6
@@ -61,6 +61,12 @@ public class JavaToKotlinCopyPasteConversionTestGenerated extends AbstractJavaTo
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("AddImportsWithExplicitImports.java")
|
||||||
|
public void testAddImportsWithExplicitImports() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/copyPaste/conversion/AddImportsWithExplicitImports.java");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("AddKClassImport.java")
|
@TestMetadata("AddKClassImport.java")
|
||||||
public void testAddKClassImport() throws Exception {
|
public void testAddKClassImport() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/copyPaste/conversion/AddKClassImport.java");
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/copyPaste/conversion/AddKClassImport.java");
|
||||||
|
|||||||
Reference in New Issue
Block a user