{"action":"created","issue":{"url":"https://api.github.com/repos/Valloric/YouCompleteMe/issues/1300","labels_url":"https://api.github.com/repos/Valloric/YouCompleteMe/issues/1300/labels{/name}","comments_url":"https://api.github.com/repos/Valloric/YouCompleteMe/issues/1300/comments","events_url":"https://api.github.com/repos/Valloric/YouCompleteMe/issues/1300/events","html_url":"https://github.com/Valloric/YouCompleteMe/pull/1300","id":53020762,"number":1300,"title":"RFC: Argument hints, a.k.a. parameter completions!","user":{"login":"oblitum","id":1269815,"avatar_url":"https://avatars.githubusercontent.com/u/1269815?v=3","gravatar_id":"","url":"https://api.github.com/users/oblitum","html_url":"https://github.com/oblitum","followers_url":"https://api.github.com/users/oblitum/followers","following_url":"https://api.github.com/users/oblitum/following{/other_user}","gists_url":"https://api.github.com/users/oblitum/gists{/gist_id}","starred_url":"https://api.github.com/users/oblitum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oblitum/subscriptions","organizations_url":"https://api.github.com/users/oblitum/orgs","repos_url":"https://api.github.com/users/oblitum/repos","events_url":"https://api.github.com/users/oblitum/events{/privacy}","received_events_url":"https://api.github.com/users/oblitum/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":17,"created_at":"2014-12-29T05:34:59Z","updated_at":"2015-04-16T21:40:43Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/Valloric/YouCompleteMe/pulls/1300","html_url":"https://github.com/Valloric/YouCompleteMe/pull/1300","diff_url":"https://github.com/Valloric/YouCompleteMe/pull/1300.diff","patch_url":"https://github.com/Valloric/YouCompleteMe/pull/1300.patch"},"body":"This week I’ve setup myself to accomplish some nice \"parameter completion\" that’s in line with YouCompleteMe’s spirit.\r\n\r\nI’d like to talk about the reasoning behind the design first:\r\n\r\n- There can’t be any _argument completion_ per se, only type hints for the current argument to be passed. So I’m gonna refer to this not as _parameter completion_, but as _argument hints_.\r\n\r\n- We should stay away from a mechanism like the one employed by jedi-vim. It’s pure hackery and very prone to instability. I’ve tried it and it breaks just because one is using one colorscheme or another. We should try to stick with the native popup mechanisms offered by Vim to be stable.\r\n\r\n- We can’t start to try parsing function prototypes ourselves, on YCM/ycmd's side, to provide the hints. Such semantic analysis power should come from Clang.\r\n\r\nFrom these three assumptions I’ve devised the following design that can live in harmony with the rest of YCM:\r\n\r\n- There should be a new kind of trigger for argument hints.\r\n\r\n- Once the user starts typing text _after_ the argument hint trigger, the normal YCM completion should be able to take place. Argument hints should popup solely at the spot of an argument hint trigger, and nowhere else.\r\n\r\n- Argument hints should not provide text for completion, just hints in the popup, but no text for completion for them.\r\n\r\n- Example candidates of argument hint triggers are `(` and `,`.\r\n\r\n- libclang should be smart enough to complete after `(` and `,` to provide argument hints. If not, we should try to improve it for that and not try to hammer it on YCM/ycmd’s side.\r\n\r\nI say this’s in line with YouCompleteMe’s spirit because it doesn’t requires pressing `Enter`, etc, for some kind of selection of arguments.\r\n\r\n[Check The Video](https://vimeo.com/115547016)\r\n\r\nThis pull is actually working for free function's argument hints with the current libclang. Hints for C++ require improvements on Clang’s codebase. [Argument hints are a weak point of libclang at this moment](http://lists.cs.uiuc.edu/pipermail/cfe-dev/2012-September/024529.html), [I’ve created a fork that makes it work for C++](https://github.com/oblitum/clang/tree/improved_argument_hints), but it doesn’t work for providing hints for template arguments, for functors, or constructors, which can all work with some bit of effort probably. Nonetheless, having it working for functions, function template instances and member variations of both is quite OK. I’ll have to discuss this on the cfe-dev mailing list later.\r\n\r\nThis pull is also targetting issue #1287. I’ve removed full prototypes from the default completion popup since they can get annoying, and are less useful with this enabled.\r\n\r\nI’m providing this pull as an RFC at this moment. I’ve not provided any tests yet and I’d like to hear comments/suggestions/critics and the feasibility of it being merged. I’ll sign the CLA after that, or not.\r\n\r\nOn issue #234 I mention another method that resembles clang_complete, which also works and currently serves for template arguments. I also provide it for YCM in my fork.\r\n\r\nLast but not least: for anyone out there, HIRE ME ;-)\r\n\r\nHappy holidays!"},"comment":{"url":"https://api.github.com/repos/Valloric/YouCompleteMe/issues/comments/93846046","html_url":"https://github.com/Valloric/YouCompleteMe/pull/1300#issuecomment-93846046","issue_url":"https://api.github.com/repos/Valloric/YouCompleteMe/issues/1300","id":93846046,"user":{"login":"oblitum","id":1269815,"avatar_url":"https://avatars.githubusercontent.com/u/1269815?v=3","gravatar_id":"","url":"https://api.github.com/users/oblitum","html_url":"https://github.com/oblitum","followers_url":"https://api.github.com/users/oblitum/followers","following_url":"https://api.github.com/users/oblitum/following{/other_user}","gists_url":"https://api.github.com/users/oblitum/gists{/gist_id}","starred_url":"https://api.github.com/users/oblitum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oblitum/subscriptions","organizations_url":"https://api.github.com/users/oblitum/orgs","repos_url":"https://api.github.com/users/oblitum/repos","events_url":"https://api.github.com/users/oblitum/events{/privacy}","received_events_url":"https://api.github.com/users/oblitum/received_events","type":"User","site_admin":false},"created_at":"2015-04-16T21:40:43Z","updated_at":"2015-04-16T21:40:43Z","body":"Same state, must find time to improve the pull and it must wait for libclang 3.7 to ever get merged."}}