develop

Cucumber:Gherkin syntax highlighting for Notepad++

Some configuration for enabling Gherkin syntax highlighting for your Notepad++

Introduction

Sometimes I want to edit a .feature file and don’t have Visual Studio handy, so I decided to create a syntax highlighter for Notepad++.

To install it, simply download and extract it. Open Notepad++ and open the User Defined dialogue from the View menu. Click on import and browse to the extracted gherkin.xml file. If you open a .feature file from Notepad++, it should now have some color coding.

<NotepadPlus>
    <UserLang name="Gherkin" ext="feature">
        <Settings>
            <Global caseIgnored="no" />
            <TreatAsSymbol comment="no" commentLine="no" />
            <Prefix words1="no" words2="yes" words3="no" words4="no" />
        </Settings>
        <KeywordLists>
            <Keywords name="Delimiters"><00>00</Keywords>
            <Keywords name="Folder+"></Keywords>
            <Keywords name="Folder-"></Keywords>
            <Keywords name="Operators"></Keywords>
            <Keywords name="Comment"> 1 2 0|</Keywords>
            <Keywords name="Words1">Feature: Scenario: When Then And Given Examples: Scenario Outline: Background:</Keywords>
            <Keywords name="Words2">@</Keywords>
            <Keywords name="Words3"></Keywords>
            <Keywords name="Words4"></Keywords>
        </KeywordLists>
        <Styles>
            <WordsStyle name="DEFAULT" styleID="11" fgColor="000000" bgColor="FFFFFF" fontName="Consolas" fontStyle="0" fontSize="10" />
            <WordsStyle name="FOLDEROPEN" styleID="12" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" />
            <WordsStyle name="FOLDERCLOSE" styleID="13" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" />
            <WordsStyle name="KEYWORD1" styleID="5" fgColor="0000FF" bgColor="FFFFFF" fontName="Consolas" fontStyle="0" fontSize="10" />
            <WordsStyle name="KEYWORD2" styleID="6" fgColor="009393" bgColor="FFFFFF" fontName="Consolas" fontStyle="0" fontSize="10" />
            <WordsStyle name="KEYWORD3" styleID="7" fgColor="A80000" bgColor="FFFFFF" fontName="Consolas" fontStyle="0" fontSize="10" />
            <WordsStyle name="KEYWORD4" styleID="8" fgColor="800000" bgColor="FFFFFF" fontName="" fontStyle="0" />
            <WordsStyle name="COMMENT" styleID="1" fgColor="000000" bgColor="FFFFFF" fontName="Consolas" fontStyle="0" fontSize="10" />
            <WordsStyle name="COMMENT LINE" styleID="2" fgColor="800000" bgColor="FFFFFF" fontName="Consolas" fontStyle="0" fontSize="10" />
            <WordsStyle name="NUMBER" styleID="4" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" />
            <WordsStyle name="OPERATOR" styleID="10" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" />
            <WordsStyle name="DELIMINER1" styleID="14" fgColor="B70000" bgColor="FFFFFF" fontName="" fontStyle="0" />
            <WordsStyle name="DELIMINER2" styleID="15" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" />
            <WordsStyle name="DELIMINER3" styleID="16" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" />
        </Styles>
    </UserLang>
</NotepadPlus>