Skip to Content

Editing

Edit ISML templates faster - typing aids, Smart Enter, Surround With, folding, structure view, intentions, refactorings, new template kinds and drag and drop

The editor closes, pairs, folds and moves ISML tags as whole blocks. Drag and drop, the refactorings and the Declare pdict type and Inline included template intentions need a license, the rest of this page works without one, see Free and licensed

${ closes itself, a typed } or quote types over the closing one, > on <isif> adds </isif>, and Enter between the tags opens an indented line

Typing

You typeYou get
${${}, with the caret inside. A typed } types over the closing brace
> on <isif>, <isloop> and other tags with a bodyThe end tag after the caret
> on <iselse> or <iselseif>The tag lines up with its <isif>
</The end tag of the innermost open ISML tag
Backspace in an empty ${}Both braces go
(, [ or { in ${...} or <isscript>The closing bracket, right before the } or </isscript>, so ${require( becomes ${require()}. Follows Insert paired brackets in Settings › Editor › General › Smart Keys
Enter between a start tag and its end tagAn indented line between them

Editing a start tag name renames its end tag, per Simultaneous <tag></tag> editing in Settings › Editor › General › Smart Keys › HTML/CSS

Smart Enter (Cmd+Shift+Enter, Ctrl+Shift+Enter) completes the current tag: closes ${ and quotes, adds the required attributes, closes the tag and adds the end tag

Selecting and moving

  • Extend Selection (Alt+Up, Ctrl+W) grows in ISML steps: expression text, ${...}, attribute value, attribute, start tag, whole tag, <isif> branch, whole <isif> chain
  • The caret on a tag name highlights its pair, on <isif>, <iselseif> or <iselse> the whole chain. Move Caret to Code Block Start and End jump along it
  • Move Statement Up and Down (Cmd+Shift+Up, Ctrl+Shift+Up) move a multi-line ISML element as one block

Surround With

Select text and press Cmd+Alt+T (Ctrl+Alt+T):

SurrounderResult
<isif><isif condition="${}">, caret in the condition
<isif> / <iselse>The same with an <iselse> branch
<isloop><isloop items="${}" var="item">, caret in items
<isdecorate><isdecorate template="">, caret in template
<isobject><isobject object="${}" view="none">, caret in object
<iscomment>, <isscript>The tag, caret after it
${...}, <isprint>The text as an expression or as <isprint value>, in place

Whole-line selections get the tags on their own lines and an indented body, other selections are wrapped in place

Comments

Comment Line (Cmd+/, Ctrl+/) and Comment Block (Cmd+Alt+/, Ctrl+Shift+/) write <iscomment>, because ISML tags and ${} inside an HTML comment still run on the server. Inside <isscript> they write JavaScript comments. <iscomment> doesn't nest, so a range that holds a comment is wrapped around it

With Comment template data with HTML comments in Settings › Languages & Frameworks › ISML, plain markup lines get <!-- -->. Lines with ISML tags or ${...} always get <iscomment>

Folding

RegionFolded
<isloop><isloop product in pdict.products>...</isloop>
<isdecorate>, <isobject> and other tags with a bodyThe tag name and its template or object, then ...
<isif>The body of <isif> and of each branch, each with its own marker
<isscript>, <iscomment>The first line, then ...
${...}${...}
A static Resource.msg(...) or Resource.msgf(...) call in ${...} or <isscript>The message, such as "Loyalty rewards"

<iscomment>region Name</iscomment> and <iscomment>endregion</iscomment> mark a custom region. In Settings › Editor › General › Code Folding › ISML, <isscript> blocks (off) folds scripts when a file opens and File header comment (on) folds the first comment

Resource.msg calls fold when a file opens, once indexing ends, and need a license. Click the text to open the call and the gutter marker to fold it back, or turn them off with Resource.msg() messages under B2C Commerce Scripts on the same page, see Messages as text

Structure and breadcrumbs

The Structure tool window and File Structure (Cmd+F12, Ctrl+F12) list the ISML tags with a summary:

TagReads as
<isloop items="${pdict.items}" var="item">isloop item in pdict.items
<isset name="total" ... scope="page">isset total (page)
<isinclude url="${URLUtils.url('Product-Tile', ...)}">isinclude url Product-Tile
<iscache type="relative" hour="24">iscache 24h
<ismodule ... name="productprice">ismodule isproductprice

<isscript> lists the functions and variables it declares. Show Expressions adds each tag's ${...} expressions. The breadcrumbs merge HTML and ISML, for example div.product-tile › isloop item › isif item.available › a.name

Intentions

Alt+Enter intentions, in the SFCC/ISML group of Settings › Editor › Intentions:

IntentionWhat it does
Convert ${...} to <isprint> and backSwitches between an expression and <isprint value>
Invert <isif>Negates the condition and swaps the branches
Merge nested <isif> and Split <isif> into nested <isif>Joins two conditions with &&, or splits them
Extract to resource bundleMoves literal text to a key of the bundle you pick, reusing a key that already holds it, and prints ${Resource.msg('key', 'bundle', null)}
Declare pdict typeWrites an @pdict line for a member, see Scripting in ISML. Needs a license
Introduce template variableMoves the expression to an <isset scope="page"> on the line above, prints the variable in its place and starts renaming it. Asks whether to replace the same expression further down
Inline included templateReplaces an <isinclude> with the template's text, also as Refactor › Inline. Needs a license
Extract to <module>.<function>()In <isscript>, moves the block or the selected statements to a function of a server module under cartridge/scripts/templates/ and calls it in their place, see Digital Script intentions

Refactorings

These need a license:

RefactoringWhat it does
Refactor › Extract › Include File...Moves the selection to a new template under templates/<locale> and includes it. When the selection reads <isscript> names or imports, which an included template doesn't see, a hint lists them
Refactor › Extract › Custom Tag...Moves the selection to a module template and calls it as a tag, see Custom Tags
Rename on a templateUpdates every path and the copies in other cartridges, see Template Navigation

New templates

File › New › ISML File opens the New ISML File dialog with Template, Page with decorator, Decorator, Modules file, Custom tag template, Email template, JSON template and Page Designer component. A name typed on a cartridge folder goes under templates/default/. Each kind's text is in Settings › Editor › File and Code Templates, with an ISML File Header include

Drag and drop

Drop a template from the Project view into a template to insert an <isinclude>. Drop a script or style sheet to add assets.addJs() or assets.addCss() in an <isscript>, as SFRA does, or <script> and <link> tags with Tags in Settings › Languages & Frameworks › ISML › Dropped scripts and styles

Spellchecking covers <iscomment> text and description attributes such as <isslot description>

On this page