{"action":"created","issue":{"url":"https://api.github.com/repos/elixir-lang/elixir/issues/4335","repository_url":"https://api.github.com/repos/elixir-lang/elixir","labels_url":"https://api.github.com/repos/elixir-lang/elixir/issues/4335/labels{/name}","comments_url":"https://api.github.com/repos/elixir-lang/elixir/issues/4335/comments","events_url":"https://api.github.com/repos/elixir-lang/elixir/issues/4335/events","html_url":"https://github.com/elixir-lang/elixir/pull/4335","id":136730965,"number":4335,"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},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-02-26T15:43:57Z","updated_at":"2016-02-27T03:43:49Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/elixir-lang/elixir/pulls/4335","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"},"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"},"comment":{"url":"https://api.github.com/repos/elixir-lang/elixir/issues/comments/189571625","html_url":"https://github.com/elixir-lang/elixir/pull/4335#issuecomment-189571625","issue_url":"https://api.github.com/repos/elixir-lang/elixir/issues/4335","id":189571625,"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},"created_at":"2016-02-27T03:43:49Z","updated_at":"2016-02-27T03:43:49Z","body":"@josevalim Thanks for the answer!\r\nUnifying the implementation is I think a good idea.\r\n\r\nThere is a point I am a little ensure about.\r\n\r\nThe current behaviour of completions gives only the documented functions,\r\nwith the arity including all optional arguments, so for example\r\n\r\n```\r\nEnum.any? # tab gives -> any?/2\r\n```\r\n\r\nthough `any?/1` does exist.\r\n\r\nI personally think that showing all the arities would be a good idea,\r\nas it would at least help to know which parameters are optional and which are not,\r\nbut it could some noise when there are a lot of completions.\r\n\r\nWhat do you think?\r\n"}}