Create a gist now

Instantly share code, notes, and snippets.

Cucumber Language definition file for TextMate; modified to work with Sublime Text 2
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>fileTypes</key>
<array>
<string>feature</string>
</array>
<key>firstLineMatch</key>
<string>기능|機能|功能|フィーチャ|خاصية|תכונה|Функціонал|Функционалност|Функционал|Особина|Могућност|Özellik|Właściwość|Tính năng|Savybė|Požiadavka|Požadavek|Osobina|Ominaisuus|Omadus|OH HAI|Mogućnost|Mogucnost|Jellemző|Fīča|Funzionalità|Funktionalität|Funkcionalnost|Funkcionalitāte|Funcționalitate|Functionaliteit|Functionalitate|Funcionalitat|Funcionalidade|Fonctionnalité|Fitur|Feature|Egenskap|Egenskab|Crikey|Característica|Arwedd(.*)</string>
<key>foldingStartMarker</key>
<string>^\s*\b(예|시나리오 개요|시나리오|배경|背景|場景大綱|場景|场景大纲|场景|劇本大綱|劇本|例子|例|テンプレ|シナリオテンプレート|シナリオテンプレ|シナリオアウトライン|シナリオ|サンプル|سيناريو مخطط|سيناريو|امثلة|الخلفية|תרחיש|תבנית תרחיש|רקע|דוגמאות|Тарих|Сценарій|Сценарији|Сценарио|Сценарий структураси|Сценарий|Структура сценарію|Структура сценарија|Структура сценария|Скица|Рамка на сценарий|Примери|Пример|Приклади|Предыстория|Предистория|Позадина|Передумова|Основа|Мисоллар|Концепт|Контекст|Значения|Örnekler|Założenia|Wharrimean is|Voorbeelden|Variantai|Tình huống|The thing of it is|Tausta|Taust|Tapausaihio|Tapaus|Tapaukset|Szenariogrundriss|Szenario|Szablon scenariusza|Stsenaarium|Struktura scenarija|Skica|Skenario konsep|Skenario|Situācija|Senaryo taslağı|Senaryo|Scénář|Scénario|Schema dello scenario|Scenārijs pēc parauga|Scenārijs|Scenár|Scenariusz|Scenariul de şablon|Scenariul de sablon|Scenariu|Scenarios|Scenario Outline|Scenario Amlinellol|Scenario|Scenarijus|Scenariji|Scenarijaus šablonas|Scenarijai|Scenarij|Scenarie|Rerefons|Raamstsenaarium|Příklady|Példák|Príklady|Przykłady|Primjeri|Primeri|Primer|Pozadí|Pozadina|Pozadie|Plan du scénario|Plan du Scénario|Piemēri|Pavyzdžiai|Paraugs|Osnova scénáře|Osnova|Náčrt Scénáře|Náčrt Scenáru|Mate|MISHUN SRSLY|MISHUN|Kịch bản|Kontext|Konteksts|Kontekstas|Kontekst|Koncept|Khung tình huống|Khung kịch bản|Juhtumid|Háttér|Grundlage|Geçmiş|Forgatókönyv vázlat|Forgatókönyv|Exemplos|Exemples|Exemplele|Exempel|Examples|Esquema do Cenário|Esquema do Cenario|Esquema del escenario|Esquema de l'escenari|Esempi|Escenario|Escenari|Enghreifftiau|Eksempler|Ejemplos|EXAMPLZ|Dữ liệu|Dis is what went down|Dasar|Contoh|Contexto|Contexte|Contesto|Condiţii|Conditii|Cobber|Cenário|Cenario|Cefndir|Bối cảnh|Blokes|Beispiele|Bakgrunn|Bakgrund|Baggrund|Background|B4|Antecedents|Antecedentes|All y'all|Achtergrond|Abstrakt Scenario|Abstract Scenario)</string>
<key>foldingStopMarker</key>
<string>^\s*$</string>
<key>keyEquivalent</key>
<string>^~C</string>
<key>name</key>
<string>Gherkin</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#feature_element_keyword</string>
</dict>
<dict>
<key>include</key>
<string>#feature_keyword</string>
</dict>
<dict>
<key>include</key>
<string>#step_keyword</string>
</dict>
<dict>
<key>include</key>
<string>#strings_triple_quote</string>
</dict>
<dict>
<key>include</key>
<string>#strings_single_quote</string>
</dict>
<dict>
<key>include</key>
<string>#strings_double_quote</string>
</dict>
<dict>
<key>include</key>
<string>#comments</string>
</dict>
<dict>
<key>include</key>
<string>#tags</string>
</dict>
<dict>
<key>include</key>
<string>#scenario_outline_variable</string>
</dict>
<dict>
<key>include</key>
<string>#table</string>
</dict>
</array>
<key>repository</key>
<dict>
<key>comments</key>
<dict>
<key>captures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>comment.line.number-sign</string>
</dict>
</dict>
<key>match</key>
<string>\s*(#.*)</string>
</dict>
<key>table</key>
<dict>
<key>begin</key>
<string>^\s*\|</string>
<key>end</key>
<string>\|\s*$</string>
<key>name</key>
<string>keyword.control.cucumber.table</string>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>\w</string>
<key>name</key>
<string>source</string>
</dict>
</array>
</dict>
<key>feature_keyword</key>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>keyword.language.gherkin.feature</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>string.language.gherkin.feature.title</string>
</dict>
</dict>
<key>match</key>
<string>^\s*(기능|機能|功能|フィーチャ|خاصية|תכונה|Функціонал|Функционалност|Функционал|Особина|Могућност|Özellik|Właściwość|Tính năng|Savybė|Požiadavka|Požadavek|Osobina|Ominaisuus|Omadus|OH HAI|Mogućnost|Mogucnost|Jellemző|Fīča|Funzionalità|Funktionalität|Funkcionalnost|Funkcionalitāte|Funcționalitate|Functionaliteit|Functionalitate|Funcionalitat|Funcionalidade|Fonctionnalité|Fitur|Feature|Egenskap|Egenskab|Crikey|Característica|Arwedd):(.*)\b</string>
</dict>
<key>step_keyword</key>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>keyword.language.gherkin.feature.step</string>
</dict>
</dict>
<key>match</key>
<string>^\s*(하지만|조건|먼저|만일|만약|단|그리고|그러면|那麼|那么|而且|當|当|前提|假設|假如|但是|但し|並且|もし|ならば|ただし|しかし|かつ|و |متى |لكن |عندما |ثم |بفرض |اذاً |כאשר |וגם |בהינתן |אזי |אז |אבל |Якщо |Унда |То |Припустимо що |Припустимо |Онда |Но |Нехай |Лекин |Когато |Када |Кад |К тому же |И |Задато |Задати |Задате |Если |Допустим |Дадено |Ва |Бирок |Аммо |Али |Але |Агар |А |І |Și |És |anrhegedig a |Zatati |Zakładając |Zadato |Zadate |Zadano |Zadani |Zadan |Youse know when youse got |Youse know like when |Yna |Ya know how |Ya gotta |Y |Wun |Wtedy |When y'all |When |Wenn |WEN |Và |Ve |Und |Un |Thì |Then y'all |Then |Tapi |Tak |Tada |Tad |Så |Stel |Soit |Siis |Si |Quando |Quand |Quan |Pryd |Pokud |Pokiaľ |Però |Pero |Pak |Oraz |Onda |Ond |Oletetaan |Og |Och |O zaman |Når |När |Niin |Nhưng |N |Mutta |Men |Mas |Maka |Majd |Mais |Maar |Ma |Lorsque |Lorsqu'|Kun |Kuid |Kui |Khi |Keď |Ketika |Když |Kai |Kada |Kad |Jeżeli |Ja |Ir |I CAN HAZ |I |Ha |Givun |Givet |Given y'all |Given |Gitt |Gegeven |Gegeben sei |Fakat |Eğer ki |Etant donné |Et |Então |Entonces |Entao |En |Eeldades |E |Duota |Dun |Donat |Donada |Diyelim ki |Dengan |Den youse gotta |De |Dato |Dar |Dann |Dan |Dado |Dacă |Daca |DEN |Când |Cuando |Cho |Cept |Cand |Cal |But y'all |But |Buh |Biết |Bet |BUT |Atès |Atunci |Atesa |Angenommen |And y'all |And |An |Ama |Als |Alors |Allora |Ali |Aleshores |Ale |Akkor |Aber |AN |A také |A |\* )</string>
</dict>
<key>feature_element_keyword</key>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>keyword.language.gherkin.feature.scenario</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>string.language.gherkin.scenario.title.title</string>
</dict>
</dict>
<key>match</key>
<string>^\s*(예|시나리오 개요|시나리오|배경|背景|場景大綱|場景|场景大纲|场景|劇本大綱|劇本|例子|例|テンプレ|シナリオテンプレート|シナリオテンプレ|シナリオアウトライン|シナリオ|サンプル|سيناريو مخطط|سيناريو|امثلة|الخلفية|תרחיש|תבנית תרחיש|רקע|דוגמאות|Тарих|Сценарій|Сценарији|Сценарио|Сценарий структураси|Сценарий|Структура сценарію|Структура сценарија|Структура сценария|Скица|Рамка на сценарий|Примери|Пример|Приклади|Предыстория|Предистория|Позадина|Передумова|Основа|Мисоллар|Концепт|Контекст|Значения|Örnekler|Założenia|Wharrimean is|Voorbeelden|Variantai|Tình huống|The thing of it is|Tausta|Taust|Tapausaihio|Tapaus|Tapaukset|Szenariogrundriss|Szenario|Szablon scenariusza|Stsenaarium|Struktura scenarija|Skica|Skenario konsep|Skenario|Situācija|Senaryo taslağı|Senaryo|Scénář|Scénario|Schema dello scenario|Scenārijs pēc parauga|Scenārijs|Scenár|Scenariusz|Scenariul de şablon|Scenariul de sablon|Scenariu|Scenarios|Scenario Outline|Scenario Amlinellol|Scenario|Scenarijus|Scenariji|Scenarijaus šablonas|Scenarijai|Scenarij|Scenarie|Rerefons|Raamstsenaarium|Příklady|Példák|Príklady|Przykłady|Primjeri|Primeri|Primer|Pozadí|Pozadina|Pozadie|Plan du scénario|Plan du Scénario|Piemēri|Pavyzdžiai|Paraugs|Osnova scénáře|Osnova|Náčrt Scénáře|Náčrt Scenáru|Mate|MISHUN SRSLY|MISHUN|Kịch bản|Kontext|Konteksts|Kontekstas|Kontekst|Koncept|Khung tình huống|Khung kịch bản|Juhtumid|Háttér|Grundlage|Geçmiş|Forgatókönyv vázlat|Forgatókönyv|Exemplos|Exemples|Exemplele|Exempel|Examples|Esquema do Cenário|Esquema do Cenario|Esquema del escenario|Esquema de l'escenari|Esempi|Escenario|Escenari|Enghreifftiau|Eksempler|Ejemplos|EXAMPLZ|Dữ liệu|Dis is what went down|Dasar|Contoh|Contexto|Contexte|Contesto|Condiţii|Conditii|Cobber|Cenário|Cenario|Cefndir|Bối cảnh|Blokes|Beispiele|Bakgrunn|Bakgrund|Baggrund|Background|B4|Antecedents|Antecedentes|All y'all|Achtergrond|Abstrakt Scenario|Abstract Scenario):(.*)</string>
</dict>
<key>scenario_outline_variable</key>
<dict>
<key>begin</key>
<string>&lt;</string>
<key>end</key>
<string>&gt;</string>
<key>name</key>
<string>variable.other</string>
</dict>
<key>strings_double_quote</key>
<dict>
<key>begin</key>
<string>"</string>
<key>end</key>
<string>"</string>
<key>name</key>
<string>string.quoted.double</string>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>\\.</string>
<key>name</key>
<string>constant.character.escape.untitled</string>
</dict>
</array>
</dict>
<key>strings_single_quote</key>
<dict>
<key>begin</key>
<string>(?&lt;![a-zA-Z"])'</string>
<key>end</key>
<string>'(?![a-zA-Z])</string>
<key>name</key>
<string>string.quoted.single</string>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>\\.</string>
<key>name</key>
<string>constant.character.escape</string>
</dict>
</array>
</dict>
<key>strings_triple_quote</key>
<dict>
<key>begin</key>
<string>"""</string>
<key>end</key>
<string>"""</string>
<key>name</key>
<string>string.quoted.single</string>
</dict>
<key>tags</key>
<dict>
<key>captures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>storage.type.tag.cucumber</string>
</dict>
</dict>
<key>match</key>
<string>(@[^@\r\n\t ]+)</string>
</dict>
</dict>
<key>scopeName</key>
<string>text.gherkin.feature</string>
<key>uuid</key>
<string>85E2C52C-9B16-4A54-81E7-6D8D3ADAEFA8</string>
</dict>
</plist>
@bcantin
bcantin commented Apr 12, 2011

Woot. Thank you for creating this. This is how I installed it on OS X

in SL2, Prefences > Browse Packages

Download the above gist
In the Browse Packages directory opened above (Packages) create a new folder. I called mine Cucumber

in that folder I copied the downloaded file, restarted SL2 and it worked

@paulbjensen

Hi, I tried downloading the instructions on the gist, but unfortunately it didn't work. I got the following error:

Error loading syntax file "Packages/Cucumber/Syntaxes/Cucumber Steps.tmLanguage": Error parsing plist xml: Failed to open file In file "Packages/Cucumber/Syntaxes/Cucumber Steps.tmLanguage"

What I did was the following instructions:

cd Library/Application\ Support/Sublime\ Text\ 2/Packages/
git clone git://github.com/cucumber/cucumber-tmbundle.git Cucumber
cd Cucumber/Syntaxes/
rm Cucumber\ Plain\ Text\ Feature.tmLanguage
wget https://raw.github.com/gist/864839/8752ef038ecaab8c9f3174b6ec419ed6f391e0c3/Cucumber%20Plain%20Text%20Feature.tmLanguage

Then I restarted Sublime Text 2, and it worked fine.

@HaloZero

I can't seem to get any color syntax or anything running properly. Or is this only for the completion and etc?

@unixmonkey
Owner

It does syntax highlighting. Did you open a .feature file and do "view -> syntax -> open all with current extension as -> Cucumber -> Gherkin"?

@colszowka

Works for me on latest ST2 on Ubuntu, thanks!

@ScottRadcliff

Thanks! Works like a champ. Makes SublimeText just a little better.

@mazuhl
mazuhl commented Sep 22, 2011

Really useful, thanks for taking the time to share this.

@databyte

I stumbled upon this and thought I'd mention this: https://github.com/sagework/cucumber-sublime2-bundle

Just clone it directly into your Packages folder and it'll be easy to update with a pull or fork your changes.

@JeanMertz

Is it just me, or does the "toggle comment" function not work in plain text feature files?

@unixmonkey
Owner

It's not just you. This only does syntax highlighting. The one linked above is the same; no commenting.
However, you can get close with the sagework one by doing this:
You can enable commenting by opening a .feature file and doing 'view -> syntax -> open all with current extension as -> Cucumber -> Cucumber Steps', but the syntax highlighting is a little different (not very much though)

@JeanMertz

@unixmonkey, I managed to solve the issue by creating a Comments.tmPreferences file in Packages/Cucumber, containing the following lines:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>name</key>
    <string>Comments</string>
    <key>scope</key>
    <string>text.gherkin.feature</string>
    <key>settings</key>
    <dict>
        <key>shellVariables</key>
        <array>
            <dict>
                <key>name</key>
                <string>TM_COMMENT_START</string>
                <key>value</key>
                <string># </string>
            </dict>
            <dict>
                <key>name</key>
                <string>TM_COMMENT_START_2</string>
                <key>value</key>
                <string>=begin
</string>
            </dict>
            <dict>
                <key>name</key>
                <string>TM_COMMENT_END_2</string>
                <key>value</key>
                <string>=end
</string>
            </dict>
        </array>
    </dict>
    <key>uuid</key>
    <string>98793a40-e7e7-473a-89ad-74d872ad3a3b</string>
</dict>
</plist>

That should solve the commenting problem

@waynehoover

I am also getting this error:

Error loading syntax file "Packages/Cucumber/Cucumber Steps.tmLanguage": Error parsing plist xml: Failed to open file In file "Packages/Cucumber/Cucumber Steps.tmLanguage"

So I had to move the file out the Syntaxes directory and into the main root. Not sure why it was looking for it there, but now everything is working.

@vas-aceqa

This is a great plugin. Exactly what i was looking for. Thanks!

@tomquas
tomquas commented May 21, 2012

thanks a lot, just what i was looking for...

@tbeseda
tbeseda commented May 23, 2012

Thanks @unixmonkey and @JeanMertz. Also, looks like user @sagework is gone/404.

@enda7
enda7 commented Jul 20, 2012

Nice work. thx :)

@verdi327
verdi327 commented Aug 4, 2012

thanks a bunch

@dmcnulla

This is beautiful. I did notice that it has the same issue that most apps have with color coding cucumber - the "([^"]*)" regex string always messes it up because of the middle quote. I've been solving it be doing a global replace to "(.+?)" when editing and reversing that when saving. Anybody seen an answer for that?

@zedtux
zedtux commented Apr 3, 2013

Is it possible to fix broken colors in cucumber steps files when using regular expressions ?

@islador
islador commented Aug 14, 2013

Thanks! This slotted beautifully into my Sublime Text 2 copy. I didn't even have to restart.

@nicohvi
nicohvi commented Oct 9, 2013

Can confirm that this works with Sublime 3 as well :-)

@Funfun
Funfun commented Oct 23, 2013

working great! thank you.

@amansiddiqi

@bcantin's directions worked great on OS 10.10.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment