Gherkin PowerTools![]() Format, lint and navigate Gherkin
Why Gherkin PowerTools?Writing Behavior-Driven Development (BDD) specifications often leads to misaligned tables, inconsistent indentation, and syntax typos caught only during test execution. This extension runs natively in VS Code to format your files, detect structural errors in real-time, and provide navigation capabilities directly to your code. Before / AfterThe formatter uses the Gherkin AST to apply consistent keyword casing, indentation and table alignment. Before
After
CompatibilityFeatures are divided into two tiers based on your project stack: Generic
|
| Feature | Gherkin PowerTools | Official Cucumber Extension |
|---|---|---|
| Formatter | Configurable indentation, dynamic table alignment relative to keyword, tag wrapping. | 2-space indentation, internal table cell alignment. |
| Diagnostics | Adds structural checks and quick fixes for issues such as missing colons, keyword typos and malformed tables. | Highlights syntax errors and undefined steps. |
| Code Actions | Auto-corrects typos, inserts colons, closes data tables. | Generates undefined step snippets. |
| Navigation | Supports Behave/Python decorators. | Supports multiple languages (Java, Ruby, JS, SpecFlow, etc.). |
Features
1. Formatter
Auto-indentation, dynamic data table alignment to the preceding step keyword, auto-casing for Gherkin keywords (given -> Given), and configurable tag wrapping.
2. Live Diagnostics Linter
Real-time syntax error detection. Flags missing colons after block keywords, invalid structural nesting (e.g., Examples without Scenario Outline), and unclosed data tables.
3. Quick Fixes (Code Actions)
Apply auto-corrections (Cmd+. / Ctrl+.) over diagnostic warnings:
- Correct misspelled keywords based on Levenshtein distance.
- Append missing colons.
- Convert
ScenariotoScenario Outlinewhen anExamplestable is added. - Close malformed data table rows.
4. Behave Navigation (Go To Definition)
Use Cmd+Click on macOS or Ctrl+Click on Windows and Linux on any step to jump to its Python @given, @when, or @then implementation.
5. Autocomplete
Suggests steps as you type based on your Python step definitions. Converts Behave placeholders into VS Code tab-stops.
6. Hover
- Steps: Hover over any step to view the underlying Python function signature and its associated Docstring.
- Tags: Hover over any Gherkin tag (
@tag) to view its "Blast Radius" (the exact number of scenarios and outline examples across the entire workspace affected by that tag).
7. Dashboard
An HTML webview displaying heuristic workspace metrics, including a Gherkin quality indicator, scenario complexity signals and tag distribution.
8. Workspace Analytics
Estimates executable permutations and provides a heuristic comparison between automated and manual execution effort.
Configuration
Available via your VS Code settings.json:
| Setting | Default | Description |
|---|---|---|
gherkinPowerTools.indentation.steps |
4 |
Number of spaces to indent step lines. |
gherkinPowerTools.tables.alignToKeyword |
true |
Align pipe tables dynamically to the start of the step text. |
gherkinPowerTools.emptyLines.betweenScenarios |
1 |
Enforced blank lines between Scenario / Rule blocks. |
gherkinPowerTools.tags.format |
"wrap" |
"wrap" splits long tags at 80 chars. "singleLine" disables wrapping. |
Format on Save:
"[feature]": { "editor.defaultFormatter": "carloscamara.vscode-gherkin-powertools", "editor.formatOnSave": true }
Documentation
For architecture overviews and feature deep-dives, see the Documentation Website.
Contributing
Bug reports, feature requests, and code contributions are welcome. See CONTRIBUTING.md to get started.
License
Licensed under the MIT License - © Carlos Camara.
