diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaMethodCallElement.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaMethodCallElement.java index be53fc0cd139..151dce0520c9 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaMethodCallElement.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaMethodCallElement.java @@ -15,11 +15,11 @@ */ package com.intellij.codeInsight.completion; +import com.intellij.codeInsight.AutoPopupController; import com.intellij.codeInsight.completion.util.MethodParenthesesHandler; import com.intellij.codeInsight.lookup.*; import com.intellij.codeInsight.lookup.impl.JavaElementLookupRenderer; -import com.intellij.codeInsight.template.Template; -import com.intellij.codeInsight.template.TemplateManager; +import com.intellij.codeInsight.template.*; import com.intellij.codeInsight.template.impl.ConstantNode; import com.intellij.codeInsight.template.impl.TemplateManagerImpl; import com.intellij.codeInsight.template.impl.TemplateState; @@ -206,7 +206,8 @@ public class JavaMethodCallElement extends LookupItem implements Type template.addTextSegment(", "); } String name = StringUtil.notNullize(parameters[i].getName()); - template.addVariable(name, new ConstantNode(name), new ConstantNode(name), true); + Expression expression = Registry.is("java.completion.argument.live.template.completion") ? new AutoPopupCompletion() : new ConstantNode(name); + template.addVariable(name, expression, new ConstantNode(name), true); } template.addTextSegment(argList.getText().substring(caretOffset - argRange.getStartOffset(), argList.getTextLength())); template.addEndVariable(); @@ -353,4 +354,24 @@ public class JavaMethodCallElement extends LookupItem implements Type } } + + private static class AutoPopupCompletion extends Expression { + @Nullable + @Override + public Result calculateResult(ExpressionContext context) { + return new InvokeActionResult(() -> AutoPopupController.getInstance(context.getProject()).scheduleAutoPopup(context.getEditor())); + } + + @Nullable + @Override + public Result calculateQuickResult(ExpressionContext context) { + return null; + } + + @Nullable + @Override + public LookupElement[] calculateLookupItems(ExpressionContext context) { + return null; + } + } } diff --git a/platform/util/resources/misc/registry.properties b/platform/util/resources/misc/registry.properties index ba533ae2d310..a07131a59a03 100644 --- a/platform/util/resources/misc/registry.properties +++ b/platform/util/resources/misc/registry.properties @@ -329,6 +329,9 @@ java.completion.make.outer.variables.final.description=Make variables accessed f java.completion.argument.live.template=false java.completion.argument.live.template.description=When completing a method call, start a live template with all arguments +java.completion.argument.live.template.completion=false +java.completion.argument.live.template.completion.description=If java.completion.argument.live.template is enabled, show completion for method arguments immediately + java.completion.show.constructors=false java.completion.show.constructors.description=Show separate constructors when completing constructor call, instead of a single class name