How can I change the template for kotlins toString() code generation in intellij?
When working with java files inside of intellij, you are able to auto-generate the override for the `toString()` method by using `Code > Generate > toString()`. From here you are able to go into `Settings > Templates`, and create new templates to change how intellij would format the generated `toString()` method.
Where is this setting for kotlin code? I have project entirely made in kotlin, however the `Settings` button doesn't exist whenever I go to generate my `toString()`. there's no way i'm going to hand write the `toString()` method for hundreds of different classes, so am I just going to be forced to use this whack formatting that puts hundreds of characters on a single line? I mean, there is another template option that allows `Multiple templates with concatenation` that looks like the following:
```kotlin
override fun toString(): String {
return "MyBogusObject(" +
"firstProperty=$firstProperty" +
"secondProperty=$secondProperty" +
")"
}
```
however, I think that's ugly and I would prefer intellij generate something like the following (no concat):
```kotlin
override fun toString(): String {
return """
MyBogusObject(
firstProperty=$firstProperty
secondProperty=$secondProperty
)
""".trimIndent()
}
```
A quick google search for this continues to yield results on the jetbrains website that give instructions for how to change the template, but nothing in regards to the languages that support this. Am I going about this wrong? is there any way that I can update the template for kotlin? if not, are there any alternatives? third-parties that'll do this for me (no preferred)?
请先登录再写评论。