fix: preserve meaningful surrounding spaces in JSX text#782
Open
SunsetTechuila wants to merge 5 commits into
Open
fix: preserve meaningful surrounding spaces in JSX text#782SunsetTechuila wants to merge 5 commits into
SunsetTechuila wants to merge 5 commits into
Conversation
SunsetTechuila
commented
May 19, 2026
|
|
||
| fn has_jsx_trailing_space<'a>(current_node: Node<'a>, previous_node: Option<Node<'a>>, context: &Context<'a>) -> bool { | ||
| if let Node::JSXText(text) = current_node { | ||
| if matches!(previous_node, Some(previous_node) if is_ignore_jsx_expr_container(previous_node, context)) { |
Author
There was a problem hiding this comment.
is_ignore_jsx_expr_container
Otherwise tests/specs/issues/deno/issue026681.txt fails
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #476
Surrounding spaces are trimmed in the
get_linesfunction to remove source indentation for multi-line cases:dprint-plugin-typescript/src/generation/generate.rs
Line 4199 in 1271b4f
I ended up fixing this at the
gen_for_single_linelevel, as solutions at thegen_jsx_textandget_lineslevels seemed worse.Important
This PR is AI-assisted. I have little experience working with Rust and none working on parsers or formatters.