[ANN] VSCode extension for Livecode

Find out what's going on with LiveCode (the company), product releases, announcements, and events.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
prometheus
Posts: 25
Joined: Sun Dec 13, 2015 6:05 pm

[ANN] VSCode extension for Livecode

Post by prometheus » Sun Jan 23, 2022 10:24 pm

Hello everyone, for those who like VSCode, here is an extension created by the Ferruslogic team for this great editor, at the moment only for .livecodescript files, but very soon it will be extended to other formats like lc (web) and lcb. Even so, it already has handler, constants and variables definition resolution, syntax highlight, code formatting and syntax verification (linting).

stam
Posts: 1179
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: [ANN] VSCode extension for Livecode

Post by stam » Mon Jan 24, 2022 12:19 am

I do like VSCode, but have been using Atom with it's syntax colour and linting for LCS/LCB. I'll look into this with interest.

The biggest issue for me with these things is the lack of integration; i'd like if possible to launch the external editor to edit a script and being able to modify this directly and from the external editor (ie without having to copy/paste in either direction) but that's probably wishful thinking. Plus debugging would be... challenging (although i guess could be done in the native SE).

On a related note, both the Atom extension and this rely on Server for linting - but how does that work now that server is premium (roughly equivalent in price to choosing 2 platforms in the 'Standard edition'). This doesn't affect me as i have this, but for other users this will be an issue, is there a way around this?

prometheus
Posts: 25
Joined: Sun Dec 13, 2015 6:05 pm

Re: [ANN] VSCode extension for Livecode

Post by prometheus » Mon Jan 24, 2022 2:42 am

@stam There is a plugin that with a few modifications should work, but I don't know under which license is it, just to be sure I'm trying to contact the original developers. I'll post it here if possible as soon I get an answer from them

bwmilby
Posts: 403
Joined: Wed Jun 07, 2017 5:37 am
Location: Henrico, VA
Contact:

Re: [ANN] VSCode extension for Livecode

Post by bwmilby » Tue Jan 25, 2022 3:03 am

Linting should not be a problem until LC10 adds new syntax. The community version (which you probably could still compile from source if needed) should be fine for this purpose.

ScriptTracker could be a possible solution to the integration issue. It exports all of the scripts of a binary stack to files that can be edited in your favorite editor. The tool watches the folder of scripts and will import changes as they happen. Debugging still happens in the IDE. It currently monitors a single binary stack (with substacks) at a time. Scripts are exported/synced when the stack is saved.
Brian Milby

Script Tracker https://github.com/bwmilby/scriptTracker

prometheus
Posts: 25
Joined: Sun Dec 13, 2015 6:05 pm

Re: [ANN] VSCode extension for Livecode

Post by prometheus » Tue Jan 25, 2022 6:01 am

bwmilby wrote:
Tue Jan 25, 2022 3:03 am
Linting should not be a problem until LC10 adds new syntax. The community version (which you probably could still compile from source if needed) should be fine for this purpose.

ScriptTracker could be a possible solution to the integration issue. It exports all of the scripts of a binary stack to files that can be edited in your favorite editor. The tool watches the folder of scripts and will import changes as they happen. Debugging still happens in the IDE. It currently monitors a single binary stack (with substacks) at a time. Scripts are exported/synced when the stack is saved.
I don't think so, I tried script tracker some time ago and I had serious problems with the project I was working on because of the auxiliary properties created by ScriptTracker in binary format for each object, the linting is already working for Livecodescript, and tomorrow I will upload an update with support for LCB

PaulDaMacMan
Posts: 550
Joined: Wed Apr 24, 2013 4:53 pm
Contact:

Re: [ANN] VSCode extension for Livecode

Post by PaulDaMacMan » Fri Feb 11, 2022 4:30 am

Excellent, thanks! The more choices the better!

I too have been using Atom with it's syntax colorization / linting for LCS/LCB, but the existing Atom package is a little wonky, particularly with LCB, and have already been considering switching to a different editor.

Interestingly as I've been slowly dissecting and fiddling about with every bit of the IDE, I've noticed that the script editor scripts does already appear to have some provisions for checking if a script was modified by an outside source, but I have not yet looked very closely at the script editor scripts.

Extension Builder stuff is already compiled by a shell app "lc-compile", that could likely be used directly from one of these code editors / IDE type apps such as Atom or VSCode.
My LCB Repos: https://github.com/PaulMcClernan/
My LiveCode YouTube Videos: PlayList

prometheus
Posts: 25
Joined: Sun Dec 13, 2015 6:05 pm

Re: [ANN] VSCode extension for Livecode

Post by prometheus » Fri Feb 11, 2022 3:32 pm

Currently LCB linting is made using LC Server as intermediary, so LC Server and lc-compile needs to be both configured, me and a colleague are working on this and planning to make LCB linting use lc-compile directly but it will take some time because we are working on this in our free time and we are not plenty of it these days :)

stam
Posts: 1179
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: [ANN] VSCode extension for Livecode

Post by stam » Mon Feb 14, 2022 12:57 am

Hi @prometheus,
Just been writing a batch of scriptOnlyStacks and I'm really liking using VSCode over Atom, and both over the built in editor. Thank you guys for providing this extension!

Just a few questions:
Is it possible to autocomplete structures on hitting return (e.g. hitting return after on <command> also puts an end <command> in code etc?) so it more closely mimics the default script editor

I'm having some issues with the formatter - on mac the shortcut is shift-opt-F which works but can be really slow (in a script of 50 lines can easily take 30 sec). In fact it's so slow it caused my saves to fail (i had format on save ticked but had to disable this).
Is this something i've done? I'm not expert in VSCode so it's possible - any suggestions?

Code folding: this doesn't work as i would expect - for example, in a if / else / end if code block, if i click the fold icon at the 'if' in only collapse the code between 'if' and 'else' and not between the 'if' and 'end if' as i would expect. Can this be improved?

Thank you for any advice,
Stam

prometheus
Posts: 25
Joined: Sun Dec 13, 2015 6:05 pm

Re: [ANN] VSCode extension for Livecode

Post by prometheus » Mon Feb 14, 2022 4:06 pm

stam wrote:
Mon Feb 14, 2022 12:57 am
Hi @prometheus,
Just been writing a batch of scriptOnlyStacks and I'm really liking using VSCode over Atom, and both over the built in editor. Thank you guys for providing this extension!

Just a few questions:
Is it possible to autocomplete structures on hitting return (e.g. hitting return after on <command> also puts an end <command> in code etc?) so it more closely mimics the default script editor

I'm having some issues with the formatter - on mac the shortcut is shift-opt-F which works but can be really slow (in a script of 50 lines can easily take 30 sec). In fact it's so slow it caused my saves to fail (i had format on save ticked but had to disable this).
Is this something i've done? I'm not expert in VSCode so it's possible - any suggestions?

Code folding: this doesn't work as i would expect - for example, in a if / else / end if code block, if i click the fold icon at the 'if' in only collapse the code between 'if' and 'else' and not between the 'if' and 'end if' as i would expect. Can this be improved?

Thank you for any advice,
Stam
Hi Stam, there are still a lot of things to do, autocompletion of structures is one of them. Regarding the slowness of the formatter, the extension currently is using original LC one, but soon will be updated with another about 8x faster, but still the current formatter on windows with a script of 12000 lines of codes it takes only about 4 seconds to format, we will test it on mac soon and try to replicate the problem you are having. The folding is currently working based on indentation, but eventually will be updated to be based on syntax.
This is a extension that a colleague and I use every day, so updates will come regularly with improvements and fixes as we do them to support our main work. Feel free to leave any suggestions or bugs in the repository issues https://github.com/Ferruslogic/vscode-livecodescript. Tnak you very much for the feedback Stam.

stam
Posts: 1179
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: [ANN] VSCode extension for Livecode

Post by stam » Mon Feb 14, 2022 4:11 pm

Thanks for the great work and for providing this to the community @prometheus - truly very much appreciated.
Look forward to the updates on this!
Stam

stam
Posts: 1179
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: [ANN] VSCode extension for Livecode

Post by stam » Fri Apr 01, 2022 2:17 pm

prometheus wrote:
Fri Feb 11, 2022 3:32 pm
Currently LCB linting is made using LC Server as intermediary, so LC Server and lc-compile needs to be both configured, me and a colleague are working on this and planning to make LCB linting use lc-compile directly but it will take some time because we are working on this in our free time and we are not plenty of it these days :)
I completely get what you mean about free time (or the lack thereof!) ;)

Quick question i'm hoping you can help with - i've just installed LC 10 on my machine at work (amazingly our extremely restrictive firewalls/rules allowed me to install both LC, GitHub desktop and VSCode on my windows10 machine at work!).

However i can't see where lc-server and lc-compile files are so i can configure your fantastic plugin. Any suggestions? Are they even available in LC 10?

Many thanks
Stam

--- EDIT: i found lc-compile in the \LiveCode 10 (dp 3)\Toolchain\ folder -- but can't seem to find lc-server...

bwmilby
Posts: 403
Joined: Wed Jun 07, 2017 5:37 am
Location: Henrico, VA
Contact:

Re: [ANN] VSCode extension for Livecode

Post by bwmilby » Fri Apr 01, 2022 2:24 pm

The server component is a separate download. The community version should work fine for linting (at least until the new LC 10 syntax is used).
Brian Milby

Script Tracker https://github.com/bwmilby/scriptTracker

stam
Posts: 1179
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: [ANN] VSCode extension for Livecode

Post by stam » Fri Apr 01, 2022 2:26 pm

Thanks Brian,
Yep i remember the old way of doing this and have the mac version from previously. This doesn't seem to work on windows ;)

My new licence should include 'server' as well but how does that work?

bwmilby
Posts: 403
Joined: Wed Jun 07, 2017 5:37 am
Location: Henrico, VA
Contact:

Re: [ANN] VSCode extension for Livecode

Post by bwmilby » Fri Apr 01, 2022 2:54 pm

I had it working on my previous company laptop with Atom. Pretty much the same as on the Mac though. Just download the server binaries for Windows and enter the path (I’ve only done it in Atom).
Brian Milby

Script Tracker https://github.com/bwmilby/scriptTracker

stam
Posts: 1179
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: [ANN] VSCode extension for Livecode

Post by stam » Fri Apr 01, 2022 4:48 pm

Thanks Brian - i'm afraid i had a 'senior moment' there - i couldn't see the server download on downloads.livecode.com and assumed it must be part of the new package... completely forgetting that i had to log onto my account page instead and download server from there :oops: :oops:
All good now lol!

Post Reply

Return to “Announcements”