{"action":"created","comment":{"url":"https://api.github.com/repos/go-lang-plugin-org/go-lang-idea-plugin/pulls/comments/84687701","pull_request_review_id":5439116,"id":84687701,"diff_hunk":"@@ -0,0 +1,308 @@\n+/*\n+ * Copyright 2013-2016 Sergey Ignatov, Alexander Zolotov, Florin Patan\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+package com.goide.intentions;\n+\n+import com.goide.psi.*;\n+import com.goide.psi.impl.GoElementFactory;\n+import com.goide.psi.impl.GoPsiImplUtil;\n+import com.intellij.codeInsight.intention.BaseElementAtCaretIntentionAction;\n+import com.intellij.openapi.editor.Editor;\n+import com.intellij.openapi.project.Project;\n+import com.intellij.openapi.util.Comparing;\n+import com.intellij.openapi.util.Pair;\n+import com.intellij.psi.PsiElement;\n+import com.intellij.psi.util.PsiTreeUtil;\n+import com.intellij.util.IncorrectOperationException;\n+import com.intellij.util.ObjectUtils;\n+import com.intellij.util.containers.ContainerUtil;\n+import org.jetbrains.annotations.Contract;\n+import org.jetbrains.annotations.Nls;\n+import org.jetbrains.annotations.NotNull;\n+import org.jetbrains.annotations.Nullable;\n+\n+import java.util.Collection;\n+import java.util.List;\n+import java.util.Map;\n+import java.util.stream.Collectors;\n+\n+public class GoMoveToStructInitializationIntention extends BaseElementAtCaretIntentionAction {\n+  public static final String NAME = \"Move field assignment to struct initialization\";\n+\n+  public GoMoveToStructInitializationIntention() {\n+    setText(NAME);\n+  }\n+\n+  @Nls\n+  @NotNull\n+  @Override\n+  public String getFamilyName() {\n+    return NAME;\n+  }\n+\n+  @Override\n+  public boolean isAvailable(@NotNull Project project, Editor editor, @NotNull PsiElement element) {\n+    Pair<List<GoReferenceExpression>, GoCompositeLit> pair = getFieldReferencesAndStructLiteral(element);\n+    return !pair.first.isEmpty() && pair.second != null;\n+  }\n+\n+  @NotNull","path":"src/com/goide/intentions/GoMoveToStructInitializationIntention.java","position":62,"original_position":62,"commit_id":"189831cb960fba412d833745bdb8a5ad3f7d743f","original_commit_id":"189831cb960fba412d833745bdb8a5ad3f7d743f","user":{"login":"grenki","id":6865824,"avatar_url":"https://avatars.githubusercontent.com/u/6865824?v=3","gravatar_id":"","url":"https://api.github.com/users/grenki","html_url":"https://github.com/grenki","followers_url":"https://api.github.com/users/grenki/followers","following_url":"https://api.github.com/users/grenki/following{/other_user}","gists_url":"https://api.github.com/users/grenki/gists{/gist_id}","starred_url":"https://api.github.com/users/grenki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grenki/subscriptions","organizations_url":"https://api.github.com/users/grenki/orgs","repos_url":"https://api.github.com/users/grenki/repos","events_url":"https://api.github.com/users/grenki/events{/privacy}","received_events_url":"https://api.github.com/users/grenki/received_events","type":"User","site_admin":false},"body":"You can return null pair for error cases. It's easier to understand ","created_at":"2016-10-24T13:33:17Z","updated_at":"2016-10-24T13:33:50Z","html_url":"https://github.com/go-lang-plugin-org/go-lang-idea-plugin/pull/2795#discussion_r84687701","pull_request_url":"https://api.github.com/repos/go-lang-plugin-org/go-lang-idea-plugin/pulls/2795","_links":{"self":{"href":"https://api.github.com/repos/go-lang-plugin-org/go-lang-idea-plugin/pulls/comments/84687701"},"html":{"href":"https://github.com/go-lang-plugin-org/go-lang-idea-plugin/pull/2795#discussion_r84687701"},"pull_request":{"href":"https://api.github.com/repos/go-lang-plugin-org/go-lang-idea-plugin/pulls/2795"}}},"pull_request":{"url":"https://api.github.com/repos/go-lang-plugin-org/go-lang-idea-plugin/pulls/2795","id":89091326,"html_url":"https://github.com/go-lang-plugin-org/go-lang-idea-plugin/pull/2795","diff_url":"https://github.com/go-lang-plugin-org/go-lang-idea-plugin/pull/2795.diff","patch_url":"https://github.com/go-lang-plugin-org/go-lang-idea-plugin/pull/2795.patch","issue_url":"https://api.github.com/repos/go-lang-plugin-org/go-lang-idea-plugin/issues/2795","number":2795,"state":"open","locked":false,"title":"Move to struct assignment intention","user":{"login":"wbars","id":5152749,"avatar_url":"https://avatars.githubusercontent.com/u/5152749?v=3","gravatar_id":"","url":"https://api.github.com/users/wbars","html_url":"https://github.com/wbars","followers_url":"https://api.github.com/users/wbars/followers","following_url":"https://api.github.com/users/wbars/following{/other_user}","gists_url":"https://api.github.com/users/wbars/gists{/gist_id}","starred_url":"https://api.github.com/users/wbars/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wbars/subscriptions","organizations_url":"https://api.github.com/users/wbars/orgs","repos_url":"https://api.github.com/users/wbars/repos","events_url":"https://api.github.com/users/wbars/events{/privacy}","received_events_url":"https://api.github.com/users/wbars/received_events","type":"User","site_admin":false},"body":"fixes #2702","created_at":"2016-10-12T20:50:34Z","updated_at":"2016-10-24T13:39:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"057f384d107a1f9d265a51681b403b745c183989","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/go-lang-plugin-org/go-lang-idea-plugin/pulls/2795/commits","review_comments_url":"https://api.github.com/repos/go-lang-plugin-org/go-lang-idea-plugin/pulls/2795/comments","review_comment_url":"https://api.github.com/repos/go-lang-plugin-org/go-lang-idea-plugin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/go-lang-plugin-org/go-lang-idea-plugin/issues/2795/comments","statuses_url":"https://api.github.com/repos/go-lang-plugin-org/go-lang-idea-plugin/statuses/189831cb960fba412d833745bdb8a5ad3f7d743f","head":{"label":"wbars:go-2702","ref":"go-2702","sha":"189831cb960fba412d833745bdb8a5ad3f7d743f","user":{"login":"wbars","id":5152749,"avatar_url":"https://avatars.githubusercontent.com/u/5152749?v=3","gravatar_id":"","url":"https://api.github.com/users/wbars","html_url":"https://github.com/wbars","followers_url":"https://api.github.com/users/wbars/followers","following_url":"https://api.github.com/users/wbars/following{/other_user}","gists_url":"https://api.github.com/users/wbars/gists{/gist_id}","starred_url":"https://api.github.com/users/wbars/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wbars/subscriptions","organizations_url":"https://api.github.com/users/wbars/orgs","repos_url":"https://api.github.com/users/wbars/repos","events_url":"https://api.github.com/users/wbars/events{/privacy}","received_events_url":"https://api.github.com/users/wbars/received_events","type":"User","site_admin":false},"repo":{"id":69814068,"name":"go-lang-idea-plugin","full_name":"wbars/go-lang-idea-plugin","owner":{"login":"wbars","id":5152749,"avatar_url":"https://avatars.githubusercontent.com/u/5152749?v=3","gravatar_id":"","url":"https://api.github.com/users/wbars","html_url":"https://github.com/wbars","followers_url":"https://api.github.com/users/wbars/followers","following_url":"https://api.github.com/users/wbars/following{/other_user}","gists_url":"https://api.github.com/users/wbars/gists{/gist_id}","starred_url":"https://api.github.com/users/wbars/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wbars/subscriptions","organizations_url":"https://api.github.com/users/wbars/orgs","repos_url":"https://api.github.com/users/wbars/repos","events_url":"https://api.github.com/users/wbars/events{/privacy}","received_events_url":"https://api.github.com/users/wbars/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/wbars/go-lang-idea-plugin","description":"Google Go language IDE built using the IntelliJ Platform","fork":true,"url":"https://api.github.com/repos/wbars/go-lang-idea-plugin","forks_url":"https://api.github.com/repos/wbars/go-lang-idea-plugin/forks","keys_url":"https://api.github.com/repos/wbars/go-lang-idea-plugin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wbars/go-lang-idea-plugin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wbars/go-lang-idea-plugin/teams","hooks_url":"https://api.github.com/repos/wbars/go-lang-idea-plugin/hooks","issue_events_url":"https://api.github.com/repos/wbars/go-lang-idea-plugin/issues/events{/number}","events_url":"https://api.github.com/repos/wbars/go-lang-idea-plugin/events","assignees_url":"https://api.github.com/repos/wbars/go-lang-idea-plugin/assignees{/user}","branches_url":"https://api.github.com/repos/wbars/go-lang-idea-plugin/branches{/branch}","tags_url":"https://api.github.com/repos/wbars/go-lang-idea-plugin/tags","blobs_url":"https://api.github.com/repos/wbars/go-lang-idea-plugin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wbars/go-lang-idea-plugin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wbars/go-lang-idea-plugin/git/refs{/sha}","trees_url":"https://api.github.com/repos/wbars/go-lang-idea-plugin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wbars/go-lang-idea-plugin/statuses/{sha}","languages_url":"https://api.github.com/repos/wbars/go-lang-idea-plugin/languages","stargazers_url":"https://api.github.com/repos/wbars/go-lang-idea-plugin/stargazers","contributors_url":"https://api.github.com/repos/wbars/go-lang-idea-plugin/contributors","subscribers_url":"https://api.github.com/repos/wbars/go-lang-idea-plugin/subscribers","subscription_url":"https://api.github.com/repos/wbars/go-lang-idea-plugin/subscription","commits_url":"https://api.github.com/repos/wbars/go-lang-idea-plugin/commits{/sha}","git_commits_url":"https://api.github.com/repos/wbars/go-lang-idea-plugin/git/commits{/sha}","comments_url":"https://api.github.com/repos/wbars/go-lang-idea-plugin/comments{/number}","issue_comment_url":"https://api.github.com/repos/wbars/go-lang-idea-plugin/issues/comments{/number}","contents_url":"https://api.github.com/repos/wbars/go-lang-idea-plugin/contents/{+path}","compare_url":"https://api.github.com/repos/wbars/go-lang-idea-plugin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wbars/go-lang-idea-plugin/merges","archive_url":"https://api.github.com/repos/wbars/go-lang-idea-plugin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wbars/go-lang-idea-plugin/downloads","issues_url":"https://api.github.com/repos/wbars/go-lang-idea-plugin/issues{/number}","pulls_url":"https://api.github.com/repos/wbars/go-lang-idea-plugin/pulls{/number}","milestones_url":"https://api.github.com/repos/wbars/go-lang-idea-plugin/milestones{/number}","notifications_url":"https://api.github.com/repos/wbars/go-lang-idea-plugin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wbars/go-lang-idea-plugin/labels{/name}","releases_url":"https://api.github.com/repos/wbars/go-lang-idea-plugin/releases{/id}","deployments_url":"https://api.github.com/repos/wbars/go-lang-idea-plugin/deployments","created_at":"2016-10-02T18:27:31Z","updated_at":"2016-10-02T18:27:35Z","pushed_at":"2016-10-24T12:12:17Z","git_url":"git://github.com/wbars/go-lang-idea-plugin.git","ssh_url":"git@github.com:wbars/go-lang-idea-plugin.git","clone_url":"https://github.com/wbars/go-lang-idea-plugin.git","svn_url":"https://github.com/wbars/go-lang-idea-plugin","homepage":"https://plugins.jetbrains.com/plugin/5047","size":34639,"stargazers_count":0,"watchers_count":0,"language":"Java","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":"go-lang-plugin-org:master","ref":"master","sha":"cde4a8f55d1ea96fabd3c104b6726a98740f4347","user":{"login":"go-lang-plugin-org","id":6117521,"avatar_url":"https://avatars.githubusercontent.com/u/6117521?v=3","gravatar_id":"","url":"https://api.github.com/users/go-lang-plugin-org","html_url":"https://github.com/go-lang-plugin-org","followers_url":"https://api.github.com/users/go-lang-plugin-org/followers","following_url":"https://api.github.com/users/go-lang-plugin-org/following{/other_user}","gists_url":"https://api.github.com/users/go-lang-plugin-org/gists{/gist_id}","starred_url":"https://api.github.com/users/go-lang-plugin-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/go-lang-plugin-org/subscriptions","organizations_url":"https://api.github.com/users/go-lang-plugin-org/orgs","repos_url":"https://api.github.com/users/go-lang-plugin-org/repos","events_url":"https://api.github.com/users/go-lang-plugin-org/events{/privacy}","received_events_url":"https://api.github.com/users/go-lang-plugin-org/received_events","type":"Organization","site_admin":false},"repo":{"id":869754,"name":"go-lang-idea-plugin","full_name":"go-lang-plugin-org/go-lang-idea-plugin","owner":{"login":"go-lang-plugin-org","id":6117521,"avatar_url":"https://avatars.githubusercontent.com/u/6117521?v=3","gravatar_id":"","url":"https://api.github.com/users/go-lang-plugin-org","html_url":"https://github.com/go-lang-plugin-org","followers_url":"https://api.github.com/users/go-lang-plugin-org/followers","following_url":"https://api.github.com/users/go-lang-plugin-org/following{/other_user}","gists_url":"https://api.github.com/users/go-lang-plugin-org/gists{/gist_id}","starred_url":"https://api.github.com/users/go-lang-plugin-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/go-lang-plugin-org/subscriptions","organizations_url":"https://api.github.com/users/go-lang-plugin-org/orgs","repos_url":"https://api.github.com/users/go-lang-plugin-org/repos","events_url":"https://api.github.com/users/go-lang-plugin-org/events{/privacy}","received_events_url":"https://api.github.com/users/go-lang-plugin-org/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/go-lang-plugin-org/go-lang-idea-plugin","description":"Google Go language IDE built using the IntelliJ Platform","fork":false,"url":"https://api.github.com/repos/go-lang-plugin-org/go-lang-idea-plugin","forks_url":"https://api.github.com/repos/go-lang-plugin-org/go-lang-idea-plugin/forks","keys_url":"https://api.github.com/repos/go-lang-plugin-org/go-lang-idea-plugin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/go-lang-plugin-org/go-lang-idea-plugin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/go-lang-plugin-org/go-lang-idea-plugin/teams","hooks_url":"https://api.github.com/repos/go-lang-plugin-org/go-lang-idea-plugin/hooks","issue_events_url":"https://api.github.com/repos/go-lang-plugin-org/go-lang-idea-plugin/issues/events{/number}","events_url":"https://api.github.com/repos/go-lang-plugin-org/go-lang-idea-plugin/events","assignees_url":"https://api.github.com/repos/go-lang-plugin-org/go-lang-idea-plugin/assignees{/user}","branches_url":"https://api.github.com/repos/go-lang-plugin-org/go-lang-idea-plugin/branches{/branch}","tags_url":"https://api.github.com/repos/go-lang-plugin-org/go-lang-idea-plugin/tags","blobs_url":"https://api.github.com/repos/go-lang-plugin-org/go-lang-idea-plugin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/go-lang-plugin-org/go-lang-idea-plugin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/go-lang-plugin-org/go-lang-idea-plugin/git/refs{/sha}","trees_url":"https://api.github.com/repos/go-lang-plugin-org/go-lang-idea-plugin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/go-lang-plugin-org/go-lang-idea-plugin/statuses/{sha}","languages_url":"https://api.github.com/repos/go-lang-plugin-org/go-lang-idea-plugin/languages","stargazers_url":"https://api.github.com/repos/go-lang-plugin-org/go-lang-idea-plugin/stargazers","contributors_url":"https://api.github.com/repos/go-lang-plugin-org/go-lang-idea-plugin/contributors","subscribers_url":"https://api.github.com/repos/go-lang-plugin-org/go-lang-idea-plugin/subscribers","subscription_url":"https://api.github.com/repos/go-lang-plugin-org/go-lang-idea-plugin/subscription","commits_url":"https://api.github.com/repos/go-lang-plugin-org/go-lang-idea-plugin/commits{/sha}","git_commits_url":"https://api.github.com/repos/go-lang-plugin-org/go-lang-idea-plugin/git/commits{/sha}","comments_url":"https://api.github.com/repos/go-lang-plugin-org/go-lang-idea-plugin/comments{/number}","issue_comment_url":"https://api.github.com/repos/go-lang-plugin-org/go-lang-idea-plugin/issues/comments{/number}","contents_url":"https://api.github.com/repos/go-lang-plugin-org/go-lang-idea-plugin/contents/{+path}","compare_url":"https://api.github.com/repos/go-lang-plugin-org/go-lang-idea-plugin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/go-lang-plugin-org/go-lang-idea-plugin/merges","archive_url":"https://api.github.com/repos/go-lang-plugin-org/go-lang-idea-plugin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/go-lang-plugin-org/go-lang-idea-plugin/downloads","issues_url":"https://api.github.com/repos/go-lang-plugin-org/go-lang-idea-plugin/issues{/number}","pulls_url":"https://api.github.com/repos/go-lang-plugin-org/go-lang-idea-plugin/pulls{/number}","milestones_url":"https://api.github.com/repos/go-lang-plugin-org/go-lang-idea-plugin/milestones{/number}","notifications_url":"https://api.github.com/repos/go-lang-plugin-org/go-lang-idea-plugin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/go-lang-plugin-org/go-lang-idea-plugin/labels{/name}","releases_url":"https://api.github.com/repos/go-lang-plugin-org/go-lang-idea-plugin/releases{/id}","deployments_url":"https://api.github.com/repos/go-lang-plugin-org/go-lang-idea-plugin/deployments","created_at":"2010-08-29T08:20:01Z","updated_at":"2016-10-24T12:55:12Z","pushed_at":"2016-10-24T12:12:19Z","git_url":"git://github.com/go-lang-plugin-org/go-lang-idea-plugin.git","ssh_url":"git@github.com:go-lang-plugin-org/go-lang-idea-plugin.git","clone_url":"https://github.com/go-lang-plugin-org/go-lang-idea-plugin.git","svn_url":"https://github.com/go-lang-plugin-org/go-lang-idea-plugin","homepage":"https://plugins.jetbrains.com/plugin/5047","size":69695,"stargazers_count":3889,"watchers_count":3889,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":454,"mirror_url":null,"open_issues_count":401,"forks":454,"open_issues":401,"watchers":3889,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/go-lang-plugin-org/go-lang-idea-plugin/pulls/2795"},"html":{"href":"https://github.com/go-lang-plugin-org/go-lang-idea-plugin/pull/2795"},"issue":{"href":"https://api.github.com/repos/go-lang-plugin-org/go-lang-idea-plugin/issues/2795"},"comments":{"href":"https://api.github.com/repos/go-lang-plugin-org/go-lang-idea-plugin/issues/2795/comments"},"review_comments":{"href":"https://api.github.com/repos/go-lang-plugin-org/go-lang-idea-plugin/pulls/2795/comments"},"review_comment":{"href":"https://api.github.com/repos/go-lang-plugin-org/go-lang-idea-plugin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/go-lang-plugin-org/go-lang-idea-plugin/pulls/2795/commits"},"statuses":{"href":"https://api.github.com/repos/go-lang-plugin-org/go-lang-idea-plugin/statuses/189831cb960fba412d833745bdb8a5ad3f7d743f"}}}}
{"actor":{"display_login":"grenki"}}