I am trying to use Resharper’s Search with Pattern/Structural Replacement functionality to find (cs)html fragments like the following, with the end goal of replacing said code with an editor template:
<div class="editor-label">
@Html.LabelFor(model => model.FirstName)
</div>
<div class="editor-field">
@Html.TextBoxFor(model => model.FirstName, new { @class = "text" })
@Html.ValidationMessageFor(model => model.FirstName)
</div>
I am using the following pattern, but I receive an error saying that the search pattern could not be parsed:
@Html.LabelFor(model => model.$propertyName$)
<div class="editor-label">
@Html.LabelFor(model => model.$propertyName$)
</div>
<div class="editor-field">
@Html.TextBoxFor(model => model.$propertyName$, new { @class = "text" })
@Html.ValidationMessageFor(model => model.$propertyName$)
</div>
Can anyone tell me:
- If I am doing something wrong
- If Resharper’s pattern functionality is capable of dealing with HTML
- If Resharper’s pattern functionality is capable of dealing with multiline patterns
Thanks in advance
JP
ReSharper 6.0 doesn’t support SSR in HTML, but 6.1 will.
But still, only plain HTML (in html, aspx, cshtml files), but not Razor constructions, like @Html.
So, your pattern will not work even in 6.1.
P.S. Yes, ReSharper is capable of handling multiline patterns.