microsoft / microsoft/microsoft-ui-xaml
XAML auto-formatting breaks RichTextBlock blocks apart
- Dominant language
- C++
- Stars
- 8.4k
- Forks
- 942
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 105
Description
### Describe the bug
In my Visual Studio configuration I have enabled "Position each attribute on a separate line" for XAML to keep my code more readable.
The problem I see is that, contrarily to `TextBlock`, this setting is applied to `RichTextBlock.Blocks` as well while it shouldn't.
### Steps to reproduce the bug
A concrete example is:
```xaml
```
Formatting this block (with Ctrl+K, Ctrl+D) will result in the runs to break into separate lines:
```xaml
```
But at compile time the two are going to produce two different markups, as in the latter case a `Run` containing a space is going to be added in between.
`TextBlock` handles this gracefully by maintaining the original format within the inlines. Could the same behavior be applied to `Paragraph` inlines?
### Expected behavior
_No response_
### Screenshots
_No response_
### NuGet package version
None
### Windows version
_No response_
### Additional context
_No response_
Contributor guide
Research direction
Start by reproducing the supplied RichTextBlock and Paragraph markup with the stated formatting setting, then compare its handling with TextBlock in the XAML formatter. Done means formatting preserves the original inline structure and does not insert whitespace between adjacent Run elements.
Written by the indexing model from the issue text.
Assessment
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100