mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fixed PY-9466 Wrong current parameter highlighting for the very first parameter in finction
regression, added test
This commit is contained in:
@@ -178,7 +178,10 @@ public class PyParameterInfoHandler implements ParameterInfoHandler<PyArgumentLi
|
||||
// highlight the next parameter to be filled
|
||||
if (canOfferNext) {
|
||||
int highlightIndex = Integer.MAX_VALUE; // initially beyond reason = no highlight
|
||||
if (lastParamIndex < parameterList.size() - 1) { // lastParamIndex not at end, or no args
|
||||
if (isArgsEmpty) {
|
||||
highlightIndex = marked.getImplicitOffset(); // no args, highlight first (PY-3690)
|
||||
}
|
||||
else if (lastParamIndex < parameterList.size() - 1) { // lastParamIndex not at end, or no args
|
||||
if (namedParameters.get(lastParamIndex).isPositionalContainer()) {
|
||||
highlightIndex = lastParamIndex; // stick to *arg
|
||||
}
|
||||
@@ -186,9 +189,6 @@ public class PyParameterInfoHandler implements ParameterInfoHandler<PyArgumentLi
|
||||
highlightIndex = lastParamIndex + 1; // highlight next
|
||||
}
|
||||
}
|
||||
else if (isArgsEmpty) {
|
||||
highlightIndex = marked.getImplicitOffset(); // no args, highlight first (PY-3690)
|
||||
}
|
||||
else if (lastParamIndex == parameterList.size() - 1) { // we're right after the end of param list
|
||||
if (namedParameters.get(lastParamIndex).isPositionalContainer() || namedParameters.get(lastParamIndex).isKeywordContainer()) {
|
||||
highlightIndex = lastParamIndex; // stick to *arg
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
def foo(a, b, c):
|
||||
pass
|
||||
|
||||
foo(<arg1>)
|
||||
@@ -375,6 +375,11 @@ public class PyParameterInfoTest extends LightMarkedTestCase {
|
||||
feignCtrlP(marks.get("<arg4>").getTextOffset()).check("*arg, a=1, b=2", new String[]{"a=1, "});
|
||||
}
|
||||
|
||||
public void testNoArgs() {
|
||||
Map<String, PsiElement> marks = loadTest(1);
|
||||
feignCtrlP(marks.get("<arg1>").getTextOffset()).check("a, b, c", new String[]{"a, "});
|
||||
}
|
||||
|
||||
/**
|
||||
* Imitates pressing of Ctrl+P; fails if results are not as expected.
|
||||
* @param offset offset of 'cursor' where ^P is pressed.
|
||||
|
||||
Reference in New Issue
Block a user