有没有办法告诉 IntelliJ IDEA 在搜索/替换或重构期间不要查看文件?
基本上我的问题是主题 ^
我有 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这里有两个问题:
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?
您可以在“项目结构->模块”中将该目录标记为排除
You can mark the directory as Excluded in "Project Structure->Modules"
您可以将此目录标记为“生成的源根目录”
You can mark this directory as for "Generated Sources Root"