Visual Studio Code only succeeded because a failed online editor was pivoted to become a desktop product, according to Microsoft Distinguished Engineer Erich Gamma.
Gamma spoke at the virtual VS Code Day yesterday on how the world's favourite programmer's editor (or is it an IDE?) came about.
Introduced at the Build event in April 2015, the VS Code open-source editor is nearly six years old. Microsoft already had a successful development tool, Visual Studio, and few could have guessed that this new editor would supplant its Windows-only cousin in popularity to the extent that just four years later Eclipse director Mike Milinkovich would express his concern about "a monopoly on development experience."
Gamma is co-author of the seminal 1994 book Design Patterns: Elements of Reusable Object-Oriented Software, describing proven models for object-oriented programming. He put these ideas into practice when, as a Distinguished Engineer at IBM Rational Software, he worked on the Java-based Eclipse IDE. According to Lee Nackman, Rational CTO at the time, both the project and the name targeted Microsoft. "Eclipse had a good ring to it and we liked the idea of eclipsing Visual Studio," he said in 2005.
Despite those ambitions, in 2011 Gamma joined Microsoft and started work on the "Monaco" project, a code editor in the browser. One of its first features was autosave. "In order to not lose any work, we always had autosave enabled... we never had the guts to change the default in VS Code to autosave, but it's a great feature and everybody in the team has it enabled," Gamma said on a virutal stage ysterday.
VS Code stats presented yesterday: 14 million monthly users, 28,000 extensions, 100,000 closed issues
"What many people don't know is that we decided to not use any UI frameworks from the beginning and that's still true today," Gamma added, "because performance is very important to us and we want to be fully in control of our own destiny."
Visual Studio Online "Monaco" was launched as a way of editing Azure websites in the browser, but failed to attract users. There were "about 3,000 monthly users, and for Microsoft, it's very hard to be relevant with this number of users," Gamma recalled. It would have to grow by 10 times or more, or be dumped.
2014 was the pivot, Gamma said. The team decided to reposition the project as a cross-platform tool, using the recently developed Electron framework, which wraps Google's Chromium project, enabling web applications to run on the desktop. It was against the normal flow: a web application that became a desktop application. The project was code-named "Ticino" and aimed at "born-on-the-web developers, with scenarios aimed at multi-platform development, debugging and deployment of Node.js applications and cross-platform .NET components," according to an internal document displayed by Gamma. It would be more than an editor, but less than a full IDE, aiming for a sweet spot between the two. VS Code was ready in time for a preview at Build the following year.
The next landmark was to support extensions, without which VS Code could not win wide adoption. Gamma drew on his Eclipse experience. "Extensions are really cool, but extensions can also hurt you," he said. "We decided to run extensions in a separate process so that the VS Code core is less impacted by extensions. For instance, save happens in the core so if an extension does some weird things or has problems it cannot impact the save." The extension API uses RPC (remote procedure call) to the extension host, explained Gamma, which also shields extension authors from VS Code's internal implementation details.
Work on this was rapid, enabling the extension API to be introduced at Microsoft's Connect event in October 2015, along with the announcement that VS Code was now open source. By then Microsoft had decided that "embracing open source, embracing open standards" was the right way to attract developers, said Gamma.
Erich Gamma (left) and Microsoft cloud EVP Scott Guthrie open source VS Code at the Connect event, October 2015
In 2016 another key piece was introduced, the Language Server Protocol (LSP). This enables developers to plug-in support for programming languages, driving features like syntax highlighting, code completion, and error detection. Next came an integrated terminal, developed by a new VS Code team based on Microsoft's main site in Redmond, Gamma said, the initial team having been in Zurich.
Remote editing was the next big challenge, partly driven by the introduction of the Windows Subsystem for Linux (WSL), and partly by the idea of being able to run applications in the browser using code in GitHub repositories. "What if you could just open this repository in VS code, and you can press F5 to run it?" said Gamma.
This meant in part reverting VS Code to become more of a browser application, which required more refactoring. Direct calls to Node.js APIs were removed and services abstracted so that, for example, "on the desktop you get native dialogs and in the browser you get HTML-built dialogues," he said. Remote development now supports both WSL and running VS Code in a Docker container, and Codespaces, a feature of GitHub, is in closed preview, and enables the repository feature Gamma mentioned – though Codespaces is taking time to get it right.
Development of VS Code is managed by Microsoft but "every month we have a plan that is a GitHub issue. Everybody can see it," Gamma said. "Since 2011 we ship every month and we have release notes every month to show continuous progress."
What's coming? There is a big commitment to Python-based integrated Jupyter notebooks, Gamma said. The arrival of Python's creator, Guido van Rossum, at Microsoft last year probably does no harm to the company's support for the language. A Python presentation later in the event showed a difference editor for Jupyter notebooks, which looks a nice feature.
Asked what he would have done differently, Gamma wouldn't give much away, though he said that the naming of the open-source project versus the VS Code product is a problem. "[Google] Chrome did a better job," he said. "They have Chrome as the product, Chromium as the open-source core. We cause some confusion." It was because of haste, he said. "The name VS Code came up five days before we shipped."
Lurking underneath that naming confusion is a larger matter: is VS Code an open project for the community or a Microsoft product that reflects company strategy? Currently it is both, but the corporate ownership is troubling to some (such as Eclipse's Milinkovich).
There is also the question of whether the project can truly avoid the bloat that so often damages successful products as they age. Gamma, though, with a background in software patterns and experience of what did and did not work at Eclipse, is well placed to manage that. As for the Eclipse Foundation, it has granted VS Code the sincerest form of flattery in the shape of its own Theia project. ®