Force file watcher execution

Hello,

I'm using phpstorm 7 (trial) on windows 8.
I use file watchers for sass/scss to css compilation. However, the file watcher seems to kick in at times while I'm still typing a css rule and doesn't always detect a file change when I'm done typing. This often leaves me up with an error as css output (because it did the compilation when there was an incomplete css rule). Then I start adding or removing blank lines, hoping the file watcher will pick up a change, but most of the time it doesn't.
I don't know if this is a windows file system or phpstorm problem, but it is very very annoying. One solution would be an easily accessible button or context-menu item to manually (re)start the compilation.

2
2 comments

Hi there,

1) Uncheck "Immediate file synchronization" option in File Watcher settings -- this will make file watcher to be executed ONLY when file will be saved and not after you make any changes to the file.

2) "Settings | Menus and Toolbars" -- you can customize any context menu yourself. The action (when adding new entry to any menu) to manually re-run file watcher on a specific file can be found under "Plugins | File Watcher | Run File Watcher".

3) To manually re-run file watcher without modifying any context menu you need to:

  • Select required files/folders in Project View
  • Ctrl+Shift+A twice in a row (or "Help | Find Action..." and then activate check box on that screen)
  • Search for "run file wa" (without quotes obviously) and choose "Run File Watcher" entry


Alternatively:

  • "Settings | Keymaps"
  • Find "Run File Watcher" action under "Plugins | File Watcher"
  • Assign any keyboard shortcut you want
  • Use it after selecting desired file(s)/folder(s) in Project View
4

I've found this when searching how to 'touch' (like the *nix command) a file in the project, and force a watcher to process it.

The definition got lost in a Phpstorm upgrade :(

I managed to find the old definition, in case it helps someone.

Add and ExternalTool:

Program: touch
Arguments: $FilePath$
Working directory: $ProjectFileDir$

Associate a key of your choosing under Settings > Keymap > External Tools (I used Windows T).

 

0

Please sign in to leave a comment.