CodeLens Actions

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.

Routes and SFRA extensions

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.

Hook implementations

A script registered in hooks.json gets a lens identifying the system or custom hook it implements. Click it to return to the registration. For custom hooks, the action can include the exported function name.

This is especially useful when several hook registrations share a script. If a hook lens indicates Unsaved changes, save the file so its indexed positions can catch up. See Typed hooks for the matching completion and type behavior.

Job step functions

Step-type lenses link an implementation back to steptypes.json. They cover both a task-oriented script function and the configured functions of a chunk-oriented step, such as read, process, and write.

The lens identifies the step type and the function's configured role. This lets you trace a helper-looking export back to the job-step contract that calls it.

Custom API operations

Custom APIs span three files: api.json, an OpenAPI schema, and a script. The extension adds links between the indexed operation's registration, schema, and implementation where those targets are available.

Use the lenses to answer which operation calls an export, where its HTTP contract is declared, and which script implements a configured endpoint. Completion and definition navigation for the same files are described in SFCC contracts.

Resource keys

An indexed .properties entry gets two lenses:

ActionResult
UsagesInspect indexed uses of that key, such as Resource.msg calls.
LocalizationsInspect the matching localized entries across available resource files.

A zero count describes the current local index; it does not prove a key is unused by dynamically constructed lookups or external code. Resources Manager provides the editor for working across translations.

Metadata attributes

An XML metadata attribute definition shows Indexing usages… while its usage data is being prepared, then an N usages lens. Open the result to inspect references to that attribute.

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.

Cartridge paths

Supported site cartridge-path and Business Manager cartridge-path XML entries get a lens that opens the Cartridge Path Editor. The label includes the relevant site or context and cartridge count.

Use it to inspect or change the order that controls module resolution. The action is available on recognized cartridge-path metadata, not arbitrary colon-separated XML text.

Log occurrences

When log analysis maps an error to a local source line, a lens shows SFCC Logs: N occurrences. It can also show how many log files contributed those occurrences.

Click it to open the grouped issue or error details. If a grouped issue is available, Export SFCC log issue appears alongside it. These lenses depend on logs loaded or streamed into the extension and on source mapping; they are not produced by static type checking.

Missing a lens?

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.

On this page