Skip to content

codepress/wp-phpstorm-settings

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PhpStorm Settings

Shared PhpStorm settings for the Codepress team so we all work with the same configuration and produce the same output across our codebase.

  1. Live Templates
  2. Code Inspections
  3. Scopes
  4. File Watchers
  5. Development
  6. Alternatives

Overview

Settings come in two flavours:

  • Application settings (Live Templates, Code Inspections) are copied into your PhpStorm configuration directory.
  • Project settings (Scopes, File Watchers) live in the project's own .idea directory.
File Type Copy to
templates/PHP.xml, templates/WordPress.xml, templates/JavaScript.xml Application <config>/templates
inspection/Codepress.xml Application <config>/inspection
scopes/Admin_Columns_Free.xml, scopes/Admin_Columns_Pro.xml Project <project>/.idea/scopes
fileWatchers/watcherTasks.xml Project <project>/.idea

<config> is your PhpStorm configuration directory, ~/Library/Application Support/JetBrains/PhpStorm20xx.x/ (pick the latest PhpStorm20xx.x folder). The exact path for your install is shown under Help > Edit Custom Properties. <project> is the project opened in PhpStorm — see the File Watchers note for which directory that must be.

Live Templates

Our custom live templates for PhpStorm, divided into three groups:

  • PHP templates/PHP.xml
  • WordPress templates/WordPress.xml
  • JavaScript templates/JavaScript.xml

Usage

  • Copy the templates/PHP.xml, templates/WordPress.xml and templates/JavaScript.xml files from this repo.
  • Copy them to your <config>/templates directory.
  • Restart PhpStorm.
  • The groups are activated by default. Disable any group or live template from PhpStorm Preferences > Editor > Live Templates.
  • The abbreviations that trigger each live template are listed under PhpStorm Preferences > Editor > Live Templates.

Code Inspections

Our own WordPress code inspections profile for PhpStorm.

Usage

  • Copy the inspection/Codepress.xml file from this repo.
  • Copy it to your <config>/inspection directory.
  • Activate the profile by selecting 'Codepress' under PhpStorm Preferences > Editor > Inspections.

Scopes

Shared project scopes for the Admin Columns codebase. They let PhpStorm target the free core and the Pro plugin separately (excluding vendor, tools and build directories) and are used by the File Watchers below to run the correct php-cs-fixer config per scope.

  • Admin Columns Free scopes/Admin_Columns_Free.xml
  • Admin Columns Pro scopes/Admin_Columns_Pro.xml

Scopes are project settings and live in the project's .idea directory.

Usage

  • Copy the scopes/Admin_Columns_Free.xml and scopes/Admin_Columns_Pro.xml files from this repo.
  • Copy them to your project's .idea/scopes directory.
  • Restart PhpStorm.
  • The scopes 'Admin Columns Free' and 'Admin Columns Pro' are now available under PhpStorm Preferences > Appearance & Behavior > Scopes.

File Watchers

Shared File Watchers that run php-cs-fixer on save so the whole team produces the same formatting output. There are two watchers, each scoped to its plugin (see Scopes above):

  • php-cs-fixer (Pro) runs against the Pro .php-cs-fixer.dist.php config for the 'Admin Columns Pro' scope.
  • php-cs-fixer (Free) runs against the free core .php-cs-fixer.dist.php config for the 'Admin Columns Free' scope.

Like the scopes, File Watchers are project settings and live in the project's .idea directory.

Usage

  • Import the Scopes first — the watchers reference them by name.
  • Copy the fileWatchers/watcherTasks.xml file from this repo.
  • Copy it to your project's .idea directory (replacing the existing watcherTasks.xml).
  • Restart PhpStorm.
  • The watchers appear under PhpStorm Preferences > Tools > File Watchers.

Project root: the watcher paths resolve $ProjectFileDir$/admin-columns-pro/…, so they only work when the directory opened in PhpStorm is the parent folder that contains admin-columns-pro/ — not the plugin folder itself. If you open the plugin directly as the project, the watchers will not find the php-cs-fixer configs.

PHP binary: the watchers call PHP at /opt/homebrew/opt/php@8.3/bin/php (Homebrew on Apple Silicon). Adjust the program path in watcherTasks.xml to match your local PHP 8.3 binary if it differs.

Development

  • Clone the repo.

  • Symlink the application setting you want to edit into the matching PhpStorm directory so changes are picked up live (this works for templates and inspection; project settings live in the project's .idea and are copied, not symlinked):

     $ cd <config>/<directory>
     $ ln -s /<path_to_repo>/<directory>/<filename>.xml
    
  • Restart PhpStorm.

  • Make changes, submit pull requests etc.

Alternatives

Manually copying files works, but PhpStorm has built-in ways to share configuration that may suit the team better:

  • Settings Sync (File > Manage IDE Settings > Settings Sync) syncs application settings across your own machines via your JetBrains account.
  • Settings Repository (File > Manage IDE Settings > Settings Repository) syncs application settings from a shared Git repository — closest to what this repo does, but automated.
  • Import / Export Settings (File > Manage IDE Settings > Import Settings) imports a settings .zip.
  • Commit project settings to the project repo. The Scopes and File Watchers are plain .idea files; committing them directly into the Admin Columns repo removes the manual copy step for everyone.

About

Recommended PhpStorm configuration files for working on Admin Columns Pro

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors