I have been trying to make a plugin that lets me automatically format parts of my code in a specific way by pressing a hotkey while I am editing a script.
However there is one massive hole in the Script Editor API which prevents me from creating this plugin: there is no way of figuring out which script the user is currently interacting with.
I can get all the open scripts, but that’s useless for this. I can force the user to select the script in the explorer, but that’s just bad. There are heuristics that can be used (such as listening to ScriptEditorService.TextDocumentDidChange) but they are insufficient.
I wish these things were more clearly documented.