Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

code folding in Visual Studio for F#

I find that I tend to write long source files in F#. Some open source projects in F# also have long source files, e.g. FPersec and F# for excel.

So it would be very helpful if code folding (even very limited support) is available in VS for F#. E.g. in a module, we can fold out functions that are stable, only leave functions that are subject to change unfold.

Is this feature easy to be supported, e.g. by a third party vendor?

like image 315
Yin Zhu Avatar asked May 16 '10 10:05

Yin Zhu


2 Answers

Folding of F# code is possible with F# Outlinig Visual Studo extension. I can also recommend to look at F# Depth Colorizer.

like image 52
olegg Avatar answered Oct 27 '22 13:10

olegg


Unfortunately, this feature is not available in F# (neither #region, nor folding of, for example, let bindings or type declarations as in C#).

I would also love to see this in future versions of F# - in fact, I tried writing a prototype of this feature during my internship at MSR, but it was (sadly) more difficult than it looked at first, so the code never reached the production quality and there were many far more important things that the F# team needed to focus on before the VS 2010 release...

Regarding third party support - If it is possible to implement code folding as an addition to the existing F# language service, then it should be possible (simply by looking for some special comments such as (* #region Some name*)), but I'm not 100% sure if that can be added by some plugin or macro.

like image 39
Tomas Petricek Avatar answered Oct 27 '22 12:10

Tomas Petricek