Omnisharp-vscode: #region..#endregion is not foldable if at same column as enclosed method

Created on 25 Jul 2016  路  12Comments  路  Source: OmniSharp/omnisharp-vscode

Moved from https://github.com/Microsoft/vscode/issues/9661:

  • VSCode Version: Code 1.3.1 (e6b4afa53e9c0f54edef1673de9001e9f0f547ae, 2016-07-12T13:35:06.227Z)
  • OS Version: Windows_NT ia32 10.0.10586

Regions must be in the same tab. It would be great to allow us to fold no matter if they are in the same tab or not.
wrong
right

Steps to Reproduce:

  1. Create a Script (C#)
  2. Create a method
  3. Create a region encapsulating the method (Must be at the same tabulation)
  4. Region cannot be fold
  5. Move the method using tab
  6. Now you can fold the region
Bug Editor-Code Folding

Most helpful comment

I would like to add another quirk to this bug, the folding matches on the next '#' not the end of the region. For example;

``` C#

region FOO

//Some code

if BAR

//Some conditional code

endif

//Bit more code

endregion

```

If you fold the FOO region it collapses to the 'BAR' part of the #if.

All 12 comments

Hmmm... I wonder if this is fixed with #631.

It doesn't. I did notice that csharp.json has this section:

  "foldingStartMarker": "^\\s*#\\s*region|^\\s*/\\*|^(?![^{]*?//|[^{]*?/\\*(?!.*?\\*/.*?\\{)).*?\\{\\s*($|//|/\\*(?!.*?\\*/.*\\S))",
  "foldingStopMarker": "^\\s*#\\s*endregion|^\\s*\\*/|^\\s*\\}",

There are two issues:

  1. The regex's are malformed - all / should be escaped \/ or in this case because they are in a string block \\/
  2. Even fixed (locally) it still doesn't have any impact on folding in VSCode, so I am not sure what contributes to how folding works in VSCode

I haven't investigated folding in VS Code either, so I was curious if it gathered information from the syntax grammar. Will take a closer look in the near future

Similar to #567

Probably same issue, but note that they don't seem to work at column 0 ...
capture

Any updates on this issue? I can confirm that it's still the same, I use version 1.6.1 on Mac OS X

Unfortunately, no there isn't any update on this one yet.

I would like to add another quirk to this bug, the folding matches on the next '#' not the end of the region. For example;

``` C#

region FOO

//Some code

if BAR

//Some conditional code

endif

//Bit more code

endregion

```

If you fold the FOO region it collapses to the 'BAR' part of the #if.

Just updating everyone here. The problem is that we don't actually have a way to add custom folding in VS Code today. There is an issue tracking this: https://github.com/Microsoft/vscode/issues/3422.

@DustinCampbell
OmniSharp wont support folding on #region until VS Code fix stuff at their side? Sad

@guoboism: I'm confused by your comment. There's actually no way for us to do it until we have API from VS Code to make it possible.

We now have an API from VS Code that will allow us to fix issues like this one. I'm tracking that work at https://github.com/OmniSharp/omnisharp-vscode/issues/2335.

Was this page helpful?
0 / 5 - 0 ratings