No named arguments completion in brackets
This commit is contained in:
@@ -311,12 +311,14 @@ class ExpectedInfos(
|
||||
val isFunctionLiteralArgument = argument is FunctionLiteralArgument
|
||||
|
||||
val callType = call.callType
|
||||
val isArrayAccess = callType == Call.CallType.ARRAY_GET_METHOD || callType == Call.CallType.ARRAY_SET_METHOD
|
||||
val rparenthTail = if (isArrayAccess) Tail.RBRACKET else Tail.RPARENTH
|
||||
|
||||
val argumentPositionData = if (argumentName != null) {
|
||||
ArgumentPositionData.Named(descriptor, callType, argumentName)
|
||||
}
|
||||
else {
|
||||
val namedArgumentCandidates = if (!isFunctionLiteralArgument && descriptor.hasStableParameterNames()) {
|
||||
val namedArgumentCandidates = if (!isFunctionLiteralArgument && !isArrayAccess && descriptor.hasStableParameterNames()) {
|
||||
val usedParameters = argumentToParameter.filter { it.key != argument }.map { it.value }.toSet()
|
||||
descriptor.valueParameters.filter { it !in usedParameters }
|
||||
}
|
||||
@@ -326,9 +328,6 @@ class ExpectedInfos(
|
||||
ArgumentPositionData.Positional(descriptor, callType, argumentIndex, isFunctionLiteralArgument, namedArgumentCandidates)
|
||||
}
|
||||
|
||||
val isArrayAccess = callType == Call.CallType.ARRAY_GET_METHOD || callType == Call.CallType.ARRAY_SET_METHOD
|
||||
val rparenthTail = if (isArrayAccess) Tail.RBRACKET else Tail.RPARENTH
|
||||
|
||||
var parameters = descriptor.valueParameters
|
||||
if (callType == Call.CallType.ARRAY_SET_METHOD) { // last parameter in set is used for value assigned
|
||||
if (parameter == parameters.last()) {
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
operator fun String.get(p1: Int, p2: Int): Int = 0
|
||||
|
||||
fun bar() {
|
||||
""[<caret>]
|
||||
}
|
||||
|
||||
// ABSENT: p1
|
||||
// ABSENT: p2
|
||||
+6
@@ -1503,6 +1503,12 @@ public class JSBasicCompletionTestGenerated extends AbstractJSBasicCompletionTes
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("NotInBrackets.kt")
|
||||
public void testNotInBrackets() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/namedArguments/NotInBrackets.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("NotInElse.kt")
|
||||
public void testNotInElse() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/namedArguments/NotInElse.kt");
|
||||
|
||||
+6
@@ -1503,6 +1503,12 @@ public class JvmBasicCompletionTestGenerated extends AbstractJvmBasicCompletionT
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("NotInBrackets.kt")
|
||||
public void testNotInBrackets() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/namedArguments/NotInBrackets.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("NotInElse.kt")
|
||||
public void testNotInElse() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/namedArguments/NotInElse.kt");
|
||||
|
||||
Reference in New Issue
Block a user