PhpStorm - Can't add a theme - php

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

Related

How to stop PhpStorm from indexing my `excluded` directory?

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.

How to keep source and build folders in sync during debugging?

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.

Add an empty line at end of file according to PSR-2 on PhpStorm

I use PSR-2 for code styling my code.
When I inspect a file using Codesniffer most of the times I get the following error.
332 | ERROR | [x] Expected 1 newline at end of file; 0 found
It's obvious how to fix this. What I need to know is if PhpStorm has a way to add the 1 newline at end of file
I already loaded the predefined style from Settings -> Editor -> Code Style -> PHP -> Set From -> PSR-1/PSR-2 and also used the Reformat Code to change the CS accordingly.
Everything is fixed except from the new line. Am I missing something?
You already have two answers for how to turn it on for ALL file types in IDE (in short: Settings/Preferences | Editor | General -> Ensure line feed at file end on Save).
In modern version (2020.3) that option has been reworded a bit. Now it says Ensure every saved file ends with a line break
To do this for .php files only you can do the following:
Install EditorConfig plugin (if you do not have it installed yet). In modern versions it is already bundled and enabled by default.
Create .editorconfig file in your project root (or whatever folder that would be where you want to apply such style -- it will be applied to files in this folder and below). If you have one already -- open and inspect it
Add rule for *.php files only -- property to use would be insert_final_newline
An example:
[*.php]
insert_final_newline = true
Links:
EditorConfig site
List of supported proerties
someone said picture speaks louder :D
you will need to tick the Ensure line feed at file end on save box
In PhpStorm preferences go to:
Editor > General
Check the box "Other: Ensure line feed at file end on Save."
Just realize this affects all code files you edit in PhpStorm, not just PHP files.
Under Settings: Editor > General click Ensure line feed at file end on save is checked.
It will add a new line to EVERY file (.js, .css, .html), but it's the only way I've found, and it's a small hit for allowing PSR-2.

SVN post-commit hook which update changelog.txt in Windows OS

I'am new to SVN, and I can't find a solution to make "after commit" update a specific txt file.
I have a php project, within changelog.txt inside the root folder (at the same level where index.php is located). What I want is that after each svn commit, my changelog.txt will be updated with some information by looking like this:
*** YYYY-MM-DD HH:MM by SVN_USERNAME
SVN_COMMIT_MESSAGE
-------------------------------------------------
*** 2010-09-22 18:31 by marco.belinni
- eshop category navigation - fixed issue with navigation, due overcaching with previous version of seo tool
-------------------------------------------------
*** 2010-09-20 01:03 by jean.laroche
- plg_c16n - fixed canonicalization with SEO Plugin which redirects non www urls to www urls
- mod_login - fixed ie and ff login, hidded input type "remember me" with checked paramater
- the whole frontpage have bolded text because of bolded "READ MORE" button - need to clean it before posting any article
- eshop browse - 10products per page FIXED by clearing cache and purged ALL urls
- eshop orderby - removed useless "SELECT" option in selection field for sorting out the items on page
-------------------------------------------------
I tried to find some info but there was a plenty websites showing the exemples with C++ programming. Is there any other solution to use only SVN and PHP ? As I'am not even a newbie in C++.
UPDATED
Here is a visual to show you where my changelog.txt is:
- web
|- framework
| + engine
| + framework
- web
+ css
+ images
| index.php
-->| changelog.txt
Thanks
I'm going to assume your changelog is stored in SVN itself. In which case, stop right there.
You cannot update a file that's stored in SVN after committing, because it will then need committing, which will trigger the update that makes it need committing... you get the idea.
You can happily write data to a new file and use that however, simply create a file called post_commit in the hooks directory and put some script in it (and script language you like) to call svn log, pipe the output to your changelog file.

How to enable autocomplete/syntax-highlight for PHP core functions in Eclipse?

I searched a lot, checked many times the neccesary steps, but it still don't work.
My environment is :
Latest eclipse for PHP developer package
Project is newed, not check out directly from SVN
.project has a line
<nature>org.eclipse.php.core.PHPNature</nature>
.buildpath has a line
<buildpathentry kind="con" path="org.eclipse.php.core.LANGUAGE"/>
.settings/org.eclipse.core.resources.prefs
has a line
include_path=0;/projectname
file ensured opened in PHP Editor
Something works:
PHP core function defination displayed when mouse over, and Ctrl+Click will open its defined file, but input 'arr' nothing happens, while a list of array functions expected
Autocomplete does work for internal functios/variables such as class members
But never works for PHP core functions, neither syntax highlighting
Right-Click on your project -> Configure -> Add PHP Support...
Works for me on Eclipse 3.5 / PDT 2.1
For me, nothing worked, except:
Backup and then delete the .db files under: /.metadata/.plugins/org.eclipse.dltk.core.index.sql.h2/
Restart eclipse.
I got this tip from #4 in: http://www.nwiresoftware.com/blogs/nwire/2010/09/five-tips-speeding-eclipse-pdt-and-nwire
As noted before the 'natures' node for php core is listed but this is most insufficient when the project is imported or checked out.
Make a backup of your .project
Remove the 'natures' node children
Close/Re-open eclipse
Right-click project -> Configure -> Add PHP Support
Add back other 'natures' children
The issue is that project will not make the necessary imports because it assumes it already has.
Nothing helped, but this:
In Eclipse:
Go to Window -> Preferences -> General -> Editors -> File Associations
Click Add
Type *.php
Under Associated Editors choose PHP Editor and click Default on the right.
Close and open your php file.
There are 3 .dll files: model.h2.db, model.lock.db and model.trace.db under workspace/.metadata/.plugins/org.eclipse.dltk.core.index.sql.h2
Remove these files and restart Eclipse.
There seem to still be a lot of bugs related to auto-completion for the PHP Development Tools Project (PDT) (See Open Bugs).
One has been entered two days ago: bug 286733 "When using sub namespace completion does not work."
But this is hardly the only one:
"Autocomplete on namespaces failed" (bug 281766)
"[php 5.3] Code assist doesn't provide method completion" (bug 286068)
...
They are all related to the namespace of the PHP code. Could you check if you reproduce the error in a global namespace?
If issue is still exists, follow the following steps:
Remove project from eclipse.
Goto your project folder and remove .Settings folder and .project
file.
Again import php project with different name.
it's work for me.
Right-Click on your project -> Configure -> Convert to PHP Project...
Works for me on Eclipse 4.6 / PDT 5.2

Categories