提交 41cea56d 编写于 作者: Š Šimon Koníček

Adding a resource string

上级 439c9132
...@@ -12,6 +12,8 @@ namespace Microsoft.CodeAnalysis.CSharp.SplitIntoNestedIfStatements ...@@ -12,6 +12,8 @@ namespace Microsoft.CodeAnalysis.CSharp.SplitIntoNestedIfStatements
internal sealed class CSharpSplitIntoNestedIfStatementsCodeRefactoringProvider internal sealed class CSharpSplitIntoNestedIfStatementsCodeRefactoringProvider
: AbstractSplitIntoNestedIfStatementsCodeRefactoringProvider<IfStatementSyntax, ExpressionSyntax> : AbstractSplitIntoNestedIfStatementsCodeRefactoringProvider<IfStatementSyntax, ExpressionSyntax>
{ {
protected override string IfKeywordText => SyntaxFacts.GetText(SyntaxKind.IfKeyword);
protected override int LogicalAndSyntaxKind => (int)SyntaxKind.LogicalAndExpression; protected override int LogicalAndSyntaxKind => (int)SyntaxKind.LogicalAndExpression;
protected override bool IsConditionOfIfStatement(SyntaxNode expression, out IfStatementSyntax ifStatement) protected override bool IsConditionOfIfStatement(SyntaxNode expression, out IfStatementSyntax ifStatement)
......
...@@ -3235,6 +3235,15 @@ internal class FeaturesResources { ...@@ -3235,6 +3235,15 @@ internal class FeaturesResources {
} }
} }
/// <summary>
/// Looks up a localized string similar to Split into nested &apos;{0}&apos; statements.
/// </summary>
internal static string Split_into_nested_0_statements {
get {
return ResourceManager.GetString("Split_into_nested_0_statements", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Structures. /// Looks up a localized string similar to Structures.
/// </summary> /// </summary>
......
...@@ -1469,4 +1469,7 @@ This version used in: {2}</value> ...@@ -1469,4 +1469,7 @@ This version used in: {2}</value>
<data name="Fix_formatting" xml:space="preserve"> <data name="Fix_formatting" xml:space="preserve">
<value>Fix formatting</value> <value>Fix formatting</value>
</data> </data>
<data name="Split_into_nested_0_statements" xml:space="preserve">
<value>Split into nested '{0}' statements</value>
</data>
</root> </root>
\ No newline at end of file
...@@ -18,6 +18,8 @@ internal abstract class AbstractSplitIntoNestedIfStatementsCodeRefactoringProvid ...@@ -18,6 +18,8 @@ internal abstract class AbstractSplitIntoNestedIfStatementsCodeRefactoringProvid
where TIfStatementSyntax : SyntaxNode where TIfStatementSyntax : SyntaxNode
where TExpressionSyntax : SyntaxNode where TExpressionSyntax : SyntaxNode
{ {
protected abstract string IfKeywordText { get; }
protected abstract int LogicalAndSyntaxKind { get; } protected abstract int LogicalAndSyntaxKind { get; }
protected abstract bool IsConditionOfIfStatement(SyntaxNode expression, out TIfStatementSyntax ifStatement); protected abstract bool IsConditionOfIfStatement(SyntaxNode expression, out TIfStatementSyntax ifStatement);
...@@ -39,7 +41,10 @@ public sealed override async Task ComputeRefactoringsAsync(CodeRefactoringContex ...@@ -39,7 +41,10 @@ public sealed override async Task ComputeRefactoringsAsync(CodeRefactoringContex
if (IsPartOfBinaryExpressionChain(token, LogicalAndSyntaxKind, out var rootExpression) && if (IsPartOfBinaryExpressionChain(token, LogicalAndSyntaxKind, out var rootExpression) &&
IsConditionOfIfStatement(rootExpression, out _)) IsConditionOfIfStatement(rootExpression, out _))
{ {
context.RegisterRefactoring(new MyCodeAction(c => FixAsync(context.Document, context.Span, c))); context.RegisterRefactoring(
new MyCodeAction(
c => FixAsync(context.Document, context.Span, c),
IfKeywordText));
} }
} }
...@@ -86,8 +91,8 @@ private static bool IsPartOfBinaryExpressionChain(SyntaxToken token, int syntaxK ...@@ -86,8 +91,8 @@ private static bool IsPartOfBinaryExpressionChain(SyntaxToken token, int syntaxK
private sealed class MyCodeAction : CodeAction.DocumentChangeAction private sealed class MyCodeAction : CodeAction.DocumentChangeAction
{ {
public MyCodeAction(Func<CancellationToken, Task<Document>> createChangedDocument) public MyCodeAction(Func<CancellationToken, Task<Document>> createChangedDocument, string ifKeywordText)
: base("Split into nested 'if' statements", createChangedDocument) : base(string.Format(FeaturesResources.Split_into_nested_0_statements, ifKeywordText), createChangedDocument)
{ {
} }
} }
......
...@@ -152,6 +152,11 @@ ...@@ -152,6 +152,11 @@
<target state="new">Replace '{0}' with '{1}' </target> <target state="new">Replace '{0}' with '{1}' </target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="Split_into_nested_0_statements">
<source>Split into nested '{0}' statements</source>
<target state="new">Split into nested '{0}' statements</target>
<note />
</trans-unit>
<trans-unit id="Use_block_body_for_lambda_expressions"> <trans-unit id="Use_block_body_for_lambda_expressions">
<source>Use block body for lambda expressions</source> <source>Use block body for lambda expressions</source>
<target state="new">Use block body for lambda expressions</target> <target state="new">Use block body for lambda expressions</target>
......
...@@ -152,6 +152,11 @@ ...@@ -152,6 +152,11 @@
<target state="new">Replace '{0}' with '{1}' </target> <target state="new">Replace '{0}' with '{1}' </target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="Split_into_nested_0_statements">
<source>Split into nested '{0}' statements</source>
<target state="new">Split into nested '{0}' statements</target>
<note />
</trans-unit>
<trans-unit id="Use_block_body_for_lambda_expressions"> <trans-unit id="Use_block_body_for_lambda_expressions">
<source>Use block body for lambda expressions</source> <source>Use block body for lambda expressions</source>
<target state="new">Use block body for lambda expressions</target> <target state="new">Use block body for lambda expressions</target>
......
...@@ -152,6 +152,11 @@ ...@@ -152,6 +152,11 @@
<target state="new">Replace '{0}' with '{1}' </target> <target state="new">Replace '{0}' with '{1}' </target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="Split_into_nested_0_statements">
<source>Split into nested '{0}' statements</source>
<target state="new">Split into nested '{0}' statements</target>
<note />
</trans-unit>
<trans-unit id="Use_block_body_for_lambda_expressions"> <trans-unit id="Use_block_body_for_lambda_expressions">
<source>Use block body for lambda expressions</source> <source>Use block body for lambda expressions</source>
<target state="new">Use block body for lambda expressions</target> <target state="new">Use block body for lambda expressions</target>
......
...@@ -152,6 +152,11 @@ ...@@ -152,6 +152,11 @@
<target state="new">Replace '{0}' with '{1}' </target> <target state="new">Replace '{0}' with '{1}' </target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="Split_into_nested_0_statements">
<source>Split into nested '{0}' statements</source>
<target state="new">Split into nested '{0}' statements</target>
<note />
</trans-unit>
<trans-unit id="Use_block_body_for_lambda_expressions"> <trans-unit id="Use_block_body_for_lambda_expressions">
<source>Use block body for lambda expressions</source> <source>Use block body for lambda expressions</source>
<target state="new">Use block body for lambda expressions</target> <target state="new">Use block body for lambda expressions</target>
......
...@@ -152,6 +152,11 @@ ...@@ -152,6 +152,11 @@
<target state="new">Replace '{0}' with '{1}' </target> <target state="new">Replace '{0}' with '{1}' </target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="Split_into_nested_0_statements">
<source>Split into nested '{0}' statements</source>
<target state="new">Split into nested '{0}' statements</target>
<note />
</trans-unit>
<trans-unit id="Use_block_body_for_lambda_expressions"> <trans-unit id="Use_block_body_for_lambda_expressions">
<source>Use block body for lambda expressions</source> <source>Use block body for lambda expressions</source>
<target state="new">Use block body for lambda expressions</target> <target state="new">Use block body for lambda expressions</target>
......
...@@ -152,6 +152,11 @@ ...@@ -152,6 +152,11 @@
<target state="new">Replace '{0}' with '{1}' </target> <target state="new">Replace '{0}' with '{1}' </target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="Split_into_nested_0_statements">
<source>Split into nested '{0}' statements</source>
<target state="new">Split into nested '{0}' statements</target>
<note />
</trans-unit>
<trans-unit id="Use_block_body_for_lambda_expressions"> <trans-unit id="Use_block_body_for_lambda_expressions">
<source>Use block body for lambda expressions</source> <source>Use block body for lambda expressions</source>
<target state="new">Use block body for lambda expressions</target> <target state="new">Use block body for lambda expressions</target>
......
...@@ -152,6 +152,11 @@ ...@@ -152,6 +152,11 @@
<target state="new">Replace '{0}' with '{1}' </target> <target state="new">Replace '{0}' with '{1}' </target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="Split_into_nested_0_statements">
<source>Split into nested '{0}' statements</source>
<target state="new">Split into nested '{0}' statements</target>
<note />
</trans-unit>
<trans-unit id="Use_block_body_for_lambda_expressions"> <trans-unit id="Use_block_body_for_lambda_expressions">
<source>Use block body for lambda expressions</source> <source>Use block body for lambda expressions</source>
<target state="new">Use block body for lambda expressions</target> <target state="new">Use block body for lambda expressions</target>
......
...@@ -152,6 +152,11 @@ ...@@ -152,6 +152,11 @@
<target state="new">Replace '{0}' with '{1}' </target> <target state="new">Replace '{0}' with '{1}' </target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="Split_into_nested_0_statements">
<source>Split into nested '{0}' statements</source>
<target state="new">Split into nested '{0}' statements</target>
<note />
</trans-unit>
<trans-unit id="Use_block_body_for_lambda_expressions"> <trans-unit id="Use_block_body_for_lambda_expressions">
<source>Use block body for lambda expressions</source> <source>Use block body for lambda expressions</source>
<target state="new">Use block body for lambda expressions</target> <target state="new">Use block body for lambda expressions</target>
......
...@@ -152,6 +152,11 @@ ...@@ -152,6 +152,11 @@
<target state="new">Replace '{0}' with '{1}' </target> <target state="new">Replace '{0}' with '{1}' </target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="Split_into_nested_0_statements">
<source>Split into nested '{0}' statements</source>
<target state="new">Split into nested '{0}' statements</target>
<note />
</trans-unit>
<trans-unit id="Use_block_body_for_lambda_expressions"> <trans-unit id="Use_block_body_for_lambda_expressions">
<source>Use block body for lambda expressions</source> <source>Use block body for lambda expressions</source>
<target state="new">Use block body for lambda expressions</target> <target state="new">Use block body for lambda expressions</target>
......
...@@ -152,6 +152,11 @@ ...@@ -152,6 +152,11 @@
<target state="new">Replace '{0}' with '{1}' </target> <target state="new">Replace '{0}' with '{1}' </target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="Split_into_nested_0_statements">
<source>Split into nested '{0}' statements</source>
<target state="new">Split into nested '{0}' statements</target>
<note />
</trans-unit>
<trans-unit id="Use_block_body_for_lambda_expressions"> <trans-unit id="Use_block_body_for_lambda_expressions">
<source>Use block body for lambda expressions</source> <source>Use block body for lambda expressions</source>
<target state="new">Use block body for lambda expressions</target> <target state="new">Use block body for lambda expressions</target>
......
...@@ -152,6 +152,11 @@ ...@@ -152,6 +152,11 @@
<target state="new">Replace '{0}' with '{1}' </target> <target state="new">Replace '{0}' with '{1}' </target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="Split_into_nested_0_statements">
<source>Split into nested '{0}' statements</source>
<target state="new">Split into nested '{0}' statements</target>
<note />
</trans-unit>
<trans-unit id="Use_block_body_for_lambda_expressions"> <trans-unit id="Use_block_body_for_lambda_expressions">
<source>Use block body for lambda expressions</source> <source>Use block body for lambda expressions</source>
<target state="new">Use block body for lambda expressions</target> <target state="new">Use block body for lambda expressions</target>
......
...@@ -152,6 +152,11 @@ ...@@ -152,6 +152,11 @@
<target state="new">Replace '{0}' with '{1}' </target> <target state="new">Replace '{0}' with '{1}' </target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="Split_into_nested_0_statements">
<source>Split into nested '{0}' statements</source>
<target state="new">Split into nested '{0}' statements</target>
<note />
</trans-unit>
<trans-unit id="Use_block_body_for_lambda_expressions"> <trans-unit id="Use_block_body_for_lambda_expressions">
<source>Use block body for lambda expressions</source> <source>Use block body for lambda expressions</source>
<target state="new">Use block body for lambda expressions</target> <target state="new">Use block body for lambda expressions</target>
......
...@@ -152,6 +152,11 @@ ...@@ -152,6 +152,11 @@
<target state="new">Replace '{0}' with '{1}' </target> <target state="new">Replace '{0}' with '{1}' </target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="Split_into_nested_0_statements">
<source>Split into nested '{0}' statements</source>
<target state="new">Split into nested '{0}' statements</target>
<note />
</trans-unit>
<trans-unit id="Use_block_body_for_lambda_expressions"> <trans-unit id="Use_block_body_for_lambda_expressions">
<source>Use block body for lambda expressions</source> <source>Use block body for lambda expressions</source>
<target state="new">Use block body for lambda expressions</target> <target state="new">Use block body for lambda expressions</target>
......
...@@ -11,6 +11,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.SplitIntoNestedIfStatements ...@@ -11,6 +11,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.SplitIntoNestedIfStatements
Friend NotInheritable Class VisualBasicSplitIntoNestedIfStatementsCodeRefactoringProvider Friend NotInheritable Class VisualBasicSplitIntoNestedIfStatementsCodeRefactoringProvider
Inherits AbstractSplitIntoNestedIfStatementsCodeRefactoringProvider(Of MultiLineIfBlockSyntax, ExpressionSyntax) Inherits AbstractSplitIntoNestedIfStatementsCodeRefactoringProvider(Of MultiLineIfBlockSyntax, ExpressionSyntax)
Protected Overrides ReadOnly Property IfKeywordText As String = SyntaxFacts.GetText(SyntaxKind.IfKeyword)
Protected Overrides ReadOnly Property LogicalAndSyntaxKind As Integer = SyntaxKind.AndAlsoExpression Protected Overrides ReadOnly Property LogicalAndSyntaxKind As Integer = SyntaxKind.AndAlsoExpression
Protected Overrides Function IsConditionOfIfStatement(expression As SyntaxNode, ByRef ifStatement As MultiLineIfBlockSyntax) As Boolean Protected Overrides Function IsConditionOfIfStatement(expression As SyntaxNode, ByRef ifStatement As MultiLineIfBlockSyntax) As Boolean
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册