How to create custom template parameter macro?
Dear ReSharper Community, if I create a Live, Surround or File Template I have the option to quote a parameter with the $ symbol. For example: $FUNCNAME$.
Now I have the option to choose a macro, but in my case I would need a macro which returns the project name in all caps with no extension.
Thus I need to create my own macro which can be selected under “Choose macro”. A macro which is close to my needs is called "Current file name in upper case with all non-alphanumeric replaced with underscores".
Has anyone an idea how to archive this?
Please sign in to leave a comment.
Hello,
It's currently not possible to add a custom macro, all the predefined macros are implemented in R# itself. Since you want the name of the current project, I guess you need to use the "Name of the current project" macro. Or did you mean the name of the current file?
Hello Igor Akhmetov,
thank you for your response. I need it differently:
“Name of the current project in upper case with all non-alphanumeric replaced with underscores” and “Current file name in upper case with all non-alphanumeric replaced with underscores without file extension.”
The existing macros “Name of the current project” and “Current file name in upper case with all non-alphanumeric replaced with underscores” are close to my needs, but I need them exactly as described before.
Otherwise, the replaced parameter doesn't match to the defines in my source code.
Example use case: File Template “MyHeader”:
Result should be:
What I can achieve with the current macros:
EXAMPLE_FILENAME_CPP: I need to remove the _CPP somehow.
ExampleProjectname: Should be all upper case and all non-alphanumeric replaced with underscores.
Sorry, I don't think this is possible right now.