Page 4 of 5
Re: GLX2 script editor released for Revolution
Posted: Thu Dec 10, 2020 6:24 pm
by FourthWorld
This may be one of those use cases where using the styledText array may shine brightly.
Re: GLX2 script editor released for Revolution
Posted: Thu Dec 10, 2020 6:48 pm
by mwieder
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.
Re: GLX2 script editor released for Revolution
Posted: Fri Dec 18, 2020 6:01 pm
by DarkKnight
I've installed GLX2, but I can't seem to get any preferences to save or any scripts to save between sessions.
Re: GLX2 script editor released for Revolution
Posted: Mon Dec 21, 2020 8:35 pm
by mwieder
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.
Re: GLX2 script editor released for Revolution
Posted: Tue Dec 22, 2020 9:33 am
by FourthWorld
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.
Re: GLX2 script editor released for Revolution
Posted: Tue Dec 22, 2020 5:35 pm
by mwieder
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
Re: GLX2 script editor released for Revolution
Posted: Thu Dec 24, 2020 3:16 am
by Bernard
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.
Re: GLX2 script editor released for Revolution
Posted: Thu Dec 24, 2020 3:44 am
by mwieder
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.
Re: GLX2 script editor released for Revolution
Posted: Thu Dec 24, 2020 12:38 pm
by Bernard
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.
Re: GLX2 script editor released for Revolution
Posted: Thu Dec 24, 2020 1:53 pm
by Bernard
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.
Re: GLX2 script editor released for Revolution
Posted: Thu Dec 24, 2020 6:11 pm
by mwieder
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.
Re: GLX2 script editor released for Revolution
Posted: Wed Feb 24, 2021 10:39 pm
by FourthWorld
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?
Re: GLX2 script editor released for Revolution
Posted: Thu Feb 25, 2021 12:01 am
by mwieder
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.
Re: GLX2 script editor released for Revolution
Posted: Thu Mar 25, 2021 12:05 am
by mwieder
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
Re: GLX2 script editor released for Revolution
Posted: Thu Mar 25, 2021 12:15 am
by FourthWorld
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.