GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Indent text blocks with the whitespace of the concatenation they replace by jkschneider · Pull Request #1477 · openrewrite/rewrite-migrate-java

Conversation

@jkschneider

@jkschneider jkschneider commented Nov 19, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

UseTextBlocks indents a new text block with the whitespace of the concatenation it replaces, character for character. A tab-indented concatenation now gives a tab-indented text block, even when the style says spaces. Before, the recipe converted that indentation to the style's tabs or spaces, which mixed tabs and spaces in hand-indented files.

Blank lines inside the text block stay empty instead of carrying that indentation. A text block strips trailing whitespace from every line anyway, so the string's value doesn't change.

This follows the rule from openrewrite/rewrite#10089: code a recipe replaces in place keeps its own whitespace, not the style's and not its neighbors'. The focused UseTextBlocksTest also passes with the keepEditedLineIndentation check and its shifted-input mode.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@moderne-meeseeks moderne-meeseeks Bot assigned jkschneider Nov 19, 2026
@moderne-meeseeks moderne-meeseeks Bot added this to OpenRewrite Nov 19, 2026
@github-project-automation github-project-automation Bot moved this to In Progress in OpenRewrite Nov 19, 2026
@jkschneider
jkschneider force-pushed the fix/use-text-blocks-generated-and-binary-data branch from 27b8704 to 827d10b Compare November 19, 2026 22:34
@jkschneider
jkschneider force-pushed the draft/use-text-blocks-indentation branch from 351cd9f to a2e4bb4 Compare November 19, 2026 22:35
@jkschneider jkschneider mentioned this pull request Nov 19, 2026
Preserve generated code and encoded data in UseTextBlocks #1470
Merged
@jkschneider
jkschneider force-pushed the fix/use-text-blocks-generated-and-binary-data branch from 827d10b to 0e119d7 Compare November 19, 2026 22:42
@jkschneider
jkschneider force-pushed the draft/use-text-blocks-indentation branch from a2e4bb4 to 7117ad7 Compare November 19, 2026 22:43
@jkschneider
jkschneider force-pushed the fix/use-text-blocks-generated-and-binary-data branch from 0e119d7 to 82cf380 Compare November 19, 2026 23:04
@jkschneider
jkschneider force-pushed the draft/use-text-blocks-indentation branch from 7117ad7 to 11d9540 Compare November 19, 2026 23:05
Base automatically changed from fix/use-text-blocks-generated-and-binary-data to main November 19, 2026 23:08
@jkschneider
jkschneider force-pushed the draft/use-text-blocks-indentation branch from 11d9540 to ffb9ca0 Compare November 19, 2026 23:11
@jkschneider
Preserve observed text block indentation prefixes for design review
6505c7d
@jkschneider
jkschneider force-pushed the draft/use-text-blocks-indentation branch from ffb9ca0 to 6505c7d Compare November 20, 2026 15:27
@jkschneider jkschneider changed the title Review text-block continuation indentation policy Indent text blocks with the whitespace of the concatenation they replace Nov 20, 2026
@jkschneider
jkschneider marked this pull request as ready for review November 20, 2026 15:27
@jkschneider
jkschneider merged commit b62d3e0 into main Nov 20, 2026
1 check passed

Uh oh!

There was an error while loading. Please reload this page.

@jkschneider
jkschneider deleted the draft/use-text-blocks-indentation branch November 20, 2026 15:30
@github-project-automation github-project-automation Bot moved this from In Progress to Done in OpenRewrite Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@jkschneider jkschneider

Labels

None yet

Projects

OpenRewrite
Archived in project

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@jkschneider
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.