kvn
kvn

Reputation: 2300

How to open multiple projects in WebStorm from command line?

I understand that I can open a project in WebStorm from terminal using its shell tools.

At the moment, WebStorm open the current working directory with the command webstorm .

However, if I navigate to a different project (say project2) in my terminal and run the same command webstorm . again. I expect WebStorm to open my project2 in a new window, but for some reason this doesn't happen.

Please let me know if there is a setting which should be enabled to use this feature.

All other editors (VS Code, Atom, Sublime) support this, I'm hoping that WebStorm would also have a similar feature.

Upvotes: 3

Views: 830

Answers (1)

Evan Wieland
Evan Wieland

Reputation: 1518

It's a little clunky because it only works on a Mac, but I came up with a work around for this issue. 1. Paste this into your .bash_profile:

# Open WebStorm project
ws(){
  for var in "$@"
    do
    open -a /Applications/WebStorm.app "$var"
  done
}

2. To use, open your terminal (make sure it's a new terminal session so it reflects the .bash_profile changes) and run:

$ ws /some/project/directory

or to open multiple projets at the same time:

$ ws /some/project/directory /some/other/project/directory

This will focus the window of the project being opened. Also, if the project is already opened, it will only focus the project's window rather than opening a new session.

Upvotes: 3

Related Questions