0

I have a Git repo with two directories:

  • backend (PHP/Laravel code)
  • frontend (TypeScript/Vue code)

I would like that backend is marked as excluded when the project is opened in WebStorm and frontend to be excluded when it is opened in PhpStorm.

This is to ensure that searches/indexing only happen for the files that I would actually edit in that specific IDE.

When I change the excluded directory it seems to automatically apply this to the other IDE as well. Is there some way to keep this setting separate?

Comments:

  • I intentionally have both frontend and backend in one repository.
  • Opening the subdirectories in their own IDEA projects does not seem to be an option because the Git integration only works when the project is in the root folder of the repository.
LazyOne
  • 158,824
  • 45
  • 388
  • 391
Chris
  • 13,100
  • 23
  • 79
  • 162

1 Answers1

0

When I change the excluded directory it seems to automatically apply this to the other IDE as well.

It is expected. That's because the project settings are stored in the .idea subfolder. All IDEA-based IDEs use the same .idea settings format. So opening the same folder/project in different IDEs simply makes them use that already-made config (shared between IDEs).

Plus, both PhpStorm and WebStorm use the same module type ID (WEB_MODULE) and can have only 1 module in total in a project. IntelliJ IDEA and some other IDEs (like PyCharm for example) can work with projects that can have more than one module and of different types.


Is there some way to keep this setting separate?

Yes, with the help of a small workaround: you need to store .idea used by another IDE in another place. As simple as that.

The setup and steps:

  1. Lets assume that you have your project in C:\Projects\MyProject.
  2. Make a brand new empty project in another place, e.g. C:\Projects\IDEProjectsStore\MyProject-frontend. It will be used for a frontend.
  3. Go to Settings/Preferences | Directories and remove an existing Content Root (which will be C:\Projects\IDEProjectsStore\MyProject-frontend from the previous step).
  4. Add new Content Root instead -- point to the actual project (C:\Projects\MyProject from step #1)
  5. Save and configure as needed.

What you will have now:

  • This frontend project will now have its settings stored in C:\Projects\IDEProjectsStore\MyProject-frontend\.idea while another (original project with backend) will have them in C:\Projects\MyProject\.idea.
  • Projects (project-specific IDE settings) are stored in 2 separate places while they both use the same folder with the code.

Basically: a project in the IDE's eyes is an .idea folder with a parent folder added as a Content Root by default. Our workaround keeps the second project in a different folder while sharing the same Content Root between them.

https://youtrack.jetbrains.com/issue/IDEA-170102/ -- that's a ticket that asks for a straightforward way of doing this.


I would like that backend is marked as excluded when the project is opened in WebStorm and frontend to be excluded when it is opened in PhpStorm.

Why do you need two IDEs for this?

In case if you do not know: PhpStorm = WebStorm + PHP + Database. You do not really need WebStorm here. Just install any missing plugins that come bundled with WebStorm.

LazyOne
  • 158,824
  • 45
  • 388
  • 391