Skip to content

GLX2 Script Editor Documentation

Mark Wieder edited this page May 27, 2020 · 3 revisions

GLX2 Script Editor for LiveCode

GLX2ScriptEditor Release Notes

  • Licensing changed to MIT model

Installing:

The GLX2 Script Editor should be placed in your user Plugins folder. The next time you launch the LiveCode IDE you will see the GLX2 status bar under the LiveCode menubar.

At the right of the GLX2 status bar is the script editor toggle button. If you are currently using the IDE's script editor the status bar will have a background color that matches your edition of LiveCode (Community, CommunityPlus, Indy, Business) and the toggle button at the right will say "GLX2" and have a contrasting background color. Clicking on the toggle button will switch your editor preference between the IDE's script editor and the GLX2 script editor.

StatusToggle1.png

StatusToggle2.png

The first time you launch the GLX2 script editor you will see the Preferences panel with the default preferences. You can invoke the preferences panel at any time by either selecting glx2ScriptEditor from the Plugins menu of the LiveCode menubar or by right-clicking the script editor toggle button in the status bar.

The text of the status bar will show you the current build unless you're moving the mouse over a LiveCode stack, in which case the text will show you the object you're hovering over.

If you're using OSX then the Mac menubar will change to the GLX2 script editor's menubar when you're editing scripts.

For best results, it's a good idea to delete any "GLX2 Code Prefs.txt" preferences file in your Plugins directory. Some custom properties have been deprecated, and they may resurrect themselves if they're in a previously-existing preferences file and cause undefined behavior. If there is no preferences file in the Plugins folder then a new one will be created.

NOTE: the glx2Plugins.txt file should be placed in the same user plugins folder as glx2 itself. If you have an older "glx2 Plugins.txt" file you can get rid of it. I renamed the new file to eliminate the embedded space, and the older naming convention will just be ignored. Current external plugin integrations are lcTaskList and PowerDebug.

Features

  • Clairvoyance typeahead (default after 4 typed characters)
  • Clairvoyance knows the difference between commands and functions: it won't suggest values that are inappropriate for the syntax: it won't suggest commands where only functions can be used, etc.
  • The Clairvoyance trigger can be changed from 4 characters in the Preferences panel.

Clairvoyance1.png Clairvoyance2.png

* Handler folders

HandlerGroups.png

When editing scripts you can enter a line starting with "-->" to create a handler group. This will create a folder in the handlers pane to help you organize your handlers. If there are no handler groups then a virtual group folder named "All handlers" will appear. Double click a handler group folder to see the handlers in the group.

* Hyperlinking handlers

HandlerLinks.png

handler links are in italics if in some other script, plain text if in the same script

Click a handler link to go to the handler declaration and create a breadcrumb to allow you to return to the original location.

* Breadcrumbs

Breadcrumbs.png

click a breadcrumb to return to the original script point it represents

shift-click to remove the breadcrumb from the list

* Unlimited undos!

This is a big deal. I got rid of the old undo mechanism that wasn't really working very well and put a FILO stack array in its place. Fast, efficient, and you can undo all the way back to when you first opened the script editing session.

  • Split screen viewing has been restored. Shift-click on a tab to open a second screen for viewing. Shift-click it again to close the split pane. Still can only edit the lower pane, but it's a start.

IDE Script Editor compatibility

  • control-tab and shift-control tab move among the open script editor tabs.

  • Return key on OSX now compiles script, Enter enters a newline. Return on a compiled script closes that tab.

  • Support for code script drag-and-drop and option-drag cloning

  • Bracketing in place if text is selected, insertion of the single character otherwise

    supported characters are single quote, double quote, (, [, {

  • Hover tooltip features: constants show their values hoverConstant.png

  • Control+mouseOver the Find button turns it into "Find All", which will bring up a list of the locations of the found phrase anywhere in the stack file scripts (stack, substacks, cards, controls). Clicking on any line in the datagrid will bring that script up in the script editor with the specified line highlighted.

Keyboard equivalents

  • To see a word in the docs, highlight and press the F1 key.
  • F7 toggles between browse and edit tools
  • The F3 key acts like command-G as a "Find Again" command
  • Alt-F7 key is also Find Again.
  • Control-shift-O (that's the letter O, not a zero) Outlines the selected control structure
  • Option-return inserts a single divider
  • Option-shift-return inserts a double divider

Preferences

Preferences.png

  • Ruled lines in scripts

RuledLines.png

  • Code folding preference for control structures

CodeFolding.png

  • Colorization
  • Italicize comments

ItalicizedComment.png

ItalicizedBlockComment.png

  • Bold Folder Names

  • Capitalize Control Structures

  • Sort Handler List

  • Chalkboard or Alabaster theme

  • Font choices: typeface, size

  • Indentation depth

  • Complete structures on return preference

  • Autosave and Autoarchive options

  • Test-Driven Development encouragement

  • Explicit Variables option

  • Restore Last Session on Startup

  • Handler links/Bold Handler links

  • Code stubbing added to new commands and functions with optional support to aid in Test-Driven Development.

    Click in line number field to toggle ghost breakpoints on and off.

    Line numbering and ghost breakpoints adjust properly to cut/paste/edit/code addition and deletion.

Refactoring from the Script menu

Script formatting from the Script menu

bracket selected code with:

  • if/end if

  • if/else/end if

  • repeat

  • repeat for

  • repeat with

  • repeat until

  • switch/end switch

  • try/catch/end try

  • single quotes

  • double quotes

  • lock screen/unlock screen

  • Unit test generation. Click a command declaration, then select from the contextual menu. The tests will be created in a file named "tests.text" in the same directory as the stack file.

  • Documentation generation. Inline javadoc-style - select from the contextual menu.

Compatibility

  • GLX2 is now using features from recent LiveCode builds, so it is compatible with LiveCode 9. Possibly 8.

  • Compatibility with Bill Vlahos' lcTaskList plugin. If you have this installed, right-click on a line in the script editor to insert a task comment.

  • Better PowerDebug integration on script errors: error text appears in GLX2 statusbar and as tooltip on line with error

  • You can highlight the outline of control structures by selecting (for instance) an if statement and pressing control-shift-O (for outline... that's an Oh, not a zero) to show where its corresponding end if statement is. Or select the end statement to see the beginning of the control structure. This works with if, repeat, switch, and try structures. You can scroll the screen to view long control structures, and finally press control-shift-O again to when you're done. highlighting.png

  • You can do the same with a right or left parenthesis (select or click just inside the parenthesis and press control-shift-O) to highlight text to its matching parenthesis. This also works for array keys and JSON objects: invoking the outline inside of any "(){}[]" string will highlight its matching delimiter.

Plugin support

  • Plugin support through contextual menus.
  • Current built-in plugin integrations are lcTaskList and PowerDebug.
  • More plugin support can be added by editing the glx2Plugins.txt file in the Plugins folder.

Colorization

  • Live colorization of lines as you type.
  • Constants are now formatted in green in the code to differentiate them from variables.
  • Quoted strings that aren't properly closed will now highlight the entire line in red. unquote.png
  • Breakpoints show up in red to catch your attention. redbreakpoint.png