-
-
Notifications
You must be signed in to change notification settings - Fork 689
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
Implement Document Formatting #1732
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! 🤩
describe('getGherkinFormattingEdits', () => { | ||
it('returns text edits that prettifies a Gherkin document', () => { | ||
const gherkinSource = `Feature: Hello | ||
Scenario: World |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about using reindent-template-literals
(as a dev dependency) to avoid breaking the indentation, as it is done with cucumber-js?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The gherkinSource
is intentionally unindented and the test verifies that it's indented after formatting.
Why do we need to worry about breaking indentation? (Not quite sure what you mean).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean, the indentation in the test file itself is broken.
For example: cucumber/cucumber-js@dd62cbb#diff-7e7cef54343b7de585c12b93987ac29f464c8ec6e7dcb33fea9b969e507c1073
Before: the indentation in the file is hard to follow: https://github.com/cucumber/cucumber-js/blob/24ff9dc635ed25a32bdb6daf0028ecaf89569393/src/formatter/helpers/issue_helpers_spec.ts
After: the indentation has been fixed: https://github.com/cucumber/cucumber-js/blob/ad4a25b062c2d2922cbbba09712cc026e28fbd5a/src/formatter/helpers/issue_helpers_spec.ts
This is just a matter of readability
@aslakhellesoy is there anything that could be used directly under java / cucumber-jvm? |
Summary
Implement Gherkin Document formatting in language server / vscode extension / monaco plugin.
Details
The actual formatting is done by the
pretty
function in@cucumber/gherkin-utils
Motivation and Context
People using an editor want to format their documents 😄
How Has This Been Tested?
With unit tests and manual testing of VSCode extension and monaco plugin.
Screenshots (if appropriate):
Before:
After:
Types of changes
Checklist: