Script Editor - New Foundation and First Features

Hi Developers,

We talked a few months ago about the new Script Editor we’re working on (The Script Editor). Well, now it’s starting to become real! With this release, the new architecture is live in Studio supporting several features. The full transition will be gradual and take place over the remainder of 2020. In addition to more visible improvements, you may start noticing the Script Editor get progressively faster, more responsive and less…quirky.

Folding and Formatting Improvements
As of today, code folding and auto formatting (including auto indentation and auto code block completion) are being driven by the new engine. Specific upgrades include:

  • The script sidebar no longer displays fold indicators for code blocks that are not collapsible
  • An extra line and indentations are automatically added when enter is pressed between a pair of curly braces for table syntax
  • Auto code block completion is smarter about nested code blocks on the same line
  • Auto indentation is smarter about aligning the closing line of a code block

Auto-Indent is Now the Default
The default settings for auto indentation have been changed to an “absolute” indentation rule. It corrects the indentation level to maintain proper formatting. For example, starting with this code and pressing Enter…
start
…will result in corrected formatting
auto_indent
If you don’t like this behavior, you may switch back to the old “relative” indentation rule in the Studio preferences.

Seeing Spaces (and Tabs)!
Viewing the examples above, you may ask yourself “Are those lines indented with tabs or spaces?”. And up until now you would just have to guess - but no longer! Now there is VISIBLE WHITESPACE. You can turn this goodness on with the Studio > Script Editor > Show Whitespace settings.

We will have more improvements here soon. For anyone dealing with some unholy mixture of spaces and tabs (shudder), selection formatting and whole document formatting are coming. Hang tough!

Moving Blocks (and Lines!)
We’ve added hotkeys to move blocks of code up and down. Alt+Arrow Keys (Opt+Arrow Keys on Mac) will do this now. Using these hotkeys without a selected block will move a single line up/down. Keep those hands on the keyboard!

These spicy new features are brought to you by feature chefs par excellence: @cruiser_forever, @PaintedGardener, @yohooyohoo, @HugoBLH , and @sunny0724!

Happy coding!

304 Likes

This topic was automatically opened after 15 minutes.

That’s all amazing, but is this part forced too?

There’s this issue I consider recent, where my code blocks get auto-completed even with indentation and related options off.


With that aside, the moving blocks and lines feature is definitely a cool update!

9 Likes

This is good to hear! I think I’ll like the absolute indention, I need my code to be organized neatly.

The new improvements are a real nice touch! I don’t see a need for whitespace, though. Spaces and tabs, I think both work fine if it’s spaced neatly. I’m definitely gonna make use of the moving blocks feature though, editing scripts will be easier than ever! :smile:

8 Likes

Spicy indeed!

I feel excited to use scripts more often LOL.

Look, my code’s dancing now!

Everyone’s happy, even the code LOL, so this is an awesome update!

But here’s the thing:


I don’t like the dots in between words like that, I don’t really see much of a use for it and it seems to clutter everything up. All I see from that is Morse code, which I don’t even know at all LOL.

Also, it’d be great to have auto-complete detect objects nested within other objects. Right now it only works until layer 2, and then there are no suggestions deeper in.

Another thing: I’d love to toggle between relative and absolute indentation via a hotkey because there are frequent use cases for both and I don’t feel like going to the settings tab every so often. So, a keyboard shortcut would make it so much easier to properly indent your code. I mean, it can annoying with the absolute indention, and same goes for relative.

But still, keep it up, Roblox! :roblox: :roblox_light:

57 Likes

Yes, finally a quality update when it comes to us programmers on ROBLOX!

Indents and formatting will be my personal favorite since it will make the code much easier to read and well organized for programmers around the community.

Sweet, this feature will be useful to see how many “tabs” you have done or the indents on the script. :eyes:

Many thanks! :wave: :roblox_light:

3 Likes

Good. It’s hard to help people debug in #help-and-feedback:scripting-support when their code isn’t indented properly. Glad to see changes that benefit the platform as a whole.

Not personally a fan of the whitespace indicators, though. They don’t stand out as much as I’d expect.
image
I’d prefer this (above) look closer to this (Notepad++):
image
The tab indicators are more clearly defined, and the spaces aren’t off-center like in the Script editor.

13 Likes

Yes! Scripting in roblox just got way better!
Though, how many of these features have just been completely rolled out, or are they gonna be added to beta features list?

This feature is gonna be awesome for me, whenever I do tables like this I always have to press tab to indent another line. Thanks for the other features!

1 Like

Do you have “Show Whitespace” on in your settings? Because that’s what causes it. The whole point is to see the whitespace in your script.

Other than this, this is a great update to the script editor that fixed a bug I commonly saw that indented another level when hitting enter from the very front of a line.

2 Likes

I really like this feature but there is some things that seems unplanned or not fully thought through.

I like this but I have a question. Is the unexpected Unicode character error caused by this update?

1 Like

Really nice update tho, but sometimes it doesnt autocomplete…

This is amazing! Now I can organize my code!

So what will happen to the Minify/Beautify plugin?

1 Like

Nothing, the plugin doesn’t become obsolete because of this update.

1 Like

unknown
auto indent doesn’t seem to work so well with spaces. might be a bug

3 Likes

That plugin beautifies the entire script. This only beautifies the line you’re on when you press Enter.

2 Likes

Oh, alright! I usually code messy so this stays still!

1 Like

Using the new editor, I got this error:

attempt to perform arithmetic (unm) on function

Does anyone know what the operator “unm” is?