KT-10655 No "in" in code completion popup after "!"
#KT-10655 Fixed
This commit is contained in:
@@ -40,6 +40,7 @@ import org.jetbrains.kotlin.lexer.KtTokens.*
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.psi.psiUtil.*
|
||||
import org.jetbrains.kotlin.resolve.ModifierCheckerCore
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull
|
||||
|
||||
open class KeywordLookupObject
|
||||
|
||||
@@ -139,7 +140,22 @@ object KeywordCompletion {
|
||||
while (parent != null) {
|
||||
when (parent) {
|
||||
is KtBlockExpression -> {
|
||||
return buildFilterWithContext("fun foo() { ", prevParent, position)
|
||||
val prefixText = "fun foo() { "
|
||||
if (prevParent is KtExpression) {
|
||||
return buildFilterWithContext(prefixText, prevParent, position)
|
||||
}
|
||||
else {
|
||||
val lastExpression = prevParent
|
||||
.siblings(forward = false, withItself = false)
|
||||
.firstIsInstanceOrNull<KtExpression>()
|
||||
if (lastExpression != null) {
|
||||
val contextAfterExpression = lastExpression
|
||||
.siblings(forward = true, withItself = false)
|
||||
.takeWhile { it != prevParent }
|
||||
.joinToString { it.text }
|
||||
return buildFilterWithContext(prefixText + "x" + contextAfterExpression, prevParent, position)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
is KtWithExpressionInitializer -> {
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
fun foo() {
|
||||
list.filter { it !i<caret> }
|
||||
}
|
||||
|
||||
// EXIST: in
|
||||
// EXIST: is
|
||||
// NOTHING_ELSE
|
||||
+6
@@ -353,6 +353,12 @@ public class KeywordCompletionTestGenerated extends AbstractKeywordCompletionTes
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("NotInNotIs2.kt")
|
||||
public void testNotInNotIs2() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/keywords/NotInNotIs2.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("PrefixMatcher.kt")
|
||||
public void testPrefixMatcher() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/keywords/PrefixMatcher.kt");
|
||||
|
||||
Reference in New Issue
Block a user