5 Reasons to Use Visual Studio Code

The days of Microsoft hating Linux are long past; in fact, the company joined the Linux Foundation in November 2016, surprising many open-source advocates. Visual Studio Code, a.k.a., VS Code, is another key example. While it’s not exactly an Integrated Development Environment (IDE), it includes built-in support for JavaScript, Typescript, node.js, and extensions for other languages.

As I’m rather used to Microsoft editors on Windows, I went for the Linux version of Visual Studio Code. It’s a 34 MB .deb file download; I installed it on Ubuntu 16.04 LTS under VirtualBox.

Installation is fairly straightforward, and typing code from the command line runs it. If you’re curious, here are five reasons to use VS Code.

Not Quite a Full IDE, But…

Compared to Gedit, or virtually any editor I’ve used on Linux, VS Code is probably one of the best editors around. If you love VIM, the name “Microsoft” may stick in your craw—but never fear, you can still configure VS Code to be VIM-like via extensions. The editor includes 14 themes, plus there are lots more in the marketplace. It’s highly customizable.

So as an editor, what can it do? It’s multi-tabbed and lets you organize files by folder or project for installed languages. There’s smart editing for built-in languages such as JavaScript and Typescript, as well as for languages installed from extensions. This lets you navigate by definition, and find references to where a symbol is used; it also allows bulk renaming. When you try “Find All References,” it includes a peek of the reference use inline.

Editing is powerful, with folding regions, and a minimap preview has been introduced in the February 2017 update, which is a handy way to navigate through long files in the editor. Git integration, which used to be done by extension, is now built-in.

Extensions

This is beyond a doubt the most useful feature. There’s a comprehensive list of extensions available for VS Code in the online marketplace, which has existed since mid-2015.

I looked for Python and found 30 packages out of the current 2,660 extensions. You can search for these from the extensions page or online. Most are free, but it’s also possible to pay for extensions.

In the Languages category, there are 642 extensions covering virtually every programming language I’ve ever heard of… and a few I haven’t (such as Lean and Nitrogen).

Installing extensions is as easy as clicking one button. You can manage them easily, including updating and disabling. It’s all very slick and works flawlessly, and the website shows how you can create your own extensions and publish them to the marketplace. A number of sample extensions are provided, including a debugger and language support for Google Go.

Extensions run in their own process for stability and are lazily loaded. After I installed the C# extension and switched to it, it began downloading the Mono Runtime for Linux/x64, Mono Framework Assemblies, OmniSharp and the .NET Core Debugger (Ubuntu 16.04 / x64). Even if an extension misbehaves, you are still able to save or load files in VS Code.

The extensibility reference is detailed and a must for anyone developing extensions.

Debugging?

While VS Code isn’t quite a full IDE, you can install and run debuggers (it even comes with one for JavaScript). The marketplace includes 68 free debuggers, including C/C++, Java, PHP, Python, Ruby, C#, Go, Lua, Haxe, Android and others.

If you’re already familiar with debugging in Visual Studio, then you’ll be at home in this context: Set breakpoints with expression conditions and hit counts, Step in, Step Over, and so on. (No reverse debugging yet, though!)

Develop for Unity

Unity is the 2D/3D game engine and framework that you can program in C# for free (or with a commercial license). This article on Microsoft’s website covers developing your first game (though it predates VS Code).

The C# extension includes code colorization, bracket matching, IntelliSense, CodeLens and more. Add in the Unity configuration and you can use it for creating games, but it doesn’t include any tools for image editing.

Highly Configurable

VS Code can be configured with themes, snippets and language support. The list of user and Workspace settings is very comprehensive and contained in a file settings.json. From the quick links menu on the right of the welcome screen, you can go straight to editing it. On the left is the full list of (currently) 294 settings in a read-only file. You just copy the ones you want onto the right, change them, and save the file.

I copied “editor.minimap.enabled” to the User Settings file, set it to true, and the minimap instantly appeared.

There are many sections in the read-only file and some appear to have been added by the extensions I installed. Workspace settings are for individual projects and saved in the project folder.

Conclusion

VS Code is very impressive and ran without a glitch on Ubuntu. I did wonder if I could use it for web development—and sure enough, there were three ftp extensions in the marketplace. It’s not as powerful as Dreamweaver (just as an example), but with a bit of work…

Image Credit: Undrey/Shutterstock.com

Post a Comment

Your email address will not be published.