PHPStorm, Vendor and multiple Git roots
Asked Answered
G

1

7

I have a project with a composer.json that adds many modules as dependencies, and I want to be able to work on them all in the same PHPStorm project. When I make changes to a file in the vendor directory, and run git status on CLI, I see the differences, however PHPStorm inline tools do not register the changes (no blue line on left sidebar).

If I go in to the project settings and add the particular vendor dependency as a git root, the folder which contains the .git folder, the IDE starts to work as I expect/hope.

However, I don't want to have to repeat this process for all of my dependencies, it feels like too much manual work? Is there a better way?

Update: Still no joy, the 'Show History' button doesn't work when I use vendor as a source.

Here's my project structure:

  • /home/PhpstormProjects/MyProject/.idea
    • (folder kept separate to avoid VCS having to ignore .idea)
  • /home/my-project/htdocs/
    • (Resource Root, which has a .git repo auto-recofnised by PHPStorm)
  • /home/my-project/vendor/modulenamespace/modulename/
    • (multiple modules each with a .git but NOT auto-recognised by PHPStorm)
Gisborne answered 12/1, 2015 at 10:34 Comment(3)
normally PHPStorm is trying to recognize your git roots and prompts you to add them. Not sure why it's not working for you. Try re-opening the project - will PHPStorm prompt you to add the roots?Harmon
Unfortunately not, it only has the main project as a root, no prompt to add new ones. Really strange, it feels like it should work, otherwise it would be more pain than its worth to get the IDE using vendor properly.Gisborne
OK I made my main project the 'Resource Root', marked the vendor directory as 'Source' and also Excluded vendor so it doesn't clog up the indexer (i have vendor directories symlinking to resource root) and they appeared as Unregistered VCS roots, meaning I could select-all and add! Not entirely sure if 'source' is correct here, but it seems to have resolved my issue for now...?Gisborne
G
2

Turns out it's a known issue, due to number of levels deep the .git repos are: https://youtrack.jetbrains.com/issue/IDEA-108316

Gisborne answered 14/1, 2015 at 13:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.