简体   繁体   English

为什么 Visual Studio 会突出显示 Razor (.cshtml/.razor) 中的双花括号?

[英]Why does Visual Studio highlight double curly braces in Razor (.cshtml/.razor)?

Although I have been working with Razor pages( .cshtml ) and Razor components( .razor ) in Blazor for a while in Visual Studio 2019, I did not stumble upon this feature up until now where it highlights anything between two pairs of braces: {{ }} . Although I have been working with Razor pages( .cshtml ) and Razor components( .razor ) in Blazor for a while in Visual Studio 2019, I did not stumble upon this feature up until now where it highlights anything between two pairs of braces: {{ }}

It does it for both Razor pages( .cshtml ) and Razor components( .razor ).它适用于 Razor 页面( .cshtml )和 Razor 组件( .razor )。 There is no mention of such syntax in the Razor syntax documentation . Razor 语法文档中没有提到这种语法。 What purpose was the {{}} syntax intended to serve? {{}}语法的目的是什么? What am I missing?我错过了什么?

This is what it looks like.这就是它的样子。 The text is highlighted in hot pink:文本以亮粉色突出显示:

双括号之间突出显示的文本。

This is what the same highlight looks like in the light theme:这是浅色主题中相同的亮点:

浅色主题中突出显示的文本

This is mapped by the "HTML Client Template Value" setting in Tools|Options.这由工具|选项中的“HTML 客户端模板值”设置映射。

It is a piece of HTML syntax used in ao Angular for data-binding,它是一段 HTML 语法在 ao Angular 中用于数据绑定,
like <h1> {{user.username}} </h1> .<h1> {{user.username}} </h1> Comparable to Blazor's yellow @堪比 Blazor 的黄色@

I don't think this has any meaning in a Blazor (razor) file.我认为这在 Blazor(剃刀)文件中没有任何意义。 Safe to ignore.安全忽略。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Visual Studio 2012 - 未加载Razor视图文件(“.cshtml”)中的断点 - Visual Studio 2012 - Breakpoints in Razor view files (“.cshtml”) not being loaded 为什么 Visual Studio 2019 会删除对新 .razor 文件的监视? - Why does Visual Studio 2019 remove watch for new .razor files? 为什么模式不适用于 cshtml (razor) asp.net? - why does pattern not work for cshtml (razor) asp.net? 为什么剃须刀在Visual Studio中工作而不在exe外部工作? - Why is razor working in visual studio and not outside in the exe? 获取Visual Studio以使用自定义主机factoryType突出显示Razor语法 - Get Visual Studio to highlight Razor syntax with a custom host factoryType 如何在剃刀中逃避花括号(例如,定义数组) - How to escape curly braces in razor (e.g. to define an array) 将razor(cshtml)和c#项目添加到Visual Studio vb网站是否错误? - Is it wrong to add razor (cshtml) and c# projects to a Visual Studio vb website? 在Visual Studio 2012中使用Curly括号自动完成 - Curly braces autocomplete in Visual Studio 2012 Visual Studio使用MVC5和Razor突出显示.cshtml页面中不存在的错误 - Visual Studio highlights non-existant errors in .cshtml pages using MVC5 and Razor 为什么Razor页面(OnX)处理程序在debug / visual studio中被调用两次? - Why does Razor page (OnX) handler get invoked twice in debug/visual studio?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM