Jonathan Nicholson

Getting Syntax Highlighting Working with Jenkinsfile's and Sublime Text

I was struggling to find a way to get groovy syntax highlighting working with Jenkinsfile's in Sublime Text (ST) since the default syntax rules for ST look at the file extension.

Using the ApplySyntax package, I was able to get it working really quickly. Once the package is installed, it can be configured through Preferences > Package Settings > ApplySyntax > Settings. The rule I added to the "syntaxes" array is as follows:

"syntaxes": [
    {
        "syntax": "Groovy/Groovy",
        "rules": [
            {"file_path": ".*/Jenkinsfile\\..*$"}
        ]

    }
]

The documentation for the package can be found here.

#programming #technology #jenkins #jenkinsfile #st3 #sublime text #st4

- 4 toasts