diff --git a/python/src/com/jetbrains/python/PyParameterInfoHandler.java b/python/src/com/jetbrains/python/PyParameterInfoHandler.java index 5c288251f2be..b1d2eeae08ae 100644 --- a/python/src/com/jetbrains/python/PyParameterInfoHandler.java +++ b/python/src/com/jetbrains/python/PyParameterInfoHandler.java @@ -3,6 +3,7 @@ package com.jetbrains.python; import com.intellij.codeInsight.lookup.LookupElement; import com.intellij.lang.parameterInfo.*; import com.intellij.openapi.util.TextRange; +import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; import com.intellij.util.ArrayUtil; import com.intellij.util.text.CharArrayUtil; @@ -156,11 +157,17 @@ public class PyParameterInfoHandler implements ParameterInfoHandler args = PyUtil.flattenedParensAndLists(arglist.getArguments()); for (PyExpression arg : args) { if (arg.getTextRange().contains(current_param_offset)) { - PyNamedParameter param = result.getPlainMappedParams().get(arg); - if (param != null) { - final Integer param_index = param_indexes.get(param); - if (param_index < hint_flags.size()) { - hint_flags.get(param_index).add(ParameterInfoUIContextEx.Flag.HIGHLIGHT); + PsiElement seeker = arg; + while (seeker != arglist && seeker != null && !result.getPlainMappedParams().containsKey(seeker)) { + seeker = seeker.getParent(); // flattener may have flattened a tuple arg that is mapped to a plain param; find it. + } + if (seeker instanceof PyExpression) { + PyNamedParameter param = result.getPlainMappedParams().get((PyExpression)seeker); + if (param != null) { + final Integer param_index = param_indexes.get(param); + if (param_index < hint_flags.size()) { + hint_flags.get(param_index).add(ParameterInfoUIContextEx.Flag.HIGHLIGHT); + } } } else if (arg == result.getTupleArg()) { diff --git a/python/src/com/jetbrains/python/psi/impl/PyCallExpressionHelper.java b/python/src/com/jetbrains/python/psi/impl/PyCallExpressionHelper.java index 3b013dff78ed..6e807b3f6472 100644 --- a/python/src/com/jetbrains/python/psi/impl/PyCallExpressionHelper.java +++ b/python/src/com/jetbrains/python/psi/impl/PyCallExpressionHelper.java @@ -467,7 +467,7 @@ public class PyCallExpressionHelper { PyNamedParameter n_par = par.getAsNamed(); if (n_par != null) { cnt += 1; - slots.put(n_par, arg); + slots.put(n_par, PyUtil.peelArgument(arg)); mapped_args.add(arg); } else { diff --git a/python/testData/paramInfo/TupleArgPlainParam.py b/python/testData/paramInfo/TupleArgPlainParam.py new file mode 100644 index 000000000000..24b8e574387a --- /dev/null +++ b/python/testData/paramInfo/TupleArgPlainParam.py @@ -0,0 +1,4 @@ +def f(a, b, c): + return a, b, c + +f(1, (2, 3, 4), 5)