Visual Studio Code First Impressions

Microsoft will soon release a cross platform code editor to develop ASP.NET and NodeJS applications in Windows, Linux and Mac. The Visual Studio Code is an advanced code editor which is part of the Visual Studio family.

I will give that a moment to sink in.

Yes, Microsoft has made a code editor for Linux. And the pre-release version looks most promising especially for cross-platform development.

As a powerful code editor, Visual Studio Code comes with many great features. VS Code is meant for simple daily use yet offers more than your usual syntax highlighting text editor. Of course, it will highlight around thirty of the most common languages. VS Code also offers bracket matching, multiple selections and multiple cursor edition, code completion with what Microsoft calls “IntelliSense” for select languages, live references, peeked editor, hover information, and many other useful features.

Besides the powerful editing capabilities, VS Code features regex capable search, has a simple git interface and handles git commands, and also comes with a debugger.

Visual Studio Code comes as a distribution agnostic binary for Linux. There is no installer, which is probably better, as you might not want Microsoft-made application request root privileges on your system (Even though Microsoft is one of the biggest contributors to the Linux kernel development, it just gives a certain peace of mind for the long-time Linux user.).

You can get the current pre-release version with

but it is probably best to visit the Visual Studio Code website to make sure you get the latest file. After the download, you will need to make a directory for it to live in:

and unzip the downloaded file into it:

Creating a symlink will make it easier to run VS Code, which in our case would look like:

Then just run

from a terminal or create a desktop shortcut. If you have a project you’d like to load when VS Code starts, enter the directory and run

Upon first start, you will be greeted with a dark-themed, dual-pane simple code editor window, showing a welcome message.

Dual-pane simple code editor window.

The welcome screen is a mix of markup and markdown, and as such it is an excellent showcase of how easily VS Code can render markdown. On the following image, the welcome file is shown twice, its code beside its preview (Ctrl + Shift + V to toggle):

The welcome screen is a mix of markup and markdown.

When you load some ASP.NET projects, however, you will be greeted with a complaint.

When you load some ASP.NET projects you see a complaint.

VS Code uses mono 3.10+, and without it some of its functionality does not work as expected. Unfortunately mono 3.10 did not yet find its way into most Linux distros. On Ubuntu 15.04, you will still get version 3.2.8 packaged. To install the latest version, recommends to add a Debian Wheezy repository. This will of course be compatible with Debian-based systems, but mixing distro repositories is usually not considered a very good idea.

If you absolutely must have the latest mono (4.0.1 at the time of writing) or you want to rely on VS Code for production (which you should not, as it is pre-relrease), you can add the repository with:

then run

For more options and information, visit the mono-project website.

Now you are all set and ready to use VS Code in all its glory, apart from the occasional small glitches, as it is still pre-release (Microsoft does not like to call it beta for some reason.).

As noted above, VS Code comes with several useful and indeed powerful capabilities. The most interesting ones are outlined below. (The screenshots were taken on a random Microsoft code sample project downloaded from MSDN.)

Code completion: just start typing and you will be offered anything that matches the syntax of the file’s language. (If not, press Ctrl + Space)

Code completion in VS Code.

Go to definition: quickly find any definition with “Ctrl + F12” (depending on language). If you press Ctrl and hover over a an object, you can get a preview of its declaration so that you will not need to jump anywhere.

Go to definition in VS Code.

Multiple selection and cursors: select all occurrences of any word with “Alt + Left Click.” You can add a cursor at the end of each line with “Ctrl + Shift + L,” allowing you to edit all occurrences of an object or symbol at once.

Multiple selection and cursors in VS Code.

Dynamic reference info: you get real-time reference information.

Dynamic reference info in VS Code.

Peek editor: you must not switch context; you can have a “sneak-peek” with “Ctrl + Shift + f10.”

Peek editor for VS Code.

You also get simple version control with git

Simple version control with Git.

and easy configuration by editing some JSON files (File>Preferences).

Easy configuration by editing some JSON files.

Of course VS Code offers much more than this. To get the greater picture and learn all about the advanced functionality, visit the Visual Studio Code website.

Visual Studio Code is a breakthrough. It is Microsoft’s next effort to make cross platform development (that also includes Linux) easier after open-sourcing their .NET core. While it packs some interesting features, it might feel unusual for someone accustomed to developing on Linux at first. Still VS Code can easily become a go-to tool for ASP.NET and NodeJS developers who only visit Linux for the quick checkup/debuggin, yet the Linux-native developer may still shy away from it at present.

If you already run mono 3.10+ and are used to some VisualStudio features, VS Code might just be right for you. Otherwise, you might just find yourself hard-pressed to look for the proper justification to move away from your preferred Linux native editor/IDE just yet. Nevertheless, Visual Studio Code is promising, with a potential to become a really powerful editor for cross platform development.