-
Notifications
You must be signed in to change notification settings - Fork 676
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fold All Regions feature doesn't work #2621
Comments
From @vscodebot[bot] on October 18, 2018 8:42 (Experimental duplicate detection) |
Please add a code sample. I tried with the folloing sample and it worked //#region
Test
//#endregion
//#region
Test2
//#endregion
|
Do you use an extension for c# ? Out of the box you get indentation based folding with region markers sand your example works the same way as my example. |
From @suadev on October 23, 2018 14:14 Yes, i use c# extension that powered by omnisharp. My whole extension list; |
The problem is with the C# extension's foldingRangeProvider: Ranges originating from #region/#endregion need be marked with Kind: FoldingRangeKind.Region. |
@suadev What are the keys you are using to fold the region. I tried the combination specified here https://code.visualstudio.com/docs/editor/codebasics#_folding and it seems to work fine for me. Note that in using |
@akshita31 as i said in my first post; "Fold All Regions" feature doesn't work neither by ctrl+k, ctrl+8 nor by F1 menu. |
@suadev As per the vscode documentation here : https://code.visualstudio.com/docs/editor/codebasics#_folding, "Fold All" is Ctrl K+ Ctrl 0(zero) and that seems to work fine for me. Can you try that once ? |
However I do agree that Fold All regions through F1 doesnt work here. |
It's not "Fold All", The feature that i am talking about is "Fold all regions" :) |
@suadev Apologies I got a bit confused here. I am totally able to reproduce the problem. |
On further investigation, I realised that we are using the "BlockStructureService" from roslyn to provide the spans for CodeFolding. The "BlockType" defined in roslyn doesn't have an explicit type for a "Region" - http://source.roslyn.io/#Microsoft.CodeAnalysis.Features/Structure/BlockTypes.cs,863b31bd5e041d18. For regions it returns the base type called "NonStructural". In omnisharp-roslyn - https://github.com/OmniSharp/omnisharp-roslyn/blob/94114978fdfa233c1391b6f630f092db5aa87053/src/OmniSharp.Roslyn.CSharp/Services/Structure/BlockStructureService.cs#L80 we are comparing the type and checking if the type == "Region" which is not returned by roslyn as of now, hence we return the null type to the extension and the given region is not marked as a "Region" @rchande Thoughts here ? |
@rchande: anything I can do to help you with the issue? Would be really great to have this working again :) Thanks in advance! |
@zeroskyx The issue is that OmniSharp isn't properly marking "region" folding units as having the "region" kind. Thus, when you issue the command in VS Code, the C# extension doesn't think it has any regions to fold. |
@rchande: thank you for the clarification -- what would be the steps to fix the issue? It would be really great to have it working again with .NET Core 3 coming up :) Keep up the great work! |
Have you given up on this issue? With region support in almost every language now (even Bash) it's sad to see that this feature only does not work in C# 😕 |
This issue is fixed in 1.21.17 |
@JoeRobich it doesn't work. Between, when i start vscode, i see this exception; System.InvalidCastException: Specified cast is not valid. at OmniSharp.HostHelpers.Start(Func`1 action) in D:\a\1\s\src\OmniSharp.Host\HostHelpers.cs:line 29 |
do you have a repro project? |
@filipw i am working on a dotnet core 3.1 web api project. Tried on another project and got same exception. The whole log: Starting OmniSharp server at 4/14/2020, 9:31:30 AM OmniSharp server started. Starting OmniSharp on Windows 6.2.9200.0 (x64) at OmniSharp.HostHelpers.Start(Func`1 action) in D:\a\1\s\src\OmniSharp.Host\HostHelpers.cs:line 29 |
according to your log, you are on the old version of omnisharp it should be 1.35.0. check if you have any |
@filipw done :) Thank you ! |
From @suadev on October 18, 2018 8:42
"Fold All Regions" feature doesn't work neither by ctrl+k, ctrl+8 nor by F1 menu.
Copied from original issue: microsoft/vscode#61220
The text was updated successfully, but these errors were encountered: