Closed adam-coster closed 4 months ago
I don't think this is possible for the following reasons:
a) Dangling #region
and #endregion
statements are allowed by the compiler
b) Regions can contain opening/closing brackets
#region hmm
#region how do we indent this
if (true) {
#endregion
}
Ah yeah, good points. The former issue is probably fine since you could have implicit endings at EOF, but the latter is definitely weird.
I've been playing around with Gobo a bit to see how it would format some of our code. So far the only issue is that our main game programmer makes frequent use of
#region
s, including nested regions, to organize code.Since #region is an official keyword rather (rather than a JavaScript-style comment convention) it would make sense to include it in the AST and indent the contents of a region. And if we're doing that, also indent nested regions recursively!
That may be out of scope, but I suspect that a lot of GameMaker programmers make heavy use of regions to organize code so the use-case is probably there.