brg*_*ner 6 c# visual-studio-2010 resharper-5.1
Eclipse(至少在使用Java时)具有自动突出显示方法中所有行的功能,当方法定义中将光标放在返回类型上时方法返回.
Visual Studio + ReSharper 5.1.3中是否还有C#这样的功能?
string Do()
{
if(/**/)
return ""; // here
if(/**/)
return "1"; // here
if(/**/)
return "2"; // here
throw new Exception(""); // here
}
Run Code Online (Sandbox Code Playgroud)
当我将光标放在此示例的第一行中的字符串时,// here应突出显示标记的行.
看起来名为 Linguist 的 VS2010 扩展将接近您想要的功能。它可以为任何正则表达式进行自定义突出显示。但它似乎无法根据您的光标位置来更改它。
没有用于设置的 GUI。%LOCALAPPDATA%\Linguist相反,您可以配置一些设置文件。
由于我已经按照我希望的 Resharper 方式突出显示了语法,因此我从子目录Styles.field中的文件中删除了所有格式standard。如果您这样做,您需要保留所有名称,因此它看起来类似于:
样式字段
# If new elements are added (or old ones removed) then Definitons.cs
# and Languages.Init have to be updated.
Name: attribute
Name: command
Name: comment
<<< keep all the names in this file, just remove formatting >>>
Run Code Online (Sandbox Code Playgroud)
您将需要设置一种命名样式以用于突出显示。我做了:
Name: emphasis
BackColor: Red
Run Code Online (Sandbox Code Playgroud)
然后我custom.lang在子目录中创建了一个名为(但您可以用 .lang 扩展名命名的任何文件)的文件custom。这就是我为突出显示 return 语句所做的事情:
自定义语言
Language: csharp
Globs: *.cs
Emphasis: \breturn\b
Emphasis: \bthrow\b
Run Code Online (Sandbox Code Playgroud)
这让事情对我有用。有点复杂,但它是免费的。另一种方法可能是清除该standard\C#.lang文件,以便您可以保留其他文件格式。
最后还有另一个选择,因为它位于 github 上,您可以为突出显示的文本添加新的样式定义,这样我们就不会破坏其余的格式。很高兴有选择:)
| 归档时间: |
|
| 查看次数: |
127 次 |
| 最近记录: |