Does the new ScriptDocument.EditTextAsync function allow me to programmatically set the source of a script to have more than 200k characters?
My biggest problem with the existing API (and by that i just mean the Source property on Scripts) was that It would refuse to take a string longer than 200k. If I can now just repeatedly append to a script in smaller chunks that would completely solve my problem.
Been looking at the API change history and thought that this could be enabled on live experiences. Is there a reason to why we can’t enable this in our experiences?
local x = string.rep("-", 1000) .. "\n";
for i = 1, 500 do
game:GetService("ScriptEditorService"):FindScriptDocument(workspace.Script):EditTextAsync(x, i, 1, i, 1)
wait()
end
Yes! I needed this so much for my plugin. Now everything I need is an ability to highligh certain string patterns in the editor and open temporary script tabs.
Edit: Is this only for scripts which are opened in the script editor?
Finally we can make plugins that can extend script editor functionality, can’t wait to see what talented creators will make. It’s gonna be a big upgrade for me since I use script editor 99% of my time spent in studio.
An epic idea, what if we could freely place and remove endpoints?? Better yet, an epic API feature for this class, the ability to pause and resume scripts!
Will there be API to add things to the autocomplete menu? Or for things like displaying GUIs?
Imagine if you could have a ViewportFrame displayed when you hover over a variable holding a part, and that you could have the basic tools like resizing. Or if you could add custom functions shown in autocomplete, and when you press tab, it actually defines the function at the top of the script or at a place marked with a comment. Or if you could make it so changes other team members make would be shown above as a notification.
Dude that’s another solid feature suggestion. Imagine having a custom module that acts like a class, and being able to autocomplete using your own API… MIND BLOWN
Not OP, but this could allow for adding functionality similar to VSCode’s Ctrl + K W shortcut, which closes all open script documents. It’d also allow for similar functionality such as mapping a keybind to close all scripts to the right of the open file.
Rojo has a feature called “Open Scripts Externally” that will attempt to open a file in an external editor when you open the corresponding script in Studio. Since the file opens in your external editor Rojo closes the one in Studio. Here’s the relevant code:
-- Force-close the script inside Studio... with a small delay in the middle
-- to prevent Studio from crashing.
spawn(function()
local existingParent = activeScript.Parent
activeScript.Parent = nil
for i = 1, 3 do
RunService.Heartbeat:Wait()
end
activeScript.Parent = existingParent
end)
As you can see this is pretty hacky and it interferes with other Rojo features because you are removing the script from the DataModel temporarily.
EDIT: I’m not sure if the delay is necessary. I just tested it and it doesn’t crash. However, it would still be nice to close a script without removing it.