Studio should have an option to auto0format (fix spaces around operators / commas, fix indentation, etc) upon save / script close.
All real coding IDEs have this feature because it highlights mistakes and avoids style discrepancies. This would significantly help out learners, who would no longer be left with misleading indentation. It would also help manage larger pieces of code and refactoring without having to worry as much.
I like this idea, but the only issue is everyone formats their code differently. Personally, I prefer spaces after commas and between code and comment sections, but maybe some people don’t. Also do you propose a way to handle whitespace? If you would want that to be included, there would be a lot of difficulty with decided upon what restrictions to follow as everyone spaces out their code differently.
This code is the one of the major reasons I didn’t indent my code for about a year after learning Lua, then for another year or so after that I developed my own indent style which was terrible
I remember reading this comment and thinking that it was a cool style, fortunately I never used it myself though.
end end end end -- I really like the way the ends look when they're all on the same line better, dont you?
I found it basically unreadable when they were all on the same line, so I never did that, luckily, but I remember not indenting my code for the same reason.
Since there’s such variance to code styles, I think this would be better implemented as a plugin. But we can’t do that because we need the following:
An event that fires before the place file saves and another that fires when it finishes saving. This would allow us to write plugins that make modifications before saving or only to the saved file. This could be used to automatically format scripts, or to do other things like automatically manage the location of server/client modulescripts, search, find, and create remote* objects to be saved with the place, update model properties, increment version numbers, and more.
I think this would be a much more useful feature overall, and allows for implementing auto-format in a way that any developer can modify for their needs.
Welcome to ROBLOX, where we can achieve a lot by haxing things together.
Done by only using the commandline: https://www.youtube.com/watch?v=zu64yFR25fw (if script.Source wasn’t protected, even a regular (local)script would’ve been able to do that)