有没有办法自动填充参数名称? [英] Is there a way to auto-fill arguments names?
本文介绍了有没有办法自动填充参数名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我使用大量参数实例化类(或调用方法)时,我总是使用命名参数.但是每次都输入每个参数名称很累:
When I instantiate classes (or call methods) with a large number of parameters I'm always using named arguments. But it's tiring to type each argument name every time:
data class User(val id: String,
val name: String,
val age: Int)
val user = User(id = "1", name = "John", age = 99)
IDEA 可以这样预填参数吗?
Can IDEA pre-fill parameters like this?
val user = User(
id = ,
name = ,
age =
)
推荐答案
有一个很棒的插件:https://plugins.jetbrains.com/plugin/10942-kotlin-fill-class
它使用一些默认参数自动填充构造函数,以便您可以覆盖您想要的参数;)
It autofills the constructor with some default parameters so you can override the ones you want ;)
这篇关于有没有办法自动填充参数名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文