Surround with template: Containing member name as parameter?
Existing code:
public string FontFamily { get; }
public BarCode Generate(Barcode barcode) { ... }
Resulting code:
#region FontFamily
public string FontFamily { get; }
#endregion
#region Generate
public BarCode Generate(Barcode barcode) { ... }
#endregion
However, I could not find a parameter for the surround with template to insert the inner member name.
Yes, I saw the other post, but it is pretty old and more complex than my use case.
If there is a way to reach my requirement with or without using surround with templates, please let me know.
It would be still better if I could apply this operation to all members of a class at once.
Please sign in to leave a comment.
Hello Niklas!
Thank you for contacting us.
Live Template is definitely what you are looking for - https://www.jetbrains.com/help/resharper/Templates__Applying_Templates__Creating_Source_Code_Using_Live_Templates.html
Using Live Templates you can create your custom Surround With template meeting your requirements.
Thank you.
I had already tried that, but I do not know which template macro to use to get the inner member name (FontFamily, ... in my example above).
Hello Niklas!
Please accept my appoligies cause I've misled you.
The specified behavior cannot be reached using Live Templates feature.
I've filed corresponding feature request in our issue tracker - https://youtrack.jetbrains.com/issue/RSRP-466437. It is addressed to file layout subsystem as it meets requirement to apply this operation to all members at once.
You are welcome to comment or vote for the request.
Thank you.