UndertaleModTool icon indicating copy to clipboard operation
UndertaleModTool copied to clipboard

Suggestion: Formatting options for decompiled code

Open ithinkandicode opened this issue 3 years ago • 4 comments

Would it be possible to add options to change the decompiled code formatting style?

In particular:

  • Make all if() statements use { ... } (instead of 2-line ifs that don't use no curly braces)
  • Add empty lines above and below if() and while() statements

I can make a personal regex script to automate the second thing, but 2-line ifs are much harder to account for.

(edit: I originally misspoke and said "2 newlines" but meant \n\n ie. 1 empty line)

ithinkandicode avatar Mar 12 '22 18:03 ithinkandicode

I see the need for the first one (though maybe not if you just have a one-line if), but why have 2 newlines above and below if / while statements?

Archie-osu avatar Mar 12 '22 18:03 Archie-osu

why have 2 newlines above and below if / while statements?

To space out the code a bit, so it's easier to visually parse. Like this:

tight spacious
tight spacious

This is a simplified example, with larger complex blocks it helps more.

ithinkandicode avatar Mar 12 '22 21:03 ithinkandicode

Should this be merged with #944 ?

Miepee avatar Jun 24 '22 14:06 Miepee

Should this be merged with #944 ?

Happy to merge, I'll comment on 944

ithinkandicode avatar Aug 29 '22 21:08 ithinkandicode