5

Can IntelliJ IDEA automatically fill the method call with variables?

Possibly using the names which are based on the names of the parameters of the method which is called and even also with possibility to extract those variables as parameters of the current method?

See the screenshots below for reference.

Before: IntelliJ knows what are the names of the parameters of the method which is being called. Before

After: IntelliJ created properly named variables for us. enter image description here

With automatic extracting of all parameters: IntellJ can automatically extract these variables to be parameters of the current method. enter image description here

2
  • 1
    Does this solve your problem? stackoverflow.com/questions/93591/… Commented Mar 14, 2019 at 10:21
  • @Maximus What is described in the answers to the question that you linked is a nice feature and nice auto-completion but you need to have the variables already there, they won't be created automatically for you. Commented Mar 14, 2019 at 10:52

1 Answer 1

2

It should work if there are the local variables with the same name exist in context:

enter image description here

See also IDEABKL-6690, IDEABKL-5496 requests. You can also try Smart Completion: https://www.jetbrains.com/help/idea/auto-completing-code.html#smart_completion.

There is a custom plugin that seems to do the thing - https://plugins.jetbrains.com/plugin/8638-auto-filling-java-call-arguments. You can give it a try

Sign up to request clarification or add additional context in comments.

2 Comments

The plugin what you mentioned does the thing :) I mean, to do what I wanted to do I need both, the feature provided by the plugin and the features built into the IntelliJ. You shall consider adding the functionality provided by that plugin into the IntelliJ itself :)
The plugin is working great. Make sure to install the forked 1.2 version which fixes a bug with overloaded methods : github.com/kontext-e/AutoFillingCallArguments/issues/…

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.