Sketch with multiple files

In other threads it was discussed how to have a sketch with multiple files.

This works by leaving the main file completely empty and having multiple tabs.

But there was a reference to the fact that Arduino IDE is not that clever and for variables and function declarations it works by left to right so you must have the declarations on a tab near the left if you want other tabs on the right to see it.

Is this correct? Is there a way to re-arrange the tabs after they have been created? Alphabetically maybe?

Is there another way to make the IDE more clever?

After the main file (the one with the same name as the project directory) the IDE loads the other .ino files in alphabetical order. Global variables in earlier files are visible to the code in later files, but not vice-versa.

You can easily do a few experiments to figure it out.

My inclination would be to put the global variables in the main file unless you specifically want some that have more limited scope.

...R

Thanks.