BDD Feature Files Syntax Highlighting in Notepad++

If you are using Notepad++ as a IDE for your development, then it has syntax highlighting options for various languages.

I am the one who frequently use to write agile user stories for my BDD tests.

So I want some better Syntax Highlighting in my IDE rather than displaying it as a normal text file.

And there is pretty much easier way to define this for our custom languages in Notepad++.

Save the following content as a Feature.xml file.

 
<NotepadPlus>
 <UserLang name="Feature" ext="Feature" udlVersion="2.1">
 <Settings>
 <Global caseIgnored="yes" allowFoldOfComments="no" foldCompact="no" forcePureLC="0" decimalSeparator="0" />
 <Prefix Keywords1="yes" Keywords2="yes" Keywords3="yes" Keywords4="yes" Keywords5="yes" Keywords6="no" Keywords7="no" Keywords8="no" />
 </Settings>
 <KeywordLists>
 <Keywords name="Comments"></Keywords>
 <Keywords name="Numbers, prefix1"></Keywords>
 <Keywords name="Numbers, prefix2"></Keywords>
 <Keywords name="Numbers, extras1"></Keywords>
 <Keywords name="Numbers, extras2"></Keywords>
 <Keywords name="Numbers, suffix1"></Keywords>
 <Keywords name="Numbers, suffix2"></Keywords>
 <Keywords name="Numbers, range"></Keywords>
 <Keywords name="Operators1"></Keywords>
 <Keywords name="Operators2"></Keywords>
 <Keywords name="Folders in code1, open"></Keywords>
 <Keywords name="Folders in code1, middle"></Keywords>
 <Keywords name="Folders in code1, close"></Keywords>
 <Keywords name="Folders in code2, open"></Keywords>
 <Keywords name="Folders in code2, middle"></Keywords>
 <Keywords name="Folders in code2, close"></Keywords>
 <Keywords name="Folders in comment, open"></Keywords>
 <Keywords name="Folders in comment, middle"></Keywords>
 <Keywords name="Folders in comment, close"></Keywords>
 <Keywords name="Keywords1">GIVEN
WHEN
AND
THEN</Keywords>
 <Keywords name="Keywords2">Scenario
[
]</Keywords>
 <Keywords name="Keywords3">Feature
{
}</Keywords>
 <Keywords name="Keywords4">Check
(
)</Keywords>
 <Keywords name="Keywords5">should</Keywords>
 <Keywords name="Keywords6"></Keywords>
 <Keywords name="Keywords7"></Keywords>
 <Keywords name="Keywords8"></Keywords>
 <Keywords name="Delimiters"></Keywords>
 </KeywordLists>
 <Styles>
 <WordsStyle name="DEFAULT" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
 <WordsStyle name="COMMENTS" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
 <WordsStyle name="LINE COMMENTS" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
 <WordsStyle name="NUMBERS" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
 <WordsStyle name="KEYWORDS1" fgColor="0080FF" bgColor="FFFFFF" fontStyle="1" nesting="0" />
 <WordsStyle name="KEYWORDS2" fgColor="FF0080" bgColor="FFFFFF" fontStyle="1" nesting="0" />
 <WordsStyle name="KEYWORDS3" fgColor="800080" bgColor="FFFFFF" fontStyle="1" nesting="0" />
 <WordsStyle name="KEYWORDS4" fgColor="FF0000" bgColor="FFFFFF" fontStyle="1" nesting="0" />
 <WordsStyle name="KEYWORDS5" fgColor="FF8040" bgColor="FFFFFF" fontStyle="1" nesting="0" />
 <WordsStyle name="KEYWORDS6" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
 <WordsStyle name="KEYWORDS7" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
 <WordsStyle name="KEYWORDS8" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
 <WordsStyle name="OPERATORS" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
 <WordsStyle name="FOLDER IN CODE1" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
 <WordsStyle name="FOLDER IN CODE2" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
 <WordsStyle name="FOLDER IN COMMENT" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
 <WordsStyle name="DELIMITERS1" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
 <WordsStyle name="DELIMITERS2" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
 <WordsStyle name="DELIMITERS3" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
 <WordsStyle name="DELIMITERS4" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
 <WordsStyle name="DELIMITERS5" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
 <WordsStyle name="DELIMITERS6" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
 <WordsStyle name="DELIMITERS7" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
 <WordsStyle name="DELIMITERS8" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
 </Styles>
 </UserLang>
</NotepadPlus>

Goto your Notepad++ [I am using the latest Version 6.3].

Select Language Tab and Click “Define Your Language” option.

This will open the Editor to define your own language.

Click on “Import” and locate the above saved xml file.

That’s it. Now close the window.

So hereafter whenever if you open a “.Feature” file in Notepad++ IDE, it will highlight all

the keywords related to your BDD User Stories.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s