mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fix parameter popup for vararg methods (was empty for vararg params)
This commit is contained in:
+4
-4
@@ -1,6 +1,4 @@
|
||||
// Copyright 2000-2017 JetBrains s.r.o.
|
||||
// Use of this source code is governed by the Apache 2.0 license that can be
|
||||
// found in the LICENSE file.
|
||||
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.codeInsight.hint.api.impls;
|
||||
|
||||
import com.intellij.codeInsight.AnnotationTargetUtil;
|
||||
@@ -563,13 +561,15 @@ public class MethodParameterInfoHandler implements ParameterInfoHandlerWithTabAc
|
||||
buffer.append("(");
|
||||
}
|
||||
|
||||
final int currentParameter = context.getCurrentParameterIndex();
|
||||
int currentParameter = context.getCurrentParameterIndex();
|
||||
|
||||
PsiParameter[] parms = method.getParameterList().getParameters();
|
||||
int numParams = parms.length;
|
||||
int highlightStartOffset = -1;
|
||||
int highlightEndOffset = -1;
|
||||
if (numParams > 0) {
|
||||
if (context.isSingleParameterInfo() && method.isVarArgs() && currentParameter >= numParams) currentParameter = numParams - 1;
|
||||
|
||||
for (int j = 0; j < numParams; j++) {
|
||||
if (context.isSingleParameterInfo() && j != currentParameter) continue;
|
||||
|
||||
|
||||
+6
@@ -364,20 +364,26 @@ public class CompletionHintsTest extends LightFixtureCompletionTestCase {
|
||||
public void testVarargWithNoMandatoryArguments() throws Exception {
|
||||
configureJava("class C { int vararg(int... args){ return 0; } void m() { varar<caret> } }");
|
||||
complete();
|
||||
waitForAllAsyncStuff();
|
||||
checkResultWithInlays("class C { int vararg(int... args){ return 0; } void m() { vararg(<HINT text=\"args:\"/><caret>) } }");
|
||||
checkHintContents("<html><b>int...</b></html>");
|
||||
type("1");
|
||||
next();
|
||||
waitForAllAsyncStuff();
|
||||
checkResultWithInlays("class C { int vararg(int... args){ return 0; } void m() { vararg(<hint text=\"args:\"/>1, <caret>) } }");
|
||||
checkHintContents("<html><b>int...</b></html>");
|
||||
next();
|
||||
waitForAllAsyncStuff();
|
||||
checkResultWithInlays("class C { int vararg(int... args){ return 0; } void m() { vararg(<hint text=\"args:\"/>1)<caret> } }");
|
||||
checkHintContents(null);
|
||||
prev();
|
||||
waitForAllAsyncStuff();
|
||||
checkResultWithInlays("class C { int vararg(int... args){ return 0; } void m() { vararg(<hint text=\"args:\"/>1, <caret>) } }");
|
||||
checkHintContents("<html><b>int...</b></html>");
|
||||
prev();
|
||||
waitForAllAsyncStuff();
|
||||
checkResultWithInlays("class C { int vararg(int... args){ return 0; } void m() { vararg(<HINT text=\"args:\"/>1<caret>) } }");
|
||||
checkHintContents("<html><b>int...</b></html>");
|
||||
}
|
||||
|
||||
public void testVarargWithTwoMandatoryArguments() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user