ISML

ISML templates in JetBrains IDEs - the 28 ISML tags and their values, template path completion and navigation, JavaScript in isscript and expressions

ISML templates open as HTML with SFCC on top. The IDE's HTML support keeps working, and Intellij SFCC adds the ISML tags, completes and links template paths, and treats <isscript> and ${...} as real JavaScript with the Script API behind it

ISML template attributes complete from the cartridge path, next to the 28 ISML tags and their attributes

Tags and attributes

The plugin knows all 28 ISML tags, from <isif> and <isloop> to <isslot> and <iscache>. Type <is to list them, and inside a tag the attribute completion offers that tag's attributes. HTML warnings about unknown tags are turned off for is* tags, so a template isn't covered in yellow

Attributes with a fixed set of values list exactly those values:

TagAttributeValues
<isset>scopesession, request, page
<isremove>scopesession, pdict, request, page
<iscache>status, type, varybyon or off, relative or daily, price_promotion
<iscontent>type, encoding, compacttext/html, application/xml, application/json, and the encodings
<isprint>encoding, timezonehtmlcontent, jsblock, uricomponent and the other encodings, SITE, INSTANCE, utc
<isredirect>permanenttrue, false
<isslot>contextglobal, category

Because templates are HTML to the IDE, its HTML features such as tag matching, Emmet and Reformat Code work as in any HTML file

Template paths

Every template attribute completes template paths from your linked cartridges, relative to templates/<locale> and without the .isml extension. Each item shows the cartridge it comes from

cartridge/templates/default/cart/cart.isml
<isdecorate template="common/layout/page">
    <isinclude template="cart/cartTotals" />
    <ismodule template="components/modules/badge" name="badge" />
</isdecorate>

On <isinclude>, <isdecorate> and <ismodule>, Cmd+Click (Ctrl+Click) opens the template, and the gutter icon Navigate to template does the same. When the template exists in several cartridges, Choose Declaration lists each copy. A path built with an expression, such as template="${pdict.template}", isn't resolved

The same template paths complete in scripts, for example in res.render('cart/cart'), see SFCC Contracts

JavaScript in templates

WhereTreated as
The body of <isscript>JavaScript
${...} in text and attribute valuesA JavaScript expression
The name of <isset> and the var of <isloop>JavaScript

Inside them you get the same completion as in a script: the Script API, the globals such as session and request, and URLUtils and Resource, which templates can use without a require. SFCC strings complete too, so ${URLUtils.url('Cart-Show')} completes the route and ${Resource.msg('button.checkout', 'cart', null)} the key

<isscript>
    var ProductMgr = require('dw/catalog/ProductMgr');
    var product = ProductMgr.getProduct(pdict.pid);
</isscript>

<a href="${URLUtils.url('Product-Show', 'pid', product.ID)}">${Resource.msg('link.view.product', 'product', null)}</a>

Type ${ and the closing } is added for you

Create a template

Right-click a folder and choose New › ISML File . Enter a name and the plugin creates <name>.isml with a TEMPLATENAME comment as the first line

What isn't covered

  • pdict has no type. Its properties don't complete, because the IDE can't know what each controller puts into it
  • There are no ISML-specific inspections, live templates or formatter beyond the IDE's HTML ones
  • Find Usages on a template doesn't list the scripts and templates that include it. Use Find in Files with the template path instead

Troubleshooting

SymptomWhat to do
ISML tags are marked as unknownThe tag support needs an active license or trial, see Purchase & License
A template path doesn't completeThe template is in a cartridge that isn't linked, or not under templates/<locale>
Cmd+Click on a path does nothingThe path contains ${...}, or the tag is not <isinclude>, <isdecorate> or <ismodule>

On this page