如何在 Visual Studio 2010 中自动折叠某些注释?
我的一位同事使用 abomination 文本编辑器,它通常会在代码中留下注释块。不用说,这让我很生气。注释块看起来像这样:
/* EasyCODE ) */
/* EasyCODE ( 0
WndProc */
/* EasyCODE F */
即它们都以 EasyCODE
开头,并且大多数跨越几行。值得庆幸的是,VS2010 可以折叠注释块,因此我不必一直看到它们。
有没有办法让它自动化?一种自动折叠所有那些可怕的 EasyCODE
块的方法将是天赐之物!
A colleague of mine uses a abomination text editor that routinely leaves comment blocks all over the code. Needless to say, this is driving me rather mad. The comment blocks look like this:
/* EasyCODE ) */
/* EasyCODE ( 0
WndProc */
/* EasyCODE F */
i.e. they all start with EasyCODE
and most of them span several lines. Thankfully, VS2010 can collapse comment blocks, so I don't have to see them all the time.
Is there a way to automate that? A way to automatically collapse all those horrible EasyCODE
blocks would be godsent!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是一个应该可以做到这一点的宏。有一些更奇怪的 EasyCode 注释它没有捕获,但它基本上可以解决问题。
在宏IDE中创建一个新宏(工具->宏->宏IDE),将上面的代码粘贴到其中,然后为其分配键盘快捷键(工具->选项->环境->键盘,在列表框中搜索它)。按键盘快捷键,所有 EasyCode 注释都会消失。
玩得开心!
Here is a macro that should do it. There are some weirder EasyCode comments that it doesn't catch but it mostly does the trick.
Create a new macro in the macro IDE (Tools->Macros->Macro IDE), paste the above code into it, then assign a keyboard shortcut to it (Tools->Options->Environment->Keyboard, search for it in the listbox). Hit the keyboard shortcut and all EasyCode comments will be gone.
Have fun!
你不能自动完成它。但是,您可以选择一段代码,然后从上下文菜单“大纲/隐藏选择”(Ctrl+M Ctrl+H) 中进行选择。所以选择丑陋的评论并这样做。
摘自此处。
You can't do it automatically. However, you can select a piece of code, and choose from the context menu Outlining/Hide Selection (Ctrl+M Ctrl+H). So select the ugly comments and do it this way.
Taken from here.