有没有办法在 Eclipse 中保存时自动在文件头中添加时间戳?
我是一名使用 Eclipse PDT 的 PHP 开发人员。我希望每次保存文件时都会自动在文件头中添加时间戳。也许作为变量的替代品。假设我在文件中使用此标头:
/**
* ${filename}
* ${timestamp}
*/
当我保存文件时,我会将其替换为:
/**
* Myfile.php
* 4/20/2010 19:04
*/
如果有一个宏可以在文件的最开头添加一行仅包含时间戳,那么也可以。
有人有想法吗?
问候, 乔治
I am a PHP developer using Eclipse PDT. I would like a timestamp put automatically in my file headers whenever I save the file. Maybe as a replacement of a variable. Let's say I use this header in a file:
/**
* ${filename}
* ${timestamp}
*/
When I save the file I would this to be replaced with:
/**
* Myfile.php
* 4/20/2010 19:04
*/
It would also be ok if there is a macro that would add a line at the very beginning of the file just containing a timestamp.
Anybody with an idea?
Regards,
George
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Eclipse 本身没有提出任何建议(或 Eclipse PDT),但您可以添加与语言无关的像 AnyEdit 工具 这样的插件,建议“保存时”操作:
(来源:gmxhome.de)
因为这些都没有actions 是您要查找的内容,您可以查看源代码 并了解如何扩展这些“保存时”操作以包含您想要的内容。
There is none natively proposed by Eclipse (or Eclipse PDT), but you could add a language-agnostic plugin like AnyEdit tools, which proposes "on save" actions:
(source: gmxhome.de)
Since none of those actions are the one you are looking for, you can have a look at the source code and see how to extend those "On Save" actions to include what you are after.