Within PhpStorm 2018.1.6 I've got a directory x which I have excluded using Settings | Directories -> Exclude directory x. PhpStorm takes care of most of the directories which I have excluded but not this one. While I am editing/creating PHP tests PhpStorm constantly is busy with indexing this directory.
Directory x is part of an imported project.
Is there any reason which PhpStorm can have to exclude an excluded directory and indexes it as well? The indexing process takes forever.
Things to try (from Jetbrain team):
Remove "Add packages as libraries" checkbox at Preferences |
Languages & Frameworks | PHP | Composer (click Ok to save).
Check that you don't have those excluded directories added as include path at Preferences | Languages & Frameworks | PHP afterward.
Test by rebuilding cache File | Invalidate Caches / Restart...
I encountered this problem when I had the root project path listed in the include path and filed it as a bug and they suggested these things.
Related
I have the following Magento 2 standard project structure, but this can apply to any php composer based project:
.
..
.git
.gitignore
composer.json
composer.lock
vendor/Acme/module1
vendor/Acme/module1/composer.json
vendor/Acme/module1/.git
# .gitignore contains a directive to ignore the vendor directory because the project structure contains nested repositories
Is there a way to configure PhpStorm to highlight my changes individually for each vendor extension? At this point all my vendor changes are not displayed (because of the directive in the .gitignore file). The only changes that are highlighted are the ones in the main project repo.
You may install your vendor module via symlink using this manual https://johannespichler.com/developing-composer-packages-locally/
Then you can add this external folder to your project to simplify development via File | Settings | Directories | Add Content Root action.
Then you need to add your module VCS to your project via File | Settings | Version Control
Now you can easily manage your changes separately.
For even better control I recommend you use changelists
Recently, updated a PHP project to use source folder and build folder. We're using Gulp to build the project from the 'src' folder to the 'build' folder after pulling the 'src' folder and project configuration files from our Git repo.
project_root
|
├── src
|
├── build
|
└── {project configuration files}
Both frontend and backend developers are currently running the 'gulp watch' we've setup to keep our 'src' and 'build' folders in sync.
One of this biggest annoyances we've encountered is while debugging our project in the browser we often open the offending file where an error is reported and tinker with the code until it works in browser. However, more times than I'd like to count, we make the change to a file in the 'build' folder while debugging and then we have to manually make the change in the 'src' folder (which is often overlooked at first).
Is there any way to fix this workflow issue?
Dueling Watchers Approach
I thought about making a two file watchers to detect changes in the 'build' and 'src' folders respectively. When either watch detects a change, turn off the other folders watcher, process the changed files and sync up the other folder, then turns the other folder's watcher back on.
(This seems like the sledge-hammer approach.)
IDE Approach
We PHPStorm and Sublime Text 3 depending on the developer. In Sublime Text, I simply exclude the 'build' folder from the project so I don't accidentally open it by default. (However, I accidentally open 'build' folder files when debugging the PHP too often.)
Other
Perhaps the way we're handling project structure in general needs work. Frontend and backend development is often done in concert. Any suggestions?
After flailing my arms wildly at this problem for a few hours after posting this I found an answer to my own problem.
Turns out the best way to handle this is to use the IDE Approach and create path mappings for your project:
PHPStorm (documentation)
Settings » PHP » Servers
Check the 'use path mappings' selection.
In our case we mapped the '../src' folder to '../build'
Sublime Text with 'Xdebug Client' package
Preferences » Package Settings » Xdebug » Settings - User
Add the following to your Xdebug.sublime-settings file:
{
"path_mapping": {
"C:/wamp/www/your-project/build" : "C:/wamp/www/your-project/src"
}
}
Once your path mappings are setup, you can successfully set a breakpoint in a php file in your '../src' folder run your debugging session and the file in your '../build' folder will breakpoint at the same location.
I'm student and I got the free latest version of PhpStorm 9 (build PS-141.1912). I tried to add a theme and color scheme to PhpStorm so I put my theme (.icls file) in the C:\Users\me\.WebIde90\colors folder:
(source: noelshack.com)
Then I restarted PhpStorm, but I can't see my theme:
(source: noelshack.com)
In PhpStorm 2016.1 it will be ~\.PhpStorm2016.1\config\colors (where ~ is your user home folder - typically C:\Users\USERNAME).
Based on your screenshot and your info, you have placed them in ~\.WebIde90\colors while it should be ~\.WebIde90\config\colors (where ~ is your user home folder -- typically C:\Users\USERNAME).
In general:
A file with Color Schema (*.icls) should be put into appropriate folder and then IDE should be restarted if it was running by that time (as such stuff gets checked only on launch).
Windows: C:\Users\USERNAME\.IDE_FOLDER\config\colors
Linux: ~/.IDE_FOLDER/config/colors
Mac: ~/Library/Preferences/IDE_FOLDER/colors
Where IDE_FOLDER is the <ProductName><Version> -- e.g. PhpStorm2016.2 for the latest stable version of PhpStorm (2016.2.2).
More info on folders: https://intellij-support.jetbrains.com/hc/en-us/articles/206544519-Directories-used-by-the-IDE-to-store-settings-caches-plugins-and-logs
P.S.
If Color Schema comes as *.jar file then use File | Import Setting...
Please also note that these editor themes are for syntax highlighting mainly and can be changed at Settings/Preferences | Editor | Colors & Fonts.
This has nothing to do with GUI Theme (also known as LAF -- Look and Feel -- styling the actual GUI elements) which is a separate thing and available at Settings/Preferences | Appearance & Behavior | Appearance.
P.S.
Instead of going into Settings/Preferences .. you can use View | Quick Switch Scheme... to quickly change between various schemas (colors/keymaps/code styles/etc.)
I have a folder outside the document root named Base and a folder inside the document root to display HTML pages.
I originally had them separate projects but that's not the ideal situation obviously?
I saw one suggestion to make the directory which holds Base the project root and to exclude everything except the two directories I need. This works but is this the only way to do it?
Settings (Preferences on Mac) | Project | Directories | Add Content Root
This allows you to make any folder as part of the project (will be listed in Project View panel as separate branch).
We're using CakePHP for a new application, and we use Mercurial as the source control tool. (Mercurial uses one .hgignore file in the root directory, unlike (for example) CVS that uses .cvsignore in any directory.)
I'd like to exclude the content of the app/tmp/ directory from the source control (since they change all the time, and can be regenerated), but I can't add app/tmp/* to .hgignore, since then the standard directories under tmp (cache, logs, sessions, tests, and also cache/models, cache/persistent, ...) would be missing from new clones made by hg clone, resulting in errors.
Currently I have in my hgignore:
app/tmp/logs/*.log
app/tmp/cache/persistent/cake_*
app/tmp/cache/models/cake_*
It would be good to have a "standard" one that could be used in all projects. Can someone suggest a complete solution?
You can add
syntax: glob
app/tmp/**
to your .hgignore file and Mercurial will from that point on ignore all files under app/tmp/ with the exception of files tracked by Mercurial. See hg help patterns for more about file name patterns.
So if you do
% touch app/tmp/cache/.empty
% touch app/tmp/logs/.empty
% hg add app/tmp/cache/.empty
% hg add app/tmp/logs/.empty
and make a clone, then the app/tmp/cache and app/tmp/logs directories will be created and new files in those directories will be ignored. I think that is what you want?
This is also useful for tracking something like $HOME since you would want to ignore most files by default and only track explicitly added files.
If I understand the question correctly you want to ignore file in tmp, but not files in certain directories in tmp. If that's right then I think you can do so using this:
syntax: regexp
^tmp/(?!(cache|logs|sessions|test))
That says ignore anything that starts with tmp, unless the next part is cache, log, sessions, test. For these files:
.
`-- tmp
|-- cache
| `-- afile
`-- tmpfile
here is the hg stat result:
$ hg stat
? .hgignore
? tmp/cache/afile
I will note, though, that Cake is probably telling you not to put those files into source control based ont heir being in a tmp directory. Are you sure they're not something htat your build system is supposed to create? Sessions in particular sound pretty transitory.
In my own checkouts (from SVN), when the site was deployed, the ./tmp/ directory needed to have some specific permissions.
I removed it from version control entirely, and my deployment script created the directories as required.