/// <summary>Creates a new T4 code block.</summary> /// <param name="text">The C# code.</param> /// <param name="anchor">Where to insert the code.</param> /// <returns>A new instance of <see cref="IT4CodeBlock"/>.</returns> protected override IT4CodeBlock CreateInlineCodeBlock(string text, ITreeNode anchor) { var existingFeatureNode = anchor.FindPreviousNode(node => node is IT4FeatureBlock ? TreeNodeActionType.ACCEPT : TreeNodeActionType.CONTINUE); return(existingFeatureNode != null ? T4ElementFactory.CreateFeatureBlock(text) : T4ElementFactory.CreateStatementBlock(text)); }
private ITreeNode FindPreviousNonWhiteSpaceNode(ITreeNode currentNode) { return(currentNode.FindPreviousNode(x => x is IWhitespaceNode ? TreeNodeActionType.CONTINUE : TreeNodeActionType.ACCEPT)); }