Recently Microsoft released an extension pack for Visual Studio Code that enables remote development in different scenarios.
The Remote Development Extension Pack allows the development against a container, a remote machine, or the Windows Subsystem for Linux (WSL) while using Visual Studio (VS) Code as a full-featured development environment.
According to the VS Code development team, the extension pack was created to address a common problem in the development community:
We saw many developers trying to use VS Code to develop against containers and remote VMs configured with specific development and runtime stacks, simply because it is too hard, too disruptive, and in some cases impossible, to set up these development environments locally. We've all experienced this problem. Unless we feel it's time to flatten that machine :), we hesitate to try out a new stack like Rust, Go, Node, or Python3, for fear of "messing up" our current, well-tuned environment.
The team also explains the challenges with existing solutions:
Remote Desktop can work, but it is difficult or impossible to set up on some Linux distributions, and the development experience can be "laggy". SSH and Vim (or local tools with file synchronization) work, but they can be slow, error-prone, and generally lack the productivity of modern development tools. Browser-based tools are useful in a variety of scenarios, but developers don't want to give up the richness and familiarity that desktop tools provide, or their existing locally installed toolchains. Worse (in our opinion!) developers had to sacrifice core VS Code experiences like IntelliSense (completions), linting, and debugging, in order to work against these environments.
With the new extension pack, a developer can use VS Code locally while keeping the source code, running application, processes, and workspace extensions in a remote location. Workspace files are mounted or copied from the local file system to the remote location. Also, since workspace extensions are placed in a remote location, the entire development environment can be seamlessly switched just by connecting to a different location. The pack is composed of three different extensions:
- Remote - SSH: Provides connection to a remote machine (or virtual machine) using SSH. Once connected to a remote location, the developer can interact with files and folders on the remote filesystem.
- Remote - Containers: Provides connection to a Docker container, allowing the developer to use it as a development environment. A JSON file in the local project tells VS Code how to create or access a container with specific tool and runtime stacks.
- Remote - WSL: Provides connection to a WSL distribution, creating a Linux-based development environment.
Image source: https://code.visualstudio.com/docs/remote/remote-overview
In a recent post, Scott Hanselman, partner program manager at Microsoft, talked about the benefits of the new extensions to remote development scenarios:
It's early days but it's extraordinarily clean. I'm really looking forward to seeing how far and effortless this style of development can go. There's so much less yak shaving! It effectively removes the whole setup part of your coding experience and you get right to it.
There are still a few limitations to each of the individual extensions, mostly related to SSH authentication and Linux distributions. Active issues related to each of the extensions can be found in their respective pages, as well as specific getting started guides. In particular, a detailed tutorial explaining how to use the Remote - SSH extension was published last week in the official VS Code blog. More information about the extension pack can also be found in its GitHub repository.