Script Editor API: Now in Beta!

Just copy the example replacement script shown in the original post, and tweak it around a bit. Add custom shortcuts.

1 Like

I didn’t say you could…

1 Like

This might be off-topic. But will we ever be able to interact with the autocorrect script api? like return a table of “autofilled” strings from a string via some api.

3 Likes

Yeah that’s what i was saying.

1 Like

Oh ok, thanks! If they did add that it would be great though!

1 Like

yeah but mine is kinda different since i dont want it to show thr autocorrecr gui, but return the table of autofilled strings

but your idea is also cool.

1 Like

What would you use that for, exactly? Like press numbers 1 - 9 to autofill that?

I’d like to see these things added:

  • A method to close scripts properly.
  • A method to open scripts properly.
  • A method to open temporary script tabs.
  • A way to check if a script tab is temporary.
  • A method to apply script edits (Team Create).

Hopefully these are implemented soon as their absence is stopping me from continuing to develop my plugins.

Edit: Just tried out the new OpenScriptDocumentAsync method and it works perfectly! Thank you everyone who are working on this.

Edit2: Continuing to notice weird bugs when setting script’s parent to nil to close the tab. Please add a method to close ScriptDocuments.

Hey Developers!

Hope the summer has been treating you well! As you may know, we have been releasing new functions for the Script Editor API over the past couple of weeks. We wanted to provide you with an update that explains all of these new functions.

IMPORTANT: As this API is still in beta, code-breaking changes could possibly be made. Along with these functions, we wanted to inform you that we will be making a breaking change in the coming days to EditTextAsync: The function will now request script injection permission, which may cause it to produce errors if the plugin has not yet been granted this permission.

These are the functions that have been released over the past few weeks:

GetSelectedText
Gets the text selected in the editor, or an empty string if there is no selection.

GetSelectionEnd
Gets the larger of the cursor position and anchor. If the editor has no selection, they are the same value.

GetSelectionStart
Gets the smaller of the cursor position and anchor. If the editor has no selection, they are the same value.

HasSelectedText
Returns whether or not the editor has any text selected.

RequestSetSelectionAsync
Asks the editor to set its cursor selection to the argument values. Both anchor arguments must be passed, or neither. If neither is passed, then they each default to being the same as the corresponding cursor argument. The editor may decline to update its cursor if the text content of the document has changed, or the cursor has moved since the request was made. Returns (true, nil) if the cursor was updated, and (false, string) with an explanation string if it was not. Yields the current thread until the editor replies.

ForceSetSelectionAsync
Asks the editor to set its cursor selection to the argument values. Both anchor arguments must be passed, or neither. If neither is passed, then they each default to being the same as the corresponding cursor argument. The editor may decline to update its cursor if the text content of the document has changed. Unlike RequestSetSelectionAsync, the editor will not decline to move its cursor if the cursor has moved since the request was made. Returns (true, nil) if the cursor was updated, and (false, string) with an explanation string if it was not. Yields the current thread until the editor replies.

Happy scripting!

9 Likes

Roblox scripting features just get BETTER AND BETTER :smiley:

Could you release more details on how the LSP Callbacks work and when each event is emitted, with information of what the event is actually telling us, and what we can do in response to that.

Is it possible to get the a specific script fenv using this service? It would be really good for some plugins.

Would it be possible to have an API method allowing plugins to change syntax highlighting keywords/colors?
I think that could be useful for things such as a built-in JSON editor for editing DataStore through the script editor or having custom macros.

I’ve been using the Script Editor API close to since when it came out, and it’s been a real blessing with the third-party integrations we have created for our team.

The only downfall we have at the moment is that there is no API (that we can access at least) for when a commit is generated. This requires us to use hacky workarounds to detect script commits, and comes at the downside of not being able to see the commit reason.

It’d be great if the API was extended to also include an event for when a commit is done, including the note set by the developer when doing so.

1 Like

When will we be getting a function to preemptively request a plugin permission? I can’t have my plugin break mid execution, as this causes irreversible changes.

1 Like

Hey Developers!

We are excited to announce that we are now beginning the full release of the Script Editor API! We will be rolling out the APIs to our developer community over the coming weeks. We want to remind you that this is not the end of the API now that we have reached the start of full release and we highly encourage you to continue to send in any further API requests in as a feature request!

Here are the functions which been released over the past few weeks:

OpenScriptDocumentAsync(script: LuaSourceContainer): Tuple YIELDS
Requests that a Script Editor open the specified script. Returns (true, nil) if the request succeeds. Returns (false, string) if the request fails, with a string that describes the problem.
Learn More

CloseAsync(): Tuple YIELDS
Requests that the editor associated with this document close. Yields the current thread until the editor responds to the request.
Learn More

RegisterAutocompleteCallback(name: string, priority: number, callbackFunction: function): nil
Registers an Autocomplete callback callbackFunction named name with priority priority.
Learn More

DeregisterAutocompleteCallback(name: string): nil
Removes a previously registered callback with the name name. Documentation:
Learn More

Happy Scripting!

6 Likes

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.