A lightweight Visual Studio extension that provides syntax highlighting only for Gherkin/Cucumber .feature files.
Feature Highlighter brings beautiful, accurate syntax highlighting to your BDD feature files with a custom Gherkin parser inspired by Reqnroll. It supports multiple languages automatically (English, German, French, Spanish, and more).
This extension focuses on one thing: making your feature files easier to read with proper syntax coloring.
This extension is intentionally minimal and does NOT include:
- ❌ Test generation or execution
- ❌ IntelliSense or autocomplete
- ❌ Step definition navigation
- ❌ Step binding detection
- ❌ Refactoring tools
- ❌ Code actions or quick fixes
If you need these features, consider using the full SpecFlow or Reqnroll extensions instead.
- Keywords -
Feature,Scenario,Given,When,Then,And,But,Background,Rule,Examples(Blue, Bold) - Comments - Lines starting with
#(Green, Italic) - Tags -
@tagname(Light Blue/Cyan) - Parameters -
<parameter>,{parameter},"string",'string'(Light Green) - Doc Strings - Triple quotes
"""content"""(Tan/Brown) - Tables - Pipe-delimited data tables with cell highlighting (Yellow-ish)
With a custom Gherkin parser inspired by the Reqnroll project, keywords are automatically recognized in multiple languages:
- 🇬🇧 English:
Feature,Scenario,Given,When,Then - 🇩🇪 German:
Funktionalität,Szenario,Angenommen,Wenn,Dann - 🇫🇷 French:
Fonctionnalité,Scénario,Soit,Quand,Alors - 🇪🇸 Spanish:
Característica,Escenario,Dado,Cuando,Entonces - And more!
- Download the latest
.vsixfile from the Releases page - Double-click the
.vsixfile - Follow the Visual Studio installer prompts
- Restart Visual Studio
- Open Visual Studio 2022
- Go to Extensions → Manage Extensions
- Search for "Feature Highlighter"
- Click Download and restart Visual Studio
- Visual Studio 2022 (version 17.0 or higher)
- .NET Framework 4.8
Just open any .feature file in Visual Studio 2022, and syntax highlighting will be automatically applied!
You can customize the colors used for highlighting:
- Go to Tools → Options → Environment → Fonts and Colors
- In the "Display items" list, look for entries starting with "Gherkin":
- Gherkin Keyword
- Gherkin Comment
- Gherkin Tag
- Gherkin Parameter
- Gherkin Doc String
- Gherkin Table Cell
- Gherkin Table Pipe
- Change the colors to your preference
- Click OK to apply
Here's what a highlighted feature file looks like:
# This is a comment
@smoke @regression
Feature: User Authentication
As a user
I want to log in to the system
So that I can access my account
Background:
Given the application is running
Scenario: Successful login with valid credentials
Given I am on the login page
When I enter username "john.doe" and password "secret123"
And I click the login button
Then I should see the dashboard
And I should see a welcome message "Welcome, John!"
Scenario Outline: Login with different credentials
Given I am on the login page
When I enter username "<username>" and password "<password>"
Then I should see <result>
Examples:
| username | password | result |
| john.doe | secret123 | dashboard |
| jane.doe | pass456 | dashboard |
| invalid | wrong | error message |
Rule: Password security
Scenario: Password requirements
Given I am creating a new account
When I enter a password with {min_length} characters
Then the system should accept the password
"""
Passwords must be at least 8 characters long
and contain at least one number and one special character
"""- Visual Studio 2022 with the following workloads:
- .NET desktop development
- Visual Studio extension development
# Clone the repository
git clone https://github.com/markdav-is/Feature-Highlighter.git
cd Feature-Highlighter
# Open in Visual Studio 2022
start FeatureHighlighter.sln
# Or build from command line
msbuild FeatureHighlighter.sln /p:Configuration=Release- Open the solution in Visual Studio 2022
- Press F5 to launch the Experimental Instance
- In the Experimental Instance, open a
.featurefile - Verify that syntax highlighting is applied correctly
- Build the solution in Release configuration
- The
.vsixfile will be inFeatureHighlighter/bin/Release/FeatureHighlighter.vsix
The extension uses the Visual Studio Editor extensibility model:
- Content Type Definition - Registers
.featurefiles as "gherkin" content type - Classification Definitions - Defines logical token types (keyword, comment, tag, etc.)
- Format Definitions - Defines visual styles (colors, fonts) for each token type
- Classifier - Analyzes text and assigns classification types to text spans
- Parser Wrapper - Uses Reqnroll's Gherkin parser for accurate tokenization
This extension uses the Reqnroll Gherkin parser (BSD-3-Clause license) for robust, standards-compliant parsing of Gherkin syntax.
Special thanks to:
- The Reqnroll team for inspiring the multi-language Gherkin keyword support and providing an excellent open-source BDD framework
- The SpecFlow team for pioneering .NET BDD tooling
- The Cucumber community for the Gherkin language specification
This project is licensed under the MIT License - see the LICENSE file for details.
This extension uses a custom Gherkin parser implementation with no external parsing library dependencies.
Contributions are welcome! Please feel free to submit a Pull Request.
- Keep the extension focused on syntax highlighting only
- Follow the existing code style
- Test with multiple language variants (English, German, French, etc.)
- Ensure performance is good for large files
- Update documentation as needed
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- ✅ Removed unused Gherkin and Reqnroll package dependencies
- ✅ Implemented custom self-contained Gherkin parser
- ✅ Reduced package size (~125 KB)
- ✅ Improved performance with fewer dependencies
- ✅ Syntax highlighting for all Gherkin elements
- ✅ Multi-language keyword support
- ✅ Support for parameters, tags, comments, doc strings, and tables
- ✅ Optimized for Visual Studio 2022 Dark Theme
- ✅ Lightweight and performant
Potential future enhancements (while keeping the extension focused on highlighting):
- Light theme color optimization
- Additional language support
- Performance improvements for very large files
- User-configurable color themes
Made with ❤️ for the BDD community