We all love Visual Studio Code. We all love the Terminal. Well, most of us do. So, here’s a nifty little trick how to combine the two to be a bit more productive- and hacker-wannabe-like 😉
Well, in all seriousness, there are many reasons to spend time in the terminal, like for example, EF Migrations or pushing Power Platform PCF Controls.
Whatever it might be, you might want to be able to quicky start the VS Code from the terminal, with the directory contents already open as a Solution. So, here’s how to do that.
Launch Visual Studio Code and go to “View -> Command Palette” or press Command + Shift + P. Then in the Command Line type “shell“.
The first result should say something like: “Shell Command: Install ‘code’ command in PATH“.
Once you run it, you will hopefully see that it has executed successfully.
That’s it. Now you can return to your trusty Terminal, navigate to the folder where your code is contained and use the following command to run Visual Studio Code:
Visual Studio Code will launch, with a list of files from the directory on the left side – and if you have had this folder opened before, even your files from the last Session should be reopened.
Naturally, you are not limited to opening files from the current directory, you can even do things like “go one directory below, then under it open this directory”, for example, if I was in the current directory but wanted to open the code on the same directory “level”, I could do things like this:
With “connect-to-azuresqledge” would be the location of the files from my previous blog post: Visual Studio on a Mac: Connect to an Azure SQL Edge Database in a Docker Container.
That’s it for this short post, thank you very much for visiting, stay tuned.