Cannot add Code Template (grayed out)

Answered

Hi, this might be similar to: https://intellij-support.jetbrains.com/hc/en-us/community/posts/206606285-Create-new-Code-Template-button-grayed-out?input_string=Cannot%20add%20Code%20Template%20(grayed%20out) but due to date and solution provided there doesn't work for me prefer to create new post. I'm ok if you prefer me to move it there.

 

IntelliJ version: 2020.1.4 MacOS (although issue has been there for a while now)

Issue: I cannot add new code templates, only modify existing ones. Options to add or remove are grayed out:

 

I've been able to workaround it by using other features like Live Templates, but not sure why I can't add/remove code templates if needed.

4 comments
Comment actions Permalink

Hi Christian,

This tab displays built-in snippets — templates for code fragments that IntelliJ IDEA can generate in various typical situations, e.g. for generating implemented or overridden method bodies.

You can edit the existing snippets, but you cannot create new ones because this list is formed automatically out of data supplied by various plugins.

See https://www.jetbrains.com/help/idea/settings-file-and-code-templates.html#tabs for more information about each tab's purpose.

0
Comment actions Permalink

how to use a custom template as a intention? the test class for example, i want to use file which uses Kotlin as default, but i`m getting the java one instead;

0
Comment actions Permalink

Krllus

The easiest way is to convert your Java code to Kotlin post test class creation (right-click on file > Convert Java file to Kotlin file). IntelliJ IDEA will also offer to automatically correct potentially related code in the rest of your project.

0

Please sign in to leave a comment.