GLX2 script editor released for Revolution

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9801
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: GLX2 script editor released for Revolution

Post by FourthWorld » Thu Dec 10, 2020 6:24 pm

This may be one of those use cases where using the styledText array may shine brightly.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: GLX2 script editor released for Revolution

Post by mwieder » Thu Dec 10, 2020 6:48 pm

Bernard- good catch. I've got a few unused control codes I can still utilize for edge cases like this. The code you're trying to compile is essentially undoing the htmlization of the script coloring routine in progress. They shouldn't interact like this, but...

I'll take a look and post back here when I've got something that should work.

DarkKnight
Posts: 12
Joined: Tue May 10, 2016 3:22 am

Re: GLX2 script editor released for Revolution

Post by DarkKnight » Fri Dec 18, 2020 6:01 pm

I've installed GLX2, but I can't seem to get any preferences to save or any scripts to save between sessions.

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: GLX2 script editor released for Revolution

Post by mwieder » Mon Dec 21, 2020 8:35 pm

Bernard - I've just posted the latest version to github. It's now escaping all five html entities.

Richard- I spent a few days experimenting with switching this over to styledText and found that it's just not up to the task. Was a nice idea, but unfortunately I'm still stuck with htmlText.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9801
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: GLX2 script editor released for Revolution

Post by FourthWorld » Tue Dec 22, 2020 9:33 am

mwieder wrote:
Mon Dec 21, 2020 8:35 pm
Richard- I spent a few days experimenting with switching this over to styledText and found that it's just not up to the task. Was a nice idea, but unfortunately I'm still stuck with htmlText.
I'd be interested in learning where it fell short, if/when you have time.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: GLX2 script editor released for Revolution

Post by mwieder » Tue Dec 22, 2020 5:35 pm

Sure - not a lot to tell.

The styledText array is based on paragraphs. Lines of code in the editor, in my case here. The entire line of code is styled as one.
I need to get more granular for parsing the text itself. The best I could do would be to grab the runs in the paragraph, figure out what needed to be formatted, then break that line up into multiple runs and insert them to replace the original line. And since the runs are numerically indexed, I'd have to reindex any following runs as well. What I'd need is another level of the styledText array to break up the line of text:

Code: Select all

tStyledTextArray
  paragraphNumber
  paragraphStyleArray
  runsArray
    textLineNumber
    lineStyleArray
      tokenArray -- currently just a single array element
        tokenNumber1
        token1StyleArray
        tokenNumber2
        token2StyleArray
        tokenNumber3
        token3StyleArray
        etc
If I were to use styledText instead of htmlText I'd have to give up flagging functions used as commands, styling handler calls as hypertext, color-coding variables, tooltip syntax for handlers, etc.

Example (flagging a missing right-paren with a trailing comment):

put myFunction("hello" into tArray[id]["firstName"] # just a comment

currently:

Code: Select all

tStyledTextArray
  1
  "style"
  "runs"
      1
      "style"
        textColor : "yellow"
      "text"
        put myFunction("hello" into tArray[id]["firstName"]
      2
      "style"
        textColor : "green"
      "text"
         # just a comment
after parsing the line and manipulating the array elements - note breaking up run #1 into multiple runs and reindexing the comment from run #2 to run #6:

Code: Select all

tStyledTextArray
  1
  "style"
  "runs"
      1
      "style"
        "textColor" " yellow"
      "text"
        put
      2
      "style"
        "textColor" : "blue"
         "textStyle" : "link"
     "text"
        myFunction("hello" into tArray[id]["firstName"]
      3
      "style"
        "textColor" : "blue"
         "textStyle" : "link"
     "text"
        ("hello" into tArray[id]["firstName"]
      4
      "style"
        "textColor" : "red"
     "text"
        into tArray[id]["firstName"]
      6
      "style"
        "textColor" : "green"
      "text"
         # just a comment

Bernard
Posts: 351
Joined: Sat Apr 08, 2006 10:14 pm
Location: London, England

Re: GLX2 script editor released for Revolution

Post by Bernard » Thu Dec 24, 2020 3:16 am

mwieder wrote:
Mon Dec 21, 2020 8:35 pm
Bernard - I've just posted the latest version to github. It's now escaping all five html entities.

Richard- I spent a few days experimenting with switching this over to styledText and found that it's just not up to the task. Was a nice idea, but unfortunately I'm still stuck with htmlText.
Mark, thanks a lot. I downloaded the latest version and that HTML entity problem was fixed. However, I had some other strange problems. It seemed to me that compile/save (not sure which) might not be saving my changes. This is in a script only stack that serves as the behavior for another stack. I started adding comments to the code so that they would be grouped in the handler list. After organising some of the script this way, I started copy & pasting handlers so that they were in the relevant sections. When I re-opened that SoS again, the comments weren't there and the handlers were where they were before I made those changes. Would you like me to try and repeat this to see if it truly did happen like this?

What I principally wanted to use GLX for was to organise handlers. The IDE script editor has improved so much that it has got many of the things that were missing when GLX was launched. So what I did was write a plugin of that groups handlers into a virtual handler list. This is an improvement on the GLX method insofar as the way I've implemented it the (annotated) handlers can be in any order in the LC script editor, but in the pallete I have they are still grouped and sorted alphabetically (using the Tree widget). Clicking on a handler name in the Tree "finds" it in the script editor. Always delightful that a dozen lines of code can be used to augment the LC IDE like that.

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: GLX2 script editor released for Revolution

Post by mwieder » Thu Dec 24, 2020 3:44 am

Bernard-

I can't replicate the not-saving thing at the moment. That was definitely a problem with an earlier build in that compiling *should* have set the script of the object but wasn't doing that properly, but it's supposed to be fixed in the latest build. And I do find it working here. I'll play around with it a bit tomorrow and see if I can break it.

Regarding a sorted handler list, are you aware that there's a glx2 preference for that?

...and I'm finding that just-in-time colorization is failing on OSX (but a tab keypress fixes things), so I'll have a look at that tomorrow as well.

Bernard
Posts: 351
Joined: Sat Apr 08, 2006 10:14 pm
Location: London, England

Re: GLX2 script editor released for Revolution

Post by Bernard » Thu Dec 24, 2020 12:38 pm

I'll try and replicate what appeared to happen re: saving.

BTW latest version of GLX2 also stripped all colorization (I'd forgotten that until you mentioned it). I'm pretty sure the earlier version (with html entity problem) had colorization working. Is it possible that the fix for html entities has interfered?

The handler management for a script was the main thing I was looking to benefit from. My plugin just uses

on doit p1 p2 --> handler category here

so that I don't have to physically group my handlers consecutively in the editor. Now they can be typed anywhere and the plugin just finds & lists them based on the presence of "-->" after the handler/function name. The Tree widget takes care of alphabetic sorting. I'm usually typing at the speed of my thoughts so not having to group handlers near each other is a major benefit to me. Using Script Only Stacks I see myself having very little code in most objects, so having an almost automatic way to organise handlers in these long scripts is a boon.

Bernard
Posts: 351
Joined: Sat Apr 08, 2006 10:14 pm
Location: London, England

Re: GLX2 script editor released for Revolution

Post by Bernard » Thu Dec 24, 2020 1:53 pm

I can't reproduce what I thought I saw with the script not having changes saved following compilation & re-opening.

Immediate colorisation is not working, but if the script is compiled, GLX2 closed & reopened, then the script is colorized.

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: GLX2 script editor released for Revolution

Post by mwieder » Thu Dec 24, 2020 6:11 pm

Bernard- thanks, yes, that's what I'm seeing as well.
I'll get to that live colorization thing today, and Bernd has also submitted a patch to help with it.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9801
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: GLX2 script editor released for Revolution

Post by FourthWorld » Wed Feb 24, 2021 10:39 pm

I just noticed this thread is buried in the general "Announcements" section. Mark, would you prefer it if I moved it to the "Third Party Extension Support" section?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: GLX2 script editor released for Revolution

Post by mwieder » Thu Feb 25, 2021 12:01 am

Hold that thought for a bit. We're on the verge of getting a new version out the door, and it might be more appropriate timing in a few days.

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: GLX2 script editor released for Revolution

Post by mwieder » Thu Mar 25, 2021 12:05 am

OK - I've got the latest posted to github.
Bernd Niggeman (the master of code folding) has been pushing the envelope, and we've got something that's pretty slick now.
Haven't done any back-to-back benchmarking, but subjectively it feels at least as fast as the built-in script editor.
Richard- feel free to move this thread now if you want.

https://github.com/mwieder/glx2ScriptEditor

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9801
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: GLX2 script editor released for Revolution

Post by FourthWorld » Thu Mar 25, 2021 12:15 am

mwieder wrote:
Thu Mar 25, 2021 12:05 am
Richard- feel free to move this thread now if you want.
Why now?

It's always been a third-party extension. Will future announcements about this third-party extension be in "General" or in "Third-Party Extensions"?

I don't mind moving one thread. I'd rather not do it with every build of every third-party extension.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply

Return to “Announcements”