提交 3e582736 编写于 作者: S Sam Harwell

Clarify use of 'messageFormat' as opposed to 'message'

上级 0a1ff19f
......@@ -35,18 +35,18 @@ internal abstract class AbstractCodeStyleDiagnosticAnalyzer : DiagnosticAnalyzer
protected readonly DiagnosticDescriptor UnnecessaryWithoutSuggestionDescriptor;
protected readonly LocalizableString _localizableTitle;
protected readonly LocalizableString _localizableMessage;
protected readonly LocalizableString _localizableMessageFormat;
private readonly bool _configurable;
protected AbstractCodeStyleDiagnosticAnalyzer(
string descriptorId, LocalizableString title,
LocalizableString message = null,
LocalizableString messageFormat = null,
bool configurable = true)
{
DescriptorId = descriptorId;
_localizableTitle = title;
_localizableMessage = message ?? title;
_localizableMessageFormat = messageFormat ?? title;
_configurable = configurable;
Descriptor = CreateDescriptor();
......@@ -62,19 +62,19 @@ protected DiagnosticDescriptor CreateUnnecessaryDescriptor()
protected DiagnosticDescriptor CreateUnnecessaryDescriptor(string descriptorId)
=> CreateDescriptorWithId(
descriptorId, _localizableTitle, _localizableMessage,
descriptorId, _localizableTitle, _localizableMessageFormat,
DiagnosticCustomTags.Unnecessary);
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; }
protected DiagnosticDescriptor CreateDescriptor(params string[] customTags)
=> CreateDescriptorWithId(DescriptorId, _localizableTitle, _localizableMessage, customTags);
=> CreateDescriptorWithId(DescriptorId, _localizableTitle, _localizableMessageFormat, customTags);
protected DiagnosticDescriptor CreateDescriptorWithTitle(LocalizableString title, params string[] customTags)
=> CreateDescriptorWithId(DescriptorId, title, title, customTags);
protected DiagnosticDescriptor CreateDescriptorWithId(
string id, LocalizableString title, LocalizableString message,
string id, LocalizableString title, LocalizableString messageFormat,
params string[] customTags)
{
if (!_configurable)
......@@ -83,7 +83,7 @@ protected DiagnosticDescriptor CreateDescriptorWithTitle(LocalizableString title
}
return new DiagnosticDescriptor(
id, title, message,
id, title, messageFormat,
DiagnosticCategory.Style,
DiagnosticSeverity.Hidden,
isEnabledByDefault: true,
......
......@@ -17,13 +17,13 @@ namespace Microsoft.CodeAnalysis.Diagnostics.Analyzers.NamingStyles
internal abstract class NamingStyleDiagnosticAnalyzerBase<TLanguageKindEnum> :
AbstractCodeStyleDiagnosticAnalyzer where TLanguageKindEnum : struct
{
private static readonly LocalizableString s_localizableMessage = new LocalizableResourceString(nameof(FeaturesResources.Naming_rule_violation_0), FeaturesResources.ResourceManager, typeof(FeaturesResources));
private static readonly LocalizableString s_localizableMessageFormat = new LocalizableResourceString(nameof(FeaturesResources.Naming_rule_violation_0), FeaturesResources.ResourceManager, typeof(FeaturesResources));
private static readonly LocalizableString s_localizableTitleNamingStyle = new LocalizableResourceString(nameof(FeaturesResources.Naming_Styles), FeaturesResources.ResourceManager, typeof(FeaturesResources));
protected NamingStyleDiagnosticAnalyzerBase()
: base(IDEDiagnosticIds.NamingRuleId,
s_localizableTitleNamingStyle,
s_localizableMessage)
s_localizableMessageFormat)
{
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册