code folding in Visual Studio for F#

2019-06-15 23:28发布

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?

2条回答
看我几分像从前
2楼-- · 2019-06-16 00:10

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.

查看更多
等我变得足够好
3楼-- · 2019-06-16 00:28

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

查看更多
登录 后发表回答