mirror of
https://github.com/AlexMacocian/WpfExtended.git
synced 2026-07-15 14:59:30 +00:00
38 lines
1.8 KiB
C#
38 lines
1.8 KiB
C#
using Microsoft.CodeAnalysis;
|
|
using Microsoft.CodeAnalysis.Text;
|
|
|
|
namespace System.Extensions
|
|
{
|
|
internal static class Diagnostics
|
|
{
|
|
public const string DependencyPropertyGenerator_NoAttributeFound = "DGD 0001";
|
|
public const string DependencyPropertyGenerator_ClassMustBeTopLevel = "DGD 1001";
|
|
|
|
public static Diagnostic MissingAttributeDiagnostic(string attributeName, string attributeNamespace) => Diagnostic.Create(
|
|
new DiagnosticDescriptor(
|
|
DependencyPropertyGenerator_NoAttributeFound,
|
|
$"{attributeNamespace}.{attributeName} not found",
|
|
"Could not find attribute with name {0} in namespace {1}.",
|
|
"WpfExtended.SourceGeneration",
|
|
DiagnosticSeverity.Error,
|
|
true,
|
|
$"This error occurs when the attribute generated by the {nameof(DependencyPropertyGenerator)} is not found",
|
|
null),
|
|
Location.None,
|
|
attributeName, attributeNamespace);
|
|
|
|
public static Diagnostic ClassNotTopLevelDiagnostic(string className, string containingSymbol, SyntaxTree syntaxTree, TextSpan textSpan) => Diagnostic.Create(
|
|
new DiagnosticDescriptor(
|
|
DependencyPropertyGenerator_ClassMustBeTopLevel,
|
|
$"{className} must be top level",
|
|
"Class {0} must be top level. It is currently declared under {1}.",
|
|
"WpfExtended.SourceGeneration",
|
|
DiagnosticSeverity.Error,
|
|
true,
|
|
null,
|
|
null),
|
|
Location.Create(syntaxTree, textSpan),
|
|
className, containingSymbol);
|
|
}
|
|
}
|