Script Editor - New Foundation and First Features

The technical term for this is leading (start) and trailing (end) whitespace. I don’t know the term for other whitespace but being able to separate them out into three categories would be very useful imho.

1 Like

Has the following issue that I addressed recently been fixed?

2 Likes

I had no idea this existed in Studio. Thank you for pointing it out.

2 Likes

Thanks for letting us know! This is going to be a huge timesaver for me – I need to learn about all these kinds of shortcuts that’ll improve quality of life in the Studio :slight_smile:

2 Likes

Really awesome that you are working on this! The editor is really the primary tool for scripters, a good editor saves so much time and prevents so many bugs.

It would be really nice if some more hooks into script editing were somehow opened to plugin scripts.

Also, there is one feature I personally would >love< to see regarding the auto-complete. Even if the type of object in a variable is unknown, if I start typing :FindF or :WaitF then you can be pretty sure I’m looking for :FindFirstChild( or :WaitForChild(… And similarly suggestions/autocompletions for other ROBLOX idioms/ highly used API elements like this (especially the wordy ones) would make us so much more efficient. Also perhaps a better way to quickly find enums would be very helpful.

These are by no means demands, I just hope my feedback can be helpful. I do all my scripting in studio, and editor features mean a lot to me. But I also see a lot of new developers having trouble to find or read the API, indent properly, and all those tiny things that a good editor gives you just a little (or big) edge in.

Thanks for improving our scripting editor!
Nonaz_jr

3 Likes

yoo this is fancy. loving it so far!

1 Like

Took you long enough to stop detecting comments that contained do, then, function or repeat as collapsibles. I finally don’t have to avoid using them or capitalize them anymore.

1 Like

The “unm” error is a legitimate syntax error that arises when trying to negate a function (or anything else that can’t be negated).
An example is:

print(-math.random)

Notice the lack of parentheses after the random function. This always used to throw an error, it’s just that now it includes the weird “unm” thing in the error message.

1 Like

One thing I would love to have in the new and improved script editor are “regions” so we can keep our code more organized than ever. Like regions in Visual Studio 2019 as shown in this GIF example: https://gyazo.com/f39e4506861bb202a771f0141895bb09

2 Likes

There’s a pretty serious problem with the new editor. If you press Shift + Enter to create a new line, it inserts a carriage return character, as opposed to a regular newline character.

image

After line 34, I pressed Shift + Enter a few times. You’ll notice that the editor didn’t detect these as new lines. When I run my code, I’m met with the error:

Unexpected Unicode character: U+2028. Did you mean ’ '?

I noticed a few times that if I deleted these carriage returns, I’d get other weird errors. One error I got was that I was missing an end on line 25, even though my code was only 23 lines long and I wasn’t missing an end. I was able to fix this by copying all the code, deleting it and pasting it again.

I’ve posted this problem in a few other places, but I figured I’d post it here since this thread is the announcement for the updated editor.

2 Likes

I like the changes that you just made.
Thank you!

I am aware, was just asking however if it did cause problems cause you might just want to file a bug report if it did.

Its still a pretty awesome feature irregardless of if it puts any errors in my console :slight_smile:

Is there any plans to make existing code blocks automatically indent themselves if wrapped in another block? (something like this)

It’s currently quite annoying to indent all of the existing blocks manually. Multi-cursor could also solve this issue but it’s also troublesome because then you end up adding white space to empty lines.

Might I suggest a 3rd mode for showing whitespace? Currently in the Studio script editor, whitespace is shown for every empty space. Personally, I do not want to see whitespace in every scenario, such as between keywords and in strings, as examples. I see viewing whitespace as a tool to see that all code is aligned properly. I would rather see the whitespace in larger gaps of spaces, such as in tabs. Visual Studio Code has 3 (or 4) modes for viewing whitespace:

Mode 1: No whitespace is shown. This has been the default in Studio.

none

Mode 2: All whitespace is shown. This shows all whitespace in the script editor and is currently what Studio’s editor supports and is referred to in the parent post.

all

Mode 3: Whitespace is shown in instances where 2 or more spaces are present. This helps clean whitespace clutter in places like strings and between keywords where usually one does not need to see that there is whitespace. Pay close attention to the strings and keywords in the following screenshot compared to the screenshot in Mode 2.

boundary

Additionally, VS Code has an option to show whitespace only for the selected text. I don’t know how necessary this is, but here is an example gif:

selected

In addition to this suggestion, I would like to point out that Studio’s current editor has no option to use spaces instead of tabs. Many programmers prefer spaces over tabs yet still use the tab key as it is a quick way to insert 4 (or 2) spaces in most editors if configured to use spaces instead of tabs. Could we have the option to change the tab key to insert a variable amount of spaces in lieu of tabs?

An example of where this would be useful is as follows:

In this example, we can see that using tabs can be a bit cumbersome as lining things up with a mix of spaces and tabs is quite messy and cumbersome:

tabsspaces

Additionally, if the name of the variable is changed later, it can really mess up the formatting set up in the gif above and the programmer must fight the mix of spaces and tabs to get things to line up again. However, if the programmer sets their editor to use just spaces, it makes things much simpler are things are more consistent.

QVEGjxmdiU

Additionally, if the name of the variable is changed in this scenario, it is easier to align things as the programmer would not need to use a mixed space/tab system.

Finally, it simply looks nicer. Look at what mixed spaces and tabs can look like:

And here is the same example with just spaces:

Wow, that’s a large reply, but I hope it shows that these are important features to myself and many others (I hope!). I am not sure how hard these features would be to implement, but I would assume that they would be pretty basic additions to the script editor.

Thanks!

4 Likes

This is a Awesome feature to have in Studio! It will definitely make scripting much faster!

You can only drag one window off at a time. It would be nice if you could drag a window out wich contains all the script editors. It would also be nice if it functioned more like a normal window with a fullscreen button etc.

3 Likes

I remember auto-indent having troubles with elseif blocks in some cases, has it been corrected?

1 Like

Love the improvements to the indentation system, much better !

But I accidentally closed studio again looking at the new settings cus of this popup, please get rid of it! Make 'Restart' window after changing settings smarter

This will make Coding Easier TY :slight_smile:

On the track of improving scripting Quality of life; another good idea is when you copy and paste blocks of code, the Block gets properly Tabbed within the code its pasted into?

1 Like