Digital Script

Digital Script in JetBrains IDEs - .ds and server .js files with Rhino syntax, import calls, pipelets, the compatibility mode and B2C checks

Digital Script is the server script language of Salesforce B2C Commerce: JavaScript that Rhino runs, with importPackage, importClass and importScript, for each loops, E4X and type annotations. Intellij SFCC makes it a native IDE language, so .ds files and the server .js files of your cartridges get the syntax, scope and checks the server applies

The mode decides which newer syntax is an error in .ds files, server .js files and templates. Not set uses the mode of the code version last activated from the B2C explorer, and the comment names it

Explore Digital Script

Which files are Digital Script

FilesParsed as
.dsDigital Script, always. The file type is Digital Script
.js inside a cartridge folderDigital Script while Parse cartridge .js as Digital Script is on, the default. The file type stays JavaScript, so ESLint, Prettier and the debugger still treat it as JavaScript
.js under cartridge/client, cartridge/static, cartridge/js, cartridge/front-end or cartridge/front, in node_modules, and every .mjs or .cjs fileJavaScript
${...} and <isscript> in templatesThe template dialect of Digital Script: E4X members parse, XML literals don't, see Scripting in ISML

The client folders count only right under cartridge, so cartridge/scripts/js is still server code

The first start after the update moves *.ds from the JavaScript file type to Digital Script, once. If you map .ds back to JavaScript later, the IDE keeps your choice

require paths, module.superModule and custom attributes work in .ds files as in server .js files, see JavaScript

Settings

Options are in Settings › Languages & Frameworks › Digital Script. Project options are saved in .idea/intellij-sfcc-script.xml, so the team can share them

GroupOptionWhat it does
RuntimeScript compatibility modeThe mode of the site's code version, from Business Manager › Administration › Site Development › Code Deployment. Syntax that mode can't run is an error in .ds files, server .js files, ${...} and <isscript>. Not set uses the mode of the code version last activated from the B2C explorer, see Where the mode comes from
Server JavaScriptParse cartridge .js as Digital ScriptOn. Server scripts accept the Rhino forms B2C Commerce runs, such as for each (var item in items). Turning it off reparses them as JavaScript. .ds files are always Digital Script
ImportsOptimize imports on the flyOff, for you only. Removes unused and repeated import calls as you edit, see Optimize Imports

Script compatibility mode moved here from the ISML page. One mode covers templates, .ds and server .js files. A mode picked on the ISML page before 2026.3 counts until you pick one here, and the ISML page now shows the mode with a Change on the Digital Script page link

The other Digital Script options sit with their features:

WhereWhat
Editor › Inspections › SFCC › Digital ScriptThe checks, see Digital Script Inspections
Editor › Color Scheme › Digital ScriptRhino keywords, type annotations, imports, E4X and pipelet headers, see Colors
Editor › Intentions › SFCC/Digital ScriptFive intentions, see Intentions
Editor › Live Templates › Digital ScriptSeven live templates, see Live templates
Editor › File and Code TemplatesThe Digital Script group of the New dialog's templates
Editor › Inlay Hints › Code vision › Digital ScriptThe lens above functions that other scripts use through importScript
Editor › General › Code Folding › B2C Commerce ScriptsResource.msg() messages, which shows Resource.msg calls as their text, see Folding

Free and licensed

A license change applies at once, without a restart:

FreeNeeds a license or trial
The Digital Script file type and parsing, Rhino forms includedImport calls: binding, completion, links, gutter icons and Code Vision
Highlighting, with the type annotation, import call and pipelet header colorsThe imported name and pdict key colors
The compatibility mode check, its fixes and the Rhino syntax checksEvery other Digital Script inspection, Optimize Imports and on the fly
Live templates, the New Digital Script File dialog, File Structure and foldingQuick documentation, E4X and pdict completion, and the intentions
Type annotations, and for each over Script API collectionsE4X types, loops over maps, arrays and XML, the function scope of a block const, and pipelet, hook and job step parameter types
Dictionary rows of Script nodes in the Pipeline EditorScriptFile links in pipeline XML

See Purchase & License for the trial

Works while the IDE indexes

Parsing, highlighting, folding, the compatibility mode check and the Rhino syntax checks work while the IDE indexes. importScript targets, imported names and the checks that read other files answer once indexing ends. Until then, Name that nothing declares leaves unresolved names to the IDE's own warning

From the plugin's performance tests:

TaskTime
Parsing a 5,000-line script23 ms, against 33 ms as plain ES6
Typing 1,000 for each variables in one highlighting pass242 ms
First completion after ProductMgr.91 ms
Go to Declaration on an imported function2.4 ms
Find Usages of a function 100 scripts import11.7 ms
Highlighting a 1,600-line script that imports 4 packages, a class and 10 scripts802 ms

The plugin parses all 199 SiteGenesis scripts and 207 SFRA server scripts without a parse error

What isn't covered

  • Expression closures, legacy generators, let blocks and array comprehensions don't parse yet
  • After importScript, static properties of an imported function, such as ResourceHelper.getConstants(), don't resolve
  • Job step parameters stays Object: the parameter definitions in steptypes.json aren't read, and the dw.system.Status return isn't checked
  • The Pipeline Editor reads dictionary rows only from .ds scripts, and doesn't show the header descriptions
  • Call Hierarchy doesn't list top-level calls in template code, and Analyze Data Flow isn't available

Troubleshooting

SymptomWhat to do
A .ds file opens as JavaScript or textMake sure *.ds belongs to Digital Script in Settings › Editor › File Types
for each or an XML literal is an error in a server .js fileTurn on Parse cartridge .js as Digital Script, and check that the file isn't in a client folder
Template literals or arrow functions are errorsSet Script compatibility mode to your code version's mode, see Compatibility mode
Imported names don't resolve or completeImport calls need a license or trial, and indexing must finish
Cannot find script on an importScript path that existsAdd the cartridge: prefix. Without one, only the calling script's cartridge is searched, see Script paths
An import call stays after Optimize ImportsIt's used, its script doesn't resolve, or it's used as a value, see What stays
Optimize imports on the fly removes nothingIt waits while the caret is on the import calls or the file has errors, and needs the Unused or repeated import call inspection on
A Script node has no dictionary rowsRows come from the header of a .ds script. A .js pipelet gets none, see Script nodes

On this page