7 Days of VS Code

A series of short articles I wrote while exploring VS Code, from navigating the editor to customizing it and working with version control.

01 / 07

An Overview of VS Code

Intro

Out of the box, VS Code is described as a "lightning fast" and "lightweight" source code editor that supports hundreds of programming languages. It can be used on any platform — Mac, Linux, Windows.

Visual Studio Code editor

The guts

VS Code is built on Electron, along with JavaScript, Node.js and some Microsoft-y things like the Visual Studio debugger and TypeScript. So it's a pretty powerful editor.

It has built-in IntelliSense (note: not all languages, so you may need to pick up an extension for ones not included). For those who are not familiar, IntelliSense provides a number of features like code completion, parameter info, and more. You may have heard IntelliSense called in a different form like code completion or code hinting.

And to be honest, it's the kind of thing you don't really know you're missing until you fully use it.

It's got the Visual Studio debugger allowing you to step through code, inspect vars, view call stacks, and execute commands in console easily.

VS Code is great for building cross-platform applications. It was originally described as being created for building web and cloud applications, but I believe it is and will continue to be for more than just that.

So, why VS Code?

Why choose something like VS Code, well let's see...

Customization

Firstly, how customizable it is. It's super easy to install many third-party extensions or to even create your own (which we will be learning how to do later on!).

Open source

It's open source. So you can contribute to it and join the community on GitHub. I always find a tool most powerful when the community can come in and improve it.

Missing a feature? Let the community create it and it helps to expand the improvement for integration with other tools. Super!

Git diff view

I have adored IntelliJ's git diff view for the longest time and now VS Code has got a great one as well. VS Code displays the current and the previous versions side by side for a quick comparison and makes it easy to solve merge issues!

Side-by-side Git diff view in Visual Studio Code
Image credited to bytearcher in the original article.

The fact that git is integrated already is also just great.

Easy split-screen

Forget remembering the shortcut for split-screen. VS Code makes it easy with the click of an icon.

Located at the upper right side of the editor. There are also several other ways to split: keyboard shortcuts, drag and drop, or Ctrl and click on the file in the Explorer.

Peek view

Peek editor open inside Visual Studio Code
Image: Visual Studio Code documentation, as credited in the original article.

Want to check something quickly without doing a huge context switch? VS Code introduces peeked editors so that you can easily search, and even make edits right there in the peeked editor.

Terminal

VS Code makes it convenient to execute a command line task without the need to switch windows. (Note: it starts at the root of your workspace.) And you can even manage multiple terminals if you want.

Zen Mode

Zen Mode hides all the UI features (activity bar, status bar, side panels, etc.) and lets you focus on your code. The editor becomes fullscreen.

To enable Zen Mode you can either select it by the View menu, the Command Palette, or by hitting Ctrl+K Z.

Zen Mode in Visual Studio Code
Image from VS Code Tips & Tricks, as credited in the original article.

There's probably an extension for that...

Whatever you are in need of, whatever feature you love in another editor/IDE, there's probably an extension for that!

Wait, why an editor over an IDE?

Let's compare

An editor, like VS Code, is built for speed, starts up fast since it's so lightweight and extensions are loaded in a separate process.

An IDE, like Visual Studio, is feature rich, robust, and can "do everything". However, it tends to be slower and you can feel overloaded with features. You might be so overloaded that you can not even utilize the IDE's full potential... or maybe you don't even need all those luxurious features.

Let's dive in a bit. Let's compare VS Code to Visual Studio. VS Code is portable as hell, works on all platforms and generally requires fewer admin rights. VS Code allows you to install plugins and extensions as you go, as you need.

As mentioned earlier Visual Studio, being an IDE, is feature rich. If you don't need all those features, maybe go for something lighter.

Examples of editors: Sublime, Vim, Brackets, Atom, VS Code.

Examples of IDEs: Visual Studio, IntelliJ, Eclipse, WebStorm.

TL;DR

Your setup is an important part of how you work and how productive you will be as a developer. And so your choice of code editor is no exception!

I highly recommend checking out VS Code. Considering it requires little configuration to get up and running it makes it a must try in my books!

02 / 07

Navigating VS Code

New to Visual Studio Code? Its look and feel is pretty similar to most editors and IDEs. But let's take a bit to become familiar with it.

I will quickly introduce you to the fundamentals: the Activity Bar, the Editor, Tabs, the Status Bar, the Command Palette, and the Minimap. All in under 3 minutes!

Activity Bar

Visual Studio Code activity bar

Explorer: Explorer allows you to browse and manage files and folders in your current workspace/folder. Windows: Ctrl+Shift+E Mac: Cmd+Shift+E

Search: Ctrl+Shift+F. Search current files open for a specific string. Also allowing you the option for "Find and Replace".

Source control: Ctrl+Shift+G. Integration with your version control system — namely Git! Which comes built in. You have the ability to initialize the current workspace/folder and/or perform version control functions like commit, pull, etc.

Debugger: Ctrl+Shift+D. Displays useful debugging information like call stacks, variables, and breakpoints.

Editor

The main area! You can open up to 3 editors side by side in one single instance of VS Code. You can have multiple tabs within each (a.k.a open multiple files).

Three editors displayed side by side in Visual Studio Code
Original image from the 2018 article.

Switch between them by using Windows: Ctrl or Mac: Cmd along with the number key 1, 2, or 3.

Re-arrange the editors by drag and dropping along the top bar.

Tabs

When you open a file in VS Code, it'll open a new tab in the current editor.

Tabs open across the top of the Visual Studio Code editor
Original image from the 2018 article.

By default, tabs are added to the right, but you can re-arrange tabs the same way you would editors, by drag and dropping the filename header located at the top.

Status Bar

Visual Studio Code status bar

The status bar gives you info about the project, or in particular the file, you currently have open.

Right side: The current line you are on, the indentation setting, the encoding, EOL sequence, and the language mode.

Left side: If you have Git setup, you will be able to see things like what branch you currently have checked out, along with any errors and warnings.

Command Palette

Allows quick keyboard accessibility for even quicker access to VS Code functionality and commands. Ctrl+Shift+P or Ctrl+P with >.

Command Palette open in Visual Studio Code

What you'll find in the palette will differ based on the extensions you installed. Therefore, the more you install the more functionality you'll have access to.

Depending on where you are in your code, you can find out what you can execute by typing ? into the command palette. It'll pop back to you a list of available commands.

Minimap

Located on the right side of the editor. Click or drag the shaded area to navigate to that section of the code. The minimap gives you a nice overview of the file you have open.

Minimap displayed on the right side of Visual Studio Code

And that's it for navigating VS Code!

← Back to Reflections