Developing Code out of the goodness of their hearts? No. Developing Code as part of some convoluted marketing strategy that cannot be measured? Also no.
More likely they're developing Code to compete with Sublime Text and the like. They don't have a product in that market and Microsoft's strategy is what it's always been: gaining marketshare.
Microsoft's success is [now] defined by developers active on MS technology. It underlies the open-sourcing of technologies long held proprietary, as well as the responsiveness to developer feedback.
Long term, I suspect the theory is if MS has a majority stake in the developer market, it can start defining the technology the world runs on (again). Its more of a give-take relationship though, with MS devoting resources to the resources developers actually use.