YAML
PhpStorm enables you to work with YAML files (.yml, .yaml) and supports the following capabilities:
Syntax highlighting
You can change color settings in the Editor | Code Style | YAML page of the Settings/Preferences dialog (Ctrl+Alt+S).
You can access code style settings related to YAML in the Editor | Code Style | YAML page of the Settings/Preferences dialog (Ctrl+Alt+S).
PhpStorm detects duplicated keys, unused anchors in YAML documents, and so on. For the complete list of YAML-related code inspections in PhpStorm, see Code Inspections in YAML.
For example, you can use code completion for YAML documents that have the JSON schema, or you can complete anchor aliases.
For instance, you can navigate between anchors and aliases.
Renaming (for example, anchors and aliases)
Let’s explore some YAML-specific features available in the editor.
Anchors and aliases
PhpStorm supports working with anchors and aliases. If you specify a new anchor in the YAML file, the editor will show a warning that this anchor is not used by any node.
![YAML: unused anchor warning YAML: unused anchor warning](https://resources.jetbrains.com/help/img/idea/2022.1/yaml_unused_anchor_warning.png)
The editor enables you now to complete aliases for this anchor.
![YAML: complete alias YAML: complete alias](https://resources.jetbrains.com/help/img/idea/2022.1/yaml_complete_alias.png)
You can navigate from aliases to the anchor using the Ctrl+B shortcut.
![YAML: navigate to anchor YAML: navigate to anchor](https://resources.jetbrains.com/help/img/idea/2022.1/yaml_navigate_anchor.png)
For the anchor, you can do the same and find all corresponding aliases.
![YAML: navigate to aliases YAML: navigate to aliases](https://resources.jetbrains.com/help/img/idea/2022.1/yaml_navigate_aliases.png)
PhpStorm also supports the rename refactoring for anchors and aliases.
![renaming the YAML anchor](https://resources.jetbrains.com/help/img/idea/2022.1/yaml_rename_anchor.png)
Remote JSON schemas
PhpStorm supports code completion and inspections for YAML files using the specified JSON schema. For instance, if you use the .travis.yml file for Travis CI configuration, PhpStorm will suggest completing its options using the JSON schema loaded from schemastore.org:
![YAML: complete JSON YAML: complete JSON](https://resources.jetbrains.com/help/img/idea/2022.1/ps_yaml_complete_json.png)
You can manage loading JSON schemas using the Languages & Frameworks | Schemas and DTDs | Remote JSON Schemas page of the Settings/Preferences dialog (Ctrl+Alt+S).
If necessary, you can specify a path to the required schema file in the Languages & Frameworks | Schemas and DTDs | JSON Schema Mappings page.
Copying keys
PhpStorm provides the ability to copy a full path to a specific option specified in the YAML file. You can do this in two ways:
Place a caret to the required key and press Ctrl+Alt+Shift+C.
Hover over the required key, right-click it and select Copy Reference.