提交 c70cac5b 编写于 作者: C Cyrus Najmabadi

Comments

上级 9cdde709
......@@ -16,6 +16,9 @@ internal abstract partial class AbstractCallWrapper<
TElementAccessExpressionSyntax,
TBaseArgumentListSyntax>
{
/// <summary>
/// A single `.Name` piece of a call-chunk like `.P1.P2.P3(...)`
/// </summary>
private readonly struct MemberChunk
{
public readonly SyntaxToken DotToken;
......@@ -28,17 +31,19 @@ public MemberChunk(SyntaxToken dotToken, TNameSyntax name)
}
/// <summary>
/// The length this chunk will be once all unnecessary whitespace has been
/// The length this name chunk will be once all unnecessary whitespace has been
/// removed from it.
/// </summary>
public int NormalizedLength()
=> DotToken.Width() + Name.Width();
}
/// <summary>
/// A full chunk of complex dotted call expression that we want to be
/// able to wrap as a single unit. It will have the form: `.P1.P2.P3(...)`
/// </summary>
private readonly struct CallChunk
{
// Optional as VB allows an initial dotted expression starting with <dot>
// in a `with` block.
public readonly ImmutableArray<MemberChunk> MemberChunks;
public readonly TBaseArgumentListSyntax ArgumentList;
......@@ -50,7 +55,7 @@ public CallChunk(ImmutableArray<MemberChunk> memberChunks, TBaseArgumentListSynt
}
/// <summary>
/// The length this chunk will be once all unnecessary whitespace has been
/// The length this call chunk will be once all unnecessary whitespace has been
/// removed from it.
/// </summary>
public int NormalizedLength()
......
......@@ -3,7 +3,6 @@
using System.Collections.Immutable;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeStyle;
using Microsoft.CodeAnalysis.Editing;
using Microsoft.CodeAnalysis.Formatting;
using Microsoft.CodeAnalysis.Options;
......@@ -22,6 +21,19 @@ internal abstract partial class AbstractCallWrapper<
TElementAccessExpressionSyntax,
TBaseArgumentListSyntax>
{
/// <summary>
/// Responsible for actually computing the set of potential wrapping options
/// for complex call expressions. The three options we offer are basically
/// 1. wrap-each. Each call-chunk will be wrapped and aligned with the first).
/// 2. wrap-long. The same as '1', except a call-chunk will only be wrapped
/// if it would go past the preferred wrapping column.
/// 3. Unwrap. All the call-chunks will be placed on a single line.
///
/// Note: These three options are always computed and returned. The caller
/// is the one that ends up eliminating any if they would be redundant. i.e.
/// if wrap-long produces the same results as wrap-each, then the caller will
/// filter it out.
/// </summary>
private class CallCodeActionComputer :
AbstractCodeActionComputer<AbstractCallWrapper>
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册