I would like to create a Resharper Live Template that changes all spaces to emphasize my βactualβ Live $ testname $ template variable:
<Fact()> _
Public Sub $testnames$()
' Arrange
$END$
' Act
' Assert
End Sub
I have it:
[Macro("applyRegex", ShortDescription = "Run on {#0:variable}", LongDescription = "")]
class ApplyRegexMacro : IMacro
{
public string EvaluateQuickResult(IHotspotContext context, IList<string> arguments)
{
return Regex.Replace(arguments[0], " ", "_", RegexOptions.IgnoreCase);
}
public HotspotItems GetLookupItems(IHotspotContext context, IList<string> arguments)
{
return null;
}
public string GetPlaceholder()
{
return "placeholder";
}
public bool HandleExpansion(IHotspotContext context, IList<string> arguments)
{
return false;
}
public ParameterInfo[] Parameters
{
get
{
return new[] { new ParameterInfo(ParameterType.String), new ParameterInfo(ParameterType.String), new ParameterInfo(ParameterType.VariableReference) };
}
}
}
But this only works when you click a tab. I want the macro to run after I exit $ testname $.
I want to be able to simply write a test name in one line of text with spaces, and then the macro will turn all spaces into underscores.
Is it possible?
source
share