Esempio n. 1
0
        private static void MoveCodeBlock(CodeElement parent, CodeElement block, EditPoint pastePoint)
        {
            EditPoint  blockStartPoint       = block.StartPoint.CreateEditPoint();
            EditPoint  previousblockEndPoint = blockStartPoint.CreateEditPoint();
            EditPoint  editPoint             = blockStartPoint.CreateEditPoint();
            TextRanges trs = null;

            if (editPoint.FindPattern("}", (int)vsFindOptions.vsFindOptionsBackwards, ref previousblockEndPoint, ref trs))
            {
                if (previousblockEndPoint.GreaterThan(parent.StartPoint))
                {
                    blockStartPoint = previousblockEndPoint;
                }
            }

            blockStartPoint.Cut(block.EndPoint, false);
            pastePoint.Paste();
            pastePoint.Insert("\r\n\r\n");
        }