Add last edited time as comment at bottom of PHP code
AI'd like to keep track on when i edited each file in my project, tried typeing it for every file, but its not best way, i keep forgetting to do it or chose not to.
Is there feature in PHP Storm to upon saving PHP or other file to add comment with something like:
PHP file
<?php
echo "Hello World";
//Last Edited on November 21, 2014 at 6:15am by user: Ivan
?>
And upon saving it again update this line with current time and user who saved it. Perhaps you can make PHPStorm option called developer Name to keep track who edited file.
I'd like to see it also in all other files in CSS, HTML, JS, etc using the comment allowed in that particular language.
If there's no feature please develop it as i find it upmost important, i'd like to see name of person who edited it as well its useful when you work in teams. I know Git can track that, but i'd like to use PHPStorm to access this info quickly, then if i need to really investigate all edits to file i can use Git.
Ability to switch between showing timestamp and showing timestamp and name is important for projects with single developer name can be turned off.
Also option to clear this info from project before going live would be nice but Optional.
Please sign in to leave a comment.
Hi there,
It's not currently possible -- such functionality is not built-in.
There is one ticket that asks for similar if not the same functionality: https://youtrack.jetbrains.com/issue/WI-17907 -- star/vote/comment to get notified on progress
You really should use proper VCS for this -- be it git or something else.
Heh you almost got me with this one.
I just remembered PhpStorm already doing this when you create new file say you click File > New... chose PHP File enter name and click OK then it creates file with following code.
If authors of PhpStorm suggest you should use GIT or other version control system for tracking when file was created or edited why they even add this comment?
All i am asking to add this comment or update time on it every time i save file (except i dont need line "Created by PhpStorm") , is this a big deal to make checkbox somewhere in options to do so?
It's just a file template -- used on file creation only. You can edit it yourself to a better one: "Settings | File and Code Templates"
I do not know what devs were/are thinking in this regard. But: creation date (not time part) is rather common element in file header comments... so why not?
1) The stuff used when file gets created (initial content: File template) works on file creation only -- it does not participate in any way when file gets updated.
2) There is not build-in stuff that would modify content of your file on save (excluding trimming whitespace characters).
3) Once again: https://youtrack.jetbrains.com/issue/WI-17907 -- As you can see it has a tons of votes (whole 1 vote over almost 1.5 years). So I guess (based on that) that it is "a big deal to make checkbox somewhere in options" as such functionality has to be implemented first.
My point was that functionality is alrady there now they can just define this variable somewhere else rather than file template and insert it each time file is saved.
All it takes is to find opening PHP tag <?php and insert that variable holding author, date and time right after PHP tag, while it moving existing code below it.
<?php
echo "Hello World";
...
?>
<?php
/* User: Ivan
* Date: 11/29/2014
* Time: 3:43 PM */
echo "Hellio World";
...
?>
That's the issue -- it's NOT there -- you misinterpreting it. That's why the aforementioned ticket exists in first place.