本文介绍了有没有办法告诉IntelliJ IDEA在搜索/替换期间或重构期间不查看文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基本上我的问题是主题^

Basically my question is the topic ^

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

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.

是的,我知道我可以将它们排除在外手动进行替换......但就像我说的那样,我想删除任何可以通过IDE修改它们的可能性(我猜不需要写保护它们,或者如果版本控制说它们就一直恢复它们)已被修改过。)

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?

推荐答案

有两个问题:

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

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)如何防止在IDE中修改文件而不对其进行写保护

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

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

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?

这篇关于有没有办法告诉IntelliJ IDEA在搜索/替换期间或重构期间不查看文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-01 15:26