File tree Expand file tree Collapse file tree 3 files changed +19
-8
lines changed Expand file tree Collapse file tree 3 files changed +19
-8
lines changed Original file line number Diff line number Diff line change 55
55
<Compile Include =" $(MSBuildThisFileDirectory)Diagnostics\Suppressors\ObservablePropertyAttributeWithPropertyTargetDiagnosticSuppressor.cs" />
56
56
<Compile Include =" $(MSBuildThisFileDirectory)Diagnostics\DiagnosticDescriptors.cs" />
57
57
<Compile Include =" $(MSBuildThisFileDirectory)Diagnostics\DiagnosticExtensions.cs" />
58
+ <Compile Include =" $(MSBuildThisFileDirectory)Diagnostics\SuppressionDescriptors.cs" />
58
59
<Compile Include =" $(MSBuildThisFileDirectory)Extensions\AttributeDataExtensions.cs" />
59
60
<Compile Include =" $(MSBuildThisFileDirectory)Extensions\CompilationExtensions.cs" />
60
61
<Compile Include =" $(MSBuildThisFileDirectory)Extensions\HashCodeExtensions.cs" />
Original file line number Diff line number Diff line change
1
+ using Microsoft . CodeAnalysis ;
2
+
3
+ namespace CommunityToolkit . Mvvm . SourceGenerators . Diagnostics ;
4
+
5
+ /// <summary>
6
+ /// A container for all <see cref="SuppressionDescriptors"/> instances for suppressed diagnostics by analyzers in this project.
7
+ /// </summary>
8
+ internal static class SuppressionDescriptors
9
+ {
10
+ /// <summary>
11
+ /// Gets a <see cref="SuppressionDescriptor"/> for a field using [ObservableProperty] with on attribute list targeting a property.
12
+ /// </summary>
13
+ public static readonly SuppressionDescriptor PropertyAttributeListForObservablePropertyField = new (
14
+ id : "MVVMTKSPR0001" ,
15
+ suppressedDiagnosticId : "CS0657" ,
16
+ justification : "Fields using [ObservableProperty] can use [property:] attribute lists to forward attributes to the generated properties" ) ;
17
+ }
Original file line number Diff line number Diff line change 8
8
using Microsoft . CodeAnalysis . CSharp ;
9
9
using Microsoft . CodeAnalysis . CSharp . Syntax ;
10
10
using Microsoft . CodeAnalysis . Diagnostics ;
11
+ using static CommunityToolkit . Mvvm . SourceGenerators . Diagnostics . SuppressionDescriptors ;
11
12
12
13
namespace CommunityToolkit . Mvvm . SourceGenerators ;
13
14
@@ -30,14 +31,6 @@ namespace CommunityToolkit.Mvvm.SourceGenerators;
30
31
[ DiagnosticAnalyzer ( LanguageNames . CSharp ) ]
31
32
public sealed class ObservablePropertyAttributeWithPropertyTargetDiagnosticSuppressor : DiagnosticSuppressor
32
33
{
33
- /// <summary>
34
- /// Gets a <see cref="SuppressionDescriptor"/> for a field using [ObservableProperty] with on attribute list targeting a property.
35
- /// </summary>
36
- private static readonly SuppressionDescriptor PropertyAttributeListForObservablePropertyField = new (
37
- id : "MVVMTKSPR0001" ,
38
- suppressedDiagnosticId : "CS0657" ,
39
- justification : "Fields using [ObservableProperty] can use [property:] attribute lists to forward attributes to the generated properties" ) ;
40
-
41
34
/// <inheritdoc/>
42
35
public override ImmutableArray < SuppressionDescriptor > SupportedSuppressions => ImmutableArray . Create ( PropertyAttributeListForObservablePropertyField ) ;
43
36
You can’t perform that action at this time.
0 commit comments