Omnisharp-vscode: Bug: A folded method also hides empty lines after it

Created on 31 Jul 2018  路  6Comments  路  Source: OmniSharp/omnisharp-vscode

  • VSCode Version: 1.25.1
  • OS Version: Ubuntu 18.04.1 LTS

Steps to Reproduce:

  1. In a c# file (or cshtml file)
  2. Fold a method
  3. It will be folded, along with empty lines after it

Example before folding:
csharp public void foo() { // some code... } // this empty line will be hidden when folding "foo()" // this empty line will be hidden when folding "foo()" // this empty line will be hidden when folding "foo()" // this empty line will be hidden when folding "foo()" public string Bar { get; set; }

Example after folding:
csharp public void foo() { ... public string Bar { get; set; }

Example of what should occur:
csharp public void foo() { ... // this empty line was not folded // this empty line was not folded // this empty line was not folded // this empty line was not folded public string Bar { get; set; }

I've marked this as a bug, rather than a request, because this is not how folding works with Visual Studio - which only folds code, not whitespace after it. And I assume you're aiming for parity with the IDEs, at least for c# anyway.

This is a really annoying problem, because when code is folded everything is bunched up together and you can't visually separate between them - which is why you'd use empty lines between them.

(The same problem exists for .cshtml files.)

Bug Editor-Code Folding Resolved-Fixed

All 6 comments

cc @rchande

I wonder if VS is merging the code folding regions or something like that. In VS, we create code folding regions for blocks of comments.

@DustinCampbell When I posted the problem on the vscode repo, I was told vscode doesn't do folding. Not sure what is the problem, but hope that helps.

VS Code has a code folding feature, but we provide the data for it. That said, we haven't actually shipped our side of that feature yet. So, this is an issue that may already be fixed in C# for VS Code. @rchande?

@lonix1 This should be fixed in our next release.

This is fixed - closing.

Before fold:

image

After fold:

image

Was this page helpful?
0 / 5 - 0 ratings