IDE Autocompletion (Schema)¶
If you use Sourcery in VSCode or JetBrains, you can configure the IDE to use a
remote schema to validate your .sourcery.yaml
file and help with
autocompletion.
See Also
JetBrains - Intellij, PyCharm, ...¶
- Open up the IDE settings management (e.g. click "File" -> "Settings").
- In the navigation menu, under "Languages & Frameworks", under "Schemas & DTDs", click "JSON Schema Mappings".
- Click the "+" icon to add a new mapping.
- Give the new mapping the name "Sourcery YAML Schema".
- Provide the URL
https://docs.sourcery.ai/resources/sourcery_yaml_schema.json
(you can see the schema yourself by following this link). - Click the new "+" icon, and in the dropdown click "File".
- In the dialog, type
.sourcery.yaml
. - Click "Accept" and/or "OK" to close the settings window.
VSCode¶
These instructions assume you have the Red Hat YAML extension for VSCode installed.
- Open your VSCode settings management (Ctrl+, or Cmd+,).
- Search for YAML settings by typing "YAML" into the search dialog.
- Scroll until you find the "Yaml: Schemas" setting, and click "Edit in settings.json".
- In the
"yaml.schemas"
field, provide the following key/value:"https://docs.sourcery.ai/resources/sourcery_yaml_schema.json": ".sourcery.yaml"
- Save the settings.json file.
settings.json
{
// additional settings
"yaml.schemas": {
"https://docs.sourcery.ai/resources/sourcery_yaml_schema.json": ".sourcery.yaml"
}
}