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

Fix indentation when formatting text blocks #1875

Merged
merged 1 commit into from
Jul 21, 2023

Conversation

milesziemer
Copy link
Contributor

Updates the formatter to indent the node value of a node kvp when they are text blocks.

A test case was added for a text block as the node value of a node kvp, and a test case was updated for when text blocks are in traits.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@milesziemer milesziemer requested a review from a team as a code owner July 21, 2023 15:43
// Dispersing the lines of the text block preserves any indentation applied from formatting parent
// nodes.
List<Doc> lines = Arrays.stream(tree.concatTokens()
.split(System.lineSeparator()))
Copy link
Contributor

Choose a reason for hiding this comment

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

This belongs on the line above, as it's an operation on the result of concatTokens() and not on the result of Arrays.stream().

Updates the formatter to indent the node value of a node kvp when
they are text blocks.

A test case was added for a text block as the node value of a node
kvp, and a test case was updated for when text blocks are in traits.
@milesziemer milesziemer force-pushed the fix-text-block-formatting branch from 69209ea to 3d9dff6 Compare July 21, 2023 16:08
@milesziemer milesziemer merged commit 0f8e446 into smithy-lang:main Jul 21, 2023
syall pushed a commit to Xtansia/smithy that referenced this pull request Aug 11, 2023
Updates the formatter to indent the node value of a node kvp when
they are text blocks.

A test case was added for a text block as the node value of a node
kvp, and a test case was updated for when text blocks are in traits.
alextwoods pushed a commit to alextwoods/smithy that referenced this pull request Sep 15, 2023
Updates the formatter to indent the node value of a node kvp when
they are text blocks.

A test case was added for a text block as the node value of a node
kvp, and a test case was updated for when text blocks are in traits.
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.

2 participants