{"action":"created","comment":{"url":"https://api.github.com/repos/elixir-lang/elixir/pulls/comments/54354119","id":54354119,"diff_hunk":"@@ -162,4 +162,36 @@ defmodule IEx.AutocompleteTest do\n     assert expand('EList') == {:yes, '.', []}\n     assert expand('EList.map') == {:yes, [], ['map/2', 'mapfoldl/3', 'mapfoldr/3']}\n   end\n+\n+  test \"completion for functions added when a module is reloaded\" do\n+    filename = \"sample.ex\"\n+    content = \"\"\"\n+    defmodule Sample do\n+    def foo(), do: 0\n+    end\n+    \"\"\"\n+\n+    reloaded_content = \"\"\"\n+    defmodule Sample do\n+    def foo(), do: 0\n+    def foobar(), do: 0\n+    end\n+    \"\"\"\n+    File.write!(filename, content)\n+    compiler_options = :elixir_config.get(:compiler_options)","path":"lib/iex/test/iex/autocomplete_test.exs","position":31,"original_position":31,"commit_id":"417152c3cde3e9eaf04f6311ac9e0a1a5e6012ad","original_commit_id":"417152c3cde3e9eaf04f6311ac9e0a1a5e6012ad","user":{"login":"josevalim","id":9582,"avatar_url":"https://avatars.githubusercontent.com/u/9582?v=3","gravatar_id":"","url":"https://api.github.com/users/josevalim","html_url":"https://github.com/josevalim","followers_url":"https://api.github.com/users/josevalim/followers","following_url":"https://api.github.com/users/josevalim/following{/other_user}","gists_url":"https://api.github.com/users/josevalim/gists{/gist_id}","starred_url":"https://api.github.com/users/josevalim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/josevalim/subscriptions","organizations_url":"https://api.github.com/users/josevalim/orgs","repos_url":"https://api.github.com/users/josevalim/repos","events_url":"https://api.github.com/users/josevalim/events{/privacy}","received_events_url":"https://api.github.com/users/josevalim/received_events","type":"User","site_admin":false},"body":"I see. I will revert my latest commit then and rewrite it to simply not use internal functions. Thank you!","created_at":"2016-02-28T18:40:52Z","updated_at":"2016-02-28T18:40:52Z","html_url":"https://github.com/elixir-lang/elixir/pull/4335#discussion_r54354119","pull_request_url":"https://api.github.com/repos/elixir-lang/elixir/pulls/4335","_links":{"self":{"href":"https://api.github.com/repos/elixir-lang/elixir/pulls/comments/54354119"},"html":{"href":"https://github.com/elixir-lang/elixir/pull/4335#discussion_r54354119"},"pull_request":{"href":"https://api.github.com/repos/elixir-lang/elixir/pulls/4335"}}},"pull_request":{"url":"https://api.github.com/repos/elixir-lang/elixir/pulls/4335","id":60860034,"html_url":"https://github.com/elixir-lang/elixir/pull/4335","diff_url":"https://github.com/elixir-lang/elixir/pull/4335.diff","patch_url":"https://github.com/elixir-lang/elixir/pull/4335.patch","issue_url":"https://api.github.com/repos/elixir-lang/elixir/issues/4335","number":4335,"state":"closed","locked":false,"title":"Update iex autocomplete to show new functions in reloaded modules.","user":{"login":"tuvistavie","id":1436271,"avatar_url":"https://avatars.githubusercontent.com/u/1436271?v=3","gravatar_id":"","url":"https://api.github.com/users/tuvistavie","html_url":"https://github.com/tuvistavie","followers_url":"https://api.github.com/users/tuvistavie/followers","following_url":"https://api.github.com/users/tuvistavie/following{/other_user}","gists_url":"https://api.github.com/users/tuvistavie/gists{/gist_id}","starred_url":"https://api.github.com/users/tuvistavie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tuvistavie/subscriptions","organizations_url":"https://api.github.com/users/tuvistavie/orgs","repos_url":"https://api.github.com/users/tuvistavie/repos","events_url":"https://api.github.com/users/tuvistavie/events{/privacy}","received_events_url":"https://api.github.com/users/tuvistavie/received_events","type":"User","site_admin":false},"body":"When I am trying things out in IEx, I use the `r` helper\r\nvery often, but when defining new functions, the completions are\r\nnot available, so I thought it would be better if they would.\r\n\r\n```elixir\r\n# my_mod.ex\r\ndefmodule MyMod do\r\n  def foo, do: \"foo\"\r\nend\r\n\r\n# iex\r\nMyMod. # tab shows foo\r\n# edit MyMod and define bar\r\nr(MyMod)\r\nMyMod. # tab still shows only foo\r\n```\r\n\r\nWith this PR, the functions newly defined are shown when the module is reloaded.\r\n\r\nHowever, I am not really sure this is the best approach, as\r\nthe functions removed when reloading will still be shown.\r\nAs it is already the case, it is not a regression, but it would\r\nbe better if there were a way to have really up to date completions.\r\n\r\nSo I have a few questions\r\n\r\n1. Does what I am trying to do in this PR seems ok?\r\n2. Is there a better way to update the completions to handle reloaded modules?\r\n3. Would there be a way to get rid of the warning caused by `Coad.load_file` redefining the `Sample` module in the test?\r\n\r\nThank you!\r\n","created_at":"2016-02-26T15:43:57Z","updated_at":"2016-02-28T18:40:52Z","closed_at":"2016-02-28T18:32:50Z","merged_at":"2016-02-28T18:32:50Z","merge_commit_sha":"372c9ce636fbc834c1a6838a92d5d82f6e02e951","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/elixir-lang/elixir/pulls/4335/commits","review_comments_url":"https://api.github.com/repos/elixir-lang/elixir/pulls/4335/comments","review_comment_url":"https://api.github.com/repos/elixir-lang/elixir/pulls/comments{/number}","comments_url":"https://api.github.com/repos/elixir-lang/elixir/issues/4335/comments","statuses_url":"https://api.github.com/repos/elixir-lang/elixir/statuses/417152c3cde3e9eaf04f6311ac9e0a1a5e6012ad","head":{"label":"tuvistavie:display-reloaded-functions-completions","ref":"display-reloaded-functions-completions","sha":"417152c3cde3e9eaf04f6311ac9e0a1a5e6012ad","user":{"login":"tuvistavie","id":1436271,"avatar_url":"https://avatars.githubusercontent.com/u/1436271?v=3","gravatar_id":"","url":"https://api.github.com/users/tuvistavie","html_url":"https://github.com/tuvistavie","followers_url":"https://api.github.com/users/tuvistavie/followers","following_url":"https://api.github.com/users/tuvistavie/following{/other_user}","gists_url":"https://api.github.com/users/tuvistavie/gists{/gist_id}","starred_url":"https://api.github.com/users/tuvistavie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tuvistavie/subscriptions","organizations_url":"https://api.github.com/users/tuvistavie/orgs","repos_url":"https://api.github.com/users/tuvistavie/repos","events_url":"https://api.github.com/users/tuvistavie/events{/privacy}","received_events_url":"https://api.github.com/users/tuvistavie/received_events","type":"User","site_admin":false},"repo":{"id":47486383,"name":"elixir","full_name":"tuvistavie/elixir","owner":{"login":"tuvistavie","id":1436271,"avatar_url":"https://avatars.githubusercontent.com/u/1436271?v=3","gravatar_id":"","url":"https://api.github.com/users/tuvistavie","html_url":"https://github.com/tuvistavie","followers_url":"https://api.github.com/users/tuvistavie/followers","following_url":"https://api.github.com/users/tuvistavie/following{/other_user}","gists_url":"https://api.github.com/users/tuvistavie/gists{/gist_id}","starred_url":"https://api.github.com/users/tuvistavie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tuvistavie/subscriptions","organizations_url":"https://api.github.com/users/tuvistavie/orgs","repos_url":"https://api.github.com/users/tuvistavie/repos","events_url":"https://api.github.com/users/tuvistavie/events{/privacy}","received_events_url":"https://api.github.com/users/tuvistavie/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tuvistavie/elixir","description":"Elixir is a dynamic, functional language designed for building scalable and maintainable applications","fork":true,"url":"https://api.github.com/repos/tuvistavie/elixir","forks_url":"https://api.github.com/repos/tuvistavie/elixir/forks","keys_url":"https://api.github.com/repos/tuvistavie/elixir/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tuvistavie/elixir/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tuvistavie/elixir/teams","hooks_url":"https://api.github.com/repos/tuvistavie/elixir/hooks","issue_events_url":"https://api.github.com/repos/tuvistavie/elixir/issues/events{/number}","events_url":"https://api.github.com/repos/tuvistavie/elixir/events","assignees_url":"https://api.github.com/repos/tuvistavie/elixir/assignees{/user}","branches_url":"https://api.github.com/repos/tuvistavie/elixir/branches{/branch}","tags_url":"https://api.github.com/repos/tuvistavie/elixir/tags","blobs_url":"https://api.github.com/repos/tuvistavie/elixir/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tuvistavie/elixir/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tuvistavie/elixir/git/refs{/sha}","trees_url":"https://api.github.com/repos/tuvistavie/elixir/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tuvistavie/elixir/statuses/{sha}","languages_url":"https://api.github.com/repos/tuvistavie/elixir/languages","stargazers_url":"https://api.github.com/repos/tuvistavie/elixir/stargazers","contributors_url":"https://api.github.com/repos/tuvistavie/elixir/contributors","subscribers_url":"https://api.github.com/repos/tuvistavie/elixir/subscribers","subscription_url":"https://api.github.com/repos/tuvistavie/elixir/subscription","commits_url":"https://api.github.com/repos/tuvistavie/elixir/commits{/sha}","git_commits_url":"https://api.github.com/repos/tuvistavie/elixir/git/commits{/sha}","comments_url":"https://api.github.com/repos/tuvistavie/elixir/comments{/number}","issue_comment_url":"https://api.github.com/repos/tuvistavie/elixir/issues/comments{/number}","contents_url":"https://api.github.com/repos/tuvistavie/elixir/contents/{+path}","compare_url":"https://api.github.com/repos/tuvistavie/elixir/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tuvistavie/elixir/merges","archive_url":"https://api.github.com/repos/tuvistavie/elixir/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tuvistavie/elixir/downloads","issues_url":"https://api.github.com/repos/tuvistavie/elixir/issues{/number}","pulls_url":"https://api.github.com/repos/tuvistavie/elixir/pulls{/number}","milestones_url":"https://api.github.com/repos/tuvistavie/elixir/milestones{/number}","notifications_url":"https://api.github.com/repos/tuvistavie/elixir/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tuvistavie/elixir/labels{/name}","releases_url":"https://api.github.com/repos/tuvistavie/elixir/releases{/id}","deployments_url":"https://api.github.com/repos/tuvistavie/elixir/deployments","created_at":"2015-12-06T06:26:36Z","updated_at":"2016-01-11T08:14:03Z","pushed_at":"2016-02-28T18:26:34Z","git_url":"git://github.com/tuvistavie/elixir.git","ssh_url":"git@github.com:tuvistavie/elixir.git","clone_url":"https://github.com/tuvistavie/elixir.git","svn_url":"https://github.com/tuvistavie/elixir","homepage":"http://elixir-lang.org/","size":33760,"stargazers_count":0,"watchers_count":0,"language":"Elixir","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":"elixir-lang:master","ref":"master","sha":"2559df88a6c0150964e902eae2827bc5d5e78ac3","user":{"login":"elixir-lang","id":1481354,"avatar_url":"https://avatars.githubusercontent.com/u/1481354?v=3","gravatar_id":"","url":"https://api.github.com/users/elixir-lang","html_url":"https://github.com/elixir-lang","followers_url":"https://api.github.com/users/elixir-lang/followers","following_url":"https://api.github.com/users/elixir-lang/following{/other_user}","gists_url":"https://api.github.com/users/elixir-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/elixir-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elixir-lang/subscriptions","organizations_url":"https://api.github.com/users/elixir-lang/orgs","repos_url":"https://api.github.com/users/elixir-lang/repos","events_url":"https://api.github.com/users/elixir-lang/events{/privacy}","received_events_url":"https://api.github.com/users/elixir-lang/received_events","type":"Organization","site_admin":false},"repo":{"id":1234714,"name":"elixir","full_name":"elixir-lang/elixir","owner":{"login":"elixir-lang","id":1481354,"avatar_url":"https://avatars.githubusercontent.com/u/1481354?v=3","gravatar_id":"","url":"https://api.github.com/users/elixir-lang","html_url":"https://github.com/elixir-lang","followers_url":"https://api.github.com/users/elixir-lang/followers","following_url":"https://api.github.com/users/elixir-lang/following{/other_user}","gists_url":"https://api.github.com/users/elixir-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/elixir-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elixir-lang/subscriptions","organizations_url":"https://api.github.com/users/elixir-lang/orgs","repos_url":"https://api.github.com/users/elixir-lang/repos","events_url":"https://api.github.com/users/elixir-lang/events{/privacy}","received_events_url":"https://api.github.com/users/elixir-lang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/elixir-lang/elixir","description":"Elixir is a dynamic, functional language designed for building scalable and maintainable applications","fork":false,"url":"https://api.github.com/repos/elixir-lang/elixir","forks_url":"https://api.github.com/repos/elixir-lang/elixir/forks","keys_url":"https://api.github.com/repos/elixir-lang/elixir/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elixir-lang/elixir/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elixir-lang/elixir/teams","hooks_url":"https://api.github.com/repos/elixir-lang/elixir/hooks","issue_events_url":"https://api.github.com/repos/elixir-lang/elixir/issues/events{/number}","events_url":"https://api.github.com/repos/elixir-lang/elixir/events","assignees_url":"https://api.github.com/repos/elixir-lang/elixir/assignees{/user}","branches_url":"https://api.github.com/repos/elixir-lang/elixir/branches{/branch}","tags_url":"https://api.github.com/repos/elixir-lang/elixir/tags","blobs_url":"https://api.github.com/repos/elixir-lang/elixir/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elixir-lang/elixir/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elixir-lang/elixir/git/refs{/sha}","trees_url":"https://api.github.com/repos/elixir-lang/elixir/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elixir-lang/elixir/statuses/{sha}","languages_url":"https://api.github.com/repos/elixir-lang/elixir/languages","stargazers_url":"https://api.github.com/repos/elixir-lang/elixir/stargazers","contributors_url":"https://api.github.com/repos/elixir-lang/elixir/contributors","subscribers_url":"https://api.github.com/repos/elixir-lang/elixir/subscribers","subscription_url":"https://api.github.com/repos/elixir-lang/elixir/subscription","commits_url":"https://api.github.com/repos/elixir-lang/elixir/commits{/sha}","git_commits_url":"https://api.github.com/repos/elixir-lang/elixir/git/commits{/sha}","comments_url":"https://api.github.com/repos/elixir-lang/elixir/comments{/number}","issue_comment_url":"https://api.github.com/repos/elixir-lang/elixir/issues/comments{/number}","contents_url":"https://api.github.com/repos/elixir-lang/elixir/contents/{+path}","compare_url":"https://api.github.com/repos/elixir-lang/elixir/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elixir-lang/elixir/merges","archive_url":"https://api.github.com/repos/elixir-lang/elixir/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elixir-lang/elixir/downloads","issues_url":"https://api.github.com/repos/elixir-lang/elixir/issues{/number}","pulls_url":"https://api.github.com/repos/elixir-lang/elixir/pulls{/number}","milestones_url":"https://api.github.com/repos/elixir-lang/elixir/milestones{/number}","notifications_url":"https://api.github.com/repos/elixir-lang/elixir/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elixir-lang/elixir/labels{/name}","releases_url":"https://api.github.com/repos/elixir-lang/elixir/releases{/id}","deployments_url":"https://api.github.com/repos/elixir-lang/elixir/deployments","created_at":"2011-01-09T08:43:57Z","updated_at":"2016-02-28T18:08:32Z","pushed_at":"2016-02-28T18:37:09Z","git_url":"git://github.com/elixir-lang/elixir.git","ssh_url":"git@github.com:elixir-lang/elixir.git","clone_url":"https://github.com/elixir-lang/elixir.git","svn_url":"https://github.com/elixir-lang/elixir","homepage":"http://elixir-lang.org/","size":41973,"stargazers_count":6386,"watchers_count":6386,"language":"Elixir","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":873,"mirror_url":null,"open_issues_count":37,"forks":873,"open_issues":37,"watchers":6386,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/elixir-lang/elixir/pulls/4335"},"html":{"href":"https://github.com/elixir-lang/elixir/pull/4335"},"issue":{"href":"https://api.github.com/repos/elixir-lang/elixir/issues/4335"},"comments":{"href":"https://api.github.com/repos/elixir-lang/elixir/issues/4335/comments"},"review_comments":{"href":"https://api.github.com/repos/elixir-lang/elixir/pulls/4335/comments"},"review_comment":{"href":"https://api.github.com/repos/elixir-lang/elixir/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/elixir-lang/elixir/pulls/4335/commits"},"statuses":{"href":"https://api.github.com/repos/elixir-lang/elixir/statuses/417152c3cde3e9eaf04f6311ac9e0a1a5e6012ad"}}}}