Page 1 of 3

Does Livecode have a prettify option?

Posted: Thu Jul 23, 2020 10:50 pm
by karmacomposer
In other languages/IDE's there is a prettify feature. It pretty much takes the code and makes sure it indents properly.

I write a lot of Livecode code either in Sublime or even notepad/notepad++

However, the code, when pasted into Livecode's editor, does not indent automatically. I would have to press enter on each
and every line to make it look right.

Is there a one key/command to do this for all the code of a given script?

Thanks.

Mike

Re: Does Livecode have a prettify option?

Posted: Thu Jul 23, 2020 11:18 pm
by dunbarx
Hi.

Clicking the tabKey will indent the entirety of the SE. You have to select "autoFormat" in the SE preferences. You can also set the width of the indentation.

Craig

Re: Does Livecode have a prettify option?

Posted: Fri Jul 24, 2020 4:02 am
by karmacomposer
Ty. I will try that.

Mike

Re: Does Livecode have a prettify option?

Posted: Fri Jul 24, 2020 2:11 pm
by Mikey
Is there any reason you are copying/pasting into the SE instead of using Script-Only Stacks?
Is there any reason you aren't using the nifty ST connection to LC Server to get LCS to do your parsing for you and then ST to do the indenting?

Re: Does Livecode have a prettify option?

Posted: Fri Jul 24, 2020 4:12 pm
by bobcole
What does ST stand for?
the nifty ST connection to LC Server
Thanks,
Bob

Re: Does Livecode have a prettify option?

Posted: Fri Jul 24, 2020 4:21 pm
by bogs
Heh Mikey, maybe not everyone knows about those things is probably it. I didn't (and still don't), bobcole didn't know about at least one of em.

You just might be a little more advanced than a LOT of others :)

Re: Does Livecode have a prettify option?

Posted: Fri Jul 24, 2020 4:59 pm
by jacque
Slight correction: the tab key formats the handler containing the insertion point. Shift-tab formats the entire script.

Re: Does Livecode have a prettify option?

Posted: Fri Jul 24, 2020 5:25 pm
by Mikey
ST is Sublime Text.
I am not a fan of being a little more advanced than a lot of others. Let's fix that, and then let's chase Trevor down.

Re: Does Livecode have a prettify option?

Posted: Fri Jul 24, 2020 5:42 pm
by FourthWorld
Mikey wrote:
Fri Jul 24, 2020 2:11 pm
Is there any reason you are copying/pasting into the SE instead of using Script-Only Stacks?
I can think of several, depending on the needs of a given project and team.
Is there any reason you aren't using the nifty ST connection to LC Server to get LCS to do your parsing for you and then ST to do the indenting?
What is the benefit of round-tripping to a server to access a routine available right in the local install?

Re: Does Livecode have a prettify option?

Posted: Fri Jul 24, 2020 5:57 pm
by bogs
Mikey wrote:
Fri Jul 24, 2020 5:25 pm
I am not a fan of being a little more advanced than a lot of others. Let's fix that, and then let's chase Trevor down.
I am a big fan of you being a little (or in this case, a LOT) more advanced than I am, for instance, I would really shudder if I were the top of the curve, so to speak.

Every day, I am quite thankful there are any number of people that participate here that I learn so much from.

Sublime Text is certainly a top end editor, but isn't everyone's cup of tea, is there a way to duplicate whatever you're using it for in other editors?

Re: Does Livecode have a prettify option?

Posted: Fri Jul 24, 2020 7:11 pm
by Mikey
@4W
The advantage is getting live syntax checking/colorizing/indenting without being locked into the SE, for those people who don't like the SE, or prefer another tool.

@bogs
The LC team prefers Atom. I'm ok with Atom. It's definitely more refined than ST is. It's the muscle car/luxury car or Android/iPhone argument. ST is faster, but you're in the weeds more.
The other reason to use ST is because of a nifty Python script Trevor wrote as a plugin for ST - I don't think it works with Atom, and I was never able to get it to work with Atom - maybe someone else did. The plugin is triggered when you save a file in your project. It then pops a signal on a local network port (i.e. just on your machine). If you are using Levure for your project or if you've copied and pasted the listener code from Levure into your project, the script that you just modified will be reloaded. So you get the benefit of being able to work on scripts in your project in ST, but have them automagically reloaded as soon as you save them, as if you were editing in the SE. The only time this causes a problem is if the script you just modified is the one that LC is busy executing. Then LC will throw up a dialog, and won't reload the script. You would have to quit LC and then go back in.

Any of the editors from the ST/Atom tree (which starts with BBEdit, I believe), are similar enough that they should be able to talk to LC Server to give you syntax highlighting, indenting, etc, however, we are now past my pay grade, so someone else will have to pick it up.

If you prefer Atom, for example, you can install the language-livecode plugin for Atom. Then click on the link in the plugin editor in Atom and there is full documentation.

Re: Does Livecode have a prettify option?

Posted: Fri Jul 24, 2020 8:01 pm
by bogs
Heh, funny enough you should mention Atom vs. Sublime, I actually prefer Geany, which I am off and on dev'ing a lang pack for. I guess it will now be the muscle car/luxury car/motorcycle or Android/iPhone/dumbphone argument. :D
(Really, from me, did you expect any less?? I can't leave well enough alone *anywhere*) :twisted:

Re: Does Livecode have a prettify option?

Posted: Fri Jul 24, 2020 9:23 pm
by SparkOut
I tried out Atom on Windows. Quite an extensive trial over time. It sucked.

Re: Does Livecode have a prettify option?

Posted: Fri Jul 24, 2020 9:24 pm
by Mikey
@sparkOut
What do you use? What didn't you like about Atom?

Re: Does Livecode have a prettify option?

Posted: Fri Jul 24, 2020 9:28 pm
by SparkOut
For LiveCode I use the IDE Script Editor (for all its drawbacks), or for LiveCode Server scripts, as well as general editing and web work, I use VS Code. Apart from anything else, it has the best s/ftp on demand client option that I have found.

Atom was clunky, slow, not intuitive to use, and seemed to be cobbled together from random modules mashed together.