Embed parameter variables in Live templates?

Hi



Does anyone know if you can embed parameter variables in Live templates?
For example in the template snippet we have:



/// /// $Description$ /// public enum $Name$ { ///

/// $EnumValue$ /// $EnumValue$, /// /// Unknown Value /// ]]>

Unknown

}

}



I am using the 'Constraint Value' macro with the string value set to 'This
Enum is a list of valid $Name$ items.' What I want to happen is the $Name$
variable is expanded before the $Description$ constant is displayed.



Alternately, is there a way of building parameter strings in resharper?



Clear as mud? Sorry new at this!



Pete



1 comment
Comment actions Permalink

Hello Peter,

You can use Move up/down buttons in Live Template editor to reorder template
variables.
However, variables are not expanded recursively, so $Name$ reference in $Description$
will not be expanded.
As a (not very good) workaround I could suggest making description a static
text, put $Name$ in that text so it is expanded and use $END$ marker at the
beginning of description to place caret for immediate description edition.

We are considering major improvements for Live Templates in next version,
thanks for idea!

Sincerely,
Ilya Ryzhenkov

JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"


PB> Hi
PB>
PB> Does anyone know if you can embed parameter variables in Live
PB> templates? For example in the template snippet we have:
PB>
PB> /// PB> PB> /// $Description$ PB> PB> /// PB> PB> public enum $Name$ PB> PB> { PB> PB> ///

PB> PB> /// $EnumValue$ PB> PB> /// PB> PB> $EnumValue$, PB> PB> /// PB> PB> /// Unknown Value PB> PB> /// PB> PB> Unknown PB> PB> } PB> PB> } PB> PB> I am using the 'Constraint Value' macro with the string value set to PB> 'This Enum is a list of valid $Name$ items.' What I want to happen PB> is the $Name$ variable is expanded before the $Description$ constant PB> is displayed. PB> PB> Alternately, is there a way of building parameter strings in PB> resharper? PB> PB> Clear as mud? Sorry new at this! PB> PB> Pete PB>]]>


0

Please sign in to leave a comment.