Excluded folders still being included

I must be misunderstanding this but when i exclude a folder, then use the Navigate->File dialog, the excluded folder's content is still being found:

surely they shouldn't be being found? 

8 comments
Comment actions Permalink

Is there any chance that you have the mentioned folder added to "Include path" at "File | Settings | Languages & Frameworks | PHP"?

0
Comment actions Permalink

Hmmmm, funnily enough the entire vendor folder's sub-directories are included there but they don't come up on the file search.

All i want is to include (for Magento dev) the vendor/magento folder + one folder of my own dev so that when you go Navigate->File the default - which seems to be 'Project Files' is just to look thru those, 

How do i do that? 

0
Comment actions Permalink

@Silas2

It does not include Laravel/Symfony classes for me:

But if I choose to include libraries as well, it will:

Maybe it's because of the way how you treat those "excluded/re-included" folders? For me it's a standard PhpStorm behaviour as those are typical composer packages.

Provide more info/screenshots for your project setup/those folders.

 

Other than that: try defining your own Scope (that would include only desired folders) and use it in that popup instead of "Project Files" (although it's not remembered between invocations right now: https://youtrack.jetbrains.com/issue/IDEA-216597)

>Hmmmm, funnily enough the entire vendor folder's sub-directories are included there but they don't come up on the file search.

You can include them there as well if so desired (by using Directory or Scope).

0
Comment actions Permalink

Here's a screenshot of the Preferences->Directories page. 

What I don't understand is how come I've marked 'generated' as 'Excluded', but its still listed under 'Sources'

0
Comment actions Permalink

>What I don't understand is how come I've marked 'generated' as 'Excluded', but its still listed under 'Sources'

1) You excluded "generated" and not "generated\code" (which may have been added back via "PHP Include Paths" functionality -- that's normal as that's how IDE can exclude folders from being used in search/todo/etc but still allow indexing them for code completion/inspections stuff)

2) "generated\code" is marked as "Source" folder -- that's different (not the typical case). Did you do that?

If you remove it, will it work as you want? If you remove and restart IDE -- will it be added back "magically"? if yes -- that folder is specified in your composer.json and you have option enabled to sync Source and Tests folders with entries specified in composer.json

P.S. I'm not a Magento user so cannot say what is the correct way of setting up IDE for such project/code base. So far it looks to me as incorrect setup/misconfiguration from the user end so would need to know more details about the setup to give any advices. Quite a lot of people using PhpStorm for Magento projects, so I'm sure it's possible to set it up.

0
Comment actions Permalink

Ok, i assumed it would exclude the tree, i see the Excluded and Source aren't mutually exclusive as well. I'm nearly getting there, but could you explain how come this is the case - I've tried to include vendor/magento , but on the RHS of the pane there is this list of excluded directories which includes all the magento ones?

0
Comment actions Permalink

>but could you explain how come this is the case - I've tried to include vendor/magento , but on the RHS of the pane there is this list of excluded directories which includes all the magento ones?

If those are composer packages .. then it's absolutely normal (default behaviour). As I have stated earlier:

  • those folders are excluded so they are not getting treated as your code (you should not be bothered with TODOs/inspections and other stuff from there)
  • at the same time they are added back as "PHP Include Path" entries (which is made for library code) so they still getting parsed and participate in code completion / IDE knows about those classes and what methods they have.

Framework/App code that you cannot edit should be handled this way. Such folder should not be marked as Source (makes no sense -- you will not be creating new classes there or adding new/editing existing code).

Here is a typical Laravel project. All code that is not meant to be edited directly is in "vendor" folder. The "can or should be edited at any time" part is located in "app" folder -- it is marked as Source (for correct namespace handling when creating new class/moving existing etc etc).

All composer packages (including Laravel Framework itself) are added back this way:

 

I think you have over-configured Directories there and unnecessarily marked some folders (once again: I do not know how Magento 2 works/their folder structure so may not be 100% correct here). Maybe check some online manuals from internet, like this one (not sure how up-to-date it is though): https://jokiruiz.com/magento-2/step-step-guide-set-phpstorm-magento-2/

0
Comment actions Permalink

Thanks very much for your help. I'll clean up my Directory config to be like yours.

0

Please sign in to leave a comment.