When developing Intellij Idea plugin creating java classes can be done with JavaDirectoryService
which creates PsiClasses
according to file templates. Is there any way to create kotlin classes with similar method?
You can use FileTemplateUtil.createFromTemplate()
to create a file of any type from a template, including a Kotlin class.
val fileTemplate = FileTemplateManager.getInstance().getTemplate("Kotlin Class")
FileTemplateUtil.createFromTemplate(template, fileName, null, psiDirectory)