Enabling Code Completion for Controllers

To allow for syntax checking and code completion for controllers, you must convert your projects into Tern projects.

Tern is a third-party plugin that supplies code completion and linting.

Convert the Cartridge to a Tern Project

  1. Right-click the cartridge in the Eclipse in the Cartridge sidebar.
    Note: If you don't see the Cartridge sidebar, change your perspective to the Salesforce B2C Commerce Development perspective.
  2. In the popup menu, select Configure > Convert to Tern Project.
    Important: Each cartridge in your workspace must be a separate project in order for it to be converted into a Tern project.
  3. In the dialog, select the Commerce Cloud module.

If the dialog doesn't appear in the last step, you must make sure that the B2C Commerce API is associated with the cartridge so that content assist works in the Eclipse JavaScript editor (JSDT).

To associate the B2C Commerce API with the cartridge:

  1. Right-click the cartridge in the Eclipse in the Navigation sidebar.
  2. In the popup menu, select Properties.
  3. Expand Tern node and select Modules.
  4. Select the Commerce Cloud checkbox in the Modules list.
  5. Click OK.

Enable Linting Support for Tern

Note: eslint is the standard linter used by B2C Commerce for the project, but Tern does not support all of the rules used by the project when the linter is run from the command line, because the version of eslint included with Tern is different from that used from the command line. If you intend to contribute to the SiteGenesis project, use the command line configuration for eslint.
  1. Right-click the Tern project.
  2. In the popup menu, select Properties >Tern > Validation.
  3. From the list of linters, select the linter you want to use.
X Privacy Update: We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used. By continuing to use this site you are giving us your consent to do this. Privacy Policy.