fix Tab not working to move between completion parameters for a call inside another call

This commit is contained in:
Dmitry Batrak
2018-07-24 10:32:37 +03:00
parent 8b5b0048da
commit fb8a15b92d
2 changed files with 17 additions and 2 deletions
@@ -327,7 +327,7 @@ public class JavaMethodCallElement extends LookupItem<PsiMethod> implements Type
PsiDocumentManager.getInstance(project).commitDocument(document);
MethodParameterInfoHandler handler = new MethodParameterInfoHandler();
ShowParameterInfoContext infoContext = new ShowParameterInfoContext(editor, project, context.getFile(), braceOffset, braceOffset);
ShowParameterInfoContext infoContext = new ShowParameterInfoContext(editor, project, context.getFile(), offset, braceOffset);
if (!methodCall.isValid() || handler.findElementForParameterInfo(infoContext) == null) {
document.deleteString(offset, offset + commas.length());
return;
@@ -1383,7 +1383,22 @@ public class CompletionHintsTest extends AbstractParameterInfoTestCase {
public void testHintsAreNotShownInImproperContext() {
configureJava("class C { void m() { int a = Math.ma<caret>5; } }");
complete("max(int a, int b)");
checkResult("class C { void m() { int a = Math.max(<caret>)5; } }");
checkResultWithInlays("class C { void m() { int a = Math.max(<caret>)5; } }");
}
public void testConstructorInvocationInsideMethodInvocation() throws Exception {
enableVirtualComma();
configureJava("class C { void m() { System.getPro<caret> } }");
complete("getProperty(String key)");
checkResultWithInlays("class C { void m() { System.getProperty(<caret>) } }");
type("new Strin");
complete("String(byte[] bytes, String charsetName)");
checkResultWithInlays("class C { void m() { System.getProperty(new String(<HINT text=\"bytes:\"/><caret><Hint text=\",charsetName:\"/>)) } }");
type("null");
next();
waitForAllAsyncStuff();
checkResultWithInlays("class C { void m() { System.getProperty(new String(<Hint text=\"bytes:\"/>null, <HINT text=\"charsetName:\"/><caret>)) } }");
}
private void checkResultWithInlays(String text) {