Backport of repl: Display multi-line strings as heredocs into v0.14 #27054
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.
Backport
This PR is auto-generated from #27045 to be assessed for backporting due to the inclusion of the label 0.14-backport.
The below text is copied from the body of the original PR.
The console and output formatter previously displayed multi-line strings with escaped newlines, e.g.
"hello\nworld\n"
. While this is a valid way to write the HCL string, it is not as common or as readable as using the heredoc syntax, e.g.This commit adds heredoc detection and display to this formatter, including support for indented heredocs for nested multi-line strings. This change affects the apply, console, and output sub-commands.
Fixes #27039. Targeting an 0.14.0 backport because this is a fairly narrowly-scoped fix to a problem introduced by changes in the 0.14 release.