Skip to content

Commit fa939b4

Browse files
committed
Simplified generated filenames
Adding the type name of the generator is not necessary since Visual Studio already groups generated sources for each individual generator, which also automatically avoids conflicts
1 parent 9283f2c commit fa939b4

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

Microsoft.Toolkit.Mvvm.SourceGenerators/ComponentModel/ObservablePropertyGenerator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ private static void OnExecuteForProperties(
148148
.ToFullString();
149149

150150
// Add the partial type
151-
context.AddSource($"[ObservablePropertyAttribute]_[{classDeclarationSymbol.GetFullMetadataNameForFileName()}].cs", SourceText.From(source, Encoding.UTF8));
151+
context.AddSource($"{classDeclarationSymbol.GetFullMetadataNameForFileName()}.cs", SourceText.From(source, Encoding.UTF8));
152152
}
153153

154154
/// <summary>
@@ -528,7 +528,7 @@ public void OnExecuteForPropertyArgs(GeneratorExecutionContext context, IReadOnl
528528
.ToFullString();
529529

530530
// Add the partial type
531-
context.AddSource($"[ObservablePropertyAttribute]_[__KnownINotifyPropertyChangedOrChangingArgs].cs", SourceText.From(source, Encoding.UTF8));
531+
context.AddSource("__KnownINotifyPropertyChangedOrChangingArgs.cs", SourceText.From(source, Encoding.UTF8));
532532
}
533533

534534
/// <summary>

Microsoft.Toolkit.Mvvm.SourceGenerators/ComponentModel/ObservableValidatorValidateAllPropertiesGenerator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Licensed to the .NET Foundation under one or more agreements.
1+
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

@@ -154,7 +154,7 @@ public void Execute(GeneratorExecutionContext context)
154154
classAttributes = Array.Empty<AttributeListSyntax>();
155155

156156
// Add the partial type
157-
context.AddSource($"[ObservableValidator]_[{classSymbol.GetFullMetadataNameForFileName()}].cs", SourceText.From(source, Encoding.UTF8));
157+
context.AddSource($"{classSymbol.GetFullMetadataNameForFileName()}.cs", SourceText.From(source, Encoding.UTF8));
158158
}
159159
}
160160

Microsoft.Toolkit.Mvvm.SourceGenerators/ComponentModel/TransitiveMembersGenerator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ private void OnExecute(
183183
.ToFullString();
184184

185185
// Add the partial type
186-
context.AddSource($"[{this.attributeTypeName}]_[{classDeclarationSymbol.GetFullMetadataNameForFileName()}].cs", SourceText.From(source, Encoding.UTF8));
186+
context.AddSource($"{classDeclarationSymbol.GetFullMetadataNameForFileName()}.cs", SourceText.From(source, Encoding.UTF8));
187187
}
188188

189189
/// <summary>

Microsoft.Toolkit.Mvvm.SourceGenerators/Input/ICommandGenerator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Licensed to the .NET Foundation under one or more agreements.
1+
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

@@ -114,7 +114,7 @@ private static void OnExecute(
114114
.ToFullString();
115115

116116
// Add the partial type
117-
context.AddSource($"[ICommandAttribute]_[{classDeclarationSymbol.GetFullMetadataNameForFileName()}].cs", SourceText.From(source, Encoding.UTF8));
117+
context.AddSource($"{classDeclarationSymbol.GetFullMetadataNameForFileName()}.cs", SourceText.From(source, Encoding.UTF8));
118118
}
119119

120120
/// <summary>

Microsoft.Toolkit.Mvvm.SourceGenerators/Messaging/IMessengerRegisterAllGenerator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Licensed to the .NET Foundation under one or more agreements.
1+
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

@@ -209,7 +209,7 @@ public void Execute(GeneratorExecutionContext context)
209209
classAttributes = Array.Empty<AttributeListSyntax>();
210210

211211
// Add the partial type
212-
context.AddSource($"[IRecipient{{T}}]_[{classSymbol.GetFullMetadataNameForFileName()}].cs", SourceText.From(source, Encoding.UTF8));
212+
context.AddSource($"{classSymbol.GetFullMetadataNameForFileName()}.cs", SourceText.From(source, Encoding.UTF8));
213213
}
214214
}
215215

0 commit comments

Comments
 (0)