简体   繁体   English

扩展 Visual Studio 编辑器

[英]Extending the Visual Studio editor

I'm writing an add-in for extending Visual Studio 2008 (adding custom functionality).我正在编写一个插件来扩展 Visual Studio 2008(添加自定义功能)。 While doing that I came across a situation where it would be good if I could provide custom messages via tooltips for any line of code.在这样做时,我遇到了一种情况,如果我可以通过任何代码行的工具提示提供自定义消息,那就太好了。

Doing this IMO requires accessing the VS editor control and by some way displaying the respective tooltip.执行此 IMO 需要访问 VS 编辑器控件并以某种方式显示相应的工具提示。 This might also be visualized like breakpoints that on mouse hovering provide a tooltip message.这也可以像在鼠标悬停时提供工具提示消息的断点一样进行可视化。

Is this implementation possible?这种实现可能吗? If yes, what's the way to go?如果是的话,有什么办法呢? If not, what similar way do you suggest?如果没有,你有什么类似的建议?

In a recent episode of Hanselminutes , they discussed how much more extensible the VS 2010 editor is going to be.在最近的 Hanselminutes 一集中,他们讨论了 VS 2010 编辑器的可扩展性有多大。 Based on what they said, I think it will be rather difficult (although probably possible) until they introduce that extensibility.根据他们所说的,我认为在他们引入可扩展性之前会相当困难(尽管可能是可能的)。

Yes it is.是的。 You can add more customization on the code editor of VS 2008, even you can create your own language service with your own intellisense support in VS 2008.您可以在 VS 2008 的代码编辑器上添加更多自定义,甚至可以在 VS 2008 中使用自己的智能感知支持创建自己的语言服务。

You can do this simply by using VS 2008 SDK, and you can also quickly play with the standalone shell of Visual Studio 2008, and MS SQL Server 2008 Management Studio is one example of customized Visual Studio standalone shell.您只需使用 VS 2008 SDK 即可完成此操作,您还可以快速使用 Visual Studio 2008 的独立 shell,MS SQL Server 2008 Management Studio 是自定义 Visual Studio 独立 shell 的一个示例。

You can visit MS Visual Studio Extensibility:您可以访问 MS Visual Studio 扩展性:

http://msdn.microsoft.com/en-us/vsx/default.aspx http://msdn.microsoft.com/en-us/vsx/default.aspx

And lots of videos on VS 2008 SDK:还有很多关于 VS 2008 SDK 的视频:

http://msdn.microsoft.com/en-us/vsx/bb507746.aspx#extensibility http://msdn.microsoft.com/en-us/vsx/bb507746.aspx#extensibility

You should take a look at Resharper and work out whether your add-in would be better suited to being a Resharper Plug-In.您应该查看 Resharper 并确定您的加载项是否更适合作为 Resharper 插件。 This approach would require your users to buy Resharper, but this sort of thing is exactly what it does.这种方法需要你的用户购买 Resharper,但这种事情正是它所做的。

For example, check out http://stylecopforresharper.codeplex.com/ where this sort of hint/tooltip stuff in Resharper is used to highlight lines of code that have StyleCop issues.例如,查看http://stylecopforresharper.codeplex.com/ ,其中 Resharper 中的此类提示/工具提示用于突出显示存在 StyleCop 问题的代码行。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM