fileTemplateGroup with "Enable Live Templates" enabled by default How?

Answered

I want to provide some File Templates with my plugin which includes $END$ live template variable. 

I used the fileTemplateGroup extension here implementing FileTemplateGroupDescriptorFactory here to register my file templates. my file Templates are placed in "resources/fileTemplates/j2ee" folder

FileTemplateGroupDescriptor only has name, description, and icon.  I want to have "Enable Live Templates" enabled by default but editable by the user.

Also, I see that the "Reformat according to style" option is disabled. is it possible to disable it by default and allow users to enable if they want. The reason is that $END$ will be placed with some indent, when the file is created the cursor is placed ignoring the indent

1
2 comments

Hi, "Enable Live Templates" is set by default if your template has "#[[$" fragment in its text. Do you have #[[$END$]]# in your template text?

As for "Reformat according to style", currently there is no way to uncheck it by default. Could you provide your template text, to reproduce the problem with cursor?

0

Hi, "Enable Live Templates" is set by default if your template has "#[[$" fragment in its text. Do you have #[[$END$]]# in your template text?

Yes, it works. 

As for "Reformat according to style", currently there is no way to uncheck it by default. Could you provide your template text, to reproduce the problem with cursor?

This is the file template I was using.

#[[#include]]#<bits/stdc++.h>

#[[#define]]# fastio ios_base::sync_with_stdio(false);cin.tie(0)

using namespace std;

int main() {
fastio;
#[[$END$]]#
return 0;
}

Here the cursor does not have that indent.

0

Please sign in to leave a comment.