Tutorial: Forge manifest IntelliSense in VS Code

Are you tired of looking up properties in the documentation when you are making changes to the Forge app manifest? Then you can import the manifest schema in VS Code to get linting and code completion by following these steps:

  1. Install the YAML extension by Red Hat.
  2. Open your VS Code settings.json (works with both user and workspace settings).
  3. Add the following property to the settings:
"yaml.schemas": {
  "https://unpkg.com/@forge/manifest@5.5.0/out/schema/manifest-schema.json": "manifest.yml"
},

This setting tells the extension to use the YAML schema from the @forge/manifest npm package for files named manifest.yml. This is the same schema that the Forge CLI uses when you run the forge lint command. Make sure to update the link to the schema file from time to time when new features are added to Forge by replacing the version number in the URL (in this case 5.5.0) with the latest version number from npm.

Manifest

9 Likes

Great idea!

I think you can use @forge/manifest@latest to grab the latest version of the schema.

2 Likes

You can achieve similar experiences on other IntelliJ IDE too:

Open the IDE and select Settings or Preferences (depending on the IDE, it has a different menu name) and search for Json Schema as the screenshot.

Click + button to create a new mapping and fill up the values as in the screenshot. Note that the Schema file or URL is the same as the one used in VS Code setting https://unpkg.com/@forge/manifest@5.0.0/out/schema/manifest-schema.json. The file pattern is manifest.yml which is the Forge manifest file name.

Once you set this for one IDE, other JetBrains IDEs will also get this setting and automatically recognize the Forge manifest file.

2 Likes