-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[XSG] Correct lineinfo for expanded markups #31641
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR corrects line information transfer when expanding markup nodes to element and value nodes in XAML source generation. The fix ensures proper #line pragma generation and improves VisualDiagnostics accuracy by preserving line numbers and positions from the original XAML source.
Key changes:
- Transfers XML line information when creating ValueNode instances during markup expansion
- Updates ValueNode constructors to include line number and position parameters
- Modernizes code patterns with primary constructors and pattern matching
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
ExpandMarkupsVisitor.cs |
Core implementation adding line info preservation during markup expansion and code modernization |
SimplifyOnPlatform.cs |
Test case updated to verify correct line number (9) in generated #line pragma |
SetBinding.cs |
Test case updated to verify correct line numbers (6) in generated code and VisualDiagnostics calls |
CompiledBindings.cs |
Test case updated to verify correct line numbers (8) in generated code and VisualDiagnostics calls |
c00c1b6 to
6f0b6d4
Compare
6f0b6d4 to
e2300c1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
| if (contextProvider != null) | ||
| { | ||
| contextProvider.Context.ReportDiagnostic(Diagnostic.Create(Descriptors.XamlParserError, LocationHelpers.LocationCreate(contextProvider.Context.ProjectItem.RelativePath!, xmlLineInfo!, match), xpe.Message)); | ||
| return null!; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't ask what changed for that return null to be needed, I have no idea
Description of Change
while expanding markup nodes to element and value nodes, some line info weren't transferred. Fixing this produces better
#linepragmas and VisualDiagnosticsIssues Fixed