How to have multiple projects in same window?
I have a directory open in PHPStorm, and code tracing and everything works great, but I want to open another directory with its own codebase, but when I do that PHPStorm prompts me only to replace the current project window with the new directory, or open a new window; I can't just have multiple projects in the left-side Projects tab like in Eclipse or Netbeans, as far as I know.
请先登录再写评论。
Hi there,
Correct -- it's not possible at the moment.
You can only add folder from another project as Additional Content Root into current project (via "Settings (Preferences on Mac) | Project | Directories"). Obviously, in such case such folder will be just a folder and will use settings from current project.
What is the reason for this? I see no roadblock to having multiple projects in a Projects window that are not related to each other, like Eclipse or Netbeans.
This IDE is built/designed a bit differently and single frame (window) represents only one project.
Project here is what you call "Workspace" in Eclipse (not sure if it's full equivalent or not). And Eclipse's "Project" is called "Module" here. Thing is -- modules are not available in PhpStorm as it uses simplified project structure as compared to full IntelliJ IDEA (simply speaking PhpStorm's project is represented by single module of "WEB_PROJECT" type)
Have a read: https://confluence.jetbrains.com/display/PhpStorm/PhpStorm+for+Users+of+Eclipse+PDT+and+Eclipse-based+IDEs
https://youtrack.jetbrains.com/issue/WI-15187 -- watch this ticket (star/vote/comment) to get notified on progress
Well if a "Project" is a "Workspace" and a "Module" is a "Project", is it possible to have multiple "Modules" where each is a directory on my computer?
Here's my codebase layout:
fullcode
fullcode/dev
fullcode/stage
fullcode/live
fullcode/includes
fullcode/data
fullcode/otherblahs
I don't use all of the folders but I'm debating between using the fullcode folder as the top-level (which is probably unnecessarily large) or separate "Modules"/"Projects" for dev/stage/live, and since I switch between the codebases a lot, it's tough right now with PHPStorm.
As I have already stated: it's not available in PhpStorm as the whole project here consists of a single module. If you want to work with PHP and have modules then you have to look at IntelliJ IDEA Ultimate.
Generally speaking ATM you have these options:
1) Make project of the "fullcode" folder and mark all unwanted folders as Excluded (will not be used for code completion/participate in search etc). Will not be a good solution if you work with different branches as IDE will see duplicate classes.
2) Make project out of any sub folder and then add any additional folders as Additional Content Roots.
3) Have individual project in any configuration you wish and work with them in separate windows (e.g. 1st project includes "dev", "includes", "data" folders; 2nd includes "live", "includes", "data").
This is the biggest obstacle to working efficiently in WebStorm for me. To copy from my comment on https://youtrack.jetbrains.com/issue/WEB-24941:
I have one repo/directory for each npm package I'm developing, and multiple of these directories included in my WebStorm project via the Directories preferences.
I need to work not just on the webapp I'm developing, but on all the npm packages I've created to use with it and other webapps as dependencies, and it's important to be able to open files from any of them quickly. If I have each npm package open in a separate WebStorm project/window, then it's less convenient to navigate between them, which is why I include multiple directories in the project instead. That way, they are all part of one big Search Everywhere index. Do you see what I mean? The fact that WebStorm isn't really designed to handle different settings for each of these packages in a single window is a major usability issue for me.
Of course, I try to have the same flow/eslint/etc settings for all of my projects, but sometimes, I'm working on forks of other open-source projects I'm using, which have different settings that I can't control.
Or is there a better way to manage my workflow? If not, should I open a usability issue regarding development on multiple interrelated projects?
I've used Eclipse for Java development and it's very well designed to support development on multiple interrelated projects at once (and even to be able to switch contexts from one set of interrelated projects to another quickly). I hope WebStorm will become the same way. Web development is changing – whereas it used to be simple enough to develop on only one project at a time, now that npm is such a significant part of the workflow and it is desirable to share common pieces of functionality between projects as well-encapsulated npm modules, developing on dependencies simultaneously will only become more common.
Please, please, rethink IntelliJ's philosophy regarding multiple projects. Eclipse got it right.
Similar problem: I often work on project and contribute to composer modules. It would be very helpful to be able to switch from full project view to module view.
After using PHPStorm for over a year consistently, I actually appreciate the separated project windows; I have dozens of folders in the left panel in our primary project, along with multiple git repos (of the related product) and test and tools folders and formatting files, and adding more projects to that list would just overcomplicate it.
What would be nice is a drop-down in a top menu somewhere of my different projects, with a link in each one to open in a window, which would save me some clicks, but right now I'm OK with the option to either open a different project in the same window or a new window.
You may try Frame Switcher plugin for switching between projects.
It's not any kind of "final solution/silver bullet" .. but rather a bit more convenient tool as compared to what IDE offers out of the box:
In case somebody has the same question in 2017. There is a simple solution without any plugins and complications.
Go to:
File->Project Structure->Modules.
Instead of adding module, simply click the third option (copy). Browse your local directory and select the project you would like to add. Module name will resolve automatically. That's it.
See the screenshot here: https://stackoverflow.com/a/47174741/3349358
@Giorgi
That's for IntelliJ IDEA only -- here in PhpStorm (you are in PhpStorm forums BTW) it's not possible as whole project is a single module.
But since some 2016.x version or so you can open more than one project in the same window. It will not be fully independent projects though (settings from main project will be used) -- more of a quick way to easy add 2nd/3rd/etc project as additional Content Root (which you could do since the beginning anyway).
https://www.jetbrains.com/help/phpstorm/opening-multiple-projects.html
@Andriy Bazanov
This is not true. It's a fraud! I lost 4 hours ringying to replicate what it's written in that documentation! What have you smoke guys? Post me a video where you do what it's written on that documanetation. And if you are able to that, let me know where to download a revison of PhpStorm that can do that. I just downloaded from your web site the program, and the checkbox Add to currently opened projects simply is not ther. Please be honest and remove that fuking documantation. It's a waste of time! Or you just like to let me fell like a fool?
@Andrea
>This is not true. It's a fraud! I lost 4 hours ringying to replicate what it's written in that documentation!
Still works here -- just tested (latest stable 2017.2.4)
>What have you smoke guys? Post me a video where you do what it's written on that documanetation.
https://blog.jetbrains.com/phpstorm/2016/11/opening-many-project-in-one-frame/
>And if you are able to that, let me know where to download a revison of PhpStorm that can do that.
There is no "special/separate" version.
>I just downloaded from your web site the program, and the checkbox Add to currently opened projects simply is not ther.
It's there. You must be doing it differently (opening the project in a different way). Please describe how you do that (what menu item do you use).
Steps:
If you just use "File | Open Recent" then that dialog will not have such option.
>Please be honest and remove that fuking documantation. It's a waste of time!
1) Nice language.
2) Documentation is correct. If you think that it needs some clarification -- please state what needs to be changed and PhpStorm team will have a look at that.
>Or you just like to let me fell like a fool?
I'm doing nothing. If anything -- all done by yourself.
P.S. I do not work for JetBrains.
I managed to get separate modules working in WebStorm by first installing PyCharm, setup licensed fully working etc. Then install WebStorm and open just the first folder. For some reason both folders are opened and modules are working just like PyCharm.
No idea if this will work for others. It may also work with just a trial PyCharm license.
@Andriy Bazanov Thank you. your answer to load Eclipse projects as modules in IntelliJ worked to me