mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-2223: Ctrl+P works in tuple or list args of plain params.
This commit is contained in:
@@ -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<PyArgumentLi
|
||||
final List<PyExpression> 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()) {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
def f(a, b, c):
|
||||
return a, b, c
|
||||
|
||||
f(1, (2, 3, <arg>4), 5)
|
||||
Reference in New Issue
Block a user