The F# Depth Colorizer for VS2012 makes it easy to see the nesting-depth of your F# code and ensure that control constructs are properly indented.  Compare:

The left screenshot shows how code appears by default.  Are the ‘try’ and ‘with’ keyword aligned?  It can be hard to tell at-a-glance.  The right screenshot has the F# Depth Colorizer installed; small changes in background color at each level of nesting/indent highlight various code blocks and make it easy to see where the indents are. 

This extension to Visual Studio 2012 parses F# code as you type and interactively updates the background colorization to match the actual parsed structure of the code.  It understands the full F# 3.0 language syntax. 

This extension is a free VSIX on the Visual Studio Gallery, so it is easy to download and try out.  Once installed, it will appear on the Visual Studio 2012 ‘Tools\Extensions and Updates…’ menu:

where you can easily remove it if you decide it’s not for you. 

Are you using the new ‘dark’ theme colors in VS2012?  Not a problem, the extension can detect dark default colors, and switches to a more appropriate color set for highlighting in the dark theme:

Like the extension, but don’t like the default colors?  You can change them.  UI is not my strong point, so unfortunately the colors are only configurable via the registry (rather than some pretty color-editor GUI).  Here is the registry entry for the default light-theme colors:

Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0\Text Editor\FSharpDepthColorizer\Light]

"Depth0"="200,200,200,222,219,222"

"Depth1"="190,190,190,206,206,206"

"Depth2"="194,194,194,216,218,219"

"Depth3"="184,184,184,202,202,202"

"Depth4"="188,188,188,214,211,214"

"Depth5"="178,178,178,198,198,198"

"Depth6"="182,182,182,210,210,210"

"Depth7"="172,172,172,194,194,194"

"Depth8"="176,176,176,206,203,206"

"Depth9"="166,166,166,190,190,190"

and dark-theme colors:

Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0\Text Editor\FSharpDepthColorizer\Dark]

"Depth0"="47,44,47,39,34,39"

"Depth1"="29,29,29,19,19,19"

"Depth2"="49,46,49,37,34,39"

"Depth3"="31,31,31,21,21,21"

"Depth4"="51,48,51,39,34,39"

"Depth5"="33,33,33,23,23,23"

"Depth6"="53,50,53,39,35,39"

"Depth7"="35,35,35,25,25,25"

"Depth8"="55,52,55,39,37,39"

"Depth9"="37,34,37,27,27,27"

(You can save these registry examples to a file “foo.reg”, run the “foo.reg” file to install those keys, and then use the “regedit” tool to inspect/change the values.  Be careful when modifying your registry!) 

The DepthN values are strings of six numbers, representing two sets of RGB values, e.g.

DepthN = R1, G1, B1, R2, G2, B2

where N is the depth of the nesting of the source code structure, the RGB1 values are the color of the left edge of the highlight (intention is to provide more visual contrast at the edge), and the RGB2 values are the main color for highlighting that nesting depth. 

Note that this is a new extension specifically designed for VS2012 (currently at the RC ‘Release Candidate’ stage); if you are using VS2010, then you’ll need to use the older version of this tool instead, linked here.