Exclude a folder without hiding it

Hi All,

Currently I'm having a challenge with code inspections I hope someone here can help me with. I am using a home grown php parser to take a php file, make some modifications, and save the newly modified file in a tmp directory. When my code runs it auto loades from the tmp directory using the same class and namespace names. Unfortunatley this makes PHPStorm think there is a problem with the namespaces in my normal code.

I've done some searching around and found two methods people have used to "exclude" files in their poject.

  1. Use "mark as Excluded"
  2. Use scopes
  3. Exclude and then include the folder as an external lib


The problem with Excluding a folder is that the folder disappears from the project entirely. I am unable to view it without going into my project settings. This is problematic when I want to quickly look how my "compiled" classes are doing, or when I want to look through the code to debug any issues. Excluding works great for fixing the namespace error, but isn't a viable solution since I can't easily view my generated files.

With scopes, I'm able to create a different "view" of the temp files, and even modify the inspections on them, but I see no way to tell phpstorm to just ignore those files. I still get the namespace errors.

Option 3 seems like it may work, but once I include the folder the errors pop back up again.

So, I'm at a loss. Is there any way to tell phpstorm to ignore / exclude a folder but still make it (and its files) easily accessible?

Thanks for any help you can provide!

-Jeff

2 comments

Hi Jeff,

1) You can mark each file as Text File (In Project View, right click, Mark as Plain Text). This needs to be done manually for every "problematic" file

2) Give those files separate/double extension (e.g. FileName.compiled.php ... or FileName.phpc) -- then you will be able to assign *.compiled.php (or *.phpc) pattern to Text Files entry in "Settings | File Types" (such files will be treated as plain text, so no indexing, code analysis, syntax highlighting etc). This, of course, requires changing your code a bit (autoloader part), but changes are very minimal.

Other than that: wait until the following ticket will be implemented -- this will allow to do approach #1 in single click: http://youtrack.jetbrains.com/issue/IDEA-97846

P.S.
There are other tickets for similar kind of functionality (different ideas behind) .. but I cant find them right now

0

Hi Andriy,

Your solution is so painfully obvious I feel silly now. Since I'm already "compiling" the files, I can simply make the extension something that will be ignored by PHPStorm.. something like .comp or .compiled or something. Sometimes it just takes someone outside of the problem to point out the obvious.

Thanks!

-Jeff

0

Please sign in to leave a comment.