The IntelliJ plugin for StrataCode supports the most important features which make IntelliJ so powerful for Java programmers. These features are supported on all of the major StrataCode language formats: .sc, .scj, .schtml, and sct. IntelliJ plugins are fairly easy to create for Parselets-based languages because features are moved down to the lowest-level possible - i.e. contained in base classes for specific types of nodes which can be shared or customized as needed for each language element.
- Download the sc4idea.jar file
- Go to IntelliJ's Preferences, Plugin tab and choose "Install from disk"
Create a directory inside of your ~/IdeaProjects for the project. Instead of that directory put a directory for your main scLayers module and inside of that in a directory called "bundles" check out the git repositories for the coreFramework into this directory
Create a new Empty project (here called "scTestProject") that points to ~/IdeaProjects/scTestProject
If you want, you can additionally check out the examples bundle here:
To create simple layers of your own without creating a new bundle, place your layer directories into:
Each directory in the layers directory can contain a layer definition file, or it can be a layer group which is a directory containing other layer groups or layer directories.
Option #1: Installation With StrataCode Source
To build and debug StrataCode itself from source, along with the apps built on it, download the 'sc' source distribution. Inside of it there are three directories - coreRuntime, fullRuntime, and system, each organized in separate IntelliJ modules.
Import three IntelliJ modules into your project: coreRuntime/coreRuntime.iml, fullRuntime/fullRuntime.iml, and system/sc.iml intelliJ modules from the sc source distribution. This will let you debug into the StrataCode source and change StrataCode itself seamlessly when debugging your application code.
In your project, select a Java SDK with version 1.6.
After importing all three modules, click "Ok" on the Project Structure dialog to save those modules before you try to create an SC module. Otherwise, it won't find the 'sc' module and create the dependency on that.
Make the project to compile the StrataCode source (so the StrataCode plugin can find the classes for StrataCode itself).
Now you can create StrataCode module.
One final step - for StrataCode itself, edit the file layers/.stratacode/scSourcePath to point to the 'sc' directory you checked out from git (the one that contains coreRuntime, fullRuntime, and system).
Option #2: Installation Without StrataCode Source
The sc4idea plugin also will usually be bundled with the sc.jar file so you do not need the StrataCode source to use the IDE.
Just create your StrataCode module in the EmptyProject or create a StrataCode project in one step.
In this case, StrataCode will find the sc.jar in the plugin, it will create a library for this jar in the configuration and add a dependency on that library to each StrataCode module.
Manually Adding StrataCode Source Dependency
If you create a module without the StrataCode source and later change your mind, edit the module's dependencies and remove the SCLib library. Create three module's from existing sources - the coreRuntime, fullRuntime and system(sc) modules. Then add a dependency on the sc module in your project.
NOTE: it's important that fullRuntime be ahead of coreRuntime in the dependency list for IntelliJ.
Also add a dependency on the JLine library. If necessary, add the Jline library (version 2.x) from Maven or from the jar file included in the SC distribution.
Creating a StrataCode Module
Checkout the 'layers' git repository and place that directory inside of your module directory. Accept the defaults - including the source path of 'layers'. That name should match the name of the 'layers' directory you put in your module's directory.
Instructions for Debugging the sc4idea plugin:
- Enable the Groovy plugin
- Install the IntelliJ PluginDev plugin
- Get a copy of the community source for IntelliiJ
- Create an sc4idea module (or import the one here)
- Create a new SDK of type "Plugin" (in "Project Structure", select "SDKs" and "+")
Add the source of the intelliJ community editor to the source path of that plugin
Make sc4idea depend on the "sc" module for the StrataCode source, or create a Library in IntelliJ called sclib that points to the sc.jar file
create a run configuration of type "plugin" for sc4idea
To deploy the plugin:
- in Project View, right click on the sc4idea module and select the Prepare plugin module for deployment menu. The results are in the sc4idea/sc4idea.jar or sc4idea.zip depending on whether or not the sc.jar is a dependency.
NOTE: * If you build from source, note that IntelliJ SDK or someone copies the class files from the intelliJ build directory into some sandbox directory in your home directory (on mac it is:
Also note that when you use sclib and enable a Compile dependency, it will put the library into
- There's a problem because coreRuntime and fullRuntime have overlapping files. During the copy this classes folder might end up with the wrong run. Whe installed a simple shell script to workaround this problem - the run configuration for the sc4idea
#!/bin/sh PLUGINDIR=/Users/jvroom/Library/Caches/IntelliJIdea13/plugins-sandbox/plugins/sc4idea/classes BUILDDIR=/jjv/vroomsys/out/production/fullRuntime cp $BUILDDIR/sc/type/PTypeUtil*.class $PLUGINDIR/sc/type/ cp $BUILDDIR/sc/type/Type*.class $PLUGINDIR/sc/type/* There are cases where you need to clean out this directory, like if you rename the module - the one for the old module might still get loaded into the classpath and precede the one you are building. ## Additional settings * In preferences, add "*.dbgidx;*.rdps;*.dep" to the Ignore files and folders in the Editor group's File Types dialog box. * Under Editor, General, Smart Keys, disable "Reformat block on typing '}'"