Is there a way to "collapse" functions and values in VS2008, like one would do for objects in languages like C#? It's incredibly time-consuming and 开发者_StackOverflowfrustrating to wade through hundreds of lines of nested function definitions.
So, the official answer is that this is not supported. However, when I was doing an internship with the F# team, I wrote a prototype implementation of this feature. Because the F# team had other more important things to do, this was never properly tested and it was not included in the final version.
The code for the feature is actually still present in F# and the feature can be turned on by adding the following to the devenv.exe.config
file:
<appSettings>
<add key="fsharp-regions-enabled" value="true" />
</appSettings>
Apparently, it's not exactly what you wanted, because you can only collapse modules and type definitions, but it could still be useful - it is difficult to decide what to make collapsible in F#, because F# has so many nested declarations...
BTW: Did I mention that this is not tested and it can crash Visual Studio or even collapse the universe?
No there is not in Visual Studio 2008 because the language service does not support outlining. It also does not in Visual Studio 2010. However the editor supports the notion of adhoc / custom outlining.
- Select a region in the editor
- Right click and go to Outlining -> Hide Selection
Unfortunately this is a completely manual process.
I have come with something that works for me and will maybe interest you. I have VS2008+RockScroll (Works On My Machine).
It really helps when I have to deal with loads of nested functions because I see much better the whole picture. Also I do a comment at the start of the body of the function, like:
// Start of bigFunctionWithLoadsOfNestedFunctions
When double-clicking on it, it both highlights in red the let-bound definition and the real start of the function in the thumbnail view. See: http://img338.imageshack.us/img338/1060/40105807.png
精彩评论