TigersEye120
TigersEye120

Reputation: 867

Associate Dockerfile language with all Dockerfiles in VS Code

What I want to do is tell Visual Studio Code to associate all files containing the word "Dockerfile" in their filename with the Dockerfile language to get the syntax highlighting. According to this site the language is just called "Dockerfile", so I added the following entry to settings.json:

"files.associations": {
    "*Dockerfile*": "Dockerfile"
}

But all that happened was that now even the standard Dockerfiles are no longer associated with their respective language. What am I doing wrong?

Upvotes: 4

Views: 540

Answers (1)

jboockmann
jboockmann

Reputation: 1025

The language identifier for Dockerfile is a lower-case dockerfile as stated on https://code.visualstudio.com/docs/languages/identifiers. Hence, you need to adjust your snippet as follows:

"files.associations": {
    "*Dockerfile*": "dockerfile"
}

Upvotes: 4

Related Questions