Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Format Document command in .feature files #33

Open
wooger opened this issue May 22, 2019 · 7 comments
Open

Add support for Format Document command in .feature files #33

wooger opened this issue May 22, 2019 · 7 comments
Labels
enhancement New feature or request

Comments

@wooger
Copy link

wooger commented May 22, 2019

Add support for using Visual Studio's 'Format Document' command (Ctrl-K, Ctrl-D) for gherkin .feature files.

This should be configurable via the global options menu.

@gasparnagy gasparnagy added the enhancement New feature or request label May 22, 2019
@gasparnagy
Copy link
Contributor

Yes, this is on my list too.
@wooger Would you be interested to contribute? I could guide you with some design ideas.

@littlegenius666
Copy link

@gasparnagy I would be really interested in contributing. I partially implemented this feature for Specflow extension for VS and I really need to use it in my everyday job :)

@gasparnagy
Copy link
Contributor

@littlegenius666 Great! I would be happy to support you!

The solution here can be built up based on

Things to note:

  • When we make the nice formatted version, we have to use the right newline character and the right indentation. See here how this can be obtained from VS. (The old VS extension always used CRLF causing some troubles.)
  • In long term, the formatting rules (whether steps should be indented, etc.) should be configurable (Deveroom already has a configuration infrastructure that can be changed using a deveroom.json config file). But for the first version, we can use fix rules.

Tests:

I try to be pretty strict on having enough/proper testing on all added feature. We have a pretty nice infrastructure where we can test editor features using a stub editor without launching VS. They are fast and support test-first development very well -- I encourage you to try it.

The AutoFormatTableCommand.feature is probably a good example to start the scenarios for the "format document" command as well, but you can take a look at the other scenarios as well in the Commands folder.

I only cover the most relevant illustrative examples as BDD scenarios, for the detailed data variation or edge cases, I use unit tests, like the AutoFormatTableCommandTests for the auto format.

You can also send a work-in-progress PR as well and I can help you out or give early feedback.

Of course I am also interested in any feedback about the development / contribution experience -- how to make it easier for anyone to contribute.

@gkalnytskyi-asx
Copy link

I would like to suggest allowing the user to put their feature file style configuration into the .editorconfig, should I raise this as another enhancement proposal?

@mityushinaanastasiya
Copy link

Hi! What is the status of this issue now? We with the team are waiting for these changes very much! Unfortunately, we always have problems related to the formatting of tables....

@MartienvdMeij
Copy link

Any news on this one? As this feature is really missing compared to the Specflow extension.

@gasparnagy
Copy link
Contributor

As you might know, Deveroom has been used as a baseline for the SpecFlow for Visual Studio 2022 product (https://github.com/SpecFlowOSS/SpecFlow.VS/) and the implementation of new features and improvements continues there and the format document has been implemented there.

The easiest recommendation to switch to VS2022, where you will get the "Deveroom-experience", but with extra features. If this is not feasible feel free to submit a PR for Deveroom. The format document feature can be done based on https://github.com/SpecFlowOSS/SpecFlow.VS/blob/main/SpecFlow.VisualStudio/Editor/Commands/AutoFormatDocumentCommand.cs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants