How to show code outline in Visual Studio?

2019-01-22 10:58发布

This kind of stuff exists in Eclipse:

alt text

But I've not found it in Visual Studio yet. Is there such a window to show code outline at all?

I tried both Document Outline and Class View windows. The Class View is close, but it only shows class information, can it come up with function info also?

17条回答
疯言疯语
2楼-- · 2019-01-22 11:09
  • not free, but if you install Visual AssistX, each document gets a dropdown box listing all methods in a file (alphabetically or in the order they occur)

  • check Class View again, it does show functions (but not per document). Also check out the Code Definition Window, extremely nice when combined with Class View.

查看更多
时光不老,我们不散
3楼-- · 2019-01-22 11:09

There is now a free add-in available through the add-in manager in VS2010 that works quite well. It also has a dark theme.

VS10x Code Map v2

Screenshot:

Screenshot of the code map

查看更多
smile是对你的礼貌
4楼-- · 2019-01-22 11:11

Trick is to call Ctrl+F2, then Tab, then Tab, then Down arrow. I've done it with this simple AutoHotkey script when I hit Ctrl+o:

#IfWinActive ahk_exe devenv.exe
^o::
  Send ^{F2}
  Send {Tab}
  Send {Tab}
  Send {Down}
  return
#IfWinActive

It will show dropdown that is closest to Quick Outline in Eclipse or others.

Outline

查看更多
混吃等死
5楼-- · 2019-01-22 11:14

In newer Visual Studio versions (e.g. 2015) you can see this directly in the solution explorer. Simply expand the .cs file and you will get the list of the methods in the order they are listed in the file. This is exactly the same as the Outline in Eclipse.

If you want to see the stuff alphabetically, open the file and between the tab pane and the editor, there is a row showing the project name, the class name with namespace, and a drop down with the available methods and properties.

查看更多
男人必须洒脱
6楼-- · 2019-01-22 11:14

Go To "Solution Explorer" and select your project; then select a class file you want to outline, then expand the little triangle just below that class (as shown in the figure below)

code outline in visual studio

查看更多
7楼-- · 2019-01-22 11:15

Had same need to see Code Outline: it's easier to understand someone's code organisation. Tried Ctrl+Shift+O and didn't like it. Found 2 free plugins in the marketplace. Tried this one by Patryk Zawadzki and found if handy and handsome.

After installation and reload of VSC look in Explorer pane new separator "Code Outline" at the bottom.

查看更多
登录 后发表回答