{"action":"created","issue":{"url":"https://api.github.com/repos/Valloric/ycmd/issues/167","labels_url":"https://api.github.com/repos/Valloric/ycmd/issues/167/labels{/name}","comments_url":"https://api.github.com/repos/Valloric/ycmd/issues/167/comments","events_url":"https://api.github.com/repos/Valloric/ycmd/issues/167/events","html_url":"https://github.com/Valloric/ycmd/pull/167","id":91526271,"number":167,"title":"[RFC] Support for FixIt in clang completer","user":{"login":"puremourning","id":10584846,"avatar_url":"https://avatars.githubusercontent.com/u/10584846?v=3","gravatar_id":"","url":"https://api.github.com/users/puremourning","html_url":"https://github.com/puremourning","followers_url":"https://api.github.com/users/puremourning/followers","following_url":"https://api.github.com/users/puremourning/following{/other_user}","gists_url":"https://api.github.com/users/puremourning/gists{/gist_id}","starred_url":"https://api.github.com/users/puremourning/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/puremourning/subscriptions","organizations_url":"https://api.github.com/users/puremourning/orgs","repos_url":"https://api.github.com/users/puremourning/repos","events_url":"https://api.github.com/users/puremourning/events{/privacy}","received_events_url":"https://api.github.com/users/puremourning/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-06-27T22:54:37Z","updated_at":"2015-06-29T19:58:34Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/Valloric/ycmd/pulls/167","html_url":"https://github.com/Valloric/ycmd/pull/167","diff_url":"https://github.com/Valloric/ycmd/pull/167.diff","patch_url":"https://github.com/Valloric/ycmd/pull/167.patch"},"body":"This change provides the server support in clang completer for providing fixit information in the diagnostic reply. The client uses this in a new :YcmFixIt command which applies changes to the vim buffer to implement trivial fixes to common coding errors. A note is added \"(FixIt)\" to the diagnostic text echo'd in vim when a FixIt is available.\r\n\r\nWhile this may seem out of the scope of ycmd/YouCompleteMe (as a completion engine), I think it is a really useful feature, and provided straight out of libclang. so I'm sending this slightly incomplete PR (along with the associated YouCompleteMe change) to see what the appetite is within the user and maintainer community, and to get feedback on the approach.\r\n\r\nI know that I need to write some tests, and perhaps tidy up some TODOs, but I would really appreciate any feedback on the approach. Also, I should confess that I haven't yet run the existing tests as I'm having trouble getting them to run on my mac. Hoping that travis will help me out :)\r\n\r\nI know I also need to update the readme.\r\n\r\nTesting has been performed manually by going through the list of .c, .cpp and .m files in clang's tests/FixIt folder and ensuring that by hitting :YcmFixIt (actually \"@:\" a lot!) on each diagnostic, the diagnostic went away (assuming a FixIt was available).\r\n\r\nI also understand that adding the vim modelines might be divisive, but the standard in this project doesn't match my usual setting :) Happy to remove them if people react angrily.\r\n\r\nOnce again thanks for the time and a great (and improving!) product.\r\n\r\nI have signed the CLA."},"comment":{"url":"https://api.github.com/repos/Valloric/ycmd/issues/comments/116818754","html_url":"https://github.com/Valloric/ycmd/pull/167#issuecomment-116818754","issue_url":"https://api.github.com/repos/Valloric/ycmd/issues/167","id":116818754,"user":{"login":"Valloric","id":919444,"avatar_url":"https://avatars.githubusercontent.com/u/919444?v=3","gravatar_id":"","url":"https://api.github.com/users/Valloric","html_url":"https://github.com/Valloric","followers_url":"https://api.github.com/users/Valloric/followers","following_url":"https://api.github.com/users/Valloric/following{/other_user}","gists_url":"https://api.github.com/users/Valloric/gists{/gist_id}","starred_url":"https://api.github.com/users/Valloric/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Valloric/subscriptions","organizations_url":"https://api.github.com/users/Valloric/orgs","repos_url":"https://api.github.com/users/Valloric/repos","events_url":"https://api.github.com/users/Valloric/events{/privacy}","received_events_url":"https://api.github.com/users/Valloric/received_events","type":"User","site_admin":false},"created_at":"2015-06-29T19:58:34Z","updated_at":"2015-06-29T19:58:34Z","body":"Thanks for sending in a PR!\r\n\r\nA past version of me would tell you this is out of scope for ycmd. Today's version of me is more mellow about such things (I don't know is that good or bad).\r\n\r\nIf we were to go down the route of providing this feature, it seems like the simplest design is that the client sends the buffer contents and gets back a new version of the buffer, which should then replace the old version. \r\n\r\nBut this then means that it's an all-or-nothing affair. You can either fix up your entire file, or nothing. By sending back info about each fix-up, the clients could present a UI for applying each fix individually or everything, as desired by the user.\r\n\r\nWe also seem to have differences between how OmniSharp and libclang expose this functionality; wrapping those differing approaches behind one API is basically the whole point of ycmd, so we need to do something sensible.\r\n\r\nAs usual, I'm open to ideas. Currently I'm leaning towards the idea of a new subcommand that would be common to completers that support fix-ups and that would return some sort of structured JSON with info about each available fix-it. The clients would then handle this in whatever way works best for them.\r\n\r\nThoughts?\r\n\r\n> I also understand that adding the vim modelines might be divisive\r\n\r\nI'm not a fan of any editor-specific artifacts in source code, and I say that as someone who uses Vim. Such artifacts don't scale (how many code editors are there?) and cruft up the code."}}