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

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