-
-
Notifications
You must be signed in to change notification settings - Fork 4
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
Create a static method to pretty print gherkin #4
Comments
I've moved this to the common repo where gherkin is maintained. |
There is a There is also cucumber/common#1555 which work in enhancing that |
I had originally opened this ticket in the cucumber-jvm project. it's there that I really need this. this was moved to the generic cucumber project which loses that fact. |
I considered the fact that you opened it in cucumber-jvm first. |
Did you consider the possibility to use cucumber-jvm to get the messages in the form of ndjson to use those as an input in javascript implementation of gherkin and then get the gherkinDocument to use with gherkin-utils? |
@nddipiazza what are you trying to achieve. You've described a solution, but not your problem. What are you trying to achieve by pretty formatting gherkin files? |
@mpkorstanje I have a java program that processes gherkin files. |
Is there a reason it has to be done in Java? We currently don't have any such function in Java. We do have a function that does it in Javascript. If it absolutely has to be Java then I guess you could port it. The structure isn't too different. https://github.com/cucumber/common/blob/main/gherkin-utils/javascript/src/pretty.ts |
Yeah unfortunately in my case java is a requirement because my app server is java and there is no js engine available. |
I think that could be nice to port gherkin-utils to other languages. That's why I've added the "Help wanted" badge :) |
I could take a stab at it. there's not much code there. But i'm super weak with ts. So it'll take me a while |
Would be helpfull for IDEs as well! |
Short reminder: if anyone would need any kind of help, feel free to join our community slack. You'll find plenty of developers ready to help. If for any reason you would not or can not join slack, we will find other way to provide any kind of help. It can be as part of this issue, or a pull-request, or something else? Are you using some tools which you would keep using? We can certainly join you there. Really, feel free to ask! We're here to help 😃 |
We now have a For implementations in other languages, please make a |
@aslakhellesoy here you go - cucumber/common#1725 |
Great stuff @nddipiazza - let's continue the discussion in cucumber/common#1725 |
* some initial commits towards https://github.com/cucumber/common/issues/1662 * finish the Pretty document stuff. * add some gitignores * code formatting. * maven-itize the project do my best at trying to add the make and gherkin-ish stuff * add more of the other files * javadoc * add comments. * the formatting of numbers on the left side caused differences with intellij's auto formatter which is not good. fixed a couple other differences between IntelliJ's auto formatter fixed some comment formatting issues. * pr review * handle end of file comments. * fix broken test * fix ci issue * add entry for gherkin-util/java in ci config.yaml * try to fix config error * try to fix config error * try removing it * Revert "fix ci issue" This reverts commit a9a30cb. * more fixes * fix typo in name * add commited files for ci * push untracked files * fix gherkin patch m2 * fix package names to match project * push source * fix remaining issues with make * push source * push untracked files * push untracked files * Update dependencies and refactor * Refactor * Limit API surface area * Add dependency on gherkin-java Co-authored-by: Nicholas DiPiazza <nicholas.dipiazza@gmail.com> Co-authored-by: Nicholas DiPiazza <nicholas.dipiazza@lucidworks.com> Co-authored-by: Nicholas DiPiazza <nicholas.dipiazza@wpsic.com> Co-authored-by: Jamie Tanna <github@jamietanna.co.uk>
* some initial commits towards https://github.com/cucumber/common/issues/1662 * finish the Pretty document stuff. * add some gitignores * code formatting. * maven-itize the project do my best at trying to add the make and gherkin-ish stuff * add more of the other files * javadoc * add comments. * the formatting of numbers on the left side caused differences with intellij's auto formatter which is not good. fixed a couple other differences between IntelliJ's auto formatter fixed some comment formatting issues. * pr review * handle end of file comments. * fix broken test * fix ci issue * add entry for gherkin-util/java in ci config.yaml * try to fix config error * try to fix config error * try removing it * Revert "fix ci issue" This reverts commit a9a30cb01f60abb6ba572ed8a7f29705554bf936. * more fixes * fix typo in name * add commited files for ci * push untracked files * fix gherkin patch m2 * fix package names to match project * push source * fix remaining issues with make * push source * push untracked files * push untracked files * Update dependencies and refactor * Refactor * Limit API surface area * Add dependency on gherkin-java Co-authored-by: Nicholas DiPiazza <nicholas.dipiazza@gmail.com> Co-authored-by: Nicholas DiPiazza <nicholas.dipiazza@lucidworks.com> Co-authored-by: Nicholas DiPiazza <nicholas.dipiazza@wpsic.com> Co-authored-by: Jamie Tanna <github@jamietanna.co.uk>
* some initial commits towards https://github.com/cucumber/common/issues/1662 * finish the Pretty document stuff. * add some gitignores * code formatting. * maven-itize the project do my best at trying to add the make and gherkin-ish stuff * add more of the other files * javadoc * add comments. * the formatting of numbers on the left side caused differences with intellij's auto formatter which is not good. fixed a couple other differences between IntelliJ's auto formatter fixed some comment formatting issues. * pr review * handle end of file comments. * fix broken test * fix ci issue * add entry for gherkin-util/java in ci config.yaml * try to fix config error * try to fix config error * try removing it * Revert "fix ci issue" This reverts commit a9a30cb01f60abb6ba572ed8a7f29705554bf936. * more fixes * fix typo in name * add commited files for ci * push untracked files * fix gherkin patch m2 * fix package names to match project * push source * fix remaining issues with make * push source * push untracked files * push untracked files * Update dependencies and refactor * Refactor * Limit API surface area * Add dependency on gherkin-java Co-authored-by: Nicholas DiPiazza <nicholas.dipiazza@gmail.com> Co-authored-by: Nicholas DiPiazza <nicholas.dipiazza@lucidworks.com> Co-authored-by: Nicholas DiPiazza <nicholas.dipiazza@wpsic.com> Co-authored-by: Jamie Tanna <github@jamietanna.co.uk>
FYI we're making good progress with this, but there are still a few areas I think we should improve on before we can say this is done - see cucumber/common#2024 for some Gherkin we'd want to finalise the prety-printing for before saying this is "ready" This is something that isn't solved by my own library https://gitlab.com/jamietanna/gherkin-formatter/ so this isn't me holding things up - I'd love for us to solve it in here 👍 |
* some initial commits towards https://github.com/cucumber/common/issues/1662 * finish the Pretty document stuff. * add some gitignores * code formatting. * maven-itize the project do my best at trying to add the make and gherkin-ish stuff * add more of the other files * javadoc * add comments. * the formatting of numbers on the left side caused differences with intellij's auto formatter which is not good. fixed a couple other differences between IntelliJ's auto formatter fixed some comment formatting issues. * pr review * handle end of file comments. * fix broken test * fix ci issue * add entry for gherkin-util/java in ci config.yaml * try to fix config error * try to fix config error * try removing it * Revert "fix ci issue" This reverts commit a9a30cb01f60abb6ba572ed8a7f29705554bf936. * more fixes * fix typo in name * add commited files for ci * push untracked files * fix gherkin patch m2 * fix package names to match project * push source * fix remaining issues with make * push source * push untracked files * push untracked files * Update dependencies and refactor * Refactor * Limit API surface area * Add dependency on gherkin-java Co-authored-by: Nicholas DiPiazza <nicholas.dipiazza@gmail.com> Co-authored-by: Nicholas DiPiazza <nicholas.dipiazza@lucidworks.com> Co-authored-by: Nicholas DiPiazza <nicholas.dipiazza@wpsic.com> Co-authored-by: Jamie Tanna <github@jamietanna.co.uk>
* some initial commits towards https://github.com/cucumber/common/issues/1662 * finish the Pretty document stuff. * add some gitignores * code formatting. * maven-itize the project do my best at trying to add the make and gherkin-ish stuff * add more of the other files * javadoc * add comments. * the formatting of numbers on the left side caused differences with intellij's auto formatter which is not good. fixed a couple other differences between IntelliJ's auto formatter fixed some comment formatting issues. * pr review * handle end of file comments. * fix broken test * fix ci issue * add entry for gherkin-util/java in ci config.yaml * try to fix config error * try to fix config error * try removing it * Revert "fix ci issue" This reverts commit a9a30cb01f60abb6ba572ed8a7f29705554bf936. * more fixes * fix typo in name * add commited files for ci * push untracked files * fix gherkin patch m2 * fix package names to match project * push source * fix remaining issues with make * push source * push untracked files * push untracked files * Update dependencies and refactor * Refactor * Limit API surface area * Add dependency on gherkin-java Co-authored-by: Nicholas DiPiazza <nicholas.dipiazza@gmail.com> Co-authored-by: Nicholas DiPiazza <nicholas.dipiazza@lucidworks.com> Co-authored-by: Nicholas DiPiazza <nicholas.dipiazza@wpsic.com> Co-authored-by: Jamie Tanna <github@jamietanna.co.uk>
* some initial commits towards https://github.com/cucumber/common/issues/1662 * finish the Pretty document stuff. * add some gitignores * code formatting. * maven-itize the project do my best at trying to add the make and gherkin-ish stuff * add more of the other files * javadoc * add comments. * the formatting of numbers on the left side caused differences with intellij's auto formatter which is not good. fixed a couple other differences between IntelliJ's auto formatter fixed some comment formatting issues. * pr review * handle end of file comments. * fix broken test * fix ci issue * add entry for gherkin-util/java in ci config.yaml * try to fix config error * try to fix config error * try removing it * Revert "fix ci issue" This reverts commit a9a30cb01f60abb6ba572ed8a7f29705554bf936. * more fixes * fix typo in name * add commited files for ci * push untracked files * fix gherkin patch m2 * fix package names to match project * push source * fix remaining issues with make * push source * push untracked files * push untracked files * Update dependencies and refactor * Refactor * Limit API surface area * Add dependency on gherkin-java Co-authored-by: Nicholas DiPiazza <nicholas.dipiazza@gmail.com> Co-authored-by: Nicholas DiPiazza <nicholas.dipiazza@lucidworks.com> Co-authored-by: Nicholas DiPiazza <nicholas.dipiazza@wpsic.com> Co-authored-by: Jamie Tanna <github@jamietanna.co.uk>
@mpkorstanje, wonder can this be closed? The Java implementation now satisfies the original request, if not mistaken. gherkin-utils/java/src/main/java/io/cucumber/gherkin/utils/pretty/Pretty.java Lines 8 to 28 in 7766139
|
Seems good enough to me. |
I find myself wishing there was a simple SDK with the ability to pretty print (format) gherkin files.
Like how intellij cucumber plugin formats them is exactly what I want.
Is there some way to add a simple static method for this?
GherkinFormatter.prettyPrint(gherkinString)
I think there is a way to do this with the library, but it's not as simple.
The text was updated successfully, but these errors were encountered: