Ejemplo n.º 1
0
        private static void RunRemoveCurrentRegion(Document document)
        {
            var textDocument = TestUtils.GetTextDocument(document);

            textDocument.Selection.MoveToLineAndOffset(18, 13);
            Assert.AreEqual(textDocument.Selection.CurrentLine, 18);

            var region = _codeModelHelper.RetrieveCodeRegionUnderCursor(textDocument);

            Assert.IsNotNull(region);

            _removeRegionLogic.RemoveRegion(region);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Called to execute the command.
        /// </summary>
        protected override void OnExecute()
        {
            base.OnExecute();

            var regionCommandScope = GetRegionCommandScope();

            switch (regionCommandScope)
            {
            case RegionCommandScope.CurrentLine:
                _removeRegionLogic.RemoveRegion(_codeModelHelper.RetrieveCodeRegionUnderCursor(ActiveTextDocument));
                break;

            case RegionCommandScope.Selection:
                _removeRegionLogic.RemoveRegions(ActiveTextDocument.Selection);
                break;

            case RegionCommandScope.Document:
                _removeRegionLogic.RemoveRegions(ActiveTextDocument);
                break;
            }
        }