Search code examples
c#visual-studio-codecode-regions

How do I prioritize #regions for folding in Visual Studio Code?


I am trying to get used to using VSCode for C# development with Unity. I have noticed that region folding is supported but it seems to be keyed off anything with a '#' symbol. For example observe the following code snippet;

#region FOO
    //Some code
#if BAR
    //Some conditional code
#endif
    //Bit more code
#endregion

In VSCode, if I was to use inlinging to folder the 'FOO' region it will only fold to the 'BAR' conditional.

How can I make it so that VSCode treats regions as all encompassing for folding in the same manner that Visual Studio does?


Solution

  • Turns out that this is a bug, along with a few others regarding folding.

    See here: https://github.com/OmniSharp/omnisharp-vscode/issues/617.