intellij-idealive-templates

How to add a subtype for a reference type in a live template?


I am trying to create a custom live template, which would create a Spring bean declaration.

This is a template text so far.

@Bean
public $TYPE$ $BEAN_NAME$() {
    return new $TYPE_SUBTYPE$();
}

and Template Variables configuration window

enter image description here

Everything works as intended BUT $TYPE_SUBTYPE$ variable. I want it to use the first found subtype of $TYPE$ or suggest subtypes of $TYPE$.

Instead of that, it gets populated with a type of $TYPE$ and doesn't pick up a subtype, in my case a type that implements an interface used in $TYPE$.

Is it a bug?


Solution

  • This is the bug. The bug was reported in Jetbrains Youtrack.

    Update 17/03/2021: It still isn't fixed although they resolved it.