skScriptLoader - A system for using SO stacks with external code editors

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
stam
Posts: 2990
Joined: Sun Jun 04, 2006 9:39 pm

skScriptLoader - A system for using SO stacks with external code editors

Post by stam » Tue Oct 04, 2022 3:12 pm

It is very interesting that the majority of responders to the poll https://forums.livecode.com/viewtopic.php?f=9&t=37285 either use or would like to use an external editor.
It's good to have access to both the built in script editor but also where possible to work in the environment of choice.

I personally prefer to work as much as possible in VSCode - and to do this i came up with my own system for using Script-Only stacks as much as possible.
I replace stack scripts, card scripts, libraries and backScripts with SO stacks and readily use these directly in VSCode (easily 90% of a project's code). The only problem was that after saving externally, changes weren't reflected in the IDE as these have to be reloaded - which usually means painfully restarting LC, which for testing purposes isn't great.

Initially i had hand-coded handlers for loading all SO stacks and then unloading them (to reload after external editing) but that quickly became tedious with 20+ SO stacks, not to mention that this wasn't initially abstracted for use in other projects.

Given this is amenable to automation, I created skScriptLoader as a plugin. You declare locations where SO stacks will reside, assign a role to each SO stack and it then generates load- and unload scripts. This means i can load all scripts easily at start up and can near-instantly reload these after editing externally. I've tried to make it as generalisable (for my needs) as possible and I spent some time making this as abstracted as possible.

Here's an example of a project i'm working on at present:
skScriptLoader.jpg
this is then minimised to a little icon top right to provide a 'reloader' to any stack containing the handlers generated:
reloader.jpg

If interested, you can download this from my GitHub at: https://github.com/stam66/skScriptLoader
The download includes a test stack with some test SO stacks - see the readme or in-app info for more.

If any issues, comments or suggestions for improvement, please raise this on the GitHub page or comment here...

Stam

Post Reply

Return to “Talking LiveCode”