提交 4c91e16f 编写于 作者: C CyrusNajmabadi 提交者: GitHub

Merge pull request #13903 from CyrusNajmabadi/stylePage

Update loc-strings, and add a comment to recent style work.
......@@ -48,7 +48,7 @@ public override void Initialize(AnalysisContext context)
private void SyntaxNodeAction(SyntaxNodeAnalysisContext syntaxContext)
{
var options = syntaxContext.Options.GetOptionSet();
var styleOption = options.GetOption(CSharpCodeStyleOptions.PreferConditionalFunctionCall);
var styleOption = options.GetOption(CSharpCodeStyleOptions.PreferConditionalDelegateCall);
if (!styleOption.Value)
{
// Bail immediately if the user has disabled this feature.
......
......@@ -871,11 +871,11 @@ internal class CSharpVSResources {
}
/// <summary>
/// Looks up a localized string similar to Prefer conditional function call.
/// Looks up a localized string similar to Prefer conditional delegate call.
/// </summary>
internal static string Prefer_conditional_function_call {
internal static string Prefer_conditional_delegate_call {
get {
return ResourceManager.GetString("Prefer_conditional_function_call", resourceCulture);
return ResourceManager.GetString("Prefer_conditional_delegate_call", resourceCulture);
}
}
......
......@@ -489,7 +489,7 @@
<data name="Prefer_throw_expression" xml:space="preserve">
<value>Prefer throw-expression</value>
</data>
<data name="Prefer_conditional_function_call" xml:space="preserve">
<value>Prefer conditional function call</value>
<data name="Prefer_conditional_delegate_call" xml:space="preserve">
<value>Prefer conditional delegate call</value>
</data>
</root>
\ No newline at end of file
......@@ -317,7 +317,7 @@ internal StyleViewModel(OptionSet optionSet, IServiceProvider serviceProvider) :
CodeStyleItems.Add(new SimpleCodeStyleOptionViewModel(CSharpCodeStyleOptions.UseImplicitTypeWhereApparent, CSharpVSResources.When_variable_type_is_apparent, s_varWhereApparentPreviewTrue, s_varWhereApparentPreviewFalse, this, optionSet, varGroupTitle, typeStylePreferences));
CodeStyleItems.Add(new SimpleCodeStyleOptionViewModel(CSharpCodeStyleOptions.UseImplicitTypeWherePossible, CSharpVSResources.Elsewhere, s_varWherePossiblePreviewTrue, s_varWherePossiblePreviewFalse, this, optionSet, varGroupTitle, typeStylePreferences));
CodeStyleItems.Add(new SimpleCodeStyleOptionViewModel(CSharpCodeStyleOptions.PreferConditionalFunctionCall, CSharpVSResources.Prefer_conditional_function_call, s_preferConditionalFunctionCall, s_preferConditionalFunctionCall, this, optionSet, nullCheckingTitle));
CodeStyleItems.Add(new SimpleCodeStyleOptionViewModel(CSharpCodeStyleOptions.PreferConditionalDelegateCall, CSharpVSResources.Prefer_conditional_delegate_call, s_preferConditionalFunctionCall, s_preferConditionalFunctionCall, this, optionSet, nullCheckingTitle));
//CodeStyleItems.Add(new SimpleCodeStyleOptionViewModel(CodeStyleOptions.PreferThrowExpression, CSharpVSResources.Prefer_throw_expression, s_preferThrowExpression, s_preferThrowExpression, this, optionSet, nullCheckingTitle));
}
}
......
......@@ -20,7 +20,7 @@ internal static class CSharpCodeStyleOptions
public static readonly Option<CodeStyleOption<bool>> UseImplicitTypeWherePossible = new Option<CodeStyleOption<bool>>(nameof(CSharpCodeStyleOptions), nameof(UseImplicitTypeWherePossible), defaultValue: CodeStyleOption<bool>.Default,
storageLocations: new RoamingProfileStorageLocation("TextEditor.CSharp.Specific.UseImplicitTypeWherePossible"));
public static readonly Option<CodeStyleOption<bool>> PreferConditionalFunctionCall = new Option<CodeStyleOption<bool>>(nameof(CSharpCodeStyleOptions), nameof(PreferConditionalFunctionCall), defaultValue: CodeStyleOptions.trueWithSuggestionEnforcement,
storageLocations: new RoamingProfileStorageLocation("TextEditor.CSharp.Specific.PreferConditionalFunctionCall"));
public static readonly Option<CodeStyleOption<bool>> PreferConditionalDelegateCall = new Option<CodeStyleOption<bool>>(nameof(CSharpCodeStyleOptions), nameof(PreferConditionalDelegateCall), defaultValue: CodeStyleOptions.trueWithSuggestionEnforcement,
storageLocations: new RoamingProfileStorageLocation("TextEditor.CSharp.Specific.PreferConditionalDelegateCall"));
}
}
......@@ -36,6 +36,9 @@ public sealed override async Task<CodeAction> GetFixAsync(FixAllContext fixAllCo
var currentSolution = fixAllState.Solution;
foreach (var task in updatedDocumentTasks)
{
// 'await' the tasks so that if any completed in a cancelled manner then we'll
// throw the right exception here. Calling .Result on the tasks might end up
// with AggregateExceptions being thrown instead.
var updatedDocument = await task.ConfigureAwait(false);
currentSolution = currentSolution.WithDocumentSyntaxRoot(
updatedDocument.Id,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册