如何用visual studioo 有哪些好用的插件

3680人阅读
无意中发现这么个地方:Ten Essential Tools,上面介绍了十个很好用的插件,以前用过几个,比如:TestDriven.NET,CodeKeep,于是使劲下了下来,但是还有两个找不到下载连接一个是PInvoke.NET 一个是VSMouseBindings,有那位朋友有或知道下载连接的提供一下,谢谢,我把下下来的打了个包,免得后来的朋友一个个找,请到这里下载 && TestDriven.NET Test-driven development is the practice of writing unit tests before you write code, and then writing the code to make those tests pass. By writing tests before you write code, you identify the exact behavior your code should exhibit and, as a bonus, at the end you have 100 percent test coverage, which makes extensive refactoring possible.
XML comments are invaluable tools when documenting your application. Using XML comments, you can mark up your code and then, using a tool like nDoc, you can generate help files or MSDN-like Web documentation based on those comments. The only problem with XML documentation is the time it takes to write it you often end up writing similar statements over and over again. The goal of GhostDoc is to automate the tedious parts of writing XML comments by looking at the name of your class or method, as well as any parameters, and making an educated guess as to how the documentation should appear based on recommended naming conventions. This is not a replacement for writing thorough documentation of your business rules and providing examples, but it will automate the mindless part of your documentation generation.
Strings play a large role in most applications, whether they are comments being used to describe the behavior of the system, messages being sent to the user, or SQL statements that will be executed. One of the frustrating parts of working with strings is that they never seem to paste correctly into the IDE. When you are pasting comments, the strings might be too long or not aligned correctly, leaving you to spend time inserting line breaks, comment characters, and tabbing. When working with strings that will actually be concatenated, you have to do even more work, usually separating the parts of the string and inserting concatenation symbols or using a string builder.
Throughout the process of software development, it is common to reuse small snippets of code. Perhaps you reuse an example of how to get an enum value from a string or a starting point on how to implement a certain pattern in your language of choice.
P/Invoke is the process used to access native Win32 API calls within the .NET Framework. One of the hard parts of using P/Invoke is determining the method signa this can often be an exercise in trial and error. Sending incorrect data types or values to an unmanaged API can often result in memory leaks or other unexpected results.
The Visual Studio IDE includes a huge number of different Windows, all of which are useful at different times. If you are like me, you have different window layouts that you like to use at various points in your dev work. When I am writing HTML, I like to hide the toolbox and the task list window. When I am designing forms, I want to display the toolbox and the task list. When I am writing code, I like to hide all the windows except for the task list. Having to constantly open, close, and move windows based on what I am doing can be both frustrating and time consuming.
Visual Studio makes creating Web services deceptively easy You simply create an .asmx file, add some code, and you are ready to go. ASP.NET can then create a Web Services Description Language (WSDL) file used to describe behavior and message patterns for your Web service.
Your mouse probably has five buttons, so why are you only using three of them? The VSMouseBindings power toy provides an easy to use interface that lets you assign each of your mouse buttons to a Visual Studio command.
Code is exponentially more readable when certain parts of that code are differentiated from the rest by using a different color text. Reading code in Visual Studio is generally much easier than trying to read code in an editor like Notepad.
Visual Studio 2005 includes a new debugging feature called visualizers, which can be used to create a human-readable view of data for use during the debugging process. Visual Studio 2005 includes a number of debugger visualizers by default, most notably the DataSet visualizer, which provides a tabular interface to view and edit the data inside a DataSet. While the default visualizers are very valuable, perhaps the best part of this new interface is that it is completely extensible. With just a little bit of work you can write your own visualizers to make debugging that much easier.
While this article has been dedicated to freely available add-ins, there are also a host of add-ins that can be purchased for a reasonable price. I encourage you to check out these other options, as in some cases they can add some tremendous functionality to the IDE. This article has been a quick tour of some of the best freely available add-ins for Visual Studio. Each of these add-ins may only do a small thing, but together they help to increase your productivity and enable you to write better code.
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:252550次
积分:3511
积分:3511
排名:第3801名
原创:84篇
评论:162条
(5)(15)(15)(42)(9)用过的不多,说下我用过的几个插件好了。Visual Assistant X以前的VS中很好用,现在有些功能新版的VS都内置了。作用也就不是很大了。不过出于习惯还是装上。它在启动时会额外扫描一次项目,如果你的解决方案很大的话扫描会有些悲剧。Visual HG好象是叫这个,也就是一个Mercurial的VS插件,提供一些集成化的功能。Emacs Emulator名字也记不住了。模拟Emacs的快捷键用的。这货最悲剧的就是复制粘贴的时候不能跨窗口,跨文件。而且和Visual Assistant有冲突,你用了这个插件VAX的配色每次打开VS都会被重置。如果不是特别依赖Emacs的快捷键,最好不要用这个。Atomineer Utils注释工具。可以生成Doxygen等格式的注释。可以配置各种选项。然后用Doxygen等工具生成类图或者文档等。这货最强悍的一点,是可以根据你函数和变量的名称自动判断这个函数或者变量的功能自动完成。再有的也就是一些软件提供的集成插件,比如VMware,.NET Memory Profiler之类的。其他的没怎么用过,看看别人的建议吧。
以前曾经用Visual Assist X + Productivity Power Tools,印象里VA对C++帮助比较大,C#就不是那么好用了(很久没用了,如果有误请指出)。现在组里给买了Resharper的license,不得不说没有Reshaper的VS现在已经用不习惯了。各种代码风格相关的tips和强大的功能,只能说两个字,必备。当然我平常用到的功能大概不到1/2,还是相对臃肿了一些。上面两个都有不少人推荐过了,就不多说了。下面是重头戏。强烈推荐一款叫做ClaudiaIDE(D前面的是i不是L!我就总把这个名字记错)的插件,这么好的东西竟然没人推荐。这货可以给你的VS编辑窗口换背景。之前的版本曾经有bug,但是现在看起来已经修正了。效果见下图们。默认图:MIKU:IA:
强烈推荐Visual Studio史上最强大的插件Resharper Resharper在代码整理,优化代码结构,重构等方面都有很强大的功能,楼主可参见下面这篇文章(年代久远,链接已失效 :(
):建议楼主不要在VS中使用仿Vim或者是Emacs的插件,这样会打乱VS本来的快捷键布局,VS本身自带的快捷键对于VS来说更加实用-----------
更新-----------------如果你使用了Entity Framework的话,那Entity Framework Power Tools也很不错。使用Visual Studio SDK制作GLSL词法着色插件
我们在Visual Studio上开发OpenGL ES项目时,避免不了写Shader。这时在vs里直接编辑shader就会显得很方便。但是vs默认是不支持GLSL的语法着色的,我们只好自己动手创造。最简单的实现自定义语法着色的方法就是创建一个VSIX插件包,我们只需要安装Visual Studio SDK,使用内置的模版就可以构建一个插件项目。
1.&安装Visual Studio SDK&
在下载最新的Visual Studio 2013 SDK。
双击安装,一路next即可。
安装完毕后我们可以在新建项目-&模版-&C#中看到&扩展性&这一条目,这些就是开发插件用的模版了。
2. 创建插件项目
新建项目,在扩展性标签中,选择Editor Classifier模版,命名为ShaderEditor,点击确定。
Visual Studio为我们生成了如下几个文件。
ShaderEditorFormat.cs文件的默认代码如下:&
[Export(typeof(EditorFormatDefinition))]
[ClassificationType(ClassificationTypeNames = "ShaderEditor")]
[Name("ShaderEditor")]
[UserVisible(true)] //this should be visible to the end user
[Order(Before = Priority.Default)] //set the priority to be after the default classifiers
internal sealed class ShaderEditorFormat : ClassificationFormatDefinition {
/// &summary&
/// Defines the visual format for the "ShaderEditor" classification type
/// &/summary&
public ShaderEditorFormat() {
this.DisplayName = "ShaderEditor"; //human readable version of the name
this.BackgroundColor = Colors.BlueV
this.TextDecorations = System.Windows.TextDecorations.U
这段代码定义了一个名为"ShaderEditor"的着色类型,编译工程并运行,我们可以在Visual Studio实验实例的工具-&选项-&字体和颜色中找到一个名为"ShaderEditor"的条目。同时我们会发现所有文本文件的颜色都变成了Colors.BlueViolet并带上了下划线。修改this.DisplayName = "ShaderEditor"的内容,可以改变在字体和颜色中显示的名字。下面的格式设置可以任意修改成喜欢的样式,但要注意在这里的格式只是插件首次安装时的默认设置,这些条目和其它着色选项一样,都可以被用户任意更改。
3. 创建GLSL的着色类型
我们已经了解了如何将着色类型添加到Visual Studio,现在修改ShaderEditorFormat.cs,添加我们的着色类型。
[Export(typeof(EditorFormatDefinition))]
[ClassificationType(ClassificationTypeNames = "GLSLText")]
[Name("GLSLText")]
[UserVisible(true)]
[Order(Before = Priority.Default)]
internal sealed class GLSLTextFormatDefinition : ClassificationFormatDefinition {
public GLSLTextFormatDefinition() {
this.DisplayName = "GLSL文本";
this.ForegroundColor = Colors.B
[Export(typeof(EditorFormatDefinition))]
[ClassificationType(ClassificationTypeNames = "GLSLIdentifier")]
[Name("GLSLIdentifier")]
[UserVisible(true)]
[Order(Before = Priority.Default)]
internal sealed class GLSLIdentifierFormatDefinition : ClassificationFormatDefinition {
public GLSLIdentifierFormatDefinition() {
this.DisplayName = "GLSL标识符";
this.ForegroundColor = Colors.B
[Export(typeof(EditorFormatDefinition))]
[ClassificationType(ClassificationTypeNames = "GLSLComment")]
[Name("GLSLComment")]
[UserVisible(true)]
[Order(Before = Priority.Default)]
internal sealed class GLSLCommentFormatDefinition : ClassificationFormatDefinition {
public GLSLCommentFormatDefinition() {
this.DisplayName = "GLSL注释";
this.ForegroundColor = Colors.DarkG
[Export(typeof(EditorFormatDefinition))]
[ClassificationType(ClassificationTypeNames = "GLSLKeyword")]
[Name("GLSLKeyword")]
[UserVisible(true)]
[Order(Before = Priority.Default)]
internal sealed class GLSLKeywordFormatDefinition : ClassificationFormatDefinition {
public GLSLKeywordFormatDefinition() {
this.DisplayName = "GLSL关键字";
this.ForegroundColor = Colors.B
[Export(typeof(EditorFormatDefinition))]
[ClassificationType(ClassificationTypeNames = "GLSLClass")]
[Name("GLSLClass")]
[UserVisible(true)]
[Order(Before = Priority.Default)]
internal sealed class GLSLClassFormatDefinition : ClassificationFormatDefinition {
public GLSLClassFormatDefinition() {
this.DisplayName = "GLSL类型";
this.ForegroundColor = Colors.G
[Export(typeof(EditorFormatDefinition))]
[ClassificationType(ClassificationTypeNames = "GLSLQualifier")]
[Name("GLSLQualifier")]
[UserVisible(true)]
[Order(Before = Priority.Default)]
internal sealed class GLSLQualifierFormatDefinition : ClassificationFormatDefinition {
public GLSLQualifierFormatDefinition() {
this.DisplayName = "GLSL限定符";
this.ForegroundColor = Colors.P
[Export(typeof(EditorFormatDefinition))]
[ClassificationType(ClassificationTypeNames = "GLSLVariable")]
[Name("GLSLVariable")]
[UserVisible(true)]
[Order(Before = Priority.Default)]
internal sealed class GLSLVariableFormatDefinition : ClassificationFormatDefinition {
public GLSLVariableFormatDefinition() {
this.DisplayName = "GLSL系统变量";
this.ForegroundColor = Colors.DarkO
[Export(typeof(EditorFormatDefinition))]
[ClassificationType(ClassificationTypeNames = "GLSLFunction")]
[Name("GLSLFunction")]
[UserVisible(true)]
[Order(Before = Priority.Default)]
internal sealed class GLSLFunctionFormatDefinition : ClassificationFormatDefinition {
public GLSLFunctionFormatDefinition() {
this.DisplayName = "GLSL系统函数";
this.ForegroundColor = Colors.DarkT
4. 导出着色类型
Editor Classifier使用了MEF框架,关于MEF的具体细节,请参考MSDN的相关文档。
我们需要注意的是,在MEF中,光定义了着色类型还不够,我们需要导出一个ClassificationTypeDefinition,才能在系统中生效。
打开ShaderEditorType.cs,我们看到系统生成的代码如下:
internal static class ShaderEditorClassificationDefinition {
[Export(typeof(ClassificationTypeDefinition))]
[Name("ShaderEditor")]
internal static ClassificationTypeDefinition ShaderEditorType = null;
这里的Name与之前默认生成的ShaderEditor相同,同理,我们将这里的代码修改成方才定义的类型
internal static class ShaderEditorClassificationDefinition {
[Export(typeof(ClassificationTypeDefinition))]
[Name("GLSLText")]
internal static ClassificationTypeDefinition GLSLTextType = null;
[Export(typeof(ClassificationTypeDefinition))]
[Name("GLSLIdentifier")]
internal static ClassificationTypeDefinition GLSLIdentifierType = null;
[Export(typeof(ClassificationTypeDefinition))]
[Name("GLSLComment")]
internal static ClassificationTypeDefinition GLSLCommentType = null;
[Export(typeof(ClassificationTypeDefinition))]
[Name("GLSLKeyword")]
internal static ClassificationTypeDefinition GLSLKeywordType = null;
[Export(typeof(ClassificationTypeDefinition))]
[Name("GLSLClass")]
internal static ClassificationTypeDefinition GLSLClassType = null;
[Export(typeof(ClassificationTypeDefinition))]
[Name("GLSLQualifier")]
internal static ClassificationTypeDefinition GLSLQualifierType = null;
[Export(typeof(ClassificationTypeDefinition))]
[Name("GLSLVariable")]
internal static ClassificationTypeDefinition GLSLVariableType = null;
[Export(typeof(ClassificationTypeDefinition))]
[Name("GLSLFunction")]
internal static ClassificationTypeDefinition GLSLFunctionType = null;
5. 关联文件类型
打开ShaderEditor.cs
[Export(typeof(IClassifierProvider))]
[ContentType("text")]
internal class ShaderEditorProvider : IClassifierProvider {
internal IClassificationTypeRegistryService ClassificationRegistry = null; // Set via MEF
public IClassifier GetClassifier(ITextBuffer buffer) {
return buffer.Properties.GetOrCreateSingletonProperty&ShaderEditor&(delegate { return new ShaderEditor(ClassificationRegistry); });
代码ContentType("text")创建了一个Provider并将它们对所有text类型的文件生效。
GLSL主要的文件扩展名为.vsh和.fsh,为了只对这两个扩展名生效,我们需要自定义一个ContentType,并创建两个扩展名关联。将上述代码修改为:
[Export(typeof(ITaggerProvider))]
[ContentType("glsl")]
[TagType(typeof(ClassificationTag))]
internal sealed class GLSLClassifierProvider : ITaggerProvider {
[Name("glsl")]
[BaseDefinition("code")]
internal static ContentTypeDefinition GLSLContentType = null;
[FileExtension(".vsh")]
[ContentType("glsl")]
internal static FileExtensionToContentTypeDefinition GLSLVshType = null;
[FileExtension(".fsh")]
[ContentType("glsl")]
internal static FileExtensionToContentTypeDefinition GLSLFshType = null;
internal IClassificationTypeRegistryService classificationTypeRegistry = null;
internal IBufferTagAggregatorFactoryService aggregatorFactory = null;
public ITagger&T& CreateTagger&T&(ITextBuffer buffer) where T : ITag {
return new GLSLClassifier(buffer, classificationTypeRegistry) as ITagger&T&;
这样我们就创建了只针对vsh和fsh文件生效的Editor。
6. 使用gplex进行词法分析
我们需要使用词法分析扫描器来实现具体的着色功能,gplex可以为我们生成C#语言的扫描器,下载地址:
解压后在binaries文件夹下找到gplex.exe,把它拷贝到项目的根目录下。
在项目根目录下新建一个GLSL文件夹,新建GLSLLexer.lex文件。并把它们添加到proj中。
在proj上右键-&属性,在生成事件选项卡中,在预先生成事件命令行中输入
cd $(ProjectDir)GLSL\$(ProjectDir)\gplex GLSLLexer
打开GLSLLexer.lex,写入以下代码:
1 %option unicode, codepage:raw
// User code is all now in ScanHelper.cs
7 %namespace Shane
8 %option verbose, summary, noparser, nofiles, unicode
public int nextToken() { return yylex(); }
public int getPos() { return }
public int getLength() { return }
16 //=============================================================
17 //=============================================================
19 number ([0-9])+
20 chars [A-Za-z]
21 cstring [A-Za-z_]
22 blank " "
23 delim [ \t\n]
24 word {chars}+
25 singleLineComment "//"[^\n]*
26 multiLineComment "/*"[^*]*\*(\*|([^*/]([^*])*\*))*\/
28 comment {multiLineComment}|{singleLineComment}
29 class bool|int|float|bvec|ivec|vec|vec2|vec3|vec4|mat2|mat3|mat4|sampler1D|sampler2D|sampler3D|samplerCube|sampler1DShadow|sampler2DShadow
30 keyword return|if|else|while|do|for|foreach|break|continue|switch|case|default|goto|class|struct|enum|extern|interface|namespace|public|static|this|volatile|using|in|out|true|false
31 qualifier const|attribute|uniform|varying
32 systemVariable gl_BackColor|gl_BackLightModelProduct|gl_BackLightProduct|gl_BackMaterial|gl_BackSecondaryColor|gl_ClipPlane|gl_ClipVertex|gl_Color|gl_DepthRange|gl_DepthRangeParameters|gl_EyePlaneQ|gl_EyePlaneR|gl_EyePlaneS|gl_EyePlaneT|gl_Fog|gl_FogCoord|gl_FogFragCoord|gl_FogParameters|gl_FragColor|gl_FragCoord|gl_FragData|gl_FragDepth|gl_FrontColor|gl_FrontFacing|gl_FrontLightModelProduct|gl_FrontLightProduct|gl_FrontMaterial|gl_FrontSecondaryColor|gl_LightModel|gl_LightModelParameters|gl_LightModelProducts|gl_LightProducts|gl_LightSource|gl_LightSourceParameters|gl_MaterialParameters|gl_MaxClipPlanes|gl_MaxCombinedTextureImageUnits|gl_MaxDrawBuffers|gl_MaxFragmentUniformComponents|gl_MaxLights|gl_MaxTextureCoords|gl_MaxTextureImageUnits|gl_MaxTextureUnits|gl_MaxVaryingFloats|gl_MaxVertexAttribs|gl_MaxVertexTextureImageUnits|gl_MaxVertexUniformComponents|gl_ModelViewMatrix|gl_ModelViewMatrixInverse|gl_ModelViewMatrixInverseTranspose|gl_ModelViewMatrixTranspose|gl_ModelViewProjectionMatrix|gl_ModelViewProjectionMatrixInverse|gl_ModelViewProjectionMatrixInverseTranspose|gl_ModelViewProjectionMatrixTranspose|gl_MultiTexCoord0|gl_MultiTexCoord1|gl_MultiTexCoord10|gl_MultiTexCoord11|gl_MultiTexCoord2|gl_MultiTexCoord3|gl_MultiTexCoord4|gl_MultiTexCoord5|gl_MultiTexCoord6|gl_MultiTexCoord7|gl_MultiTexCoord8|gl_MultiTexCoord9|gl_Normal|gl_NormalMatrix|gl_NormalScale|gl_ObjectPlaneQ|gl_ObjectPlaneR|gl_ObjectPlaneS|gl_ObjectPlaneT|gl_Point|gl_PointParameters|gl_PointSize|gl_Position|gl_ProjectionMatrix|gl_ProjectionMatrixInverse|gl_ProjectionMatrixInverseTranspose|gl_ProjectionMatrixTranspose|gl_SecondaryColor|gl_TexCoord|gl_TextureEnvColor|gl_TextureMatrix|gl_TextureMatrixInverse|gl_TextureMatrixInverseTranspose|gl_TextureMatrixTranspose|gl_Vertex
33 systemFunction radians|degress|sin|cos|tan|asin|acos|atan|pow|exp|log|exp2|log2|sqrt|inversesqrt|abs|sign|floor|ceil|fract|mod|min|max|clamp|mix|step|smoothstep|length|distance|dot|cross|normalize|faceforward|reflect|matrixCompMult|lessThan|lessThanEqual|greaterThan|greaterThanEqual|equal|notEqual|any|all|not|texture2D|texture2DProj|texture2DLod|texture2DProjLod|textureCube|textureCubeLod
34 identifier {cstring}+{number}*[{cstring}@]*{number}*
38 {keyword}
return (int)GLSLTokenType.K
39 {class}
return (int)GLSLTokenType.C
40 {qualifier}
return (int)GLSLTokenType.Q
41 {systemVariable}
return (int)GLSLTokenType.SystemV
42 {systemFunction}
return (int)GLSLTokenType.SystemF
43 {identifier}
return (int)GLSLTokenType.I
44 {comment}
return (int)
保存并关闭,这时生成一下项目,我们会看到在GLSL目录下生成了GLSLLexer.cs文件,同样把这个文件添加到proj中。
7. 处理扫描结果&
接下来我们要在ShaderEditor.cs中处理我们的扫描结果,并最终对匹配的代码行进行着色。
首先删除默认创建的ShaderEditor类。
添加一个GLSLToken枚举,这个枚举就是GLSLLexer.cs返回的枚举类型,它用来通知我们当前的语句块是哪个类型。
代码如下:
public enum GLSLTokenType {
Identifier,
Qualifier,
SystemVariable,
SystemFunction
创建我们自己的ShaderEditor类,代码如下:
1 internal sealed class GLSLClassifier : ITagger&ClassificationTag& {
ITextBuffer textB
IDictionary&GLSLTokenType, IClassificationType& typeD
internal GLSLClassifier(ITextBuffer buffer, IClassificationTypeRegistryService typeService) {
textBuffer =
typeDic = new Dictionary&GLSLTokenType, IClassificationType&();
typeDic[GLSLTokenType.Text] = typeService.GetClassificationType("GLSLText");
typeDic[GLSLTokenType.Identifier] = typeService.GetClassificationType("GLSLIdentifier");
typeDic[GLSLTokenType.Keyword] = typeService.GetClassificationType("GLSLKeyword");
typeDic[GLSLTokenType.Class] = typeService.GetClassificationType("GLSLClass");
ment] = typeService.GetClassificationType("GLSLComment");
typeDic[GLSLTokenType.Qualifier] = typeService.GetClassificationType("GLSLQualifier");
typeDic[GLSLTokenType.SystemVariable] = typeService.GetClassificationType("GLSLVariable");
typeDic[GLSLTokenType.SystemFunction] = typeService.GetClassificationType("GLSLFunction");
public event EventHandler&SnapshotSpanEventArgs& TagsChanged {
remove { }
public IEnumerable&ITagSpan&ClassificationTag&& GetTags(NormalizedSnapshotSpanCollection spans) {
IClassificationType classification = typeDic[GLSLTokenType.Text];
string text = spans[0].Snapshot.GetText();
yield return new TagSpan&ClassificationTag&(
new SnapshotSpan(spans[0].Snapshot, new Span(0, text.Length)),
new ClassificationTag(classification));
scanner.SetSource(text, 0);
tok = scanner.nextToken();
int pos = scanner.getPos();
int len = scanner.getLength();
int total = text.L
if (pos & 0 || len & 0 || pos & total) {
if (pos + len & total) {
len = total -
if (typeDic.TryGetValue((GLSLTokenType)tok, out classification)) {
yield return new TagSpan&ClassificationTag&(
new SnapshotSpan(spans[0].Snapshot, new Span(pos, len)),
new ClassificationTag(classification));
} while (tok & (int)Tokens.EOF);
Scanner scanner = new Scanner();
TagsChanged事件保证在代码发生改变时实时刷新编辑器。
& &构造方法中,通过typeService.GetClassificationType("GLSLIdentifier")取得我们定义的实例,并把它们和枚举关联起来,
& &GetClassificationType的参数传入着色类型的Name。
GetTags方法是由系统调用的迭代方法,yield return new TagSpan&ClassificationTag&()返回我们的着色对象,即可实现着色效果。编译并运行,可以看到vsh和fsh已经有了语法着色了。
本文由哈萨雅琪原创,转载请注明出处。
&原文链接:

我要回帖

更多关于 visual studio 使用 的文章

 

随机推荐