Set the language for the VS Code extension
The Ansible VS Code extension works only when the language associated with a file is set to Ansible. The extension provides features that help create Ansible playbooks, such as auto-completion, hover, and diagnostics.
The Ansible VS Code extension automatically associates the Ansible language with some files. The procedures below describe how to set the language for files that are not recognized as Ansible files.
Associate the Ansible language to YAML files
The following procedure describes how to manually assign the Ansible language to a YAML file that is open in VS Code.
About this task
Procedure
Add the persistent file association for the Ansible language to settings.json
Instead of manually associating the Ansible language to YAML files, you can add file association for the Ansible language in your settings.json file.