How to set the default file name in File Templates?
1. Use the following template to create a Class, the input file is named "Test", I want it to output the final result (and the file name is "TestRepository.cs") ? Or create a file named TestRepository.cs, how to replace the $CLASS$ in macro(current file name with out extension) as "Test" ?
namespace xxx {
public class Test{}
}
2. How to format $CLASS$ (macro=current file name without extension) to name the camel case? like input 'TestService' output 'testService'
tmpl:
namespace $NAMESPACE$
{
public class $CLASS
{
}
}
Thanks .
Please sign in to leave a comment.
Hello.
1. Do I understand right that you want a class name and a file name containing this class to be different after creating a new class? Then you should edit a “$CLASS$” variable on “File | Settings | Editor | File Templates | C# -> Class” settings page. There are several ways to set a constant for Class Name:

a. You can directly write the necessary name in the class template.
b. You can change the type of $CLASS$ variable to “Constant value” and set a predefined value.
c. Also, you can set “Current file name without extension” value and enable “Editable” mode. Then after creating a new class file a cursor will be placed on
a class name and you just can start typing the necessary class name without any additional actions.
2. Unfortunately, there is no such feature in Rider, but you can create a request on ReSharper’s tracker https://youtrack.jetbrains.com/issues/RSRP.
Best regards,
Maxim Isaev.
Thanks for your help @Maxim Isaev ^^