I haven't used it, but Microsoft is already offering machine learning based completions with IntelliCode [1]. See also the introductory blog post. [2]
It also offers sharing refined predictions within teams.
I think we will see some interesting developments in this domain over the next few years.
[1] https://visualstudio.microsoft.com/services/intellicode/
[2] https://devblogs.microsoft.com/visualstudio/ai-assisted-inte...
If you had a large dataset of keystroke-by-keystroke edit streams, you'd be able to match up erroneous code with the eventual fix. Google or Facebook could absolutely capture these datasets for their internal work if they wanted, and I suspect the results could be scary-good. They wouldn't be able to release the models, though, even for their open source work (Chromium and Android), because it would have such a high chance of revealing internal secrets.