IntelliJ: Dynamically updated file header

intellij file header example
intellij update copyright in all files
intellij author template
how to save java file in intellij
how to create a readme file in intellij
how to create yaml file in intellij
intellij templating
intellij live templates

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
 */

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.

Auto update file header? – IDEs Support (IntelliJ Platform), What i'm looking for is something that will automatically update the header in files​, specficially the date the file was last edited. Here's a Sublime  IntelliJ IDEA uses several types of templates, separated into the following tabs: The Files tab contains file templates that can be used for creating new files. The Includes tab contains templates of reusable content that can be inserted into file templates (for example, headers).


It is not supported out of the box. I suggest you do not include information about author and last edit/create time in file at all.

The reason is that your version control system (Git, SVN) contains the same information automatically. So the manual labelling is just duplicate of already existing info, but is only more error prone and needs to be manually updated.

File template variables - Help, IntelliJ IDEA provides a set of additional variables for PHP include templates, which are used to define reusable pieces of code, such as file headers and  In this tutorial, we're going to look at how to add a license header to our IntelliJ IDEA project files. The license header typically describes a project file's permitted usage and ownership. We assume that you have a basic knowledge of IntelliJ, therefore, we'll dive straight to the point.


Here's a working solution similar to what I'm using. Tested on mac os.

  1. Create a bash script which will replace first occurrence of Last modified by JaneDoe on $DATE only if the exact value is not contained in the file:

    #!/bin/bash
    
    FILE=src/java/test/Test.java
    DATE=`date '+%Y-%m-%d'`
    PREFIX="Last modified by JaneDoe on "
    STRING="$PREFIX.*$"
    SUBSTITUTE="$PREFIX$DATE"
    if ! grep -q "$SUBSTITUTE" "$FILE"; then
      sed -i '' "1,/$(echo "$STRING")/ s/$(echo "$STRING")/$(echo "$SUBSTITUTE")/" $FILE
    fi
    
  2. Install File Watchers plugin.

  3. Create a file watcher with appropriate scope (it may be this single file or any other scope, so that any change in project's source code will update modified date or version etc.) and put a path to your bash script into Program field.

Now every time the file changes the date will update. If you want to update date for each file separately, an argument $FilePath$ should be passed to the script.

Copyright - Help, To configure the default profile for all newly created projects, select File | New Projects Settings You can change the default format in the settings: You will be prompted to select in which scope you want to update the notice. A node may​  So after switching to PHPStorm from Sublime Text I am very happy with everything, except for one plugin I can't seem to find anything similar for PHPStorm.What i'm looking for is something that wil


HTTP client in IntelliJ IDEA code editor - Help, HTTP Requests are stored in .http and .rest files and are marked with the HTTP file icon icon. Inline documentation for request header fields and doc tags When an HTTP request is executed from a physical file, this file is not modified. With response handler scripts, you can programmatically react to a received HTTP  On top of the request's editor panel, click the Add Environment File shortcut link. Select the desired environment type from the popup menu. Depending on your choice, IntelliJ IDEA will create the following files inside the project: Choosing Regular will create the http-client.env.json file. This file can contain common variables such as host name, port, or query parameters, and is meant to be distributed together with your project.


Change file association manually – IDEs Support (IntelliJ Platform , I need to change manually a file type for my file "script" (no file so that Intellij automatically opens the file in the format you want. Please make it easier to dynamically override associations-by-extention, that's so 90s. date format. You can file a YouTrack issue or, better yet, submit a patch that adds this feature. I know this is an old post, but i'm looking for this exact thing, but in a livew template, not a file template. Is there any way to accomplish that? I've tried passing the Velocity-style argument string to the date() function in a variable


Fileheader, Hi,nearly all my Files have a file-header - like this: /** * Copyright by Jörg Wrase - Computer-Und-Sound.de * Date: 11.07.12 * Time: IntelliJ IDEA provides a set of additional variables for PHP include templates, which are used to define reusable pieces of code, such as file headers and PHPDoc comments). The following additional predefined variables can be used in PHP include templates: