Fixed KT-6429 Wrong replacement range in smart completion in some particular case
#KT-6429 Fixed
This commit is contained in:
@@ -272,7 +272,7 @@ public class KotlinCompletionContributor : CompletionContributor() {
|
||||
val chars = document.getCharsSequence()
|
||||
while (i < chars.length()) {
|
||||
val c = chars.charAt(i)
|
||||
if (c == '\n' || c == 'r') return true
|
||||
if (c == '\n') return true
|
||||
if (!Character.isWhitespace(c)) return false
|
||||
i++
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
import java.util.ArrayList
|
||||
|
||||
class C(p: Int, p2: Int)
|
||||
|
||||
fun foo(p: Int){
|
||||
val result = ArrayList<String>()
|
||||
C(1, <caret>result.size())
|
||||
}
|
||||
|
||||
// CHAR: '\t'
|
||||
// ELEMENT: p
|
||||
@@ -0,0 +1,11 @@
|
||||
import java.util.ArrayList
|
||||
|
||||
class C(p: Int, p2: Int)
|
||||
|
||||
fun foo(p: Int){
|
||||
val result = ArrayList<String>()
|
||||
C(1, p)<caret>
|
||||
}
|
||||
|
||||
// CHAR: '\t'
|
||||
// ELEMENT: p
|
||||
+6
-1
@@ -19,7 +19,6 @@ package org.jetbrains.jet.completion.handlers;
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.jet.JUnit3RunnerWithInners;
|
||||
import org.jetbrains.jet.JetTestUtils;
|
||||
import org.jetbrains.jet.test.InnerTestClasses;
|
||||
import org.jetbrains.jet.test.TestMetadata;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
@@ -534,6 +533,12 @@ public class SmartCompletionHandlerTestGenerated extends AbstractSmartCompletion
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("ReplaceArgument.kt")
|
||||
public void testReplaceArgument() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/completion/handlers/smart/ReplaceArgument.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("SAMExpected1.kt")
|
||||
public void testSAMExpected1() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/completion/handlers/smart/SAMExpected1.kt");
|
||||
|
||||
Reference in New Issue
Block a user