Visual Studio IntelliSense for viewing block declarations from the closing brace?

心不动则不痛 提交于 2019-12-05 06:35:34

问题


I'm really curious if anyone knows if Visual Studio's IntelliSense can be configured to display a code block's declaration by hovering over the block's closing brace (or something similar).

Rather than having to mark long code blocks with a comment, I would much rather hover over the closing brace to view which block it ends.

If what I'm saying isn't clear, imagine you had the code block below:

if (typeof(obj) is Int32)
{
    ///...PROGRAM LOGIC...
}

In this example, if I were to move the caret to the end brace, right-click the end brace, or simply hover over it. A popup window would show giving me the original declaration at the top:

if (typeof(obj) is Int32) { //...


Also, I'm interested to know if this can be done in Eclipse; I've asked that question here.

回答1:


This is now available in Visual Studio 2015.




回答2:


Looks like VSCommands for Visual Studio 2013 adds this exact functionality.

It's in "always on" mode by default (shown above), but personally, I find that annoying and change it to display the icon & tooltip only -- then when you hover over the icon you get a pop-up tooltip like you describe (the rest of the Extension is also very cool, it allows you to right click and compare files, even if they're not under source control, right click -> zip solution, all kinds of cool stuff).

To configure the feature, after installing the extension and restarting Visual Studio, open Tools -> Options -> VSCommands 12 -> Open Configuration. This opens a Configuration page (similar to project settings, etc.)

So, close the options dialog at this point and in the Configuration page, find IDE Enhancements -> Text Editor and Check Enable Code Block End Tagger (I also recommend either using Double-Click or Ctrl+Click navigation). Turn off "Show only when block beginning not visible", and then set Display Mode to "Icon Only".

And this is what you get (note the mouse cursor is missing in the screen shot, but I'm hovering over the closing brace):



来源:https://stackoverflow.com/questions/22566459/visual-studio-intellisense-for-viewing-block-declarations-from-the-closing-brace

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!