VS 2008的自定义语法突出显示 [英] Custom syntax highlighting for VS 2008

查看:109
本文介绍了VS 2008的自定义语法突出显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近我一直在使用 John Lam的"Vibrant Ink" VS配色方案,想要对其进行调整,以便突出显示具有不同颜色的类的方法名称.事实证明,在VS中没有选项.

Resharper具有一项功能,它提供了自定义语法突出显示功能.我想知道编写一个小插件可以使您的自定义语法突出显示有多难?那里有这样的开源广告插件吗?

编辑

谢谢,我设法使用DXCore破解了东西,我的VS看起来很像textmate.

VS看上去很棒http://img14.imageshack.us/img14/637/awesomevsgq1.png

**注意**

我不得不稍微修改Rory的代码段,以便它可以与C#中的点分方法名称和相等运算符一起使用.

我现在正在使用:

            string name = ea.LanguageElement.Name.Split('.').Last();

            if (name == ("op_Equality")) {
                name = "==";
            } else if (name == "op_Inequality") {
                name = "!=";
            }

            ea.PaintArgs.OverlayText(name, 
                ea.LanguageElement.NameRange.Start, 
                Color.FromArgb(255,204,0)); 

解决方案

正如Brian所说的... 社区插件网站"上还有其他一些装饰插件",并且

中有一个不错的社区 如果您有任何特定问题,请

DevExpress IDE工具论坛. /p>

DXCore CodeRush >已构建,可以让您了解哪种类型

他们具备的图形功能.

那表示您不需要这两个工具中的任何一个即可使用 DXCore .

社区网站上的所有内容都是开放源代码" ( PaintIt )

要让您了解事物的简单程度...只需将以下代码添加到基本插件模板中,即可使用社区插件网站.

可以从我的网站此处获得该二进制文件.

您只需要下载并安装 DXCore 并将插件的二进制文件(默认为C:\ Program Files \ Developer Express Inc \ DXCore for Visual Studio .NET \ 2.0 \ Bin \ Plugins).然后启动VS,您的方法名称应该全部在HotPink中(可爱)

I've been using John Lam's Vibrant Ink VS color scheme lately and wanted to tweak it so it highlights the method names for a class with a different color. Turns out there is no option in VS for that.

Resharper has a feature that provides custom syntax highlighting. I was wondering how hard is it to write a little plugin that gives you granular custom syntax highlighting? Are there any open source ad-ins like that out there?

EDIT

Thanks all, I managed to hack stuff up using DXCore and my VS is looking oh so similar to textmate.

VS is looking fantastic http://img14.imageshack.us/img14/637/awesomevsgq1.png

** NOTE **

I had to slightly modify the snippet by Rory so it works with dotted method names and equality operators in C#.

I am now using:

            string name = ea.LanguageElement.Name.Split('.').Last();

            if (name == ("op_Equality")) {
                name = "==";
            } else if (name == "op_Inequality") {
                name = "!=";
            }

            ea.PaintArgs.OverlayText(name, 
                ea.LanguageElement.NameRange.Start, 
                Color.FromArgb(255,204,0)); 

解决方案

Well as Brian has already said... My PaintIt plugin will give you some idea as to what can be done with the DXCore.

Also there are some other "Decorative plugins" on our "Community Plugin Site" and we have a decent community over in the

DevExpress IDE Tools forums if you have any specific questions.

DXCore is the framework on which RefactorPro and CodeRush are built which should give you an idea of what sort

of graphical capability they are capable of.

That said you do not need either of these tools to use the DXCore.

Everything on the Community Site is "Open Source" (So is PaintIt)

To give you an idea of how simple things are... the following code is all you need to add to a basic plugin template get the basics up and running using DXCore...

Private Sub PlugIn_EditorPaintLanguageElement(ByVal ea As DevExpress.CodeRush.Core.EditorPaintLanguageElementEventArgs) Handles Me.EditorPaintLanguageElement
    If ea.LanguageElement.ElementType = LanguageElementType.Method Then
        ea.PaintArgs.OverlayText(ea.LanguageElement.Name, _
                                 ea.LanguageElement.NameRange.Start, _
                                 Color.HotPink)
    End If
End Sub

I have created a plugin (called CR_ColorizeMemberNames) based on this code and added it to the Community Plugin Site.

The binary is available from my site here.

You need only download and install DXCore and place the binary of the plugin in the plugins folder (Defaults to C:\Program Files\Developer Express Inc\DXCore for Visual Studio .NET\2.0\Bin\Plugins).. Then start VS and your method names should all be in HotPink (Lovely)

这篇关于VS 2008的自定义语法突出显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆