Add AlsoNotify support to ReactiveAttribute and generator#354
Add AlsoNotify support to ReactiveAttribute and generator#354ChrisPulman merged 4 commits intomainfrom
Conversation
Introduces the AlsoNotify parameter to the ReactiveAttribute, allowing additional property change notifications to be specified. Updates the source generator to handle AlsoNotify, emitting RaisePropertyChanged calls for the specified properties in generated setters. Includes new and updated tests to verify the new behavior, and updates documentation to describe the new feature.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #354 +/- ##
==========================================
+ Coverage 42.86% 43.07% +0.20%
==========================================
Files 64 64
Lines 3583 3626 +43
Branches 404 411 +7
==========================================
+ Hits 1536 1562 +26
- Misses 1935 1949 +14
- Partials 112 115 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR adds AlsoNotify support to the ReactiveAttribute, enabling developers to specify additional properties that should receive change notifications when a reactive property changes. The implementation updates the source generator to handle the new parameter and emit additional RaisePropertyChanged calls in generated property setters.
Key Changes:
- Added constructor and
AlsoNotifyproperty toReactiveAttributefor specifying additional notification targets - Updated generator to parse and filter AlsoNotify parameters, excluding empty/null values and self-references
- Modified property generation templates to include additional RaisePropertyChanged calls in setters
Reviewed changes
Copilot reviewed 30 out of 30 changed files in this pull request and generated 27 comments.
Show a summary per file
| File | Description |
|---|---|
src/ReactiveUI.SourceGenerators.Roslyn/AttributeDefinitions.cs |
Adds constructor and AlsoNotify property to ReactiveAttribute for both property and field target variants |
src/ReactiveUI.SourceGenerators.Roslyn/Reactive/ReactiveGenerator.Execute.cs |
Implements AlsoNotify parsing logic and updates property generation templates to include additional notification calls |
src/ReactiveUI.SourceGenerators.Roslyn/Reactive/Models/PropertyInfo.cs |
Adds AlsoNotify parameter to PropertyInfo record to store notification targets |
src/ReactiveUI.SourceGenerators.Execute/TestViewModel.cs |
Demonstrates AlsoNotify usage with multiple property notifications |
src/ReactiveUI.SourceGenerator.Tests/UnitTests/ReactiveGeneratorTests.cs |
Adds test case for AlsoNotify feature verification |
src/ReactiveUI.SourceGenerator.Tests/REACTIVE/*.verified.cs |
Updates all verified test outputs to reflect new setter format with block syntax instead of expression syntax |
README.md |
Documents new AlsoNotify feature with usage example |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...eGeneratorTests.FromReactiveFromPartialWithAlsoNotify#TestNs.TestVM.Properties.g.verified.cs
Outdated
Show resolved
Hide resolved
...ivePropertiesWithNestedClass#TestNs1.TestViewModel3+TestInnerClass2.Properties.g.verified.cs
Outdated
Show resolved
Hide resolved
...mReactivePropertiesWithAttributesAccessAndInheritance#TestNs.TestVM.Properties.g.verified.cs
Outdated
Show resolved
Hide resolved
...EACTIVE/ReactiveGeneratorTests.FromReactiveProperties#TestNs.TestVM.Properties.g.verified.cs
Outdated
Show resolved
Hide resolved
...iveGeneratorTests.FromReactiveProperiesWithAttributes#TestNs.TestVM.Properties.g.verified.cs
Outdated
Show resolved
Hide resolved
...hNestedClass#TestNs1.TestViewModel3+TestInnerClass2+TestInnerClass3.Properties.g.verified.cs
Outdated
Show resolved
Hide resolved
...ivePropertiesWithNestedClass#TestNs1.TestViewModel3+TestInnerClass1.Properties.g.verified.cs
Outdated
Show resolved
Hide resolved
...eratorTests.FromReactivePropertiesWithIdenticalClass#TestNs2.TestVM.Properties.g.verified.cs
Outdated
Show resolved
Hide resolved
src/ReactiveUI.SourceGenerator.Tests/UnitTests/ReactiveGeneratorTests.cs
Outdated
Show resolved
Hide resolved
src/ReactiveUI.SourceGenerators.Roslyn/Reactive/ReactiveGenerator.Execute.cs
Outdated
Show resolved
Hide resolved
Removed trailing whitespace in generated property setters across multiple test verification files. Refactored AlsoNotify property handling in the source generator to filter and add valid property names more efficiently, and simplified the code for generating AlsoNotify attributes. Updated a test summary for clarity.
Corrected 'decalaration' to 'declaration' in two instances to improve documentation accuracy.
Corrected '</sumary>' to '</summary>' in the XML documentation comments for the Inheritance property in ReactiveAttribute. Updated both the source and generated test files for consistency.
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
What kind of change does this PR introduce?
feature
What is the current behavior?
Unable to include other related properties for change notifications
What is the new behavior?
Introduces the AlsoNotify parameter to the ReactiveAttribute, allowing additional property change notifications to be specified.
Updates the source generator to handle AlsoNotify, emitting RaisePropertyChanged calls for the specified properties in generated setters.
Includes new and updated tests to verify the new behavior, and updates documentation to describe the new feature.
What might this PR break?
New feature
Please check if the PR fulfills these requirements
Other information: