asbjornenge / Docker.tmbundle

Dockerfile syntax
MIT License
75 stars 27 forks source link

Feature Request: Recognize Dockerfile.* #37

Open twmartin opened 2 years ago

twmartin commented 2 years ago

It was noticed that Github gives files named like Dockerfile.* no syntax highlighting; however, this appears to be a fairly common naming convention for Dockerfiles and is also referenced in the Docker documentation (https://docs.docker.com/engine/reference/commandline/build/#specify-a-dockerfile--f). My impression is that this is the project that provides Github with its Dockerfile syntax highlighting, but please correct me if I'm wrong. The VS Code Docker syntax highlighter had a similar feature request some time ago where they decided to recognize Dockerfile.*: https://github.com/microsoft/vscode-docker/issues/1907. Could we get that same filename convention matching support here as well?

Thanks!

princemaple commented 2 years ago

similar to #31

My recommendation is to use https://packagecontrol.io/packages/ApplySyntax.

My setting is like

{
    //...
    "syntaxes": [
        {
            "syntax": "Dockerfile Syntax Highlighting/Syntaxes/Dockerfile-bash",
            "rules": [
                { "file_path": ".*(?:\\\\|/)Dockerfile(\\.\\w+)*$" }
            ]
        },
        //...
    ]
}

If someone figured out a way to do this in Sublime syntax, or ST eventually added the feature, a PR is very welcome!