Intellij Idea - Kotlin Plugin suggestion


#1

Hey,
I would like to recommend adding an annotation option to the Create New Kotlin File/Class window allowing easy creation of an annotation class this would make creating annotations slightly less tedious.
I have also created this on youtrack https://youtrack.jetbrains.com/issue/KT-23132


#2

Maybe create an issue here: https://youtrack.jetbrains.com/issues/KT


#3

But it is already fairly easy to implement annotations in Kotlin, isn’t it?

annotation class Fancy

Or do you mean some kind of assistant asking for “rentention”, “target” etc?


#4

They are certainly easy but i was just thinking it would be a little easier to have a annotation in this dropdown that fills out the boilerplate code for you
image
maybe with options relating to the target/retention etc. it would just make creating annotaions a little bit easier and if your creating alot of them(like i was) it would be a nice quality of life feature

@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.SOURCE)
annotation class example()

#5

I have created it on youtrack thanks for the suggestion


#6

But you would need some kind of wizzard, because not everbody wants @Target(AnnotationTarget.CLASS) for example.

As a not so bad workaround you could create yourself a code template in IntelliJ to save you some typing.


#7

Yeah a wizard would also be useful, and il look into using a intellij template


#8

Does anyone now or have interest in creating a Kotlin plugin that will suggest to use named arguments in Kotlin function calls and offer to insert the named parameters into your code?


#9

The IntelliJ Kotlin plugin already has this functionality, just press Alt + Enter (Show intention actions) and select: Add names to call arguments

Example:

named%20arguments

named%20arguments%202


#10

Oh wow! You are awesome! I had actually reached out to JetBrains tech support and they sent me here and told me to put in the request. I can’t believe that they didn’t just answer my question.


#11

I guess you were just unlucky. There are hundreds of intentions in intellij. You probably just talked to someone who forgot about this one.