Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Gherkin Step LensNew to Visual Studio Code? Get it now.
Gherkin Step Lens

Gherkin Step Lens

Varun Kumar Gopinath

|
3 installs
| (2) | Free
Gherkin colourizer & navigator for Reqnroll / SpecFlow C# projects. Colours keywords, highlights captured parameters, detects undefined / ambiguous / wrong-keyword steps, auto-formats Examples tables, and provides F12 Go-to-Definition with rich hover tooltips — zero config.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

🔍 Gherkin Step Lens

A VS Code extension for Reqnroll / SpecFlow teams writing Gherkin .feature files with C# step definitions.
Colours every step by its match state, highlights captured parameters, detects undefined & ambiguous steps, and provides Go-to-Definition — all with zero configuration.


✨ Features at a glance

# Feature What it does
1 🎨 Keyword colouring Feature/Scenario keywords in purple, step keywords in blue
2 🟠 Parameter highlighting Captured (.*) / {int} / {word} values in bold orange
3 🩷 Outline placeholders <placeholder> tokens in bold pink — always priority over orange
4 📊 Table colouring Header row pink, data rows orange, pipes bold blue · auto-aligned
5 🔴 Step match states 4 distinct colours for matched / ambiguous / undefined / wrong-keyword
6 🔍 Go to Definition F12 jumps to the exact C# method — picks the most-specific match
7 🔄 Auto reload Watches **/Steps/**/*.cs — colours update the moment you save
8 ⚡ Performance Prefix index + version cache + 250 ms debounce — no lag on large projects

🎨 1 · Gherkin Keyword Colouring

Every structural keyword is coloured to visually separate scenario shape from step content.

Feature: Letter Builder Sanity Scenarios

  Background:
    Given I navigate to LetterBuilder application

  Scenario Outline: Verify profile and login history
    Given I login with valid <username>
    When  I click on the login button
    Then  I should be logged in to the application
    And   I verify the profile icon is displayed

  Examples:
    | username                  |
    | Company1.Inn@yopmail.com  |
Keyword Colour
Feature: Background: Examples: 🔵 Light blue #A0C4FF
Scenario: 🟣 Purple #C586C0
Scenario Outline: keyword 🔵 Cyan #4FC1FF
Scenario Outline: title text 🟢 Green #98C379
Given When Then And But 🔵 Blue #569CD6 bold

🟠 2 · Parameter Value Highlighting

Values captured by (.*) groups (or Cucumber Expression tokens) are highlighted in bold orange — so you see exactly which parts of the step are data.

C# step definition:

[When("I navigate to (.*) page under settings option")]
public async Task NavigateToPage(string option) { ... }

Feature file — matched value lights up orange:

When  I navigate to merge fields page under settings option

Multiple capture groups on one step are all highlighted:

Then I verify that Browser, IP Address, Login Date, and Logout Date are in the table header

🩷 3 · Scenario Outline Placeholders

<placeholder> tokens are highlighted in bold pink — distinct from orange — so you always know which values come from the Examples: data table.

Scenario Outline: Login verification
  Given I login with valid <username> without DBConnection
  When  I click on the login button
  Then  I should be logged in to the application

  Examples:
    | username                  |
    | Company1.Inn@yopmail.com  |

🩷 Pink placeholder in step → 🩷 Pink header cell in Examples: → 🟠 Orange data cell in each row
Pink always wins — even if a (.*) pattern could also match the placeholder text.


📊 4 · Examples Table Colouring & Auto-Format

Every |-delimited row is coloured by role. As you type into a cell, the table is automatically aligned to the widest value in each column.

  Examples:
    | username                  | role   |   ← 🩷 header row (pink)
    | Company1.Inn@yopmail.com  | admin  |   ← 🟠 data rows (orange)
    | testuser@yopmail.com      | user   |

🔴 5 · Step Match States — 4 Colours, Instantly Understood

Every step is classified into one of four states, each with its own colour:

State What it means Colour
✅ Matched One definition found · params highlighted orange Blue keyword + orange params
⚠️ Ambiguous 2+ definitions match · hover shows all candidates 🟡 Yellow wavy underline
❌ Undefined No definition anywhere matches this step 🔴 Full line red wavy
⚠️ Wrong Keyword Text matches but under a different keyword 🔴 Keyword-only red wavy

All four states in one file:

Feature: Demonstrate every step state

  Scenario: All four colour states

    When  I navigate to merge fields page under settings option
        ✅ MATCHED — single def found, captured value is orange

    Then  I see the dashboard with all the widgets
        ⚠️ AMBIGUOUS — 2 patterns both match this step

    Given I click the green submit button at the bottom
        ❌ UNDEFINED — no definition anywhere matches

    When  I navigate to merge fields page under settings option
        ⚠️ WRONG KEYWORD — text exists under [Given], not [When]

Hover over any step to see a rich tooltip:

  • ✅ Matched → clickable link → jumps to the C# method
  • ⚠️ Ambiguous → lists every matching definition with file + line links
  • ❌ Undefined → shows a ready-to-paste C# stub to create the definition
  • ⚠️ Wrong Keyword → tells you which keyword the definition actually uses

💡 Keyword-aware matching — a [When("…")] definition only matches When steps (and And/But that follow a When). A broad [Then("I (.*)")] pattern will never accidentally highlight your When step yellow.


🔍 6 · Go to Definition — F12

Press F12 (or right-click → Go to Definition) on any step line to jump straight to the matching C# method.

── feature file ─────────────────────────────────────
When I click on the profile icon   ← press F12 here

── jumps to C# ──────────────────────────────────────
[When("I click on the profile icon")]
public async Task WhenIClickOnTheProfileIcon()
{
    await _page.ClickOnProfileButtonOnHeader();
}

🎯 Smart disambiguation — when two patterns both match, the one that captures the fewest characters wins, so you always land on the most specific definition.


🔄 7 · Automatic Step Reload

The extension watches **/Steps/**/*.cs. When you add, edit, or delete a step definition, colours and Go-to-Definition update immediately — no reload, no restart required.


⚡ 8 · Performance — Built for Large Projects

Optimisation What it does
🗂️ Prefix index Groups defs by their first 3 literal words — each step checks ~5 candidates instead of all 500+
💾 Version cache Stores colour ranges per document version — revisiting a file is instant
⏱️ Debounce 250 ms Waits until you pause typing before recomputing — no lag on every keystroke
🔁 Single pass Params, keywords, states, and tables all computed in one loop over the document

⚙️ Supported C# Step Attribute Formats

[Given("...")]   [When("...")]   [Then("...")]   [And("...")]   [But("...")]

// Multiple attributes on one method — both are indexed
[When("I click on the (.*) button")]
[When("I click on the (.*) option")]
public async Task ClickButton(string name) { ... }

// Verbatim strings with literal parentheses — fully supported
[Then(@"the column \(s\) (.*) exist")]

🥒 Cucumber Expression Tokens

Token Matches Example
{int} -?\d+ 42, -7
{float} / {double} -?\d*\.?\d+ 3.14, -0.5
{word} \w+ admin, submit
{string} "..." or '...' "hello"
{} anything any text

🎨 Colour Reference

Element Colour Hex
Feature: Background: Examples: 🔵 Light blue #A0C4FF
Scenario: 🟣 Purple #C586C0
Scenario Outline: keyword 🔵 Cyan #4FC1FF
Scenario Outline: title 🟢 Green #98C379
Given When Then And But 🔵 Blue #569CD6
Parameter values (.*) / table data 🟠 Orange #CE9178
<outline-placeholders> / table headers 🩷 Pink #FF69B4
Ambiguous step text 🟡 Yellow #DCDCAA
Undefined / wrong-keyword step 🔴 Red #F44747

⚙️ Recommended Workspace Settings

{
  "cucumberautocomplete.steps": ["CP.Automation.Tests/Steps/**/*.cs"],
  "cucumberautocomplete.gherkinDefinitionPart": "\\[?(Given|When|Then|And|But)\\s*\\(\"",
  "cucumberautocomplete.stepRegExSymbol": "\"",
  "files.associations": { "*.feature": "feature" }
}
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft