Skip to content

Conversation

@jdb0123
Copy link
Contributor

@jdb0123 jdb0123 commented Jan 9, 2025

🤔 What's changed?

Update auto formatting to replace sequential equivalent keywords with the And keyword

⚡️ What's your motivation?

New feature

🏷️ What kind of change is this?

  • ⚡ New feature (non-breaking change which adds new behaviour)

📋 Checklist:

  • I've changed the behaviour of the code
    • I have added/updated tests to cover my changes.
  • Users should know about my change
    • I have added an entry to the "[vNext]" section of the CHANGELOG, linking to this pull request & included my GitHub handle to the release contributors list.

Copy link
Contributor

@gasparnagy gasparnagy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx. It is generally good and works well - thank you.

I have noted a few smaller issues - see the separate comments for that.

Besides those I have one more request:

Please add a test to the specs project to the Editor/Commands/AutoFormatDocumentCommand.feature file. I have checked and adding this to the end of the file would be fine and enough:

Rule: Auto format should replace repeated keywords with "And"

Scenario: Repeating keywords are replaced with "And"

	Given there is a Reqnroll project scope
	And the following feature file in the editor
		"""
		Feature: Addition

		Scenario: Add two numbers
		    Given I have entered 50 into the calculator
		    Given I have entered 70 into the calculator
			When I add them
			When I check the result
			Then there should be no error
			Then the result should be 120
		"""
	When I invoke the "Auto Format Document" command without waiting for the tag changes
	Then the editor should be updated to
		"""
		Feature: Addition

		Scenario: Add two numbers
		    Given I have entered 50 into the calculator
		    And I have entered 70 into the calculator
		    When I add them
		    And I check the result
		    Then there should be no error
		    And the result should be 120
		"""

@jdb0123 jdb0123 force-pushed the auto_format_keywords branch from e5b8024 to da3ebbe Compare January 24, 2025 12:24
@jdb0123 jdb0123 force-pushed the auto_format_keywords branch from 1ff799f to 15b8379 Compare January 24, 2025 12:57
Copy link
Contributor

@gasparnagy gasparnagy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super, thx.

@gasparnagy gasparnagy merged commit 89c63d5 into reqnroll:main Feb 3, 2025
2 checks passed
@EuSiUnicredit
Copy link

Dear Reqnroll Team,

First of all, I’d like to sincerely thank you for the incredible work and dedication you’ve put into this project — it’s truly appreciated.

I’m reaching out to kindly ask if you could provide some guidance on how to disable the feature that automatically replaces repeated step keywords (like Given, When, Then) with And during formatting. I’d love to preserve the original keywords in my .feature files.

So, far I have unsuccessfully explored all the configs of .editorconfig, reqnroll.json, and even Visual Studio settings.

Any help or direction you could offer would be greatly appreciated!

@gasparnagy
Copy link
Contributor

@EuSiUnicredit This is currently not possible. We have infrastructure for this, see GherkinFormatSettings and how it is used, but no particular setting for this.

Would you be willing to try adding this feature and send a PR for it?

@EuSiUnicredit
Copy link

@gasparnagy I've checked files and seems not that hard.
Can you create an issue/request for the feature and I'll take it over with my personal github account?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants