Eight source-connected CodeLens integrations for routes, hooks, jobs, custom APIs, resources, metadata, cartridge paths, and logs
CodeLens places small, clickable actions above the code they describe. The VS Code extension supplies these actions using language-server indexes, project metadata, and log analysis. They connect a file to its registrations, callers, overrides, or runtime issues
Enable Editor: Code Lens in VS Code settings. Open the relevant source file and let its project data finish indexing
4server.append('Show', function (req, res, next) {
5res.setViewData({showBadge:true});
6next();
7});
8
9module.exports=server.exports();
Endpoint URL copied to clipboard: https://zzrx-001.dx.commercecloud.salesforce.com/on/demandware.store/Sites-RefArch-Site/default/Product-Show
Source: Salesforce B2C Commerce (Intellij SFCC)
main00Ln 4, Col 15UTF-8SFCC JavaScript
The lens row above an SFRA route copies or opens its storefront URL, lists the calls that reach it and jumps to the cartridges that append to it
On indexed SFRA, SiteGenesis, and pipeline endpoints, the extension offers:
Open Endpoint to open the route using the active connection and site context
Copy Endpoint URL to copy the resolved endpoint address
A usages count to inspect indexed callers
On SFRA routes, append, prepend, and replace counts when those actions have indexed targets
For example, start at a base server.get('Show', …) in Product.js, then use the append lens to find a cartridge extending Product-Show. The usages lens connects the route to calls such as URLUtils.url('Product-Show', …)
Opening a URL is a browser request, not a debugger session or a request editor. Routes requiring POST data or authentication still need the appropriate caller. Debugging is a separate workflow
A system hook's function shows the hook it implements, and every function of a custom hook shows hook → function. Click a lens to open its registration in hooks.json
Script
Lens
Example
Implements a system hook
The hook name
dw.order.calculate above exports.calculate
Implements a custom hook
Hook and exported function
app.loyalty.points → redeem above exports.redeem
Every exported function of a custom hook script gets its own lens, which helps when one script serves several hook functions. See Typed hooks for the matching completion and type behavior
Step-type lenses link an implementation back to steptypes.json. The lens reads step type → property, and clicking it opens that property in steptypes.json
Chunk steps also label the optional totalCountFunction, beforeStepFunction, beforeChunkFunction, afterChunkFunction, and afterStepFunction. This lets you trace a helper-looking export back to the job-step contract that calls it
api.json shows the method and the path of each endpoint, while the script and the schema link to the other two files. Each lens opens its target at the matching operation
File
Lens
Opens
api.json
The HTTP method, for example GET, above endpoint
The exported function in the script
api.json
The schema path, for example /points, above schema
The operation in the schema
Script
schema.yaml and api.json above the exported function
The operation in the schema, the endpoint in api.json
Schema
The script name and api.json above the operation
The exported function, the endpoint in api.json
Completion and definition navigation for the same files are described in SFCC contracts
checkout.propertiesOverridden by app_customDefault
Place Order
mainLn 3, Col 1UTF-8Properties
Every key in a .properties text editor shows how often scripts and templates use it and how many files of the bundle define it. Usages opens a peek, Localizations opens the Resource Bundle Editor on that key
Every key of a .properties file under cartridge/templates/resources gets two lenses in the text editor:
Lens
Click
N usages
Peeks the indexed Resource.msg and Resource.msgf calls of that key in scripts and templates
N localizations
Opens the Resource Bundle Editor with the key selected, so you can compare and edit every locale
The localizations count is the number of files of the bundle, across locales and cartridges, that define the key. Lenses show in the active editor only, and refresh as you type
A zero count describes the current local index. It does not prove a key is unused, because keys built at runtime are not counted
An attribute definition in metadata XML shows Indexing usages… while its usage data is being prepared, then an N usages lens. Click it to peek every reference to that attribute
Attribute definitions in metadata XML show how often code reads them. Click the count to peek every reference
Open Generated Metadata Types is a separate command and editor action, not a second CodeLens. It helps inspect the declarations generated from the active metadata document. See Metadata & generated types
Business Manager Cartridge Path 2site_template/preferences.xml
SavedOpen XML
In cartridge path 2Drag to reorder · top loads first
Filter cartridges in path…Add cartridge by name…Add
1bm_customstorefront • cartridges/bm_custom
2bm_app_storefront_baseNot linked to this project
Linked cartridges not in path 0 Add All
Filter linked cartridges…
All linked cartridges are already included.
main
The lens above a site's custom-cartridges or the Business Manager CustomCartridges preference opens the Cartridge Path Editor. Changes go into the XML document, ready for you to save
The number is the cartridge count. Use the editor to add, remove, and reorder cartridges, then save the XML. The action is available on recognized cartridge-path metadata, not arbitrary colon-separated XML text
📈 Unique events1📊 Total occurrences3🗂️ Log files2🌐 B2C instancezzrx-001.dx.commercecloud.salesforce.com🎯 ScopeSelected record group
Event #1 · 🔴 ERROR
⭕ MessageTypeError: Cannot read property "paymentProcessor" from null
mainLn 148, Col 1UTF-8SFCC JavaScript
Lines that analyzed logs point at show how often they failed. Open the event group in Log Center, or export it as a Markdown report
When log analysis maps an error to a local source line, that line gets two lenses:
SFCC Logs: N occurrences opens the event group in Log Center. When the occurrences come from more than one log file, the lens adds the file count, as in SFCC Logs: 3 occurrences in 2 files
Export SFCC log issue writes a Markdown report of that issue and opens its preview
These lenses depend on logs loaded or streamed into the extension and on source mapping. They are not produced by static type checking
Check that editor.codeLens is enabled, the file is saved where needed, and the source is linked to an indexed registration or metadata definition. Route URL actions additionally need an active target, and log lenses need analyzed log data. Follow Configuration & troubleshooting for the shared project checks