示例#1
0
        /// <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)
        {
            Utils.FormatLineForTextControl(solution, textControl);

            IElement   element         = Utils.GetElementAtCaret(solution, textControl);
            IBlockNode containingBlock = element.GetContainingElement <IBlockNode>(true);

            if (containingBlock != null)
            {
                new SpacingRules().CommasMustBeSpacedCorrectly(containingBlock.ToTreeNode());
            }

            IFieldDeclarationNode fieldDeclarationNode = element.GetContainingElement <IFieldDeclarationNode>(true);

            if (fieldDeclarationNode != null)
            {
                new SpacingRules().CommasMustBeSpacedCorrectly(fieldDeclarationNode.ToTreeNode());
            }
        }
示例#2
0
        /// <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)
        {
            IElement   element         = Utils.GetElementAtCaret(solution, textControl);
            IBlockNode containingBlock = element.GetContainingElement <IBlockNode>(true);

            if (containingBlock != null)
            {
                CSharpFormatterHelper.FormatterInstance.Format(containingBlock);
                new LayoutRules().CurlyBracketsForMultiLineStatementsMustNotShareLine(containingBlock.ToTreeNode());
            }
            else
            {
                IFieldDeclarationNode fieldDeclarationNode = element.GetContainingElement <IFieldDeclarationNode>(true);
                if (fieldDeclarationNode != null)
                {
                    CSharpFormatterHelper.FormatterInstance.Format(fieldDeclarationNode);
                    new LayoutRules().CurlyBracketsForMultiLineStatementsMustNotShareLine(fieldDeclarationNode.ToTreeNode());
                }
            }
        }