Suppose I have the following class and respective instance:
case class Account(name: String, age: Int, amount: BigDecimal, currency: String)
Account("name", 93, 100, "USD")
Question: Is there a shortcut in IntelliJ IDEA that will generate parameter names against passed arguments, i.e.
Account(name = "name", age = 93, amount = 100, currency = "USD")
This is very useful when you have a constructor or a method taking a long list of parameters and helps to read / refactor some old code.
Please note that I am aware of Ctrl+P
showing parameter info and I am also aware of Inlay Hints
setting in IntelliJ showing the hints in the editor.
Just alt
+Enter
and then choose "use named argument ...":
There exists intention action Use named arguments
which transforms
User("Worf")
to
User(name = "Worf")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With