/// <summary>
        /// The execute transaction inner.
        /// </summary>
        /// <param name="solution">
        /// The solution.
        /// </param>
        /// <param name="textControl">
        /// The text control.
        /// </param>
        public override void ExecuteTransactionInner(ISolution solution, ITextControl textControl)
        {
            ITreeNode element = Utils.GetElementAtCaret(solution, textControl);

            ITreeNode currentNode = element;

            ITreeNode rightNode = currentNode.FindFormattingRangeToRight();

            Utils.RemoveNewLineBefore(rightNode);
        }
예제 #2
0
        /// <summary>
        /// Comments must not be followed by blank line.
        /// </summary>
        /// <param name="node">
        /// The node.
        /// </param>
        private void CommentsMustNotBeFollowedByBlankLine(ITreeNode node)
        {
            for (ITreeNode currentNode = node; currentNode != null; currentNode = currentNode.NextSibling)
            {
                if (currentNode is ICommentNode && !(currentNode is IDocCommentNode))
                {
                    if (Utils.IsFirstNodeOnLine(currentNode))
                    {
                        ICommentNode tokenNode = currentNode as ICommentNode;

                        ITokenNode nextToken = tokenNode.GetNextToken();

                        if (nextToken != null && nextToken.IsNewLine())
                        {
                            ITokenNode nextNextToken = nextToken.GetNextToken();

                            if (nextNextToken != null)
                            {
                                ITokenNode nextNextNextToken = Utils.GetFirstNonWhitespaceTokenToRight(nextNextToken);

                                if (nextNextToken.IsNewLine() && !(nextNextNextToken is ICommentNode))
                                {
                                    ITreeNode rightNode = currentNode.FindFormattingRangeToRight();
                                    Utils.RemoveNewLineBefore(rightNode);
                                }
                            }
                        }
                    }
                }

                if (currentNode.FirstChild != null)
                {
                    this.CommentsMustNotBeFollowedByBlankLine(currentNode.FirstChild);
                }
            }
        }