具有模式/结构替换功能的 Resharper 搜索问题
我正在尝试使用 Resharper 的使用模式/结构替换进行搜索功能来查找如下所示的 (cs)html 片段,最终目标是用编辑器模板替换所述代码:
<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>
我正在使用以下模式,但我收到一条错误,指出无法解析搜索模式:
@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>
谁能告诉我:
- 如果我做错了什么
- 如果 Resharper 的模式功能能够处理 HTML
- 如果 Resharper 的模式功能能够处理 HTML多线模式
提前致谢
JP
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
ReSharper 6.0 不支持 HTML 中的 SSR,但 6.1 会。
但仍然只有纯 HTML(在 html、aspx、cshtml 文件中),而不是 Razor 结构,如 @Html。
所以,你的模式即使在 6.1 中也不起作用。
PS 是的,ReSharper 能够处理多行模式。
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.