Eclipse CDT 移动文件和重命名文件重构?

发布于 2024-10-03 21:36:30 字数 280 浏览 0 评论 0原文

Eclipse CDT 中有没有办法进行以下自动重构?

  1. 移动文件:将源文件/头文件移动到另一个项目文件夹,并自动更新与移动文件相关的每个#include指令
  2. 重命名文件:重命名源文件/头文件,并自动更新与重命名文件相关的每个 #include 指令

如果 CDT 中没有这样的功能,是否有其他 Linux 工具可以轻松地让我做到这一点?

非常感谢。

Is there a way in Eclipse CDT to do the following automatic refactorings?

  1. move file: move a source/header file to another project folder and have every #include directive relative to the moved file automatically updated
  2. rename file: rename a source/header file and have every #include directive relative to the renamed file automatically updated

If there is no such feature in CDT, is there another tool for Linux that would easily let me do this?

Thank you very much.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

记忆之渊 2024-10-10 21:36:30

我在 CDT 8.0 中找不到这些功能。我建议在 https://bugs.eclipse.org/ 提出功能请求bugs/enter_bug.cgi?product=CDT

我刚刚做了一堆你的第 2 项。(头文件重命名、#include 重命名、include-guard 重命名)。使用 eclipse 的搜索和替换大约需要 3 分钟。考虑到我以前从未这样做过,这还不错。如果在 CDT 中实现“头文件重命名”,这可能需要不到一分钟的时间。在我看来,这并不是一个很大的节省,尤其是当你考虑到这样做的频率有多低时。但随后,我不得不重命名约 20 个文件。我使用的半手动方法可能无法像 CDT refactor impl 那样扩展。

I have not been able to find either of these features in CDT 8.0. I would suggest putting in a feature request at https://bugs.eclipse.org/bugs/enter_bug.cgi?product=CDT.

I just did a bunch of your item 2. (header file renaming, #include renaming, include-guard renaming). This took about 3 minutes using eclipse's Search and Replace. Not bad considering I've never done it before. Presumably this might have taken under a minute if "header file rename" was implemented in CDT. Not a big savings, in my book, esp when you consider how infrequently this is done. But then, I had to rename ~20 files. The semi-manual approach I used wouldn't scale as well as CDT refactor impl probably would.

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