{"action":"created","comment":{"url":"https://api.github.com/repos/ignatov/intellij-erlang/pulls/comments/37963840","id":37963840,"diff_hunk":"@@ -0,0 +1,78 @@\n+/*\n+ * Copyright 2012-2015 Sergey Ignatov\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 org.intellij.erlang.completion;\n+\n+import com.intellij.codeInsight.completion.*;\n+import com.intellij.codeInsight.lookup.LookupElementBuilder;\n+import com.intellij.psi.PsiElement;\n+import com.intellij.psi.PsiFile;\n+import com.intellij.psi.util.PsiTreeUtil;\n+import com.intellij.util.ProcessingContext;\n+import com.intellij.util.containers.ContainerUtil;\n+import org.intellij.erlang.ErlangFileType;\n+import org.intellij.erlang.psi.ErlangFile;\n+import org.intellij.erlang.psi.ErlangListExpression;\n+import org.intellij.erlang.psi.ErlangTupleExpression;\n+import org.jetbrains.annotations.NotNull;\n+\n+import java.util.Set;\n+\n+import static com.intellij.patterns.PlatformPatterns.psiElement;\n+import static com.intellij.patterns.StandardPatterns.instanceOf;\n+\n+public class ErlangAppCompletionContributor extends CompletionContributor {\n+  // source: \"FILE SYNTAX\" section of http://www.erlang.org/doc/man/app.html\n+  public static final Set<String> KEYWORDS = ContainerUtil.newHashSet(\"description\", \"id\", \"vsn\", \"modules\", \"maxP\",\n+                                                                      \"maxT\", \"registered\", \"included_applications\",\n+                                                                      \"applications\", \"env\", \"mod\", \"start_phases\",\n+                                                                      \"runtime_dependencies\");\n+\n+  @Override\n+  public void beforeCompletion(@NotNull CompletionInitializationContext context) {\n+    PsiFile file = context.getFile();\n+    if (file.getFileType() != ErlangFileType.APP) return;\n+    int startOffset = context.getStartOffset();\n+    PsiElement elementAt = file.findElementAt(startOffset);\n+    PsiElement parent = elementAt != null ? elementAt.getParent() : null;\n+    if (parent instanceof ErlangTupleExpression) {\n+      context.setDummyIdentifier(\"a\");\n+    }","path":"src/org/intellij/erlang/completion/ErlangAppCompletionContributor.java","position":53,"original_position":53,"commit_id":"351149a7a92c4e38e182109378d3320ea6561d33","original_commit_id":"351149a7a92c4e38e182109378d3320ea6561d33","user":{"login":"deadok22","id":1259620,"avatar_url":"https://avatars.githubusercontent.com/u/1259620?v=3","gravatar_id":"","url":"https://api.github.com/users/deadok22","html_url":"https://github.com/deadok22","followers_url":"https://api.github.com/users/deadok22/followers","following_url":"https://api.github.com/users/deadok22/following{/other_user}","gists_url":"https://api.github.com/users/deadok22/gists{/gist_id}","starred_url":"https://api.github.com/users/deadok22/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deadok22/subscriptions","organizations_url":"https://api.github.com/users/deadok22/orgs","repos_url":"https://api.github.com/users/deadok22/repos","events_url":"https://api.github.com/users/deadok22/events{/privacy}","received_events_url":"https://api.github.com/users/deadok22/received_events","type":"User","site_admin":false},"body":"Do you really need to set dummy identifier?\r\n","created_at":"2015-08-26T09:47:05Z","updated_at":"2015-08-26T09:47:05Z","html_url":"https://github.com/ignatov/intellij-erlang/pull/678#discussion_r37963840","pull_request_url":"https://api.github.com/repos/ignatov/intellij-erlang/pulls/678","_links":{"self":{"href":"https://api.github.com/repos/ignatov/intellij-erlang/pulls/comments/37963840"},"html":{"href":"https://github.com/ignatov/intellij-erlang/pull/678#discussion_r37963840"},"pull_request":{"href":"https://api.github.com/repos/ignatov/intellij-erlang/pulls/678"}}},"pull_request":{"url":"https://api.github.com/repos/ignatov/intellij-erlang/pulls/678","id":43375864,"html_url":"https://github.com/ignatov/intellij-erlang/pull/678","diff_url":"https://github.com/ignatov/intellij-erlang/pull/678.diff","patch_url":"https://github.com/ignatov/intellij-erlang/pull/678.patch","issue_url":"https://api.github.com/repos/ignatov/intellij-erlang/issues/678","number":678,"state":"open","locked":false,"title":"Add completion for keywords in application file","user":{"login":"telezhnaya","id":11246099,"avatar_url":"https://avatars.githubusercontent.com/u/11246099?v=3","gravatar_id":"","url":"https://api.github.com/users/telezhnaya","html_url":"https://github.com/telezhnaya","followers_url":"https://api.github.com/users/telezhnaya/followers","following_url":"https://api.github.com/users/telezhnaya/following{/other_user}","gists_url":"https://api.github.com/users/telezhnaya/gists{/gist_id}","starred_url":"https://api.github.com/users/telezhnaya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/telezhnaya/subscriptions","organizations_url":"https://api.github.com/users/telezhnaya/orgs","repos_url":"https://api.github.com/users/telezhnaya/repos","events_url":"https://api.github.com/users/telezhnaya/events{/privacy}","received_events_url":"https://api.github.com/users/telezhnaya/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-08-26T08:24:50Z","updated_at":"2015-08-26T09:47:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"68eb41653fa57da9c516e3acfc412570bcf61574","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ignatov/intellij-erlang/pulls/678/commits","review_comments_url":"https://api.github.com/repos/ignatov/intellij-erlang/pulls/678/comments","review_comment_url":"https://api.github.com/repos/ignatov/intellij-erlang/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ignatov/intellij-erlang/issues/678/comments","statuses_url":"https://api.github.com/repos/ignatov/intellij-erlang/statuses/351149a7a92c4e38e182109378d3320ea6561d33","head":{"label":"telezhnaya:completion","ref":"completion","sha":"351149a7a92c4e38e182109378d3320ea6561d33","user":{"login":"telezhnaya","id":11246099,"avatar_url":"https://avatars.githubusercontent.com/u/11246099?v=3","gravatar_id":"","url":"https://api.github.com/users/telezhnaya","html_url":"https://github.com/telezhnaya","followers_url":"https://api.github.com/users/telezhnaya/followers","following_url":"https://api.github.com/users/telezhnaya/following{/other_user}","gists_url":"https://api.github.com/users/telezhnaya/gists{/gist_id}","starred_url":"https://api.github.com/users/telezhnaya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/telezhnaya/subscriptions","organizations_url":"https://api.github.com/users/telezhnaya/orgs","repos_url":"https://api.github.com/users/telezhnaya/repos","events_url":"https://api.github.com/users/telezhnaya/events{/privacy}","received_events_url":"https://api.github.com/users/telezhnaya/received_events","type":"User","site_admin":false},"repo":{"id":38743302,"name":"intellij-erlang","full_name":"telezhnaya/intellij-erlang","owner":{"login":"telezhnaya","id":11246099,"avatar_url":"https://avatars.githubusercontent.com/u/11246099?v=3","gravatar_id":"","url":"https://api.github.com/users/telezhnaya","html_url":"https://github.com/telezhnaya","followers_url":"https://api.github.com/users/telezhnaya/followers","following_url":"https://api.github.com/users/telezhnaya/following{/other_user}","gists_url":"https://api.github.com/users/telezhnaya/gists{/gist_id}","starred_url":"https://api.github.com/users/telezhnaya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/telezhnaya/subscriptions","organizations_url":"https://api.github.com/users/telezhnaya/orgs","repos_url":"https://api.github.com/users/telezhnaya/repos","events_url":"https://api.github.com/users/telezhnaya/events{/privacy}","received_events_url":"https://api.github.com/users/telezhnaya/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/telezhnaya/intellij-erlang","description":"Erlang IDE (IntelliJ-based)","fork":true,"url":"https://api.github.com/repos/telezhnaya/intellij-erlang","forks_url":"https://api.github.com/repos/telezhnaya/intellij-erlang/forks","keys_url":"https://api.github.com/repos/telezhnaya/intellij-erlang/keys{/key_id}","collaborators_url":"https://api.github.com/repos/telezhnaya/intellij-erlang/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/telezhnaya/intellij-erlang/teams","hooks_url":"https://api.github.com/repos/telezhnaya/intellij-erlang/hooks","issue_events_url":"https://api.github.com/repos/telezhnaya/intellij-erlang/issues/events{/number}","events_url":"https://api.github.com/repos/telezhnaya/intellij-erlang/events","assignees_url":"https://api.github.com/repos/telezhnaya/intellij-erlang/assignees{/user}","branches_url":"https://api.github.com/repos/telezhnaya/intellij-erlang/branches{/branch}","tags_url":"https://api.github.com/repos/telezhnaya/intellij-erlang/tags","blobs_url":"https://api.github.com/repos/telezhnaya/intellij-erlang/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/telezhnaya/intellij-erlang/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/telezhnaya/intellij-erlang/git/refs{/sha}","trees_url":"https://api.github.com/repos/telezhnaya/intellij-erlang/git/trees{/sha}","statuses_url":"https://api.github.com/repos/telezhnaya/intellij-erlang/statuses/{sha}","languages_url":"https://api.github.com/repos/telezhnaya/intellij-erlang/languages","stargazers_url":"https://api.github.com/repos/telezhnaya/intellij-erlang/stargazers","contributors_url":"https://api.github.com/repos/telezhnaya/intellij-erlang/contributors","subscribers_url":"https://api.github.com/repos/telezhnaya/intellij-erlang/subscribers","subscription_url":"https://api.github.com/repos/telezhnaya/intellij-erlang/subscription","commits_url":"https://api.github.com/repos/telezhnaya/intellij-erlang/commits{/sha}","git_commits_url":"https://api.github.com/repos/telezhnaya/intellij-erlang/git/commits{/sha}","comments_url":"https://api.github.com/repos/telezhnaya/intellij-erlang/comments{/number}","issue_comment_url":"https://api.github.com/repos/telezhnaya/intellij-erlang/issues/comments{/number}","contents_url":"https://api.github.com/repos/telezhnaya/intellij-erlang/contents/{+path}","compare_url":"https://api.github.com/repos/telezhnaya/intellij-erlang/compare/{base}...{head}","merges_url":"https://api.github.com/repos/telezhnaya/intellij-erlang/merges","archive_url":"https://api.github.com/repos/telezhnaya/intellij-erlang/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/telezhnaya/intellij-erlang/downloads","issues_url":"https://api.github.com/repos/telezhnaya/intellij-erlang/issues{/number}","pulls_url":"https://api.github.com/repos/telezhnaya/intellij-erlang/pulls{/number}","milestones_url":"https://api.github.com/repos/telezhnaya/intellij-erlang/milestones{/number}","notifications_url":"https://api.github.com/repos/telezhnaya/intellij-erlang/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/telezhnaya/intellij-erlang/labels{/name}","releases_url":"https://api.github.com/repos/telezhnaya/intellij-erlang/releases{/id}","created_at":"2015-07-08T09:00:53Z","updated_at":"2015-07-08T09:00:56Z","pushed_at":"2015-08-26T08:24:09Z","git_url":"git://github.com/telezhnaya/intellij-erlang.git","ssh_url":"git@github.com:telezhnaya/intellij-erlang.git","clone_url":"https://github.com/telezhnaya/intellij-erlang.git","svn_url":"https://github.com/telezhnaya/intellij-erlang","homepage":"https://www.jetbrains.com/idea/features/erlang.html","size":69441,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"ignatov:master","ref":"master","sha":"9002eb91298dd8b180d36e371d3bdca544a9b4be","user":{"login":"ignatov","id":426890,"avatar_url":"https://avatars.githubusercontent.com/u/426890?v=3","gravatar_id":"","url":"https://api.github.com/users/ignatov","html_url":"https://github.com/ignatov","followers_url":"https://api.github.com/users/ignatov/followers","following_url":"https://api.github.com/users/ignatov/following{/other_user}","gists_url":"https://api.github.com/users/ignatov/gists{/gist_id}","starred_url":"https://api.github.com/users/ignatov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ignatov/subscriptions","organizations_url":"https://api.github.com/users/ignatov/orgs","repos_url":"https://api.github.com/users/ignatov/repos","events_url":"https://api.github.com/users/ignatov/events{/privacy}","received_events_url":"https://api.github.com/users/ignatov/received_events","type":"User","site_admin":false},"repo":{"id":5168907,"name":"intellij-erlang","full_name":"ignatov/intellij-erlang","owner":{"login":"ignatov","id":426890,"avatar_url":"https://avatars.githubusercontent.com/u/426890?v=3","gravatar_id":"","url":"https://api.github.com/users/ignatov","html_url":"https://github.com/ignatov","followers_url":"https://api.github.com/users/ignatov/followers","following_url":"https://api.github.com/users/ignatov/following{/other_user}","gists_url":"https://api.github.com/users/ignatov/gists{/gist_id}","starred_url":"https://api.github.com/users/ignatov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ignatov/subscriptions","organizations_url":"https://api.github.com/users/ignatov/orgs","repos_url":"https://api.github.com/users/ignatov/repos","events_url":"https://api.github.com/users/ignatov/events{/privacy}","received_events_url":"https://api.github.com/users/ignatov/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ignatov/intellij-erlang","description":"Erlang IDE (IntelliJ-based)","fork":false,"url":"https://api.github.com/repos/ignatov/intellij-erlang","forks_url":"https://api.github.com/repos/ignatov/intellij-erlang/forks","keys_url":"https://api.github.com/repos/ignatov/intellij-erlang/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ignatov/intellij-erlang/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ignatov/intellij-erlang/teams","hooks_url":"https://api.github.com/repos/ignatov/intellij-erlang/hooks","issue_events_url":"https://api.github.com/repos/ignatov/intellij-erlang/issues/events{/number}","events_url":"https://api.github.com/repos/ignatov/intellij-erlang/events","assignees_url":"https://api.github.com/repos/ignatov/intellij-erlang/assignees{/user}","branches_url":"https://api.github.com/repos/ignatov/intellij-erlang/branches{/branch}","tags_url":"https://api.github.com/repos/ignatov/intellij-erlang/tags","blobs_url":"https://api.github.com/repos/ignatov/intellij-erlang/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ignatov/intellij-erlang/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ignatov/intellij-erlang/git/refs{/sha}","trees_url":"https://api.github.com/repos/ignatov/intellij-erlang/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ignatov/intellij-erlang/statuses/{sha}","languages_url":"https://api.github.com/repos/ignatov/intellij-erlang/languages","stargazers_url":"https://api.github.com/repos/ignatov/intellij-erlang/stargazers","contributors_url":"https://api.github.com/repos/ignatov/intellij-erlang/contributors","subscribers_url":"https://api.github.com/repos/ignatov/intellij-erlang/subscribers","subscription_url":"https://api.github.com/repos/ignatov/intellij-erlang/subscription","commits_url":"https://api.github.com/repos/ignatov/intellij-erlang/commits{/sha}","git_commits_url":"https://api.github.com/repos/ignatov/intellij-erlang/git/commits{/sha}","comments_url":"https://api.github.com/repos/ignatov/intellij-erlang/comments{/number}","issue_comment_url":"https://api.github.com/repos/ignatov/intellij-erlang/issues/comments{/number}","contents_url":"https://api.github.com/repos/ignatov/intellij-erlang/contents/{+path}","compare_url":"https://api.github.com/repos/ignatov/intellij-erlang/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ignatov/intellij-erlang/merges","archive_url":"https://api.github.com/repos/ignatov/intellij-erlang/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ignatov/intellij-erlang/downloads","issues_url":"https://api.github.com/repos/ignatov/intellij-erlang/issues{/number}","pulls_url":"https://api.github.com/repos/ignatov/intellij-erlang/pulls{/number}","milestones_url":"https://api.github.com/repos/ignatov/intellij-erlang/milestones{/number}","notifications_url":"https://api.github.com/repos/ignatov/intellij-erlang/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ignatov/intellij-erlang/labels{/name}","releases_url":"https://api.github.com/repos/ignatov/intellij-erlang/releases{/id}","created_at":"2012-07-24T17:41:30Z","updated_at":"2015-08-18T23:53:32Z","pushed_at":"2015-08-26T08:24:50Z","git_url":"git://github.com/ignatov/intellij-erlang.git","ssh_url":"git@github.com:ignatov/intellij-erlang.git","clone_url":"https://github.com/ignatov/intellij-erlang.git","svn_url":"https://github.com/ignatov/intellij-erlang","homepage":"https://www.jetbrains.com/idea/features/erlang.html","size":74426,"stargazers_count":396,"watchers_count":396,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":44,"mirror_url":null,"open_issues_count":122,"forks":44,"open_issues":122,"watchers":396,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ignatov/intellij-erlang/pulls/678"},"html":{"href":"https://github.com/ignatov/intellij-erlang/pull/678"},"issue":{"href":"https://api.github.com/repos/ignatov/intellij-erlang/issues/678"},"comments":{"href":"https://api.github.com/repos/ignatov/intellij-erlang/issues/678/comments"},"review_comments":{"href":"https://api.github.com/repos/ignatov/intellij-erlang/pulls/678/comments"},"review_comment":{"href":"https://api.github.com/repos/ignatov/intellij-erlang/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ignatov/intellij-erlang/pulls/678/commits"},"statuses":{"href":"https://api.github.com/repos/ignatov/intellij-erlang/statuses/351149a7a92c4e38e182109378d3320ea6561d33"}}}}