I’ve received a bunch of questions about PrimalScript since the public beta was release and most of them deal with just getting started. I thought I would prepare a short intro to PrimalScript that some people might find helpful.
PrimalScript is a fast and fully featured IDE. It supports many many languages, as such you may find some things in there that you may have no use for (A good example is the windows scripting features). After installation there is very little you will have to do to get PrimalScript working–it automatically adds the Flash MX 2004 help files and will detect the AS Class path.
What is PrimalSense?
PrimalSense is PrimalScript’s language parsing engine that will give powerful code hinting features and is the single best feature in PrimalScript. PrimalSense provides for a huge improvement in accuracy and speed of programming and is one feature that Flash Developers have not had access to before.
To test out this feature, select File > New > File… > Script File > ActionScript Class, and type “import mx.” You should see a list of available package names appear. This is only part of what PrimalSense provides. Once you have played with it a bit you will see many more useful places where PrimalSense is used.
Although you don’t really need to know how this works, some background information on what is parsed is good to know. Flash MX 2004 ships with class definitions placed in the classes folder for all built in classes (MovieClip, XML, etc), and also includes many classes not built into the player (UIObject, Tween, etc). PrimalSense parses these classes to provide accurate code hinting for all the classes in that folder. Not only does it do that, but it will also parse all ActionScript files in the current project and the current file you are working on. So at any given moment, PrimalScript ensures that any class in any of those locations will be available via PrimalSense. This will require you to always keep in mind a couple of things.
- Our file needs to have an extension of .as or .asi.
- If we want code hinting for custom classes, we will need to have a project and include all our classes in the project. Developers who have worked in other languages/environments will be used to this but many ActionScript developrs have never had to do this, so it might need some minor adjustments in your workflow if you never used a project definition to manage your files.
Simply, PrimalSense is a dynamic code hinting system that is not static and is smart enough to parse AS2 classes and provide good and useful code hinting.
PrimalScript integrates well with Flash’s help file system. As a quick test, open a new ActionScript file and type in “MovieClip” then hit F1. If this is the first time you use the context sensitive help integration, PrimalScript will create an index of Flash’s help system for fast retrieval.
Features of the help integration;
- When hitting F1, the help file index is used to look-up a match. If it only finds one match then that page will be automatically opened in a new tab inside PrimalScript.
- If several matches are found you will be presented with a list of matches to choose from.
- The help system also allows you to do a full-text search on the help files.
- Keep in mind that the index file is created the first time you launch the help system. If you update your Flash help files, you will need to click on the “reset index” button to instruct PrimalScript to rebuild the index file.
- The help system is smart. If you have a variable of type MovieClip (var myMc:MovieClip) and somewhere later on in the class you hit F1 on myMc, the help system will know that the variable is of type MovieClip and present you with help for that.
- You can specify the location of the help documentation in the preferences.
Hidden gems – Shortcuts & Nice features
I’m a sucker for shortcuts and hidden features and PrimalScript doesn’t skimp on those at all. Here are a list of shortcuts and some hidden features that I have found useful
- CTRL+Q/CTRL+SHIFT+Q (Comment/Un-comment a line)
- Code snippets: There are many code snippets that ship with PrimalScript and you can create your own. To test it out, type “class” and hit ctrl+j. You can check out and edit the snippets in the Snippets Nexus panel. Snippets are on a per language basis so make sure when you create your own snippets that they are saved in the appropriate folder. Shippets can also be used by dragging a snippet from the Snippets Nexus to the current file.
- SHIFT+Delete to delete a single line at a time.
- Double click the middle mouse button or scroll wheel button to hide the nexus window. ColdFusion Studio or HomeSite users may want to associate F9 with this command which can be done through Tools > Customize…
- Drag a folder from the windows explorer to the Workspace Nexus (project) to add the folder and all it’s sub-folders/contents quickly.
- Right click a document tab and select “Open containing folder” to open the folder where the file is contained.
- CTRL-I then begin typing part of a search string. PrimalScript will start looking for a match in the current file and hitting F3 will allow you to find the same string again and again.
- Double-click on the little trash can at the bottom right. PrimalScript keeps a history of code in case you have erased something by mistake.
- You can add the help files for JSFL and FlashComm Server Side ActionScript and receive PrimalSense for them too.
- CTRL-L will allow you to jump to a specific line number.
- CTRL-E to go back to the last edited line
- You can convert the NetConnection debugger into a projector and add it to the tools nexus for fast/quick access.
- You can add the Flash Comm admin utility pages to your info nexus for quick access.
- You can add many document formats and any tools to the info and tools nexus. Great for quick access to things like ASV and Document Generators
- Make sure to check out the Macro tools. You don’t need them often but when you do they can save you a lot of time. You can also save macro’s and map keyboard shortcuts to them.
- You can set up a command line compiler via jsfl for the project. Right click the project and add your command line tool application information there. You can even launch a jsfl file directly. Once that is configured you should be able to hit F9 to compile. (we’re working on some extensions to allow compile and run within PrimalScript and even view trace output inside PrimalScript. Keep an eye out, but don’t hold your breadth.)
- If you right-click a saved document, you should see an option to add the file to the current project.
- You can enabled PrimalScript to open the last open document/project automatically when it starts up in Tools > options > Text Editor > General > Restore Last opened file at startup.
- If you have Tortoise CVS installed, you will be able to gain access to it from the File Nexus browser by right-clicking on any folder. When working in a project, you can right-click on any file in a project and “Open Containing Folder in File Nexus” for quick syncing of the Workspace Nexus and File Nexus.
- PrimalScript also has traditional SourceControl integration through SCC plug-ins.
- Make sure to play with the color and font settings in the options to suite your preference (Black background anyone
For more information on PrimalScript be sure to check out Sapien’s website. You may also find the beta forum (news.sapien.com) of interest to see all the little things that were requested and added to this new version, and how amazingly responsive the Sapien engineers have been.