{"action":"created","comment":{"url":"https://api.github.com/repos/fdorg/flashdevelop/pulls/comments/44399104","id":44399104,"diff_hunk":"@@ -655,7 +661,79 @@ public void SaveSettings()\n             ObjectSerializer.Serialize(this.settingFilename, this.settingObject);\n         }\n \n+        void OnAddRefactorOptions(List<ICompletionListItem> list)\n+        {\n+            if (list == null)\n+                return;\n+\n+            RefactorItem.AddItemToList(refactorMainMenu.RenameMenuItem, list);\n+            RefactorItem.AddItemToList(refactorMainMenu.ExtractMethodMenuItem, list);\n+            RefactorItem.AddItemToList(refactorMainMenu.ExtractLocalVariableMenuItem, list);\n+            RefactorItem.AddItemToList(refactorMainMenu.DelegateMenuItem, list);\n+\n+            var features = ASContext.Context.Features;\n+\n+            if (!features.hasImports)\n+                return;\n+\n+            var sci = ASContext.CurSciControl;\n+            string line = sci.GetLine(sci.CurrentLine).TrimStart();\n+\n+            if (line.StartsWith(features.importKey, StringComparison.Ordinal)\n+                || !string.IsNullOrEmpty(features.importKeyAlt) && line.StartsWith(features.importKeyAlt, StringComparison.Ordinal))\n+            {\n+                RefactorItem.AddItemToList(refactorMainMenu.OrganizeMenuItem, list);\n+\n+                if (features.hasImportsWildcard)\n+                    RefactorItem.AddItemToList(refactorMainMenu.TruncateMenuItem, list);\n+            }\n+        }\n+\n         #endregion\n \n     }\n+\n+    class RefactorItem : ICompletionListItem\n+    {\n+        ToolStripItem item;\n+        string label;\n+        Bitmap icon;\n+\n+        public static void AddItemToList(ToolStripMenuItem item, List<ICompletionListItem> list)\n+        {\n+            if (item.Enabled)\n+                list.Add(new RefactorItem(item));\n+        }\n+\n+        public RefactorItem(ToolStripItem item)\n+        {\n+            this.item = item;\n+            label = Regex.Replace(item.Text, \"[&.]\", string.Empty);\n+            icon = new Bitmap(item.Image ?? PluginBase.MainForm.FindImage(\"452\")); //452, 473\n+        }\n+\n+        public string Description\n+        {\n+            get { return label; /*TextHelper.GetString(\"ASCompletion.Info.GeneratorTemplate\");*/ }","path":"External/Plugins/CodeRefactor/PluginMain.cs","position":100,"original_position":100,"commit_id":"54bdb0816857abf337232bdc022881ded67d4358","original_commit_id":"54bdb0816857abf337232bdc022881ded67d4358","user":{"login":"elsassph","id":297963,"avatar_url":"https://avatars.githubusercontent.com/u/297963?v=3","gravatar_id":"","url":"https://api.github.com/users/elsassph","html_url":"https://github.com/elsassph","followers_url":"https://api.github.com/users/elsassph/followers","following_url":"https://api.github.com/users/elsassph/following{/other_user}","gists_url":"https://api.github.com/users/elsassph/gists{/gist_id}","starred_url":"https://api.github.com/users/elsassph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elsassph/subscriptions","organizations_url":"https://api.github.com/users/elsassph/orgs","repos_url":"https://api.github.com/users/elsassph/repos","events_url":"https://api.github.com/users/elsassph/events{/privacy}","received_events_url":"https://api.github.com/users/elsassph/received_events","type":"User","site_admin":false},"body":"Maybe `TextHelper.GetString(\"Label.Refactor\").Replace(\"&\",\"\")`?","created_at":"2015-11-10T12:10:46Z","updated_at":"2015-11-10T12:10:46Z","html_url":"https://github.com/fdorg/flashdevelop/pull/950#discussion_r44399104","pull_request_url":"https://api.github.com/repos/fdorg/flashdevelop/pulls/950","_links":{"self":{"href":"https://api.github.com/repos/fdorg/flashdevelop/pulls/comments/44399104"},"html":{"href":"https://github.com/fdorg/flashdevelop/pull/950#discussion_r44399104"},"pull_request":{"href":"https://api.github.com/repos/fdorg/flashdevelop/pulls/950"}}},"pull_request":{"url":"https://api.github.com/repos/fdorg/flashdevelop/pulls/950","id":50104576,"html_url":"https://github.com/fdorg/flashdevelop/pull/950","diff_url":"https://github.com/fdorg/flashdevelop/pull/950.diff","patch_url":"https://github.com/fdorg/flashdevelop/pull/950.patch","issue_url":"https://api.github.com/repos/fdorg/flashdevelop/issues/950","number":950,"state":"open","locked":false,"title":"Include available Refactor menus in Contextual Code Generation list","user":{"login":"wise0704","id":13545633,"avatar_url":"https://avatars.githubusercontent.com/u/13545633?v=3","gravatar_id":"","url":"https://api.github.com/users/wise0704","html_url":"https://github.com/wise0704","followers_url":"https://api.github.com/users/wise0704/followers","following_url":"https://api.github.com/users/wise0704/following{/other_user}","gists_url":"https://api.github.com/users/wise0704/gists{/gist_id}","starred_url":"https://api.github.com/users/wise0704/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wise0704/subscriptions","organizations_url":"https://api.github.com/users/wise0704/orgs","repos_url":"https://api.github.com/users/wise0704/repos","events_url":"https://api.github.com/users/wise0704/events{/privacy}","received_events_url":"https://api.github.com/users/wise0704/received_events","type":"User","site_admin":false},"body":"I had a feeling that the Refactor menus are very useful, but they are not easily accessible due to the fact that every option needs a separate shortcut assigned in order to access using keyboard only (unless you press the right-click button on your keyboard which is cheating). So, inspired by Visual Studio, I thought it would be nice if the available options were to show up in the existing code generator menu (assign the shortcut to `Ctrl+OemPeriod` and boom). \r\n![capture](https://cloud.githubusercontent.com/assets/13545633/11030909/eae46590-8735-11e5-9cd5-5dbe4648d74d.PNG)![capture2](https://cloud.githubusercontent.com/assets/13545633/11031086/f0433aba-8736-11e5-9c7f-4f14418cd1be.PNG)![capture3](https://cloud.githubusercontent.com/assets/13545633/11031128/2c5472e4-8737-11e5-9024-c32a877894b5.PNG)\r\nCurrently\r\n- Rename\r\n- Extract Method\r\n- Extract Local Variable\r\n- Generate Delegate Methods\r\n- Organise Imports\r\n- Truncate Imports\r\n\r\nare available in the completion list, but more can be added with just 2 lines of code for each. (Edit: 1 line of code after 54bdb08)\r\n\r\nPlus, extended the support of `Convert to Constant` to also work for strings.\r\n![capture4](https://cloud.githubusercontent.com/assets/13545633/11031179/7a7800e4-8737-11e5-9d72-bd8257fc7979.PNG)","created_at":"2015-11-09T10:14:15Z","updated_at":"2015-11-10T12:10:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d63664054146a5b734947db2833058853bc7a8c3","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/fdorg/flashdevelop/pulls/950/commits","review_comments_url":"https://api.github.com/repos/fdorg/flashdevelop/pulls/950/comments","review_comment_url":"https://api.github.com/repos/fdorg/flashdevelop/pulls/comments{/number}","comments_url":"https://api.github.com/repos/fdorg/flashdevelop/issues/950/comments","statuses_url":"https://api.github.com/repos/fdorg/flashdevelop/statuses/54bdb0816857abf337232bdc022881ded67d4358","head":{"label":"wise0704:CodeRefactor","ref":"CodeRefactor","sha":"54bdb0816857abf337232bdc022881ded67d4358","user":{"login":"wise0704","id":13545633,"avatar_url":"https://avatars.githubusercontent.com/u/13545633?v=3","gravatar_id":"","url":"https://api.github.com/users/wise0704","html_url":"https://github.com/wise0704","followers_url":"https://api.github.com/users/wise0704/followers","following_url":"https://api.github.com/users/wise0704/following{/other_user}","gists_url":"https://api.github.com/users/wise0704/gists{/gist_id}","starred_url":"https://api.github.com/users/wise0704/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wise0704/subscriptions","organizations_url":"https://api.github.com/users/wise0704/orgs","repos_url":"https://api.github.com/users/wise0704/repos","events_url":"https://api.github.com/users/wise0704/events{/privacy}","received_events_url":"https://api.github.com/users/wise0704/received_events","type":"User","site_admin":false},"repo":{"id":45084735,"name":"flashdevelop","full_name":"wise0704/flashdevelop","owner":{"login":"wise0704","id":13545633,"avatar_url":"https://avatars.githubusercontent.com/u/13545633?v=3","gravatar_id":"","url":"https://api.github.com/users/wise0704","html_url":"https://github.com/wise0704","followers_url":"https://api.github.com/users/wise0704/followers","following_url":"https://api.github.com/users/wise0704/following{/other_user}","gists_url":"https://api.github.com/users/wise0704/gists{/gist_id}","starred_url":"https://api.github.com/users/wise0704/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wise0704/subscriptions","organizations_url":"https://api.github.com/users/wise0704/orgs","repos_url":"https://api.github.com/users/wise0704/repos","events_url":"https://api.github.com/users/wise0704/events{/privacy}","received_events_url":"https://api.github.com/users/wise0704/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/wise0704/flashdevelop","description":"FlashDevelop is a free and open source code editor.","fork":true,"url":"https://api.github.com/repos/wise0704/flashdevelop","forks_url":"https://api.github.com/repos/wise0704/flashdevelop/forks","keys_url":"https://api.github.com/repos/wise0704/flashdevelop/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wise0704/flashdevelop/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wise0704/flashdevelop/teams","hooks_url":"https://api.github.com/repos/wise0704/flashdevelop/hooks","issue_events_url":"https://api.github.com/repos/wise0704/flashdevelop/issues/events{/number}","events_url":"https://api.github.com/repos/wise0704/flashdevelop/events","assignees_url":"https://api.github.com/repos/wise0704/flashdevelop/assignees{/user}","branches_url":"https://api.github.com/repos/wise0704/flashdevelop/branches{/branch}","tags_url":"https://api.github.com/repos/wise0704/flashdevelop/tags","blobs_url":"https://api.github.com/repos/wise0704/flashdevelop/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wise0704/flashdevelop/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wise0704/flashdevelop/git/refs{/sha}","trees_url":"https://api.github.com/repos/wise0704/flashdevelop/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wise0704/flashdevelop/statuses/{sha}","languages_url":"https://api.github.com/repos/wise0704/flashdevelop/languages","stargazers_url":"https://api.github.com/repos/wise0704/flashdevelop/stargazers","contributors_url":"https://api.github.com/repos/wise0704/flashdevelop/contributors","subscribers_url":"https://api.github.com/repos/wise0704/flashdevelop/subscribers","subscription_url":"https://api.github.com/repos/wise0704/flashdevelop/subscription","commits_url":"https://api.github.com/repos/wise0704/flashdevelop/commits{/sha}","git_commits_url":"https://api.github.com/repos/wise0704/flashdevelop/git/commits{/sha}","comments_url":"https://api.github.com/repos/wise0704/flashdevelop/comments{/number}","issue_comment_url":"https://api.github.com/repos/wise0704/flashdevelop/issues/comments{/number}","contents_url":"https://api.github.com/repos/wise0704/flashdevelop/contents/{+path}","compare_url":"https://api.github.com/repos/wise0704/flashdevelop/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wise0704/flashdevelop/merges","archive_url":"https://api.github.com/repos/wise0704/flashdevelop/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wise0704/flashdevelop/downloads","issues_url":"https://api.github.com/repos/wise0704/flashdevelop/issues{/number}","pulls_url":"https://api.github.com/repos/wise0704/flashdevelop/pulls{/number}","milestones_url":"https://api.github.com/repos/wise0704/flashdevelop/milestones{/number}","notifications_url":"https://api.github.com/repos/wise0704/flashdevelop/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wise0704/flashdevelop/labels{/name}","releases_url":"https://api.github.com/repos/wise0704/flashdevelop/releases{/id}","created_at":"2015-10-28T02:50:43Z","updated_at":"2015-10-28T21:55:04Z","pushed_at":"2015-11-10T02:11:51Z","git_url":"git://github.com/wise0704/flashdevelop.git","ssh_url":"git@github.com:wise0704/flashdevelop.git","clone_url":"https://github.com/wise0704/flashdevelop.git","svn_url":"https://github.com/wise0704/flashdevelop","homepage":null,"size":70262,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"development"}},"base":{"label":"fdorg:development","ref":"development","sha":"9e1bdecdcf74ff34634b15d28b499ab7a1b9e008","user":{"login":"fdorg","id":5413341,"avatar_url":"https://avatars.githubusercontent.com/u/5413341?v=3","gravatar_id":"","url":"https://api.github.com/users/fdorg","html_url":"https://github.com/fdorg","followers_url":"https://api.github.com/users/fdorg/followers","following_url":"https://api.github.com/users/fdorg/following{/other_user}","gists_url":"https://api.github.com/users/fdorg/gists{/gist_id}","starred_url":"https://api.github.com/users/fdorg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fdorg/subscriptions","organizations_url":"https://api.github.com/users/fdorg/orgs","repos_url":"https://api.github.com/users/fdorg/repos","events_url":"https://api.github.com/users/fdorg/events{/privacy}","received_events_url":"https://api.github.com/users/fdorg/received_events","type":"Organization","site_admin":false},"repo":{"id":12687065,"name":"flashdevelop","full_name":"fdorg/flashdevelop","owner":{"login":"fdorg","id":5413341,"avatar_url":"https://avatars.githubusercontent.com/u/5413341?v=3","gravatar_id":"","url":"https://api.github.com/users/fdorg","html_url":"https://github.com/fdorg","followers_url":"https://api.github.com/users/fdorg/followers","following_url":"https://api.github.com/users/fdorg/following{/other_user}","gists_url":"https://api.github.com/users/fdorg/gists{/gist_id}","starred_url":"https://api.github.com/users/fdorg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fdorg/subscriptions","organizations_url":"https://api.github.com/users/fdorg/orgs","repos_url":"https://api.github.com/users/fdorg/repos","events_url":"https://api.github.com/users/fdorg/events{/privacy}","received_events_url":"https://api.github.com/users/fdorg/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/fdorg/flashdevelop","description":"FlashDevelop is a free and open source code editor.","fork":false,"url":"https://api.github.com/repos/fdorg/flashdevelop","forks_url":"https://api.github.com/repos/fdorg/flashdevelop/forks","keys_url":"https://api.github.com/repos/fdorg/flashdevelop/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fdorg/flashdevelop/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fdorg/flashdevelop/teams","hooks_url":"https://api.github.com/repos/fdorg/flashdevelop/hooks","issue_events_url":"https://api.github.com/repos/fdorg/flashdevelop/issues/events{/number}","events_url":"https://api.github.com/repos/fdorg/flashdevelop/events","assignees_url":"https://api.github.com/repos/fdorg/flashdevelop/assignees{/user}","branches_url":"https://api.github.com/repos/fdorg/flashdevelop/branches{/branch}","tags_url":"https://api.github.com/repos/fdorg/flashdevelop/tags","blobs_url":"https://api.github.com/repos/fdorg/flashdevelop/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fdorg/flashdevelop/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fdorg/flashdevelop/git/refs{/sha}","trees_url":"https://api.github.com/repos/fdorg/flashdevelop/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fdorg/flashdevelop/statuses/{sha}","languages_url":"https://api.github.com/repos/fdorg/flashdevelop/languages","stargazers_url":"https://api.github.com/repos/fdorg/flashdevelop/stargazers","contributors_url":"https://api.github.com/repos/fdorg/flashdevelop/contributors","subscribers_url":"https://api.github.com/repos/fdorg/flashdevelop/subscribers","subscription_url":"https://api.github.com/repos/fdorg/flashdevelop/subscription","commits_url":"https://api.github.com/repos/fdorg/flashdevelop/commits{/sha}","git_commits_url":"https://api.github.com/repos/fdorg/flashdevelop/git/commits{/sha}","comments_url":"https://api.github.com/repos/fdorg/flashdevelop/comments{/number}","issue_comment_url":"https://api.github.com/repos/fdorg/flashdevelop/issues/comments{/number}","contents_url":"https://api.github.com/repos/fdorg/flashdevelop/contents/{+path}","compare_url":"https://api.github.com/repos/fdorg/flashdevelop/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fdorg/flashdevelop/merges","archive_url":"https://api.github.com/repos/fdorg/flashdevelop/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fdorg/flashdevelop/downloads","issues_url":"https://api.github.com/repos/fdorg/flashdevelop/issues{/number}","pulls_url":"https://api.github.com/repos/fdorg/flashdevelop/pulls{/number}","milestones_url":"https://api.github.com/repos/fdorg/flashdevelop/milestones{/number}","notifications_url":"https://api.github.com/repos/fdorg/flashdevelop/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fdorg/flashdevelop/labels{/name}","releases_url":"https://api.github.com/repos/fdorg/flashdevelop/releases{/id}","created_at":"2013-09-08T20:28:46Z","updated_at":"2015-11-10T00:54:47Z","pushed_at":"2015-11-10T02:11:51Z","git_url":"git://github.com/fdorg/flashdevelop.git","ssh_url":"git@github.com:fdorg/flashdevelop.git","clone_url":"https://github.com/fdorg/flashdevelop.git","svn_url":"https://github.com/fdorg/flashdevelop","homepage":null,"size":86931,"stargazers_count":422,"watchers_count":422,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":110,"mirror_url":null,"open_issues_count":234,"forks":110,"open_issues":234,"watchers":422,"default_branch":"development"}},"_links":{"self":{"href":"https://api.github.com/repos/fdorg/flashdevelop/pulls/950"},"html":{"href":"https://github.com/fdorg/flashdevelop/pull/950"},"issue":{"href":"https://api.github.com/repos/fdorg/flashdevelop/issues/950"},"comments":{"href":"https://api.github.com/repos/fdorg/flashdevelop/issues/950/comments"},"review_comments":{"href":"https://api.github.com/repos/fdorg/flashdevelop/pulls/950/comments"},"review_comment":{"href":"https://api.github.com/repos/fdorg/flashdevelop/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/fdorg/flashdevelop/pulls/950/commits"},"statuses":{"href":"https://api.github.com/repos/fdorg/flashdevelop/statuses/54bdb0816857abf337232bdc022881ded67d4358"}}}}