File Watcher vs. Compiler

At first sight, the File Watcher concept seemed like a really great idea, but the more I'm using them, the more I wonder why that whole concept was added instead of just re-using the existing compiler infrastructure and allowing for user-created compilers.

Let's say I have a project with a bunch of LESS and Typescript files. I don't check in their outputs... that would be like checking in .class files. So when I open up a project I want to build the project. File watchers don't have any provision to do so. Furthermore, the whole file watcher design is a complete nightmare when trying to develop, because the error screen pops up all over the place (no, I cannot figure out a setting that feels 'just right').

It just seems like the existing workflow is much better and could have been used to add these compilers. You edit files, you 'Build' the project, you run/test the project. You can still have background compilers, but this whole file watcher concept seems out of place compared to the overall workflow of the rest of Intellij.


Hi Jon,

If you want just to "build a project" you can use external tools or you can select a folder and invoke "Run File Watchers" action(Press Ctrl+Shift+A and type "file wat").

If you want to hide the error screen just go to a file watcher settings and set Show Error to "Never". Also if you don't want to run a watcher on typing you can disable "Immediate file sync".

BTW you can creat you own custom file watcher(Settings -> File Watchers -> plus button -> custom). There are just some predefined temlates for popular compilers.



I understand that I can do all these things. What I don't understand is why implementing custom compilers as File Watchers was decided instead of as a compiler. Why is the workflow for compiling LESS or Typescript files so different than compiling Java files. It just strikes me as a strange distinction, and breaks some pretty well established workflows.

Ultimately this is a complaint that leads to a suggestion - unify the interface for how compilation is handled. Make the interface consistent. When I click 'Build', the entire project should be built, regardless of the compiler associated with the files.


The idea was just to make automatic external tools. It was motivated by web developers who use LESS, SASS, CoffeeScript, etc. These compilers have a watch mode when they watch for changes in a specific folder and compile files on any changes. Cause our IDEs use a Virtual File System which sync a file in a memory with a physycal one not immediatly we couldn't just use watch mode from a compiler. So we implemetned these workflow for our platform. Mainly for out lightweight WebStorm which doen't have a build button(web developers don't need it).

About the difference between Java and TypeScript compilations. You don't use .class files in your project, but you inlude translated js files into your html files. That's the main difference.


I'm a little late to the party, but I agree with the OP that the workflow using file watchers doesn't feel very smooth.  
My complaints are similar --
- I'd like to keep the transpiled files separate from the source files.  I believe this should be easy if I just change the output paths.
- Even if I uncheck "Trigger watcher regardless of syntax errors", the watcher will still trigger when I have error markers.  I'd also prefer to have the ability to make the file watcher trigger as a run configuration instead of on file save.

Also, thanks for the tip on Show console: never. This helps a lot. <3


Please sign in to leave a comment.