有没有办法在 Eclipse 中保存时自动在文件头中添加时间戳?

发布于 2024-08-30 07:45:03 字数 315 浏览 1 评论 0原文

我是一名使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

再见回来 2024-09-06 07:45:03

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:

alt text
(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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文