How to use #region or get any collapsible code?

I’m somewhat new to vex v5 c++ but not to coding in general. What’s the equivalent to c#’s region and end region?

(I’m doing a massive project which already has around 700 lines of code, and it’s getting messy)

I’m using the vex code extension on chromebook, dunno if that changes anything.

Regions are an internal view system of the Visual Studio IDE and not really part of the language. As an outlining tool, they do allow you to group and collapse sections of code but they aren’t really c# specific.

The VexCode IDE currently doesn’t have a way for users to collapse their code view. An alternative is to organize your code into different files and use the #include statement to merge the contents. See the example TestFile below.

I will admit that I haven’t tried this in the Chrome version.


int SomeCounter();


int SomeCounter(){
  int x = 1;
  return x;


#include "vex.h"
#include "TestFile.h"  //<---Include here

using namespace vex;

int main() {
  // Initializing Robot Configuration. DO NOT REMOVE!

In the beginning of the code, there’s a #pragma region and #pragma end region that works.

Problem is, even with copying and pasting these lines of code (and removing the initial #pragma, it doesn’t work.

What’s even more confusing is that the initial - thing showing it’s collapsible is still there (and works even after building)

There are some recommendations on StackOverflow with #pragma region and //{{ but they didn’t seem to work when I tested them with VexCode or Notepad++.

@jpearman is the expert. He may have some advice on this.


My understanding is that code folding was disabled for VEXcode when the configuration region was added (which was to make error reporting in terms of line number more consistent), I think the reason was that it wasn’t possible to auto collapse just that one region. VEXcode V5 Pro does support it, but that’s not chromebook compatible.


If by “auto collapse” you mean that when you open the file, the region is collapsed, I would be quite happy if all regions were auto collapsed.

1 Like