Scopes and code completion, oh my!

I've been having a lot of fun delving into various aspects of the PHPStorm.  

Based on the concept that diskspace is cheap, and drive clarity can make life simple - I'm experimenting with the following setup:

client name: client
client dev server -
my dev server - mydomain.home

Project file structure:
Main directory: client
Project name: client
client\configuration --> contains any config info I might need, ssh keys, etc
client\docs - project docs for easy reference
client\ -> website code AS DEPLOYED TO dev.  Comes from a git repository and branch devsite
client\mydomain.home -> website code AS DEPLOYED TO my local dev.  Also maps to the same git repo, but different branch home

Deployment profiles: directly maps the 2 subdirectories to their SFTP server and path.  Makes life 50 times easier as now I can manually sync the 2 directories when I want to deploy and catch conflicts caused by other devs not using the version repo

Scopes defined:
docs - just files in client\doc
config - just files in client\configuration
devsite - just files in client\
mysite - just files in client\mydomain.home

Content Roots defined:


Resource Roots defined

Excluded Roots:


Scopes make life very very easy - when I want to search for text, I can specify which scope to check and check just those files.  I can do directory comparisons between the 2 sets of code to find problems.  Etc

What I can't seem to do is configure PHPStorm such that if I have a file open in scope devsite, then it should only use files from that scope.

As a workaround, I simply use the exclude feature and swap excluded folders as needed to switch between codesets.  However, I figured I'd ask here if I was missing some feature where I can specify which set of directories to use.

If not, I can always put in a feature request.  I think being able to attach a scope to a directory so that PHPStorm knows that for files in that directory, use a specific scope for file completion would be the ideal solution.
Comment actions Permalink

Hi Gary,

It is not possible to specify what files to use for code completion and what to ignore and still have all of them properly indexed  (i.e not marking them as Plain Text etc) -- PhpStorm will use ALL available in project classes/functions (from all Content Roots, External Libraries) in code completion. You cannot limit it by Scope.

When this ticket will be implemented, it should become easier (if not solved completely) as it will take into account which file you are editing, so if you have multiple classes with the same name (main headache now) it will offer code completion from the most closest one (check comments there) --

In any case -- you can file new ticket on Issue Tracker .. but I personally do not expect this to be implemented any time soon (it's platform-wide serious change).

Comment actions Permalink

Hmm, marking them as plain text would do the trick..  Assuming the following structure:


where under each directory, there are the same set of files:

What file pattern(s) do I need to add to the plain text file type in order to mark everything in any .home or .backup directory as plain text?

I tried

And files in the .home subdir kept getting indexed as php.  

Another option would be to allow the displaying of excluded directories in the project view.  I know it doesn't sound sensible, but right now I can VERY quickly right click on a source directory and click "exclude" and once I do it immediately drops out of the code completion lookup...  however, to un-exclude a directory I have to go through a tedious file-->settings-->project settings dialog.  If the directory was shown[perhaps in red with a strikeout through it] - and I could right click to re-include it - then it would make it a lot easier to navigate using this unconcentional structure.

Comment actions Permalink
Hmm, marking them as plain text would do the trick..

Don't think so. If you do that then the file will be treated as plain text, so no syntax highlighting or inspections on those files. Currently it has to be done on per file basis (right click in Project View and select appropriate action). There is a ticket for whole folder, but who knows when it will be implemented --

What file pattern(s) do I need to add to the plain text file type in order to mark everything in any .home or .backup directory as plain text?

I'm afraid it will not work as it only takes the actual folder/file name and does not include path (parent folder).

Another option would be to allow the displaying of excluded directories in the project view.

Saw 2 or 3 tickets like that -- "Won't fix" answer straight away (if Excluded then it is excluded completely). Maybe this (or similar) ticket will do the job (but once again -- no estimates when this will be implemented and if at all) --

Comment actions Permalink

Thanks, I updated the ticket.  I tried but it is years out of date so doesn't work in either the curre
nt IntelliJIDEA or PHPStorm.   I added it to the ticket since knowing that someone did do something at one point and how might help for the future.

Comment actions Permalink

Functionality of this plugin (based on description and screenshot) is built in into an IDE already (righ click -> Mark Directory As...). The only thing that you cannot (and I very doubt that you would be with that plugin as well) is to unmark selected folder as excluded since excluded folders are not shown in Project View anyway (as well as Favourites -- I hoped this "trick" may work, but it does not).


Please sign in to leave a comment.