From 4574c70e142241b8abe23d0afddfcecc62f93e56 Mon Sep 17 00:00:00 2001
From: Glenn <5834289+glennawatson@users.noreply.github.com>
Date: Wed, 6 Nov 2024 12:44:24 +1100
Subject: [PATCH] chore: Update readme/project references (#113)
---
README.md | 68 +++++++++++++------
.../AnalyzerReleases.Shipped.md | 0
.../AnalyzerReleases.Unshipped.md | 0
.../PropertyToReactiveFieldAnalyzer.cs | 0
.../PropertyToReactiveFieldCodeFixProvider.cs | 0
.../Diagnostics/DiagnosticDescriptors.cs | 0
...ourceGenerators.Analyzers.CodeFixes.csproj | 0
...iveUI.SourceGenerators.Execute.Maui.csproj | 2 +-
...ReactiveUI.SourceGenerators.Execute.csproj | 2 +-
src/ReactiveUI.SourceGenerators.sln | 12 ++--
.../ReactiveUI.SourceGenerators.csproj | 3 +-
11 files changed, 58 insertions(+), 29 deletions(-)
rename src/{ReactiveUI.SourceGenerators.CodeFixers => ReactiveUI.SourceGenerators.Analyzers.CodeFixes}/AnalyzerReleases.Shipped.md (100%)
rename src/{ReactiveUI.SourceGenerators.CodeFixers => ReactiveUI.SourceGenerators.Analyzers.CodeFixes}/AnalyzerReleases.Unshipped.md (100%)
rename src/{ReactiveUI.SourceGenerators.CodeFixers => ReactiveUI.SourceGenerators.Analyzers.CodeFixes}/Diagnostics/CodeFixers/PropertyToReactiveFieldAnalyzer.cs (100%)
rename src/{ReactiveUI.SourceGenerators.CodeFixers => ReactiveUI.SourceGenerators.Analyzers.CodeFixes}/Diagnostics/CodeFixers/PropertyToReactiveFieldCodeFixProvider.cs (100%)
rename src/{ReactiveUI.SourceGenerators.CodeFixers => ReactiveUI.SourceGenerators.Analyzers.CodeFixes}/Diagnostics/DiagnosticDescriptors.cs (100%)
rename src/{ReactiveUI.SourceGenerators.CodeFixers => ReactiveUI.SourceGenerators.Analyzers.CodeFixes}/ReactiveUI.SourceGenerators.Analyzers.CodeFixes.csproj (100%)
diff --git a/README.md b/README.md
index 5cd6605..02b81b3 100644
--- a/README.md
+++ b/README.md
@@ -1,28 +1,55 @@
-# ReactiveUI.SourceGenerators
-Use source generators to generate ReactiveUI objects.
-The minimum C# version is 12.0 and the minimum Visual Studio version is 17.8.0.
+# ReactiveUI Source Generators Documentation
-These Source Generators were designed to work in full with ReactiveUI V19.5.31 and newer supporting all features, currently:
-- [Reactive]
-- [ObservableAsProperty]
-- [ObservableAsProperty(PropertyName = "ReadOnlyPropertyName")]
-- [ReactiveCommand]
-- [ReactiveCommand(CanExecute = nameof(IObservableBoolName))] with CanExecute
-- [ReactiveCommand][property: AttribueToAddToCommand] with Attribute passthrough
-- [IViewFor(nameof(ViewModelName))]
-- [RoutedControlHost("YourNameSpace.CustomControl")]
-- [ViewModelControlHost("YourNameSpace.CustomControl")]
+This documentation covers using ReactiveUI Source Generators to simplify and enhance the use of ReactiveUI objects.
-Versions older than V19.5.31 to this:
-- [ReactiveCommand] all options supported except Cancellation Token asnyc methods.
+- **Minimum Requirements**:
+ - **C# Version**: 12.0
+ - **Visual Studio Version**: 17.8.0
+ - **ReactiveUI Version**: 19.5.31+
-For dot net framework 4.8 and older versions please add Polyfill or PolySharp package to your project to gain the IsExternalInit class and set the LangVersion to 12.0 or latest in your project file.
+## Overview
-[analyzer codes](https://github.com/reactiveui/ReactiveUI.SourceGenerators/blob/main/src/ReactiveUI.SourceGenerators/AnalyzerReleases.Shipped.md)
+ReactiveUI Source Generators automatically generate ReactiveUI objects to streamline your code. These Source Generators are designed to work with ReactiveUI V19.5.31+ and support the following features:
-# Historical ways
-## Read-write properties
-Typically properties are declared like this:
+- `[Reactive]`
+- `[ObservableAsProperty]`
+- `[ObservableAsProperty(PropertyName = "ReadOnlyPropertyName")]`
+- `[ReactiveCommand]`
+- `[ReactiveCommand(CanExecute = nameof(IObservableBoolName))]` with CanExecute
+- `[ReactiveCommand][property: AttributeToAddToCommand]` with Attribute passthrough
+- `[IViewFor(nameof(ViewModelName))]`
+- `[RoutedControlHost("YourNameSpace.CustomControl")]`
+- `[ViewModelControlHost("YourNameSpace.CustomControl")]`
+
+### Compatibility Notes
+- For ReactiveUI versions **older than V19.5.31**, all `[ReactiveCommand]` options are supported except for async methods with a `CancellationToken`.
+- For **.NET Framework 4.8 and older**, add [Polyfill by Simon Cropp](https://github.com/Fody/Polyfill) or [PolySharp by Manuel Römer](https://github.com/manuelroemer/PolySharp) to your project and set the `LangVersion` to 12.0 or later in your project file.
+
+For more information on analyzer codes, see the [analyzer codes documentation](https://github.com/reactiveui/ReactiveUI.SourceGenerators/blob/main/src/ReactiveUI.SourceGenerators/AnalyzerReleases.Shipped.md).
+
+---
+
+## Supported Attributes
+
+### `[Reactive]`
+Marks properties as reactive, generating getter and setter code.
+
+### `[ObservableAsProperty]`
+Generates read-only properties backed by an `ObservableAsPropertyHelper` based on an `IObservable`.
+
+### `[ReactiveCommand]`
+Generates commands, with options to add attributes or enable `CanExecute` functionality.
+
+### `[IViewFor]`
+Links a view to a view model for data binding.
+
+### `[RoutedControlHost]` and `[ViewModelControlHost]`
+Platform-specific attributes for control hosting in WinForms applications.
+
+## Historical Approach
+
+### Read-Write Properties
+Previously, properties were declared like this:
```csharp
private string _name;
@@ -35,6 +62,7 @@ public string Name
Before these Source Generators were avaliable we used ReactiveUI.Fody.
With ReactiveUI.Fody the `[Reactive]` Attribute was placed on a Public Property with Auto get / set properties, the generated code from the Source Generator and the Injected code using Fody are very similar with the exception of the Attributes.
+
```csharp
[Reactive]
public string Name { get; set; }
diff --git a/src/ReactiveUI.SourceGenerators.CodeFixers/AnalyzerReleases.Shipped.md b/src/ReactiveUI.SourceGenerators.Analyzers.CodeFixes/AnalyzerReleases.Shipped.md
similarity index 100%
rename from src/ReactiveUI.SourceGenerators.CodeFixers/AnalyzerReleases.Shipped.md
rename to src/ReactiveUI.SourceGenerators.Analyzers.CodeFixes/AnalyzerReleases.Shipped.md
diff --git a/src/ReactiveUI.SourceGenerators.CodeFixers/AnalyzerReleases.Unshipped.md b/src/ReactiveUI.SourceGenerators.Analyzers.CodeFixes/AnalyzerReleases.Unshipped.md
similarity index 100%
rename from src/ReactiveUI.SourceGenerators.CodeFixers/AnalyzerReleases.Unshipped.md
rename to src/ReactiveUI.SourceGenerators.Analyzers.CodeFixes/AnalyzerReleases.Unshipped.md
diff --git a/src/ReactiveUI.SourceGenerators.CodeFixers/Diagnostics/CodeFixers/PropertyToReactiveFieldAnalyzer.cs b/src/ReactiveUI.SourceGenerators.Analyzers.CodeFixes/Diagnostics/CodeFixers/PropertyToReactiveFieldAnalyzer.cs
similarity index 100%
rename from src/ReactiveUI.SourceGenerators.CodeFixers/Diagnostics/CodeFixers/PropertyToReactiveFieldAnalyzer.cs
rename to src/ReactiveUI.SourceGenerators.Analyzers.CodeFixes/Diagnostics/CodeFixers/PropertyToReactiveFieldAnalyzer.cs
diff --git a/src/ReactiveUI.SourceGenerators.CodeFixers/Diagnostics/CodeFixers/PropertyToReactiveFieldCodeFixProvider.cs b/src/ReactiveUI.SourceGenerators.Analyzers.CodeFixes/Diagnostics/CodeFixers/PropertyToReactiveFieldCodeFixProvider.cs
similarity index 100%
rename from src/ReactiveUI.SourceGenerators.CodeFixers/Diagnostics/CodeFixers/PropertyToReactiveFieldCodeFixProvider.cs
rename to src/ReactiveUI.SourceGenerators.Analyzers.CodeFixes/Diagnostics/CodeFixers/PropertyToReactiveFieldCodeFixProvider.cs
diff --git a/src/ReactiveUI.SourceGenerators.CodeFixers/Diagnostics/DiagnosticDescriptors.cs b/src/ReactiveUI.SourceGenerators.Analyzers.CodeFixes/Diagnostics/DiagnosticDescriptors.cs
similarity index 100%
rename from src/ReactiveUI.SourceGenerators.CodeFixers/Diagnostics/DiagnosticDescriptors.cs
rename to src/ReactiveUI.SourceGenerators.Analyzers.CodeFixes/Diagnostics/DiagnosticDescriptors.cs
diff --git a/src/ReactiveUI.SourceGenerators.CodeFixers/ReactiveUI.SourceGenerators.Analyzers.CodeFixes.csproj b/src/ReactiveUI.SourceGenerators.Analyzers.CodeFixes/ReactiveUI.SourceGenerators.Analyzers.CodeFixes.csproj
similarity index 100%
rename from src/ReactiveUI.SourceGenerators.CodeFixers/ReactiveUI.SourceGenerators.Analyzers.CodeFixes.csproj
rename to src/ReactiveUI.SourceGenerators.Analyzers.CodeFixes/ReactiveUI.SourceGenerators.Analyzers.CodeFixes.csproj
diff --git a/src/ReactiveUI.SourceGenerators.Execute.Maui/ReactiveUI.SourceGenerators.Execute.Maui.csproj b/src/ReactiveUI.SourceGenerators.Execute.Maui/ReactiveUI.SourceGenerators.Execute.Maui.csproj
index 986863f..82e6642 100644
--- a/src/ReactiveUI.SourceGenerators.Execute.Maui/ReactiveUI.SourceGenerators.Execute.Maui.csproj
+++ b/src/ReactiveUI.SourceGenerators.Execute.Maui/ReactiveUI.SourceGenerators.Execute.Maui.csproj
@@ -25,7 +25,7 @@
-
+
diff --git a/src/ReactiveUI.SourceGenerators.Execute/ReactiveUI.SourceGenerators.Execute.csproj b/src/ReactiveUI.SourceGenerators.Execute/ReactiveUI.SourceGenerators.Execute.csproj
index 6c34648..f1ac395 100644
--- a/src/ReactiveUI.SourceGenerators.Execute/ReactiveUI.SourceGenerators.Execute.csproj
+++ b/src/ReactiveUI.SourceGenerators.Execute/ReactiveUI.SourceGenerators.Execute.csproj
@@ -17,7 +17,7 @@
+
-
diff --git a/src/ReactiveUI.SourceGenerators.sln b/src/ReactiveUI.SourceGenerators.sln
index 4ed07cd..1a47a1d 100644
--- a/src/ReactiveUI.SourceGenerators.sln
+++ b/src/ReactiveUI.SourceGenerators.sln
@@ -1,5 +1,5 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# 17
+# Visual Studio Version 17
VisualStudioVersion = 17.10.35027.167
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionConfig", "SolutionConfig", "{F29AF2F3-DEC8-58BC-043A-1447862C832D}"
@@ -24,7 +24,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReactiveUI.SourceGenerators
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TestLibs", "TestLibs", "{B86ED9C1-AFFB-4854-AD80-F4B4050CAD0A}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReactiveUI.SourceGenerators.Analyzers.CodeFixes", "ReactiveUI.SourceGenerators.CodeFixers\ReactiveUI.SourceGenerators.Analyzers.CodeFixes.csproj", "{C89EE66E-E1DC-4A31-9322-20D95CB0D74D}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReactiveUI.SourceGenerators.Analyzers.CodeFixes", "ReactiveUI.SourceGenerators.Analyzers.CodeFixes\ReactiveUI.SourceGenerators.Analyzers.CodeFixes.csproj", "{BD4FADD9-C0E5-46E9-906E-01B04CC856B5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -48,10 +48,10 @@ Global
{60C7C031-8765-46D7-8E0D-88CD4949F25B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{60C7C031-8765-46D7-8E0D-88CD4949F25B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{60C7C031-8765-46D7-8E0D-88CD4949F25B}.Release|Any CPU.Build.0 = Release|Any CPU
- {C89EE66E-E1DC-4A31-9322-20D95CB0D74D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {C89EE66E-E1DC-4A31-9322-20D95CB0D74D}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {C89EE66E-E1DC-4A31-9322-20D95CB0D74D}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {C89EE66E-E1DC-4A31-9322-20D95CB0D74D}.Release|Any CPU.Build.0 = Release|Any CPU
+ {BD4FADD9-C0E5-46E9-906E-01B04CC856B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {BD4FADD9-C0E5-46E9-906E-01B04CC856B5}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {BD4FADD9-C0E5-46E9-906E-01B04CC856B5}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {BD4FADD9-C0E5-46E9-906E-01B04CC856B5}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/src/ReactiveUI.SourceGenerators/ReactiveUI.SourceGenerators.csproj b/src/ReactiveUI.SourceGenerators/ReactiveUI.SourceGenerators.csproj
index 6950971..282a61d 100644
--- a/src/ReactiveUI.SourceGenerators/ReactiveUI.SourceGenerators.csproj
+++ b/src/ReactiveUI.SourceGenerators/ReactiveUI.SourceGenerators.csproj
@@ -44,8 +44,9 @@
+
-
+