IDEA-184991 Parameter info popup doesn't highlight current item

updated fix for IDEA-180584, to account for this use case
This commit is contained in:
Dmitry Batrak
2018-01-29 17:40:25 +03:00
parent 5542ec580e
commit 487719aff5
4 changed files with 21 additions and 38 deletions
@@ -343,11 +343,13 @@ public class MethodParameterInfoHandler implements ParameterInfoHandlerWithTabAc
context.setHighlightedParameter(completeMatch);
}
Object highlightedCandidate = candidates.length == 1 ? candidates[0] : context.getHighlightedParameter();
if (highlightedCandidate != null) {
PsiMethod method = (PsiMethod)(highlightedCandidate instanceof CandidateInfo
? ((CandidateInfo)highlightedCandidate).getElement() : highlightedCandidate);
if (!method.isVarArgs() && index >= method.getParameterList().getParametersCount()) context.setCurrentParameter(-1);
if (context.isSingleParameterInfo()) {
Object highlightedCandidate = candidates.length == 1 ? candidates[0] : context.getHighlightedParameter();
if (highlightedCandidate != null) {
PsiMethod method = (PsiMethod)(highlightedCandidate instanceof CandidateInfo
? ((CandidateInfo)highlightedCandidate).getElement() : highlightedCandidate);
if (!method.isVarArgs() && index >= method.getParameterList().getParametersCount()) context.setCurrentParameter(-1);
}
}
}
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2018 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.lang.parameterInfo;
@@ -38,6 +24,7 @@ public interface UpdateParameterInfoContext extends ParameterInfoContext {
boolean isPreservedOnHintHidden();
void setPreservedOnHintHidden(boolean value);
boolean isInnermostContext();
boolean isSingleParameterInfo();
UserDataHolderEx getCustomContext();
}
@@ -1,6 +1,4 @@
/*
* Copyright 2000-2018 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-2018 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;
@@ -667,6 +665,11 @@ public class ParameterInfoController extends UserDataHolderBase implements Visib
return true;
}
@Override
public boolean isSingleParameterInfo() {
return mySingleParameterInfo;
}
@Override
public UserDataHolderEx getCustomContext() {
return ParameterInfoController.this;
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2018 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.testFramework.utils.parameterInfo;
import com.intellij.lang.parameterInfo.UpdateParameterInfoContext;
@@ -105,6 +91,11 @@ public class MockUpdateParameterInfoContext implements UpdateParameterInfoContex
return false;
}
@Override
public boolean isSingleParameterInfo() {
return false;
}
@Override
public UserDataHolderEx getCustomContext() {
throw new UnsupportedOperationException();