未验证 提交 8ddf0dd2 编写于 作者: D dotnet-automerge-bot 提交者: GitHub

Merge pull request #37734 from dotnet/merges/master-to-master-vs-deps

Merge master to master-vs-deps
......@@ -16,10 +16,10 @@
<FileSignInfo Include="Microsoft.CodeAnalysis.VisualBasic.ExpressionEvaluator.ResultProvider.dll" PublicKeyToken="31bf3856ad364e35" TargetFramework=".NETStandard,Version=v1.3" CertificateName="Microsoft101240624"/>
<FileSignInfo Include="Microsoft.CodeAnalysis.ExpressionEvaluator.FunctionResolver.dll" PublicKeyToken="31bf3856ad364e35" TargetFramework=".NETStandard,Version=v1.3" CertificateName="Microsoft101240624"/>
<FileSignInfo Include="Microsoft.CodeAnalysis.ExpressionEvaluator.ResultProvider.dll" PublicKeyToken="31bf3856ad364e35" TargetFramework=".NETFramework,Version=v2.0" CertificateName="MicrosoftSHA1Win8WinBlue"/>
<FileSignInfo Include="Microsoft.CodeAnalysis.CSharp.ExpressionEvaluator.ResultProvider.dll" PublicKeyToken="31bf3856ad364e35" TargetFramework=".NETFramework,Version=v2.0" CertificateName="MicrosoftSHA1Win8WinBlue"/>
<FileSignInfo Include="Microsoft.CodeAnalysis.VisualBasic.ExpressionEvaluator.ResultProvider.dll" PublicKeyToken="31bf3856ad364e35" TargetFramework=".NETFramework,Version=v2.0" CertificateName="MicrosoftSHA1Win8WinBlue"/>
<FileSignInfo Include="Microsoft.CodeAnalysis.ExpressionEvaluator.FunctionResolver.dll" PublicKeyToken="31bf3856ad364e35" TargetFramework=".NETFramework,Version=v4.5" CertificateName="MicrosoftSHA1Win8WinBlue"/>
<FileSignInfo Include="Microsoft.CodeAnalysis.ExpressionEvaluator.ResultProvider.dll" PublicKeyToken="31bf3856ad364e35" TargetFramework=".NETFramework,Version=v2.0" CertificateName="MicrosoftWin8WinBlue"/>
<FileSignInfo Include="Microsoft.CodeAnalysis.CSharp.ExpressionEvaluator.ResultProvider.dll" PublicKeyToken="31bf3856ad364e35" TargetFramework=".NETFramework,Version=v2.0" CertificateName="MicrosoftWin8WinBlue"/>
<FileSignInfo Include="Microsoft.CodeAnalysis.VisualBasic.ExpressionEvaluator.ResultProvider.dll" PublicKeyToken="31bf3856ad364e35" TargetFramework=".NETFramework,Version=v2.0" CertificateName="MicrosoftWin8WinBlue"/>
<FileSignInfo Include="Microsoft.CodeAnalysis.ExpressionEvaluator.FunctionResolver.dll" PublicKeyToken="31bf3856ad364e35" TargetFramework=".NETFramework,Version=v4.5" CertificateName="MicrosoftWin8WinBlue"/>
<FileSignInfo Include="System.Collections.Immutable.dll" CertificateName="Microsoft101240624"/>
<FileSignInfo Include="System.Reflection.Metadata.dll" CertificateName="Microsoft101240624"/>
......
......@@ -753,7 +753,6 @@ class Test2Attribute : Attribute { }
}";
await TestAsync<MethodDeclarationSyntax>(testText);
}
#endregion
#region Extractions general
......@@ -1014,7 +1013,6 @@ C LocalFunction(C c)
}";
await TestMissingAsync<LocalFunctionStatementSyntax>(testText);
}
#endregion
#region Test predicate
......@@ -1511,7 +1509,6 @@ int N(int a)
}";
await TestAsync<ArgumentSyntax>(testText, predicate: n => n.Parent is TupleExpressionSyntax);
}
#endregion
}
}
......@@ -51,12 +51,11 @@ internal abstract class AbstractRefactoringHelpersService<TExpressionSyntax, TAr
// want the whole node `var a = b;`
// Handle selections:
// - The smallest node whose FullSpan includes the whole (trimmed) selection
// - Most/the whole wanted Node is selected (e.g. `C [|Fun() {}|]`
// - The smallest node whose FullSpan includes the whole (trimmed) selection
// - Using FullSpan is important because it handles over-selection with comments
// - Travels upwards through same-sized (FullSpan) nodes, extracting
// - Handles situations where:
// - Token with wanted Node as direct parent is selected (e.g. IdentifierToken for LocalFunctionStatement: `C [|Fun|]() {}`)
// - Most/the whole wanted Node is selected (e.g. `C [|Fun() {}|]`
// - Travels upwards through same-sized (FullSpan) nodes, extracting
// - Token with wanted Node as direct parent is selected (e.g. IdentifierToken for LocalFunctionStatement: `C [|Fun|]() {}`)
// Note: Whether we have selection or location has to be checked against original selection because selecting just
// whitespace could collapse selectionTrimmed into and empty Location. But we don't want `[| |]token`
// registering as ` [||]token`.
......@@ -108,6 +107,8 @@ internal abstract class AbstractRefactoringHelpersService<TExpressionSyntax, TAr
// We want to treat more types like expressions, e.g.: ArgumentSyntax should still trigger even if deep-in.
if (IsWantedTypeExpressionLike<TSyntaxNode>())
{
// Reason to treat Arguments (and potentially others) as Expression-like:
// https://github.com/dotnet/roslyn/pull/37295#issuecomment-516145904
await AddNodesDeepIn(document, location, relevantNodesBuilder, cancellationToken).ConfigureAwait(false);
}
}
......@@ -464,6 +465,7 @@ private static TextSpan GetSpanWithoutAttributes(SyntaxNode node, SyntaxNode roo
// //Comment1
// [||]object Property1 { get; set; }
// the comment node being part of the next token's (`object`) leading trivia and not the AttributeList's node.
// - In case only attribute is written we need to be careful to not to use next (unrelated) token as beginning current the node.
var attributeList = syntaxFacts.GetAttributeLists(node);
if (attributeList.Any())
{
......
......@@ -22,7 +22,7 @@ internal interface IRefactoringHelpersService : ILanguageService
/// - Selection is zero-width and in whitespace that corresponds to a Token whose direct ancestor is of type of type <typeparamref name="TSyntaxNode"/>.
/// - Selection is zero-width and in a header (defined by ISyntaxFacts helpers) of an node of type of type <typeparamref name="TSyntaxNode"/>.
/// - Token whose direct parent of type <typeparamref name="TSyntaxNode"/> is selected.
/// - Wanted node is an expression / argument and curent empty selection is within such syntax node (arbitrarily deep) on its first line.
/// - Selection is zero-width and wanted node is an expression / argument with selection within such syntax node (arbitrarily deep) on its first line.
/// - Whole node of a type <typeparamref name="TSyntaxNode"/> is selected.
/// </para>
/// <para>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册