有没有办法告诉 IntelliJ IDEA 在搜索/替换或重构期间不要查看文件?

发布于 2024-11-01 20:13:22 字数 238 浏览 3 评论 0原文

基本上我的问题是主题 ^

我有 4 个很大的文件。我需要将它们放入我的 Maven 项目结构下的资源中。每当我进行基于字符串的重构或搜索/替换时...我基本上希望 IDE 完全忽略这些文件。

是的,我知道我可以排除它们并手动进行替换...但就像我说的,我想消除它们可以通过 IDE 修改的任何可能性(我猜不需要对它们进行写保护,或者将它们全部恢复)版本控制表明它们已被修改的时间)。

有什么办法可以排除这些文件吗?

Basically my question is the topic ^

I have 4 files that are massive. I need to put them in resources under my maven project structure. Whenever I do a string-based refactoring or search/replace... I basically want the IDE to ignore these files altogether.

Yes, I know I can exclude them and do the replacements manually... but like I said, I want to remove any possibility that they can be modified through the IDE (without having to write-protect them I guess, or revert them all the time if the version control says they've been modified).

Is there any way I can exclude these files?

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

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

发布评论

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

评论(3

猫瑾少女 2024-11-08 20:13:22

这里有两个问题:

1) 如何在基于字符串的重构(例如搜索和替换)中排除这些文件

您可以在执行查找和替换时设置自定义范围。此自定义范围已保存,因此您不必在每次执行查找和替换时都进行设置。

打开查找和替换窗口或在路径中查找窗口,您将在窗口中看到范围部分,其中最后一个选项为“自定义”。您可以在此处选择要包含/排除的文件。

2)如何防止文件在IDE中被修改而没有写保护,

这个我不确定。您可以将它们添加到单独的更改列表中,以便它们始终与您的主要更改集分开,或者将它们添加到 vc 忽略列表中。但这并不能阻止 IDE 修改它们。也许您应该找出是什么在编辑这些文件并停止该过程?

There are two questions there:

1) How to exclude these files in string based refactoring such as search and replace

You can set up a custom scope when you do a find and replace. This custom scope is saved so you don't have to set it up every time you do a find and replace.

Open the find-and-replace window or the find-in-path window and you will see the scope section in the window with "Custom" as the last option. You can select the files that you want to include/exclude here.

2) How to prevent files from being modified in the IDE without write protecting them

This I'm not sure about. You can add them to a separate change list so that they will always be grouped away from your main set of changes or add them to the vc ignore list. But this doesn't stop the IDE from modifying them. Perhaps you should find out what is editing those files and stop that process?

简美 2024-11-08 20:13:22

您可以在“项目结构->模块”中将该目录标记为排除

在此处输入图像描述

You can mark the directory as Excluded in "Project Structure->Modules"

enter image description here

自我难过 2024-11-08 20:13:22

您可以将此目录标记为“生成的源根目录”

You can mark this directory as for "Generated Sources Root"

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