Improve analyzer diagnostics

This commit is contained in:
Oleksii Holub
2022-04-17 00:01:34 +00:00
committed by GitHub
parent 41cb8647b5
commit ed3e4f471e
21 changed files with 92 additions and 28 deletions

View File

@@ -13,7 +13,8 @@ public class OptionMustHaveUniqueShortNameAnalyzer : AnalyzerBase
public OptionMustHaveUniqueShortNameAnalyzer()
: base(
"Options must have unique short names",
"This option's short name must be unique within the command (comparison IS case sensitive).")
"This option's short name must be unique within the command (comparison IS case sensitive). " +
"Specified short name: '{0}'.")
{
}
@@ -50,7 +51,12 @@ public class OptionMustHaveUniqueShortNameAnalyzer : AnalyzerBase
if (option.ShortName == otherOption.ShortName)
{
context.ReportDiagnostic(CreateDiagnostic(propertyDeclaration.GetLocation()));
context.ReportDiagnostic(
CreateDiagnostic(
propertyDeclaration.Identifier.GetLocation(),
option.ShortName
)
);
}
}
}