本文整理汇总了C#中NextAction.Invoke方法的典型用法代码示例。如果您正苦于以下问题:C# NextAction.Invoke方法的具体用法?C# NextAction.Invoke怎么用?C# NextAction.Invoke使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NextAction
的用法示例。
在下文中一共展示了NextAction.Invoke方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddIndentBlockOperations
public override void AddIndentBlockOperations(List<IndentBlockOperation> list, SyntaxNode node, OptionSet optionSet, NextAction<IndentBlockOperation> nextOperation)
{
nextOperation.Invoke(list);
var queryExpression = node as QueryExpressionSyntax;
if (queryExpression != null)
{
var firstToken = queryExpression.FromClause.Expression.GetFirstToken(includeZeroWidth: true);
var lastToken = queryExpression.FromClause.Expression.GetLastToken(includeZeroWidth: true);
AddIndentBlockOperation(list, queryExpression.FromClause.FromKeyword, firstToken, lastToken);
for (int i = 0; i < queryExpression.Body.Clauses.Count; i++)
{
// if it is nested query expression
var fromClause = queryExpression.Body.Clauses[i] as FromClauseSyntax;
if (fromClause != null)
{
firstToken = fromClause.Expression.GetFirstToken(includeZeroWidth: true);
lastToken = fromClause.Expression.GetLastToken(includeZeroWidth: true);
AddIndentBlockOperation(list, fromClause.FromKeyword, firstToken, lastToken);
}
}
// set alignment line for query expression
var baseToken = queryExpression.GetFirstToken(includeZeroWidth: true);
var endToken = queryExpression.GetLastToken(includeZeroWidth: true);
if (!baseToken.IsMissing && !baseToken.Equals(endToken))
{
var startToken = baseToken.GetNextToken(includeZeroWidth: true);
SetAlignmentBlockOperation(list, baseToken, startToken, endToken);
}
}
}
示例2: AddIndentBlockOperations
public override void AddIndentBlockOperations(List<IndentBlockOperation> list, SyntaxNode node, OptionSet optionSet, NextAction<IndentBlockOperation> nextOperation)
{
nextOperation.Invoke(list);
if (s_allowableKinds.Contains(node.Kind()))
{
AddChangeSignatureIndentOperation(list, node);
}
}
示例3: AddAnchorIndentationOperations
public override void AddAnchorIndentationOperations(List<AnchorIndentationOperation> list, SyntaxNode node, OptionSet optionSet, NextAction<AnchorIndentationOperation> nextOperation)
{
if (node.IsKind(SyntaxKind.SimpleLambdaExpression) || node.IsKind(SyntaxKind.ParenthesizedLambdaExpression) || node.IsKind(SyntaxKind.AnonymousMethodExpression))
{
return;
}
nextOperation.Invoke(list);
}
示例4: AddSuppressOperations
public override void AddSuppressOperations(List<SuppressOperation> list, SyntaxNode node, SyntaxToken lastToken, OptionSet optionSet, NextAction<SuppressOperation> nextOperation)
{
nextOperation.Invoke(list);
var queryExpression = node as QueryExpressionSyntax;
if (queryExpression != null)
{
AddSuppressWrappingIfOnSingleLineOperation(list, queryExpression.GetFirstToken(includeZeroWidth: true), queryExpression.GetLastToken(includeZeroWidth: true));
}
}
示例5: AddSuppressOperations
public override void AddSuppressOperations(List<SuppressOperation> list, SyntaxNode node, SyntaxToken lastToken, OptionSet optionSet, NextAction<SuppressOperation> nextOperation)
{
nextOperation.Invoke(list);
AddInitializerSuppressOperations(list, node);
AddBraceSuppressOperations(list, node, lastToken);
AddStatementExceptBlockSuppressOperations(list, node);
AddSpecificNodesSuppressOperations(list, node);
}
示例6: AddSuppressOperations
public override void AddSuppressOperations(List<SuppressOperation> list, SyntaxNode node, OptionSet optionSet, NextAction<SuppressOperation> nextOperation)
{
nextOperation.Invoke(list);
if (!node.ContainsAnnotations)
{
return;
}
AddPropertyDeclarationSuppressOperations(list, node);
AddInitializerSuppressOperations(list, node);
}
示例7: AddIndentBlockOperations
public override void AddIndentBlockOperations(List<IndentBlockOperation> list, SyntaxNode node, OptionSet optionSet, NextAction<IndentBlockOperation> nextOperation)
{
nextOperation.Invoke(list);
AddBlockIndentationOperation(list, node, optionSet);
AddLabelIndentationOperation(list, node, optionSet);
AddSwitchIndentationOperation(list, node, optionSet);
AddEmbeddedStatementsIndentationOperation(list, node);
AddTypeParameterConstraintClauseOperation(list, node);
}
示例8: AddAlignTokensOperations
public override void AddAlignTokensOperations(List<AlignTokensOperation> list, SyntaxNode node, OptionSet optionSet, NextAction<AlignTokensOperation> nextOperation)
{
nextOperation.Invoke(list);
var syntaxNode = node;
var bracePair = node.GetBracePair();
if (!bracePair.IsValidBracePair())
{
return;
}
if (syntaxNode.IsLambdaBodyBlock() ||
node is InitializerExpressionSyntax)
{
AddAlignIndentationOfTokensToFirstTokenOfBaseTokenLineOperation(list, syntaxNode, bracePair.Item1, SpecializedCollections.SingletonEnumerable((SyntaxToken)bracePair.Item2));
}
}
示例9: AddIndentBlockOperations
public override void AddIndentBlockOperations(List<IndentBlockOperation> list, SyntaxNode node, OptionSet optionSet, NextAction<IndentBlockOperation> nextOperation)
{
nextOperation.Invoke(list);
var bracePair = node.GetBracePair();
// don't put block indentation operation if the block only contains lambda expression body block
if (node.IsLambdaBodyBlock() || !bracePair.IsValidBracePair())
{
return;
}
if (optionSet.GetOption(CSharpFormattingOptions.OpenCloseBracesIndent))
{
AddIndentBlockOperation(list, bracePair.Item1, bracePair.Item1, bracePair.Item1.Span);
AddIndentBlockOperation(list, bracePair.Item2, bracePair.Item2, bracePair.Item2.Span);
}
}
示例10: AddSuppressOperations
public override void AddSuppressOperations(List<SuppressOperation> list, SyntaxNode node, OptionSet optionSet, NextAction<SuppressOperation> nextOperation)
{
nextOperation.Invoke(list);
AddBraceSuppressOperations(list, node);
AddStatementExceptBlockSuppressOperations(list, node);
AddSpecificNodesSuppressOperations(list, node);
if (!optionSet.GetOption(CSharpFormattingOptions.WrappingPreserveSingleLine))
{
RemoveSuppressOperationForBlock(list, node);
}
if (!optionSet.GetOption(CSharpFormattingOptions.WrappingKeepStatementsOnSingleLine))
{
RemoveSuppressOperationForStatementMethodDeclaration(list, node);
}
}
示例11: AddAnchorIndentationOperations
public override void AddAnchorIndentationOperations(List<AnchorIndentationOperation> list, SyntaxNode node, OptionSet optionSet, NextAction<AnchorIndentationOperation> nextOperation)
{
nextOperation.Invoke(list);
var queryClause = node as QueryClauseSyntax;
if (queryClause != null)
{
var firstToken = queryClause.GetFirstToken(includeZeroWidth: true);
AddAnchorIndentationOperation(list, firstToken, queryClause.GetLastToken(includeZeroWidth: true));
}
var selectOrGroupClause = node as SelectOrGroupClauseSyntax;
if (selectOrGroupClause != null)
{
var firstToken = selectOrGroupClause.GetFirstToken(includeZeroWidth: true);
AddAnchorIndentationOperation(list, firstToken, selectOrGroupClause.GetLastToken(includeZeroWidth: true));
}
var continuation = node as QueryContinuationSyntax;
if (continuation != null)
{
AddAnchorIndentationOperation(list, continuation.IntoKeyword, continuation.GetLastToken(includeZeroWidth: true));
}
}
示例12: AddAnchorIndentationOperations
public override void AddAnchorIndentationOperations(List<AnchorIndentationOperation> list, SyntaxNode node, OptionSet optionSet, NextAction<AnchorIndentationOperation> nextOperation)
{
nextOperation.Invoke(list);
if (node.IsKind(SyntaxKind.SimpleLambdaExpression) || node.IsKind(SyntaxKind.ParenthesizedLambdaExpression))
{
AddAnchorIndentationOperation(list, node);
return;
}
if (node.IsKind(SyntaxKind.AnonymousMethodExpression))
{
AddAnchorIndentationOperation(list, node);
return;
}
var block = node as BlockSyntax;
if (block != null)
{
// if it is not nested block, then its anchor will be first token that this block is
// associated with. otherwise, "{" of block is the anchor token its children would follow
if (block.Parent == null || block.Parent is BlockSyntax)
{
AddAnchorIndentationOperation(list, block);
return;
}
else
{
AddAnchorIndentationOperation(list,
block.Parent.GetFirstToken(includeZeroWidth: true),
block.GetLastToken(includeZeroWidth: true));
return;
}
}
var statement = node as StatementSyntax;
if (statement != null)
{
AddAnchorIndentationOperation(list, statement);
return;
}
var usingNode = node as UsingDirectiveSyntax;
if (usingNode != null)
{
AddAnchorIndentationOperation(list, usingNode);
return;
}
var namespaceNode = node as NamespaceDeclarationSyntax;
if (namespaceNode != null)
{
AddAnchorIndentationOperation(list, namespaceNode);
return;
}
var typeNode = node as TypeDeclarationSyntax;
if (typeNode != null)
{
AddAnchorIndentationOperation(list, typeNode);
return;
}
var memberDeclNode = node as MemberDeclarationSyntax;
if (memberDeclNode != null)
{
AddAnchorIndentationOperation(list, memberDeclNode);
return;
}
var accessorDeclNode = node as AccessorDeclarationSyntax;
if (accessorDeclNode != null)
{
AddAnchorIndentationOperation(list, accessorDeclNode);
return;
}
}
示例13: AddIndentBlockOperations
public override void AddIndentBlockOperations(List<IndentBlockOperation> list, SyntaxNode node, OptionSet optionSet, NextAction<IndentBlockOperation> nextOperation)
{
// these nodes should be from syntax tree from ITextSnapshot.
Contract.Requires(node.SyntaxTree != null);
Contract.Requires(node.SyntaxTree.GetText() != null);
nextOperation.Invoke(list);
ReplaceCaseIndentationRules(list, node);
if (node is BaseParameterListSyntax ||
node is TypeArgumentListSyntax ||
node is TypeParameterListSyntax ||
node.IsKind(SyntaxKind.Interpolation))
{
AddIndentBlockOperations(list, node);
return;
}
var argument = node as BaseArgumentListSyntax;
if (argument != null && argument.Parent.Kind() != SyntaxKind.ThisConstructorInitializer)
{
AddIndentBlockOperations(list, argument);
return;
}
var constructorInitializer = node as ConstructorInitializerSyntax;
if (constructorInitializer != null && constructorInitializer.ArgumentList.OpenParenToken.Kind() != SyntaxKind.None)
{
var text = node.SyntaxTree.GetText();
// 3 different cases
// first case : this or base is the first token on line
// second case : colon is the first token on line
var colonIsFirstTokenOnLine = !constructorInitializer.ColonToken.IsMissing && constructorInitializer.ColonToken.IsFirstTokenOnLine(text);
var thisOrBaseIsFirstTokenOnLine = !constructorInitializer.ThisOrBaseKeyword.IsMissing && constructorInitializer.ThisOrBaseKeyword.IsFirstTokenOnLine(text);
if (colonIsFirstTokenOnLine || thisOrBaseIsFirstTokenOnLine)
{
list.Add(FormattingOperations.CreateRelativeIndentBlockOperation(
constructorInitializer.ThisOrBaseKeyword,
constructorInitializer.ArgumentList.OpenParenToken.GetNextToken(includeZeroWidth: true),
constructorInitializer.ArgumentList.CloseParenToken.GetPreviousToken(includeZeroWidth: true),
indentationDelta: 1,
option: IndentBlockOption.RelativePosition));
}
else
{
// third case : none of them are the first token on the line
AddIndentBlockOperations(list, constructorInitializer.ArgumentList);
}
}
}
示例14: AddSuppressOperations
public override void AddSuppressOperations(List<SuppressOperation> list, SyntaxNode node, OptionSet optionSet, NextAction<SuppressOperation> nextOperation)
{
nextOperation.Invoke(list);
SuppressVariableDeclaration(list, node, optionSet);
}
示例15: AddSuppressOperations
public void AddSuppressOperations(List<SuppressOperation> list, SyntaxNode node, OptionSet optionSet, NextAction<SuppressOperation> nextOperation)
{
nextOperation.Invoke(list);
}