VCS + git + file watchers

Hi all,

I would like to ask for the help with the issue I am experiencing during switching git branches (applies to other vcs, I believe) in the project within phpstorm while file watchers being applied to files.

Thing is: We are versioning the generated files so the git can auto-deploy them after push. Currently with the gulp watching (applies to other file-watchers) over some .es6 and .scss files, when I switch the git branch, some files are regenerated.

Sometimes, even if the content of the generated files remains same, phpstorm registers regenerated files as "changed", marking them with blue color (I mean VCS color, blue = updated, green = new, red = unversioned; not sure if it's default). [ VCS > Refresh file status ] is not "removing" the blue color. "git reset --hard" does.

So I am forced to A) turn off and of the gulp everytime I switch the branch, or B) do a git reset everytime I forget to turn the gulp off.

I believe problems may be caused by the fact that the files are generated during the git checkout (branch switch), what causes some timestamps or cache or something to differ.

May anbody help here or this problem is too specific? Are there any known ways to prevent need of turning the gulp off manualy every time?

Thank you for your help, guys.

6 comments

Hi there,

What's you IDE version and File Watcher settings? I assume you are talking about File Watcher plugin and not "gulp --watch" (or something like that).

File Watcher (plugin) now has separate "Trigger the watcher on external changes" option -- VCS operations are considered "external changes".

 

>I believe problems may be caused by the fact that the files are generated during the git checkout (branch switch), what causes some timestamps or cache or something to differ.

https://youtrack.jetbrains.com/issue/WEB-7912 -- File Watchers are not triggered when you do VCS actions using IDE functionality (as of 2016.3 version as per that ticket). But this does not apply if you execute such VCS commands manually in terminal/console.

 

No better explanation/suggestions from me -- JetBrains stuff may help better here.

0

Thanks Andriy,

unfortunately I am talking about gulp, specifically about built-in gulp functions PhpStorm has. I've just created gulpfile.js in the root and Storm started showing controlling menu at the left side of the project tree. After I've created run configuration for "gulp default" I added it into startup tasks.

There are of course not such a option to "Trigger the watcher on external changes" for the gulp, what I understand, as from the gulp's view, every change is external.

Yet I believe there are best practices to resolve this.

0

Well ... that's not File Watcher then.

Those are Gulp tasks -- AFAIK they are fully external (it's like writing "gulp watch" (or whatever the command is) manually in terminal if I understand everything correctly).

I personally do not see how IDE can help here: VCS changes the file .. and external app (gulp watch) performs some additional task on those files without IDE interaction.

No proper suggestions from me, sorry.

 

Although, you may browse:

 

0

Thanks again, Andriy.

I was not sucessfull finding the solution elsewhere.

Are you saying this is a wrong place to ask? I am aware there may be not pure IDE solution, but still I thought my question is tightly related to IDE.

But for the "File Watcher" - it's just a misinterpretation from your side, I believe. Because "watching a file" or "watchers" are related to many other IDEs and programs. I know there is a specific section in the Phpstorm settings called "File Watchers", and that's why I mentioned in the question this apply to many ways of watching a file. Also I do not think there is an option to connect Phostorm's File Watchers with gulp.

0

>Are you saying this is a wrong place to ask?

No -- it's a right place. You are not reporting a definite bug or something -- you are asking for some solution to your problem. On Issue Tracker you may find some comments on related subject that may help you in resolving your issue: a workaround, a detailed explanation/description etc.

Just keep in mind -- this is a forum -- it's not checked on regular (1 hour or so) basis. But JB staff does check it daily or so.

 

>But for the "File Watcher" - it's just a misinterpretation from your side, I believe.

I was referring to a File Watcher plugin (that's why I've used capital letters), which is used to execute some specific tasks on file modification. Usually those are one-job commands (like compile scss/less; minify this/that etc or alike). But it can execute any app (e.g. batch/shell script) that will do multiple jobs under the hood.

 

>Also I do not think there is an option to connect Phostorm's File Watchers with gulp.

You can run Gulp tasks as well -- just not "gulp watch" which sits in background ... but "gulp compile" (sorry, not using Gulp myself so do not know exact syntax) or similar that do the job and then exit. You will need to use full file path to the gulp executable etc.

https://confluence.jetbrains.com/display/PhpStorm/File+Watchers+in+PhpStorm

0

P.S. You may also use "Submit a Request" link at the top of the page to make Support Ticket.

1

Please sign in to leave a comment.