Do you know you can open your code in visual studio code directly from Shell or command line. This trick can be a definitely ease your process if you are command line and viscose lover like me.
Before we begin, if you are new to vscode and do not know what “code” shortcut is, then this is for you.
“code” shortcut provides a way to open code from command line directly. All you need to do is go to the code directly and run:
code .
or you can provide folder of the directory as well. For example, if my code is stored at /user/singlequote/hello-world/ then command will look something like this:
code /user/singlequote/hello-world/
Stepwise process to enable code command line shortcut
Step 1: Check if the command path available
Check if the shortcut available using code in command line, as mentioned above.
Step 2: Enable code command path in Vscode
If not enabled in viscose, then go to visual studio and press CMD+SHIFT+P for command palette in Mac and CTRL+SHIFT+P for Windows systems.
A popup will open, type and search for “code” in popup and select option “Shell Command: Install ‘code’ command in PATH” option.
Step 3: Confirm the enablement
Now again go back to shell or command line and run “code” command to verify if it has installed properly.
[Writer’s Corner]
If you liked this quick tip and you are a python developer then this python trick and definitely for you.