{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/roslyn/pulls/comments/219706936","pull_request_review_id":157947234,"id":219706936,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxOTcwNjkzNg==","diff_hunk":"@@ -55,34 +50,13 @@ public sealed override async Task RegisterCodeFixesAsync(CodeFixContext context)\n                 ? GetPackageSources(document)\n                 : ImmutableArray<PackageSource>.Empty;\n \n-            // We might have multiple different diagnostics covering the same span.  Have to\n-            // process them all as we might produce different fixes for each diagnostic.\n-\n-            var documentOptions = await document.GetOptionsAsync(cancellationToken).ConfigureAwait(false);\n-            var placeSystemNamespaceFirst = documentOptions.GetOption(GenerationOptions.PlaceSystemNamespaceFirst);\n+            var fixesForDiagnostic = await addImportService\n+                .GetFixesForDiagnosticsAsync(document, span, diagnostics, symbolSearchService, searchReferenceAssemblies, packageSources, cancellationToken).ConfigureAwait(false);\n \n-            foreach (var diagnostic in context.Diagnostics)\n+            foreach (var (diagnostic, fixes) in fixesForDiagnostic)\n             {\n-                var fixes = await addImportService.GetFixesAsync(\n-                    document, span, diagnostic.Id, placeSystemNamespaceFirst,\n-                    symbolSearchService, searchReferenceAssemblies, \n-                    packageSources, cancellationToken).ConfigureAwait(false);\n-\n-                var codeActions = ArrayBuilder<CodeAction>.GetInstance();\n-\n-                foreach (var fix in fixes)\n-                {\n-                    var codeAction = TryCreateCodeAction(document, fix);\n-                    codeActions.AddIfNotNull(codeAction);\n-\n-                    if (codeActions.Count >= MaxResults)\n-                    {\n-                        break;\n-                    }\n-                }\n-\n+                var codeActions = addImportService.GetCodeActionsForFixes(document, fixes, GetPackageInstallerService(document));","path":"src/Features/Core/Portable/AddImport/AbstractAddImportCodeFixProvider.cs","position":72,"original_position":72,"commit_id":"b2b4c61c7a0a3836332965f25ea9fd8cf1a633b1","original_commit_id":"b2b4c61c7a0a3836332965f25ea9fd8cf1a633b1","user":{"login":"heejaechang","id":1333179,"node_id":"MDQ6VXNlcjEzMzMxNzk=","avatar_url":"https://avatars3.githubusercontent.com/u/1333179?v=4","gravatar_id":"","url":"https://api.github.com/users/heejaechang","html_url":"https://github.com/heejaechang","followers_url":"https://api.github.com/users/heejaechang/followers","following_url":"https://api.github.com/users/heejaechang/following{/other_user}","gists_url":"https://api.github.com/users/heejaechang/gists{/gist_id}","starred_url":"https://api.github.com/users/heejaechang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/heejaechang/subscriptions","organizations_url":"https://api.github.com/users/heejaechang/orgs","repos_url":"https://api.github.com/users/heejaechang/repos","events_url":"https://api.github.com/users/heejaechang/events{/privacy}","received_events_url":"https://api.github.com/users/heejaechang/received_events","type":"User","site_admin":false},"body":"is GetPackageInstallerService cheap to get? otherwise, outside of loop? since it will always give back same one?","created_at":"2018-09-23T18:16:56Z","updated_at":"2018-09-23T18:16:56Z","html_url":"https://github.com/dotnet/roslyn/pull/29516#discussion_r219706936","pull_request_url":"https://api.github.com/repos/dotnet/roslyn/pulls/29516","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/comments/219706936"},"html":{"href":"https://github.com/dotnet/roslyn/pull/29516#discussion_r219706936"},"pull_request":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/29516"}}},"pull_request":{"url":"https://api.github.com/repos/dotnet/roslyn/pulls/29516","id":210869599,"node_id":"MDExOlB1bGxSZXF1ZXN0MjEwODY5NTk5","html_url":"https://github.com/dotnet/roslyn/pull/29516","diff_url":"https://github.com/dotnet/roslyn/pull/29516.diff","patch_url":"https://github.com/dotnet/roslyn/pull/29516.patch","issue_url":"https://api.github.com/repos/dotnet/roslyn/issues/29516","number":29516,"state":"open","locked":false,"title":"Explore options to allow users to add all missing imports","user":{"login":"JoeRobich","id":611219,"node_id":"MDQ6VXNlcjYxMTIxOQ==","avatar_url":"https://avatars0.githubusercontent.com/u/611219?v=4","gravatar_id":"","url":"https://api.github.com/users/JoeRobich","html_url":"https://github.com/JoeRobich","followers_url":"https://api.github.com/users/JoeRobich/followers","following_url":"https://api.github.com/users/JoeRobich/following{/other_user}","gists_url":"https://api.github.com/users/JoeRobich/gists{/gist_id}","starred_url":"https://api.github.com/users/JoeRobich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JoeRobich/subscriptions","organizations_url":"https://api.github.com/users/JoeRobich/orgs","repos_url":"https://api.github.com/users/JoeRobich/repos","events_url":"https://api.github.com/users/JoeRobich/events{/privacy}","received_events_url":"https://api.github.com/users/JoeRobich/received_events","type":"User","site_admin":false},"body":"Exploring different options to allow users to add missing imports\r\nto code that they copied into their solution (#10272). When multiple fixes are\r\nfound for the same diagnostic no action is taken. Allowing the user to\r\nsort out ambiguity.\r\n\r\n1) From the light bulb menu the user can now specify fix all for missing\r\nusing statements (#23528). \r\n\r\n![fix all missing imports solution](https://user-images.githubusercontent.com/611219/45244322-2b936880-b2ac-11e8-9630-013d9ba8fa83.gif)\r\n\r\nThis is an odd UX. In the light bulb menu the fix will have a name such as,\r\n`using System.Collections.Generic;`. The user will then choose a fix all\r\nscope from a preview of the fix. The fix all preview will show many other\r\nusing statements to be added. \r\n\r\nThere is also odd behavior around solutions with a mix of C# and VB\r\nproject. For instance, if fixing all in the Solution scope only the \r\nprojects of the same language as the file that the fix was invoked \r\nin will be considered. This is due to AddImportFixProvider being\r\nper language and not sharing diagnostic ids.\r\n\r\n2) When invoking the Remove and Sort Using command missing imports will\r\nbe added.\r\n\r\n![add imports during organize](https://user-images.githubusercontent.com/611219/45244309-20d8d380-b2ac-11e8-8cf4-013522abb461.gif)\r\n\r\nThis could be confusing since the current behavior is simply to remove and sort. \r\n\r\n\r\nThings to explore:\r\n- [ ] Create a new fixer for missing imports that is separate from the AddImport fixer.\r\n- [ ] Create a separate command from Remove and Sort Imports for Add Missing Imports\r\n- [ ] Need to bring attention to the diagnostics that have multiple fixes.\r\n","created_at":"2018-08-24T23:23:39Z","updated_at":"2018-09-23T18:16:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2af7e9be9853aea2d5d8817e1e72a1c7ad48507e","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":166377917,"node_id":"MDU6TGFiZWwxNjYzNzc5MTc=","url":"https://api.github.com/repos/dotnet/roslyn/labels/Area-IDE","name":"Area-IDE","color":"5319e7","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/dotnet/roslyn/pulls/29516/commits","review_comments_url":"https://api.github.com/repos/dotnet/roslyn/pulls/29516/comments","review_comment_url":"https://api.github.com/repos/dotnet/roslyn/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotnet/roslyn/issues/29516/comments","statuses_url":"https://api.github.com/repos/dotnet/roslyn/statuses/b2b4c61c7a0a3836332965f25ea9fd8cf1a633b1","head":{"label":"JoeRobich:add-usings-fix-all","ref":"add-usings-fix-all","sha":"b2b4c61c7a0a3836332965f25ea9fd8cf1a633b1","user":{"login":"JoeRobich","id":611219,"node_id":"MDQ6VXNlcjYxMTIxOQ==","avatar_url":"https://avatars0.githubusercontent.com/u/611219?v=4","gravatar_id":"","url":"https://api.github.com/users/JoeRobich","html_url":"https://github.com/JoeRobich","followers_url":"https://api.github.com/users/JoeRobich/followers","following_url":"https://api.github.com/users/JoeRobich/following{/other_user}","gists_url":"https://api.github.com/users/JoeRobich/gists{/gist_id}","starred_url":"https://api.github.com/users/JoeRobich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JoeRobich/subscriptions","organizations_url":"https://api.github.com/users/JoeRobich/orgs","repos_url":"https://api.github.com/users/JoeRobich/repos","events_url":"https://api.github.com/users/JoeRobich/events{/privacy}","received_events_url":"https://api.github.com/users/JoeRobich/received_events","type":"User","site_admin":false},"repo":{"id":143078388,"node_id":"MDEwOlJlcG9zaXRvcnkxNDMwNzgzODg=","name":"roslyn","full_name":"JoeRobich/roslyn","private":false,"owner":{"login":"JoeRobich","id":611219,"node_id":"MDQ6VXNlcjYxMTIxOQ==","avatar_url":"https://avatars0.githubusercontent.com/u/611219?v=4","gravatar_id":"","url":"https://api.github.com/users/JoeRobich","html_url":"https://github.com/JoeRobich","followers_url":"https://api.github.com/users/JoeRobich/followers","following_url":"https://api.github.com/users/JoeRobich/following{/other_user}","gists_url":"https://api.github.com/users/JoeRobich/gists{/gist_id}","starred_url":"https://api.github.com/users/JoeRobich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JoeRobich/subscriptions","organizations_url":"https://api.github.com/users/JoeRobich/orgs","repos_url":"https://api.github.com/users/JoeRobich/repos","events_url":"https://api.github.com/users/JoeRobich/events{/privacy}","received_events_url":"https://api.github.com/users/JoeRobich/received_events","type":"User","site_admin":false},"html_url":"https://github.com/JoeRobich/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/JoeRobich/roslyn","forks_url":"https://api.github.com/repos/JoeRobich/roslyn/forks","keys_url":"https://api.github.com/repos/JoeRobich/roslyn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JoeRobich/roslyn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JoeRobich/roslyn/teams","hooks_url":"https://api.github.com/repos/JoeRobich/roslyn/hooks","issue_events_url":"https://api.github.com/repos/JoeRobich/roslyn/issues/events{/number}","events_url":"https://api.github.com/repos/JoeRobich/roslyn/events","assignees_url":"https://api.github.com/repos/JoeRobich/roslyn/assignees{/user}","branches_url":"https://api.github.com/repos/JoeRobich/roslyn/branches{/branch}","tags_url":"https://api.github.com/repos/JoeRobich/roslyn/tags","blobs_url":"https://api.github.com/repos/JoeRobich/roslyn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JoeRobich/roslyn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JoeRobich/roslyn/git/refs{/sha}","trees_url":"https://api.github.com/repos/JoeRobich/roslyn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JoeRobich/roslyn/statuses/{sha}","languages_url":"https://api.github.com/repos/JoeRobich/roslyn/languages","stargazers_url":"https://api.github.com/repos/JoeRobich/roslyn/stargazers","contributors_url":"https://api.github.com/repos/JoeRobich/roslyn/contributors","subscribers_url":"https://api.github.com/repos/JoeRobich/roslyn/subscribers","subscription_url":"https://api.github.com/repos/JoeRobich/roslyn/subscription","commits_url":"https://api.github.com/repos/JoeRobich/roslyn/commits{/sha}","git_commits_url":"https://api.github.com/repos/JoeRobich/roslyn/git/commits{/sha}","comments_url":"https://api.github.com/repos/JoeRobich/roslyn/comments{/number}","issue_comment_url":"https://api.github.com/repos/JoeRobich/roslyn/issues/comments{/number}","contents_url":"https://api.github.com/repos/JoeRobich/roslyn/contents/{+path}","compare_url":"https://api.github.com/repos/JoeRobich/roslyn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JoeRobich/roslyn/merges","archive_url":"https://api.github.com/repos/JoeRobich/roslyn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JoeRobich/roslyn/downloads","issues_url":"https://api.github.com/repos/JoeRobich/roslyn/issues{/number}","pulls_url":"https://api.github.com/repos/JoeRobich/roslyn/pulls{/number}","milestones_url":"https://api.github.com/repos/JoeRobich/roslyn/milestones{/number}","notifications_url":"https://api.github.com/repos/JoeRobich/roslyn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JoeRobich/roslyn/labels{/name}","releases_url":"https://api.github.com/repos/JoeRobich/roslyn/releases{/id}","deployments_url":"https://api.github.com/repos/JoeRobich/roslyn/deployments","created_at":"2018-07-31T23:00:58Z","updated_at":"2018-07-31T23:01:46Z","pushed_at":"2018-09-21T23:35:34Z","git_url":"git://github.com/JoeRobich/roslyn.git","ssh_url":"git@github.com:JoeRobich/roslyn.git","clone_url":"https://github.com/JoeRobich/roslyn.git","svn_url":"https://github.com/JoeRobich/roslyn","homepage":"","size":411591,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dotnet:master","ref":"master","sha":"1060b7c1bfabc92ee01738bff8afcb33daf9985c","user":{"login":"dotnet","id":9141961,"node_id":"MDEyOk9yZ2FuaXphdGlvbjkxNDE5NjE=","avatar_url":"https://avatars0.githubusercontent.com/u/9141961?v=4","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,"node_id":"MDEwOlJlcG9zaXRvcnkyOTA3ODk5Nw==","name":"roslyn","full_name":"dotnet/roslyn","private":false,"owner":{"login":"dotnet","id":9141961,"node_id":"MDEyOk9yZ2FuaXphdGlvbjkxNDE5NjE=","avatar_url":"https://avatars0.githubusercontent.com/u/9141961?v=4","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},"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":"2018-09-23T14:27:23Z","pushed_at":"2018-09-23T18:04:35Z","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":453336,"stargazers_count":9872,"watchers_count":9872,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2366,"mirror_url":null,"archived":false,"open_issues_count":5227,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":2366,"open_issues":5227,"watchers":9872,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/29516"},"html":{"href":"https://github.com/dotnet/roslyn/pull/29516"},"issue":{"href":"https://api.github.com/repos/dotnet/roslyn/issues/29516"},"comments":{"href":"https://api.github.com/repos/dotnet/roslyn/issues/29516/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/29516/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/29516/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/roslyn/statuses/b2b4c61c7a0a3836332965f25ea9fd8cf1a633b1"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"heejaechang"}}