Add more contextual information to diagnostics

This commit is contained in:
Oleksii Holub
2022-04-20 20:27:53 +03:00
parent 864efd3179
commit 5c848056c5
10 changed files with 42 additions and 18 deletions

View File

@@ -15,7 +15,8 @@ public class ParameterMustHaveUniqueNameAnalyzer : AnalyzerBase
: base(
"Parameters must have unique names",
"This parameter's name must be unique within the command (comparison IS NOT case sensitive). " +
"Specified name: '{0}'.")
"Specified name: `{0}`. " +
"Property bound to another parameter with the same name: `{1}`.")
{
}
@@ -55,7 +56,8 @@ public class ParameterMustHaveUniqueNameAnalyzer : AnalyzerBase
context.ReportDiagnostic(
CreateDiagnostic(
propertyDeclaration.Identifier.GetLocation(),
parameter.Name
parameter.Name,
otherProperty.Name
)
);
}