{"action":"created","issue":{"url":"https://api.github.com/repos/codecadwallader/codemaid/issues/272","repository_url":"https://api.github.com/repos/codecadwallader/codemaid","labels_url":"https://api.github.com/repos/codecadwallader/codemaid/issues/272/labels{/name}","comments_url":"https://api.github.com/repos/codecadwallader/codemaid/issues/272/comments","events_url":"https://api.github.com/repos/codecadwallader/codemaid/issues/272/events","html_url":"https://github.com/codecadwallader/codemaid/issues/272","id":147335583,"number":272,"title":"Reorganizing: Remove existing regions affects in-method regions as well","user":{"login":"khorvat","id":1308966,"avatar_url":"https://avatars.githubusercontent.com/u/1308966?v=3","gravatar_id":"","url":"https://api.github.com/users/khorvat","html_url":"https://github.com/khorvat","followers_url":"https://api.github.com/users/khorvat/followers","following_url":"https://api.github.com/users/khorvat/following{/other_user}","gists_url":"https://api.github.com/users/khorvat/gists{/gist_id}","starred_url":"https://api.github.com/users/khorvat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/khorvat/subscriptions","organizations_url":"https://api.github.com/users/khorvat/orgs","repos_url":"https://api.github.com/users/khorvat/repos","events_url":"https://api.github.com/users/khorvat/events{/privacy}","received_events_url":"https://api.github.com/users/khorvat/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/codecadwallader/codemaid/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/codecadwallader/codemaid/labels/feature:%20reorganizing","name":"feature: reorganizing","color":"057363"},{"url":"https://api.github.com/repos/codecadwallader/codemaid/labels/reproduced","name":"reproduced","color":"207de5"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":15,"created_at":"2016-04-11T07:12:48Z","updated_at":"2016-04-16T11:52:32Z","closed_at":null,"body":"### Environment\r\n- Visual Studio version: 2013 Premium Update 5\r\n- CodeMaid version: 10.0.72\r\n- Code language: C#\r\n\r\n### Description\r\nReorganizing not working properly in case when you add new methods or properties to existing class.\r\n\r\n### Steps to recreate\r\n* Insert this code\r\n\r\n`\r\n    using System;\r\n    using System.Web.Mvc;\r\n\r\n    namespace Namespace\r\n    {\r\n        /// <summary>\r\n        /// Login controller.\r\n        /// </summary>\r\n        public class Login2Controller : Controller\r\n        {\r\n            protected IMembershipService Service { get; private set; }\r\n\r\n            public ActionResult Index2()\r\n            {\r\n                return View();\r\n            }\r\n\r\n            #region Constructors\r\n\r\n            /// <summary>\r\n            /// Initializes a new instance of the <see cref=\"Login2Controller\" /> class.\r\n            /// </summary>\r\n            /// <param name=\"service\">The service.</param>\r\n            public Login2Controller(IMembershipService service)\r\n            {\r\n                Service = service;\r\n            }\r\n\r\n            #endregion Constructors\r\n\r\n            #region Methods\r\n\r\n            /// <summary>\r\n            /// Index view.\r\n            /// </summary>\r\n            /// <returns></returns>\r\n            public ActionResult Index()\r\n            {\r\n                return View();\r\n            }\r\n\r\n            #endregion Methods\r\n        }\r\n    }\r\n`\r\n* try to reorganize\r\n* my settings defines region order as follows: ctor, props, methods\r\n* review order based on my settings you will notice some strange \r\n\r\n\r\n### Current behavior\r\nIf constructor is in region, property is just surrounded with region and left in place - wrong place \r\n\r\n### Expected behavior\r\nRespect defined settings and place property in the right order then surround with region."},"comment":{"url":"https://api.github.com/repos/codecadwallader/codemaid/issues/comments/210796777","html_url":"https://github.com/codecadwallader/codemaid/issues/272#issuecomment-210796777","issue_url":"https://api.github.com/repos/codecadwallader/codemaid/issues/272","id":210796777,"user":{"login":"codecadwallader","id":3823772,"avatar_url":"https://avatars.githubusercontent.com/u/3823772?v=3","gravatar_id":"","url":"https://api.github.com/users/codecadwallader","html_url":"https://github.com/codecadwallader","followers_url":"https://api.github.com/users/codecadwallader/followers","following_url":"https://api.github.com/users/codecadwallader/following{/other_user}","gists_url":"https://api.github.com/users/codecadwallader/gists{/gist_id}","starred_url":"https://api.github.com/users/codecadwallader/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codecadwallader/subscriptions","organizations_url":"https://api.github.com/users/codecadwallader/orgs","repos_url":"https://api.github.com/users/codecadwallader/repos","events_url":"https://api.github.com/users/codecadwallader/events{/privacy}","received_events_url":"https://api.github.com/users/codecadwallader/received_events","type":"User","site_admin":false},"created_at":"2016-04-16T11:52:32Z","updated_at":"2016-04-16T11:52:32Z","body":"Let's just re-purpose this one since there's only one issue:\r\n\r\nDuring reorganizing, if remove existing regions is enabled (off by default) then all regions are removed.. even those that are within methods and shouldn't really participate in reorganization.\r\n\r\nBefore:\r\n```csharp\r\nnamespace ClassLibrary2\r\n{\r\n    internal class Issue272\r\n    {\r\n\r\n        #region Public Methods\r\n\r\n        public int AMethod()\r\n        {\r\n            #region Declarations\r\n\r\n            int x = 5;\r\n\r\n            #endregion Declarations\r\n\r\n            #region Calculations\r\n\r\n            int y = x * 2;\r\n\r\n            #endregion Calculations\r\n\r\n            #region Returns\r\n\r\n            return y;\r\n\r\n            #endregion Returns\r\n        }\r\n\r\n        #endregion Public Methods\r\n    }\r\n}\r\n```\r\n\r\nObserved\r\n```csharp\r\nnamespace ClassLibrary2\r\n{\r\n    internal class Issue272\r\n    {\r\n        #region Methods\r\n\r\n        public int AMethod()\r\n        {\r\n            int x = 5;\r\n\r\n            int y = x * 2;\r\n\r\n            return y;\r\n        }\r\n\r\n        #endregion Methods\r\n    }\r\n}\r\n```"}}