Wednesday, April 21, 2010

How To Configure AllMargins Extension For Visual Studio 2010

UPDATE: Removed non AllMargins registry settings. Thanks David Pugh for letting me know.


UPDATE 2: Productivity Power Tools now combines most of the major features of AllMargins, due to David Pugh himself porting it over. Consider using it instead.


AllMargins is a VS 2010 extension that basically replaces Rockscroll from VS2005 and VS2008. It combines multiple extensions into one “All” inclusive extension. Here is an example of what mine looks like with a few features pointed out:

image

It looks pretty good now, but when you first install it, it is configured for a white background, rather than black. You can change the colors via the registry at \HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0\Text Editor, but I couldn’t find any documentation online as to what color controls what. I downloaded the code from code.msn.microsoft.com and discovered how it all worked.

AllMargin Extensions

AllMargins contains multiple extensions, but all of their configurable settings are located in the registry at \HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0\Text Editor. I’ve listed them by extension below along with the introduction and usage text I’ve pulled together from the readme files in the projects. Just edit the appropriate registry setting and open up a new window in VS2010, to see any changes you’ve made.

CaretMargin

This extension adds a margin to the OverviewMargin that shows the location of the caret and all words that match the word the caret is on.

You will see colored rectangles drawn that correspond to the location of the caret and all words that match the word the caret is in or adjacent to.

Registry Name Description
CaretMargin/MarginEnabled Should the CaretMargin be displayed
CaretMargin/MarginWidth Width of the CaretMargin (in pixels)
CaretMargin/CaretColor Color used to draw the location of the caret. Not used if Alpha = 0
CaretMargin/MatchColor Color used to draw the location of matching words. Not used if Alpha = 0


OverviewMarginImpl

This extension creates a margin displayed along the right edge of the editor. It, like the vertical scroll bar, logically maps to the entire file. By default, it acts as if all elided regions are expanded (though the portions of the file contained in a elided regions are highlighted). The OverviewMargin also can highlights the portions of the file that are above, contained in and below the text shown in the editor.

The OverviewMargin is a container for other margins (that all use a common mapping between a location on the screen and a position in the file). This extension includes two of these contained margins: the OverviewChangeTracking margin (which acts like the change tracking margin from the left side of the editor, but applied to the entire file) and the OverviewMark margin (which allows 3rd parties to draw colored marks to indicate positions of interest in the file).

Moving the mouse into the OverviewMargin will, after a brief delay, show a tooltip. The default tip for the OverviewMargin shows the contents of the file at the corresponding location but other margins contained in the OverviewMargin may provide more interesting tips.

Left clicking in the OverviewMargin to scroll to center the corresponding location in the editor. Left clicking in an elided region will center the(collapsed) elided region in the editor.

Double-left-clicking in the OverviewMargin will expand any elided regions that contain the corresponding location and then center that location in the editor.

Right-clicking in the OverviewMargin brings up an option menu that allow you to change:
Whether or not the OverviewMargin acts as if all elided regions are expanded (if they are not, then the OverviewMargin uses the same mapping between a location in the margin and a position in the file as the vertical scroll bar).
Whether or not the OverviewMargin will show the default tip when the mouse is inside the margin.

Registry Name Description
OverviewMargin/ChangeTrackingMarginEnabled Should the change tracking margin be displayed
OverviewMargin/MarkMarginEnabled Should the mark margin be displayed
OverviewMargin/ExpandElisionsInOverviewMargin Are elisions expended in the overview margin?
OverviewMargin/OverviewMarginPreviewSize Number of lines to show in the default tip for the overview margin. If 0, do not show any tip by default
OverviewMarginImpl/ChangeTrackingMarginWidth Width of the ChangeTrackingMargin (in pixels)
OverviewMarginImpl/MarkMarginWidth Width of the MarkMargin (in pixels)
OverviewMarginImpl/ElisionColor Color used to highlight elided text as ARGB. Not used if Alpha = 0.
OverviewMarginImpl/OffScreenColor Color used to highlight portions of the file not shown in the editor as ARGB. Not used if Alpha = 0.
OverviewMarginImpl/VisibleColor Color used to highlight portions of the file shown in the editor as ARGB. Not used if Alpha = 0.


Structure Adornment

This extension displays vertical lines in the editor to help show the block structure of the code file. Different colors are used to indicate different types of blocks.

Moving the mouse over one of the colored lines will, if the line extends off the top of the editor, create a tooltip at the top of the view that provides some context on what is out of view.

Registry Name Description
StructureAdornment/ClassColor Color used to show the scope of class definitions as ARGB
StructureAdornment/ConditionalColor Color used to show the scope of conditionally executed code as ARGB
StructureAdornment/LoopColor Color used to show the scope of loop bodies as ARGB
StructureAdornment/MethodColor Color used to show the scope of method bodies as ARGB
StructureAdornment/UnknownColor Color used to show the scope of unknown blocks as ARGB
StructureAdornment/Enabled Should the structure adornments be shown?


StructureMargin

This extension adds a margin to the OverviewMargin that shows the block structure of the code file. Different colors are used to indicate different types of blocks.

Moving the mouse over the structure margin will create a tooltip that provides some context on what is in the file at that location.

Registry Name Description
StructureMargin/ClassColor Color used to show the scope of class definitions as ARGB
StructureMargin/ConditionalColor Color used to show the scope of conditionally executed code as ARGB
StructureMargin/LoopColor Color used to show the scope of loop bodies as ARGB
StructureMargin/MethodColor Color used to show the scope of method bodies as ARGB
StructureMargin/UnknownColor Color used to show the scope of unknown blocks as ARGB
StructureMargin/MarginEnabled Should the StructureMargin be displayed
StructureMargin/MarginWidth Width of the StructureMargin (in pixels)
StructureMargin/MethodEllipseColor Color used to draw the ellipse that shows the scope of method bodies as ARGB. Not used if Alpha = 0


My Settings

Here are my setting that I use. If you want to use them, just save them as a .reg file to add/update them in the registry


Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0\Text Editor]
"StructureAdornment/ClassColor"="#FF5F7D7C"
"StructureAdornment/ConditionalColor"="#FF005300"
"StructureAdornment/LoopColor"="#FFFF0000"
"StructureAdornment/MethodColor"="#FF222290"
"StructureAdornment/UnknownColor"="#FF362844"
"StructureAdornment/Enabled"="True"
"OverviewMargin/ExpandElisionsInOverviewMargin"="True"
"OverviewMargin/PreviewSize"="20"
"OverviewMarginImpl/ElisionColor"="#404252FF"
"OverviewMarginImpl/OffScreenColor"="#FF000000"
"OverviewMarginImpl/VisibleColor"="#88444444"
"OverviewMargin/ChangeTrackingMarginEnabled"="True"
"OverviewMarginImpl/ChangeTrackingMarginWidth"="9"
"OverviewMargin/MarkMarginEnabled"="True"
"OverviewMarginImpl/MarkMarginWidth"="8"
"CaretMargin/Enabled"="True"
"CaretMargin/CaretColor"="#AADDFFFF"
"CaretMargin/MatchColor"="#FF6F8474"
"CaretMargin/MarginWidth"="7"
"StructureMargin/MarginEnabled"="True"
"StructureMargin/MarginWidth"="25"
"StructureMargin/MethodEllipseColor"="#20DDDDDD"
"StructureMargin/ClassColor"="#FF38E4DB"
"StructureMargin/ConditionalColor"="#FFAF22C8"
"StructureMargin/LoopColor"="#FF0AC034"
"StructureMargin/MethodColor"="#FFE86D0E"
"StructureMargin/UnknownColor"="#FFE8DE1B"