Adding Visual Studio Code to PATH

In connection with the last article regarding the basic concepts of working with ASP.NET Core MVC, I came up with a little tweak to speed up your development by at least a small margin. To make things clear enough I won’t go into much technical detail.

Consider the situation in which we were last time. We successfully created a new project and went ahead to open it in Visual Studio Code. What we did and always can do is to launch a new instance of Code and open the project folder by navigating to it in the Finder dialog window. While this approach works, I will show you a quicker way to do it.

Setup

Essentially, all that is needed to be done is to invoke a command that will do all the work for us.

  1. Launch Visual Studio
  2. Press Command + ShiftP, which will bring up the Command Palette.
  3. Enter “shell”.

    Command Palette within Visual Studio Code
    Command Palette within Visual Studio Code
  4. You should be presented with two results, one of them being “Shell Command: Install “code” command in PATH”. Click on this option and wait until the operation has completed. This usually takes no more that a second.

All is now setup. Let’s head to the usage!

Usage

So far, all seems a little easy, doesn’t it? Well…this part will be of no exception. Simply navigate to your project folder in a Terminal window and enter code . . This will instantly open a new Visual Studio Code instance with the project loaded. No further hassle.

This tweak helped me and I hope it will make your workflow a bit snappier, as well.

Leave a Reply

Your email address will not be published. Required fields are marked *