Mona Jalal Mona Jalal - 2 months ago 14
Node.js Question

What is "code . " for Visual Code Studio

The command "code ." doesn't work in this manual?

All the other steps before that worked. How can I call the Visual Studio in terminal in OSX?

Monas-MacBook-Pro:myExpressApp mona$ pwd
/Users/mona/nodejs/myExpressApp
Monas-MacBook-Pro:myExpressApp mona$ code .
-bash: code: command not found


EDIT: I ended up opening it from within Visual Code Studio by changing the workspace but I am wondering why that command "code ." won't work?
enter image description here

Answer

https://code.visualstudio.com/Docs/setup

Tip: If you want to run VSCode from the terminal, append the following to your .bashrc file

code () {
if [[ $# = 0 ]]
then
    open -a "Visual Studio Code"
else
    [[ $1 = /* ]] && F="$1" || F="$PWD/${1#./}"
    open -a "Visual Studio Code" --args "$F"
fi
}

Then $ source ~/.bashrc

Comments