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:

website: mydomain.com
client name: client
client dev server - client.mydomain.com
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\client.mydomain.com -> 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\client.mydomain.com
mysite - just files in client\mydomain.home

Content Roots defined:

client\



Resource Roots defined
client\client.mydomain.com
client\mydomain.home

Excluded Roots:
client\client.mydomain.com\logs
client\client.mydomain.com\cache
client\client.mydomain.com\tmp

client\mydomain.home\logs
client\mydomain.home\cache
client\mydomain.home\tmp



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.
5 comments
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) -- http://youtrack.jetbrains.com/issue/WI-2760

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).

0
Comment actions Permalink

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

projectdir/mydomain.com/
projectdir/mydomain.home/
projectdir/mydomain.backup/

where under each directory, there are the same set of files:
index.php
classes/someclass.php
classes/somedir/anotherclass.php
assets/js/somescript.js
assets/css/somestyle.css
assets/configs/someconfig.xml


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
*.home/*
*.home/*.php
?*.home/*.php

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.

0
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 -- http://youtrack.jetbrains.com/issue/WI-6454

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) -- http://youtrack.jetbrains.com/issue/WI-10599

0
Comment actions Permalink

Thanks, I updated the ticket.  I tried http://plugins.intellij.net/plugin/?idea&id=1865 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.

0
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).

0

Please sign in to leave a comment.