How to se own definied Variable in more than own template?

已回答

Hello.
First of all, I wish you a happy new year. Now to my question. Can I use a File And Code Template (CamelCase.java) in IntelliJ? #set($CAMEL_CASE_NAME = "${NAME.substring(0,1).toLowerCase()}${NAME.substring(1)}") define and then call CamelCase.java with #parse or #include in a 2nd template (UseCamelCase.java) in order to be able to use ${CAMEL_CASE_NAME} in UseCamelCase.java?

Thank you for your efforts.

Best regards

Markus Jannek

 

 

 

0
Hi,

Yes, you can do it by using the below steps:

1. Open `File | Settings | Editor | File and Code Templates | Includes tab`, and add a template with template name `camel` with content #set($CAMEL_CASE_NAME = "${NAME.substring(0,1).toLowerCase()}${NAME.substring(1)}")
2. Create a template in `File | Settings | Editor | File and Code Templates` and use #parse("camel") to use it.

See here for details: https://www.jetbrains.com/help/idea/parse-directive.html
0

请先登录再写评论。