The SPL editor allows you to create and edit survey source code using IntelliSurvey's SPL (survey programming language). To access the SPL editor, go to Build > Editor in the Survey Navigation menu, and choose SPL as the editor mode.
If you are already familiar with the creation and editing process, see Submitting and publishing SPL content.
Overview
In order to access the SPL editor, you must be a survey Maker. The editor's action toolbar includes the Editor Mode dropdown menu and various editing options.
- Editor Mode: The mode selected when creating the survey is the mode you default to when the applet opens. Also, the last mode you used to edit the survey is the mode you return to the next time you open the Editor applet.
- Restart Session : Restarting a session discards all unsaved changes, returning you to the last saved version of the survey. This action will undo any in-progress changes across all users.
- User icons: User icons will turn green to indicate someone is actively using either the SPL editor or IntelliBuilder (IB). Click the dropdown menu icon to view additional details.
- Split pane : The SPL editor's code window can be split into two panes to compare code segments. You can type into either pane, and the changes will automatically populate into the other.
- Line-wrapping toggle : This toggle activates/deactivates line wrapping for long lines of code. You can also use the keyboard shortcut of Ctrl+Alt+L (PC) or control+option+L (Mac).
- Send to IB: When editing in SPL, users can push their changes to IB to make them available to IB editors by clicking this button (or by saving a new version).
- File Importer : Source files downloaded from other code editors can be imported directly into the SPL editor.
Note: The SPL editor is an externally maintained code editor called CodeMirror. For a list of commonly used shortcuts in the Editor applet, see Keyboard shortcuts. Visit the CodeMirror website to learn about all of the available editing features.
Autocompleting tags and widgets
The SPL editor has an autocomplete feature for inserting code snippets like tags (e.g., type:
checkbox
), widgets (e.g., start group
), and other SPL syntax. To use autocomplete:
- Press Ctrl+Space with the cursor next to the last typed character, or press Ctrl+Space and begin typing.
- Use your arrow keys to move between suggestions.
- Click the item or press Enter to insert the snippet.
When typing, snippets that match the spelling exactly appear first in the list. As you navigate through the results, the code that would be inserted appears in bold font or in a pop-up.
For example, to find the randomize
tag, type "rand" and press Ctrl+Space. Locate the 'randomize' snippet, then select it to add randomize: y
to your survey.
Preloaded examples
The autocomplete feature can also demonstrate correct programming syntax. Several pre-loaded examples are available for use. Placeholders are denoted by '$' symbols and curly brackets '{ }'. Once inserted into the code, the cursor will default to the first placeholder for you to type. Press Tab to move to the next placeholder, and so on.
Tip! Using the autocomplete feature is a great way to learn about IntelliSurvey's SPL. Type "example" to see sets of sample questions that you can insert into your source code to serve as a reference.
Searching source code
The SPL editor includes a "find and replace" tool for keyword searches. Use the keyboard shortcut Ctrl+F (PC) or ⌘+F (Mac) to bring up the find and replace tool bar. Enter the search term in the text field, and matching terms will be highlighted as shown below.
Use the arrows to navigate to each match, or use the replace or replace all functionality to update the matching text. Additional options can be used in your search, such as matching letter casing or applying RegEx.
Code folding
To reduce scrolling, you can compress, or "fold," groups and widgets that you aren't actively working on in your source code. Collapsible regions are denoted by expand/collapse arrows and '…' (ellipses).
Comments
Comments can be used for parts of the survey that are more complicated or that will be worked on later. Comments are ignored by the code parser. To comment out a single line, use '#' at the beginning of the line. To comment out multiple lines of code, place '/*' before the first line of code and '*/' after the last.
Tip! When working with IB editors, use the internal memo
widget instead to leave visible comments in IntelliBuilder.
Version Notice: This article covers features in our r9/IS Pro platform. If you're looking for information on this topic related to r8, see Getting started with the Edit applet and Creating and editing survey content in the Edit applet.
Comments
0 comments
Please sign in to leave a comment.