Search code examples
intellij-ideapycharmphpstormwebstorm

IntelliJ: Dynamically updated file header


By default, IntelliJ Idea will insert (something like) the following as the header of a new source file:

/**
 * Created by JohnDoe on 2016-04-27.
 */

The corresponding template is:

/**
 * Created by ${USER} on ${DATE}.
 */

Is it possible to update this template so that it inserts the last date of modification when the file is changed? For example:

/**
 * Created by JohnDoe on 2016-03-27.
 * Last modified by JaneDoe on 2016-04-27
 */

Solution

  • PHPStorm has not a "hook" for launching task after detect a change in file (just for uploading in server yes). Code templating is based on the creation of file not change.

    The behaviour you want (automatic change file after manual change file) can be useful for lot of things but it's circular headhache for editor. Because if you change a file it must change file (and if a file is change ? it change file ?).

    However, You can, perhaps, "enable Live Templates" when you launch a "reformat code" which able to rewrite your begin template code that way rewrite date modification.

    Other solution is that use a tools with as grunt but I don't know if manage php file.