简体   繁体   English

如何在IntelliJ 12中为查找用法设置默认范围?

[英]How can I set the default Scope in IntelliJ 12 for Find Usages?

I've returned to IntelliJ after a long hiatus for Android development so I'm getting used to it again. 经过长时间的Android开发中断后我回到了IntelliJ,所以我又习惯了。 The problem I have is that for example when you want to see where is a class being used, you'd position the caret in the class declaration and issue cmd alt F7 (on Mac OS X) to Find Usages , which is returning stuff from mapping.txt and seeds.txt as well as the .java results, and even tho I can set up the defaults by doing shift cmd alt F7 and un-tick the: search for text occurrences and even change the scope from Project Files to a custom scope (for example), these options are not saved when I invoke Find Usages again. 我遇到的问题是,例如当你想要查看正在使用的类的位置时,你将把插入符号放在类声明中并将cmd alt F7 (在Mac OS X上)发布到Find Usages ,这是从mapping.txt和seeds.txt以及.java结果,甚至我可以通过执行shift cmd alt F7来设置默认值并取消勾选: 搜索文本出现 ,甚至将范围从Project Files更改为自定义范围(例如),当我再次调用“ 查找用法”,不会保存这些选项。

Does anybody know of a way to personalize the Find Usages so it's more close to what Eclipse would do? 有没有人知道如何个性化Find Usages所以它更接近Eclipse会做什么? (Ie, find the real usages instead of a text search for occurrences). (即,找到真实的用法而不是文本搜索事件)。

Instead of cmd alt F7 , use the shortcut alt F7 . 而不是cmd alt F7 ,使用快捷键alt F7 This will open a pop-up for you to make a selection about Scope, Test occurrences, and types of usage. 这将打开一个弹出窗口,供您选择范围,测试事件和使用类型。 You will have to make this selection one time. 您必须进行一次此选择。 The next time you press alt F7 then your choices are remembered. 下次按alt F7,您的选择将被记住。

The result is that alt F7 followed by enter gives you what you need. 结果是alt F7后跟enter可以满足您的需求。

Reporting back from the future: the behaviour described in the question has now been implemented ( Intellij issue mentioned in the comments ). 从未来报告:问题中描述的行为现已实施( 评论中提到的Intellij问题 )。

To configure cmd alt F7 to run in a default scope, start by running it against some Symbol 要将cmd alt F7配置为在默认范围内运行,请首先针对某个Symbol运行它

用法发现

Clicking on the wrench icon, one can select one of the pre-defined scopes, or create a new one (using the ... button). 单击扳手图标,可以选择一个预定义的范围,或创建一个新的范围(使用...按钮)。

范围列表

The + creates a new scope. +创建一个新范围。 Find the folder in which to look, and click Include recursively . 找到要查看的文件夹,然后单击“ 递归包含” And voila! 瞧!

创建范围

Any consequent searches will use that scope until it is changed. 任何后续搜索都将使用该范围,直到更改为止。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM