{"action":"created","issue":{"url":"https://api.github.com/repos/nsf/gocode/issues/308","labels_url":"https://api.github.com/repos/nsf/gocode/issues/308/labels{/name}","comments_url":"https://api.github.com/repos/nsf/gocode/issues/308/comments","events_url":"https://api.github.com/repos/nsf/gocode/issues/308/events","html_url":"https://github.com/nsf/gocode/issues/308","id":115681658,"number":308,"title":"Improve autocompletion results around struct initialization","user":{"login":"nsf","id":12567,"avatar_url":"https://avatars.githubusercontent.com/u/12567?v=3","gravatar_id":"","url":"https://api.github.com/users/nsf","html_url":"https://github.com/nsf","followers_url":"https://api.github.com/users/nsf/followers","following_url":"https://api.github.com/users/nsf/following{/other_user}","gists_url":"https://api.github.com/users/nsf/gists{/gist_id}","starred_url":"https://api.github.com/users/nsf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nsf/subscriptions","organizations_url":"https://api.github.com/users/nsf/orgs","repos_url":"https://api.github.com/users/nsf/repos","events_url":"https://api.github.com/users/nsf/events{/privacy}","received_events_url":"https://api.github.com/users/nsf/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/nsf/gocode/labels/Info","name":"Info","color":"207de5"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-11-07T18:01:37Z","updated_at":"2015-11-07T18:47:51Z","closed_at":null,"body":"Well, since I have no blog or any kind of mailing list. I'll just put down a couple of notes regarding stuff I do right now. Soon. I'm halfway through the improvements I wanted to achieve. Will make a little report here when I'm done."},"comment":{"url":"https://api.github.com/repos/nsf/gocode/issues/comments/154737581","html_url":"https://github.com/nsf/gocode/issues/308#issuecomment-154737581","issue_url":"https://api.github.com/repos/nsf/gocode/issues/308","id":154737581,"user":{"login":"nsf","id":12567,"avatar_url":"https://avatars.githubusercontent.com/u/12567?v=3","gravatar_id":"","url":"https://api.github.com/users/nsf","html_url":"https://github.com/nsf","followers_url":"https://api.github.com/users/nsf/followers","following_url":"https://api.github.com/users/nsf/following{/other_user}","gists_url":"https://api.github.com/users/nsf/gists{/gist_id}","starred_url":"https://api.github.com/users/nsf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nsf/subscriptions","organizations_url":"https://api.github.com/users/nsf/orgs","repos_url":"https://api.github.com/users/nsf/repos","events_url":"https://api.github.com/users/nsf/events{/privacy}","received_events_url":"https://api.github.com/users/nsf/received_events","type":"User","site_admin":false},"created_at":"2015-11-07T18:47:51Z","updated_at":"2015-11-07T18:47:51Z","body":"Okay, let's take a look at changes upcoming patch brings. As you know at some point @tiziano88 changed cursor context code quite radically. In particular support for struct initialization autocompletion was added. But it wasn't complete. For example you can see this TODO item: https://github.com/nsf/gocode/blob/c6df1295cc90424ba173336ef0ee0af2f34a5fc9/cursorcontext.go#L271\r\n\r\nAnd there are some issues with this code. At the moment it was written I didn't care much because I wasn't using Go, but now I am. And here's the patch which fixes some of the issues. I went through all of the cursor context deduction code line by line and fixed as much as I could. The list of changes:\r\n\r\n#### Case number one. Struct literals as a dot expression.\r\n**Before** (no autocompletion suggestions):\r\n![before1](https://cloud.githubusercontent.com/assets/12567/11016582/723ce808-85a8-11e5-8eac-38fffca1dfab.png)\r\n**After**:\r\n![after1](https://cloud.githubusercontent.com/assets/12567/11016593/c85aed7a-85a8-11e5-929b-16d3bfdbae5b.png)\r\n\r\n#### Case number two. Partial struct field autocompletion.\r\n**Before** (not autocompletion suggestions):\r\n![before2](https://cloud.githubusercontent.com/assets/12567/11016604/11bb091e-85a9-11e5-8883-bf17350f54ff.png)\r\n**After**:\r\n![after2](https://cloud.githubusercontent.com/assets/12567/11016607/154a37d0-85a9-11e5-8db1-74688be95081.png)\r\n\r\n#### Case number three. Imported type struct field autocompletion.\r\n**Before** (incorrect autocompletion, context deduction failure):\r\n![before3](https://cloud.githubusercontent.com/assets/12567/11016619/9ace265a-85a9-11e5-9da0-a08fc38547da.png)\r\n**After** (correct autocompletion):\r\n![after3](https://cloud.githubusercontent.com/assets/12567/11016620/9f5128bc-85a9-11e5-8d1a-9b677e704687.png)\r\n\r\nMaybe I missed or forgot a few more cases, I'm not sure. But the point is, now it should be much better. Happy go coding (pun intended)."}}