扩展Visual Studio代码查看功能 [英] Extending Visual Studio Code Review Functionality

查看:164
本文介绍了扩展Visual Studio代码查看功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有兴趣编写Visual Studio 2013+的扩展,以增强TFS中可用的当前代码审阅功能.此扩展将在团队资源管理器-代码检查"窗口中的每个注释旁边添加一个附加控件.它还需要加入保存注释的事件,并根据控件的值更新注释的文本.

I am interested in writing an extension for Visual Studio 2013+ that enhances the current code review functionality available in TFS. This extension would add an additional control next to each comment in the Team Explorer - Code Review window. It would also need to hook into the event that saves a comment, and update the text of the comment based on the value of the control.

我已经为Visual Studio编写了一些扩展,这些扩展创建了工具窗口等,因此这对我来说不是一个全新的领域.但是,我不清楚如何将钩子的内容添加到现有窗口(例如代码查看窗口)的事件中,并且文档似乎对如何实现这一点非常了解.我的问题是:

I have already written some extensions for Visual Studio that create tool windows and the like, so this is not an entirely new area for me. However, I am unclear how to go about adding content of hooking into events for an existing window (such as the code review window), and the documentation seems to be very light on how to approach this. My questions are:

-是否可以将控件添加到带有Visual Studio扩展的现有窗口中?还是扩展功能仅限于使用自定义UI添加新工具窗口?这是否可以作为现有代码检查功能的扩展,还是必须完全重新实现代码检查功能,例如

-Is it possible to add controls to existing windows with Visual Studio extensions? Or is the extension functionality limited to adding new tool windows with custom UI? Would this be possible as an extension on top of the existing code review functionality, or would it have to completely re-implement the code review functionality, as extensions like Review Assistant appear to do?

-是否有任何专门记录有关Visual Studio IDE中的代码查看窗口的文件,或者是否有任何允许扩展程序与之交互的类?如果IDE中记录了任何与代码审查相关的事件(即,在保存注释时触发的事件),将特别有帮助.

-Is there anything documented specifically about the code review windows within the Visual Studio IDE, or any classes that allow extensions to interface with them? If there are any events documented in the IDE related to code reviews (ie: an event that fires upon saving a comment) that would be especially helpful.

感谢您的帮助!

推荐答案

几个月前,我们也处于相同的情况,只是禁用了CodeReviewPage中的控件.

A few months back we were also in the same situation but for disabling a control in the CodeReviewPage.

我们所做的是在CodeReviewPage中添加了一个隐藏部分.当此部分 Initialize(object sender,...) ,并且从作为参数接收的发件人对象中,我们使用了反射来显示 CodeReviewPage 对象,然后进一步探索我们要禁用的内部控件.然后将此对象类型化为Control类的类型,然后为该控件公开所有属性,然后简单地应用ctrlObj.IsEnable = false.

What we did was added a hidden section to the CodeReviewPage. When this section Initialize(object sender,...), and from the sender object received as an argument we used Reflection to reveal the CodeReviewPage object and then further explored the control inside that we wanted to disable. This object was then type cased to the Control class and then we had all the properties exposed for that control and then simply we applied the ctrlObj.IsEnable = false.

对于您的情况,您可以通过发件人对象的 CodeReviewPage 对象公开部分,然后修改该部分或添加一个新控件并绑定一些事件.

For your case you can expose the Section from the CodeReviewPage object from sender object and then modify the section or add a new control and bind some events to it.

这篇关于扩展Visual Studio代码查看功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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