My attempt at an in-game code editor

I was extremely bored and I decided to make a code editor using TextBoxes. I tried to mimic Studio’s editor as closely as I could.

Live syntax highlighting, indentation ruler, and current line indicators


Ignore the weird caret glitch I don’t know what causes it and I’m stumped.

Completely custom caret and selection

Matching words get highlighted


This is pretty much the groundwork for Ctrl + F but that means I’m obligated to implement Ctrl + H as well as its RegEx feature which has been my nightmare for a while.

Autocompleting quotes, brackets, and braces

Also supports skipping over itself and pressing backspace near a pair deletes the whole thing


Kind of hard to see when it skips over itself because of caret glitch but trust me

Block completion


Forgot function but it’s supported too. Also it won’t append then/do if it’s already typed.

Indentation maintaining

Indenting/unindenting with Tab/Shift + Tab

Click gutter to select line

Features that Studio doesn’t have (as of writing this)

Shift + L to select whole line

Ctrl + X to cut whole line

Other things I attempted to do:

I think that’s all, I may have skipped a thing or two. Let me know if you want any feature and I may implement it. As for performance, I’ve never dropped below 58 FPS (60 FPS max), but I’ve been testing with the lexer source code, which isn’t that long (I think like 300 lines).

I won’t open source it because it’s 700 lines all crammed into a singular LocalScript (the lexer is its own ModuleScript), but I’ll gladly answer any questions.

While testing, I found a way to manipulate what the user copies so theoretically I could bypass the 200,000 character limit while supporting clipboard (not a fake clipboard, but one where the user can paste outside of Roblox or inside from outside). But that’s for another day unless Roblox fixes it.

Update 8/7/2023

I decided to rewrite and modularize the existing code. I didn’t add much though.

Custom scroll bars
This was a necessity if I wanted to implement the tap and scroll feature.

Overview ruler
So far, I only have word highlights, but I could definitely include the other types.

Other things:

Other than multiple cursors, I probably won’t add anything else. It was pretty challenging but the end product was well worth it.

Fun fact: I made this in VSCode because I was trying out Rojo

14 Likes

This looks awesome, Great job.

2 Likes

This actually looks pretty sweet. Very well executed!

2 Likes

Ignore GUI inset!!!

Looks really cool though.

1 Like

But you can’t remove the Roblox menu icon so it covers part of the gutter and text area. I could always shift it over to the right but now there’s empty space.

Oh right… But I suggest you put a grey bar along the top that will go behind the roblox icons.

Should I open-source this? I’m not sure if anyone would be interested in this kind of stuff.

  • Yes
  • No

0 voters

This looks very cool, Great job!

This is cool! I’ve tried making something like this but not much success :smile:

If you choose to open-source this, it will be amazing to allow developers like myself to either build on top of this or see the insides of how it works.

Other than that nice job!