2

I have about 50 lines of C code that I want to collapse. It's at the top-level, containing globals, typedefs, defines, etc. The only way I've figured out how to do this is by making a fake function, for example:

enter image description here

Is there another way to do this in VS Code?

samuelbrody1249
  • 4,379
  • 1
  • 15
  • 58
  • Can't speak for VS Code but, in Visual Studio (proper), you can use `#ifndef unique_daft_token` and `#endif` lines to form collapsible sections. – Adrian Mole Jan 12 '21 at 23:22
  • @AdrianMole thanks -- what's `unique_daft_token` ? – samuelbrody1249 Jan 12 '21 at 23:28
  • 1
    Anything you want it to be. Doesn't have to be daft and probably doesn't have to be unique. Something that is meaningful, though. `#ifndef code_for_minimizing_x`, for example. – Adrian Mole Jan 12 '21 at 23:30
  • https://stackoverflow.com/a/46597272/836330 Make your regions for folding - built-in. – Mark Jan 13 '21 at 01:04

1 Answers1

1

Region folding plugin will do what you want https://marketplace.visualstudio.com/items?itemName=maptz.regionfolder

JJF
  • 2,681
  • 2
  • 18
  • 31