Reputation:
does someone already has experienced this "issue" on visual studio?
it did not fold the code on the brackets, just on the function header, should have a -
on line 32,35 like on the line 25
Upvotes: 17
Views: 21423
Reputation: 2270
Had something similiar.
At work it turned out theme dracula had a bug hiding the fold line dark ..
Upvotes: 0
Reputation: 550
I found my setting for "Editor: Folding" was false! i.e disabled. (I don't recall why)
Make sure it's on, i.e enabled.
Upvotes: 0
Reputation: 1011
I tried all of the solutions posted so far to no avail. I ended up copying and pasting the code to a new file and the folding worked perfectly.
Upvotes: 1
Reputation: 489
If you stop the outlining and then start it back up, it should refresh/reset the outlining data for that file.
first goto Edit->Outlining->StopOutlining
then goto Edit->Outlining->StartAutomaticOutlining
This fixed my issue with code folding wrong code sections, and just doing weird stuff.
I made an extention for Visual Studios 2022 to do it in one click, because I was bored. https://marketplace.visualstudio.com/items?itemName=zachwuzhere.ext123
Upvotes: 0
Reputation: 61
There is a setting in the VS.Code : "Settings / Editor: Folding Strategy" I set this to "indentation" while other option is only "auto".
I guess there sometimes problems with other extensions.
Upvotes: 6
Reputation: 1706
I had the same problem with python code. For me this helped:
File -> Preferences -> Settings -> Text Editor -> Folding Strategy -> Set to "indentation"
"Folding Strategy - Controls the strategy for computing folding ranges"
This was set to "auto" for me, after changing to "indentation" it works.
I suspect the "auto" setting uses something smarter which may break depending on system, environment and used imports.
Upvotes: 56
Reputation:
Solved: Visual Studio -> Tools -> Options -> Text Editor -> C\C++- > View and set Outline Statement Blocks to true
I dont know how, but i had this option as false.
Upvotes: 0
Reputation: 89
Well that's strange.
You can try a couple things:
Does it happen anywhere else? If it does, it could be an editor option.
Regards.
Upvotes: 1