{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/roslyn/pulls/comments/51297959","id":51297959,"diff_hunk":"@@ -0,0 +1,62 @@\n+﻿// Copyright (c) Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.\n+\n+using System;\n+using Microsoft.CodeAnalysis.Editor.Commands;\n+using Microsoft.CodeAnalysis.Editor.Shared.Extensions;\n+using Microsoft.VisualStudio.Text;\n+using Microsoft.VisualStudio.Text.Operations;\n+using Roslyn.Utilities;\n+\n+namespace Microsoft.CodeAnalysis.Editor.Implementation.BlockCommentCompletion\n+{\n+    internal abstract class AbstractBlockCommentCompletionCommandHandler : ICommandHandler<ReturnKeyCommandArgs>\n+    {\n+        private readonly ITextUndoHistoryRegistry _undoHistoryRegistry;\n+        private readonly IEditorOperationsFactoryService _editorOperationsFactoryService;\n+\n+        protected AbstractBlockCommentCompletionCommandHandler(\n+            ITextUndoHistoryRegistry undoHistoryRegistry,\n+            IEditorOperationsFactoryService editorOperationsFactoryService)\n+        {\n+            Contract.ThrowIfNull(undoHistoryRegistry);\n+            Contract.ThrowIfNull(editorOperationsFactoryService);\n+\n+            _undoHistoryRegistry = undoHistoryRegistry;\n+            _editorOperationsFactoryService = editorOperationsFactoryService;\n+        }\n+\n+        public CommandState GetCommandState(ReturnKeyCommandArgs args, Func<CommandState> nextHandler) => nextHandler();\n+\n+        public void ExecuteCommand(ReturnKeyCommandArgs args, Action nextHandler)\n+        {\n+            var subjectBuffer = args.SubjectBuffer;\n+            var textView = args.TextView;\n+\n+            var caretPosition = textView.GetCaretPoint(subjectBuffer);\n+            if (caretPosition == null)\n+            {\n+                nextHandler();\n+                return;","path":"src/EditorFeatures/Core/Implementation/BlockCommentCompletion/AbstractBlockCommentCompletionCommandHandler.cs","position":39,"original_position":39,"commit_id":"5bbe72b5012c63f03e230fdc754123addae306be","original_commit_id":"5bbe72b5012c63f03e230fdc754123addae306be","user":{"login":"CyrusNajmabadi","id":4564579,"avatar_url":"https://avatars.githubusercontent.com/u/4564579?v=3","gravatar_id":"","url":"https://api.github.com/users/CyrusNajmabadi","html_url":"https://github.com/CyrusNajmabadi","followers_url":"https://api.github.com/users/CyrusNajmabadi/followers","following_url":"https://api.github.com/users/CyrusNajmabadi/following{/other_user}","gists_url":"https://api.github.com/users/CyrusNajmabadi/gists{/gist_id}","starred_url":"https://api.github.com/users/CyrusNajmabadi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CyrusNajmabadi/subscriptions","organizations_url":"https://api.github.com/users/CyrusNajmabadi/orgs","repos_url":"https://api.github.com/users/CyrusNajmabadi/repos","events_url":"https://api.github.com/users/CyrusNajmabadi/events{/privacy}","received_events_url":"https://api.github.com/users/CyrusNajmabadi/received_events","type":"User","site_admin":false},"body":"a *slightly* nicer pattern for me would be:\r\n\r\n```c#\r\npublic void Execute(...)\r\n{\r\n    if (TryHandleReturnKey(...))\r\n    {\r\n        // Don't let any other command handler run, we completely handled the return key.\r\n        return;\r\n    }\r\n\r\n    // Defer to the next command handler to process this.\r\n    nextHandler();\r\n}\r\n\r\nprivate bool TryHandleReturnKey(...)\r\n{\r\n    .. your code ...\r\n}\r\n```\r\n\r\nThis now puts the job of command handler chain management in a single place.  It means also if someone adds any sort of control flow here that they have to worry about forgetting to do this.","created_at":"2016-01-29T18:43:06Z","updated_at":"2016-01-29T18:43:06Z","html_url":"https://github.com/dotnet/roslyn/pull/8229#discussion_r51297959","pull_request_url":"https://api.github.com/repos/dotnet/roslyn/pulls/8229","_links":{"self":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/comments/51297959"},"html":{"href":"https://github.com/dotnet/roslyn/pull/8229#discussion_r51297959"},"pull_request":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/8229"}}},"pull_request":{"url":"https://api.github.com/repos/dotnet/roslyn/pulls/8229","id":57548909,"html_url":"https://github.com/dotnet/roslyn/pull/8229","diff_url":"https://github.com/dotnet/roslyn/pull/8229.diff","patch_url":"https://github.com/dotnet/roslyn/pull/8229.patch","issue_url":"https://api.github.com/repos/dotnet/roslyn/issues/8229","number":8229,"state":"open","locked":false,"title":"Add \"*\" on enter pressed within comment blocks","user":{"login":"diryboy","id":159110,"avatar_url":"https://avatars.githubusercontent.com/u/159110?v=3","gravatar_id":"","url":"https://api.github.com/users/diryboy","html_url":"https://github.com/diryboy","followers_url":"https://api.github.com/users/diryboy/followers","following_url":"https://api.github.com/users/diryboy/following{/other_user}","gists_url":"https://api.github.com/users/diryboy/gists{/gist_id}","starred_url":"https://api.github.com/users/diryboy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/diryboy/subscriptions","organizations_url":"https://api.github.com/users/diryboy/orgs","repos_url":"https://api.github.com/users/diryboy/repos","events_url":"https://api.github.com/users/diryboy/events{/privacy}","received_events_url":"https://api.github.com/users/diryboy/received_events","type":"User","site_admin":false},"body":"Fixes #2077","created_at":"2016-01-28T19:02:13Z","updated_at":"2016-01-29T18:43:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"aef9ef00c531a94f6a47e4b6a3fbe3f62abd6153","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dotnet/roslyn/pulls/8229/commits","review_comments_url":"https://api.github.com/repos/dotnet/roslyn/pulls/8229/comments","review_comment_url":"https://api.github.com/repos/dotnet/roslyn/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotnet/roslyn/issues/8229/comments","statuses_url":"https://api.github.com/repos/dotnet/roslyn/statuses/5bbe72b5012c63f03e230fdc754123addae306be","head":{"label":"diryboy:AddStar","ref":"AddStar","sha":"5bbe72b5012c63f03e230fdc754123addae306be","user":{"login":"diryboy","id":159110,"avatar_url":"https://avatars.githubusercontent.com/u/159110?v=3","gravatar_id":"","url":"https://api.github.com/users/diryboy","html_url":"https://github.com/diryboy","followers_url":"https://api.github.com/users/diryboy/followers","following_url":"https://api.github.com/users/diryboy/following{/other_user}","gists_url":"https://api.github.com/users/diryboy/gists{/gist_id}","starred_url":"https://api.github.com/users/diryboy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/diryboy/subscriptions","organizations_url":"https://api.github.com/users/diryboy/orgs","repos_url":"https://api.github.com/users/diryboy/repos","events_url":"https://api.github.com/users/diryboy/events{/privacy}","received_events_url":"https://api.github.com/users/diryboy/received_events","type":"User","site_admin":false},"repo":{"id":39498532,"name":"roslyn","full_name":"diryboy/roslyn","owner":{"login":"diryboy","id":159110,"avatar_url":"https://avatars.githubusercontent.com/u/159110?v=3","gravatar_id":"","url":"https://api.github.com/users/diryboy","html_url":"https://github.com/diryboy","followers_url":"https://api.github.com/users/diryboy/followers","following_url":"https://api.github.com/users/diryboy/following{/other_user}","gists_url":"https://api.github.com/users/diryboy/gists{/gist_id}","starred_url":"https://api.github.com/users/diryboy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/diryboy/subscriptions","organizations_url":"https://api.github.com/users/diryboy/orgs","repos_url":"https://api.github.com/users/diryboy/repos","events_url":"https://api.github.com/users/diryboy/events{/privacy}","received_events_url":"https://api.github.com/users/diryboy/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/diryboy/roslyn","description":"The .NET Compiler Platform (\"Roslyn\") provides open-source C# and Visual Basic compilers with rich code analysis APIs.","fork":true,"url":"https://api.github.com/repos/diryboy/roslyn","forks_url":"https://api.github.com/repos/diryboy/roslyn/forks","keys_url":"https://api.github.com/repos/diryboy/roslyn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/diryboy/roslyn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/diryboy/roslyn/teams","hooks_url":"https://api.github.com/repos/diryboy/roslyn/hooks","issue_events_url":"https://api.github.com/repos/diryboy/roslyn/issues/events{/number}","events_url":"https://api.github.com/repos/diryboy/roslyn/events","assignees_url":"https://api.github.com/repos/diryboy/roslyn/assignees{/user}","branches_url":"https://api.github.com/repos/diryboy/roslyn/branches{/branch}","tags_url":"https://api.github.com/repos/diryboy/roslyn/tags","blobs_url":"https://api.github.com/repos/diryboy/roslyn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/diryboy/roslyn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/diryboy/roslyn/git/refs{/sha}","trees_url":"https://api.github.com/repos/diryboy/roslyn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/diryboy/roslyn/statuses/{sha}","languages_url":"https://api.github.com/repos/diryboy/roslyn/languages","stargazers_url":"https://api.github.com/repos/diryboy/roslyn/stargazers","contributors_url":"https://api.github.com/repos/diryboy/roslyn/contributors","subscribers_url":"https://api.github.com/repos/diryboy/roslyn/subscribers","subscription_url":"https://api.github.com/repos/diryboy/roslyn/subscription","commits_url":"https://api.github.com/repos/diryboy/roslyn/commits{/sha}","git_commits_url":"https://api.github.com/repos/diryboy/roslyn/git/commits{/sha}","comments_url":"https://api.github.com/repos/diryboy/roslyn/comments{/number}","issue_comment_url":"https://api.github.com/repos/diryboy/roslyn/issues/comments{/number}","contents_url":"https://api.github.com/repos/diryboy/roslyn/contents/{+path}","compare_url":"https://api.github.com/repos/diryboy/roslyn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/diryboy/roslyn/merges","archive_url":"https://api.github.com/repos/diryboy/roslyn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/diryboy/roslyn/downloads","issues_url":"https://api.github.com/repos/diryboy/roslyn/issues{/number}","pulls_url":"https://api.github.com/repos/diryboy/roslyn/pulls{/number}","milestones_url":"https://api.github.com/repos/diryboy/roslyn/milestones{/number}","notifications_url":"https://api.github.com/repos/diryboy/roslyn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/diryboy/roslyn/labels{/name}","releases_url":"https://api.github.com/repos/diryboy/roslyn/releases{/id}","deployments_url":"https://api.github.com/repos/diryboy/roslyn/deployments","created_at":"2015-07-22T09:50:45Z","updated_at":"2016-01-18T03:28:45Z","pushed_at":"2016-01-29T16:39:20Z","git_url":"git://github.com/diryboy/roslyn.git","ssh_url":"git@github.com:diryboy/roslyn.git","clone_url":"https://github.com/diryboy/roslyn.git","svn_url":"https://github.com/diryboy/roslyn","homepage":"","size":125873,"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":"master"}},"base":{"label":"dotnet:master","ref":"master","sha":"81bdd6edca53322e71f88f621f6b211fe951dafe","user":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"repo":{"id":29078997,"name":"roslyn","full_name":"dotnet/roslyn","owner":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dotnet/roslyn","description":"The .NET Compiler Platform (\"Roslyn\") provides open-source C# and Visual Basic compilers with rich code analysis APIs.","fork":false,"url":"https://api.github.com/repos/dotnet/roslyn","forks_url":"https://api.github.com/repos/dotnet/roslyn/forks","keys_url":"https://api.github.com/repos/dotnet/roslyn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dotnet/roslyn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dotnet/roslyn/teams","hooks_url":"https://api.github.com/repos/dotnet/roslyn/hooks","issue_events_url":"https://api.github.com/repos/dotnet/roslyn/issues/events{/number}","events_url":"https://api.github.com/repos/dotnet/roslyn/events","assignees_url":"https://api.github.com/repos/dotnet/roslyn/assignees{/user}","branches_url":"https://api.github.com/repos/dotnet/roslyn/branches{/branch}","tags_url":"https://api.github.com/repos/dotnet/roslyn/tags","blobs_url":"https://api.github.com/repos/dotnet/roslyn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dotnet/roslyn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dotnet/roslyn/git/refs{/sha}","trees_url":"https://api.github.com/repos/dotnet/roslyn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dotnet/roslyn/statuses/{sha}","languages_url":"https://api.github.com/repos/dotnet/roslyn/languages","stargazers_url":"https://api.github.com/repos/dotnet/roslyn/stargazers","contributors_url":"https://api.github.com/repos/dotnet/roslyn/contributors","subscribers_url":"https://api.github.com/repos/dotnet/roslyn/subscribers","subscription_url":"https://api.github.com/repos/dotnet/roslyn/subscription","commits_url":"https://api.github.com/repos/dotnet/roslyn/commits{/sha}","git_commits_url":"https://api.github.com/repos/dotnet/roslyn/git/commits{/sha}","comments_url":"https://api.github.com/repos/dotnet/roslyn/comments{/number}","issue_comment_url":"https://api.github.com/repos/dotnet/roslyn/issues/comments{/number}","contents_url":"https://api.github.com/repos/dotnet/roslyn/contents/{+path}","compare_url":"https://api.github.com/repos/dotnet/roslyn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dotnet/roslyn/merges","archive_url":"https://api.github.com/repos/dotnet/roslyn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dotnet/roslyn/downloads","issues_url":"https://api.github.com/repos/dotnet/roslyn/issues{/number}","pulls_url":"https://api.github.com/repos/dotnet/roslyn/pulls{/number}","milestones_url":"https://api.github.com/repos/dotnet/roslyn/milestones{/number}","notifications_url":"https://api.github.com/repos/dotnet/roslyn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dotnet/roslyn/labels{/name}","releases_url":"https://api.github.com/repos/dotnet/roslyn/releases{/id}","deployments_url":"https://api.github.com/repos/dotnet/roslyn/deployments","created_at":"2015-01-11T02:39:03Z","updated_at":"2016-01-29T18:18:22Z","pushed_at":"2016-01-29T18:14:05Z","git_url":"git://github.com/dotnet/roslyn.git","ssh_url":"git@github.com:dotnet/roslyn.git","clone_url":"https://github.com/dotnet/roslyn.git","svn_url":"https://github.com/dotnet/roslyn","homepage":"","size":153287,"stargazers_count":4334,"watchers_count":4334,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1060,"mirror_url":null,"open_issues_count":1967,"forks":1060,"open_issues":1967,"watchers":4334,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/8229"},"html":{"href":"https://github.com/dotnet/roslyn/pull/8229"},"issue":{"href":"https://api.github.com/repos/dotnet/roslyn/issues/8229"},"comments":{"href":"https://api.github.com/repos/dotnet/roslyn/issues/8229/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/8229/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/8229/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/roslyn/statuses/5bbe72b5012c63f03e230fdc754123addae306be"}}}}