如何在IntelliJ IDEA中的特定代码块内搜索? [英] How to search inside a specific block of code in IntelliJ IDEA?

查看:1879
本文介绍了如何在IntelliJ IDEA中的特定代码块内搜索?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在IntelliJ IDEA中的中搜索特定的代码块或选择?

How I can search within a specific block of code or selection in IntelliJ IDEA?

我习惯在Eclipse中使用这个功能。在Eclipse中,您只需双击大括号的开头,它就会突出显示整个代码块。之后你可以在Windows上执行 Command + f

Ctrl + f )仅在突出显示的块中搜索,或者您可以只突出显示您需要的内容并搜索该代码块。

I got used to using this feature in Eclipse. In Eclipse you can just double click on the beginning of a curly bracket, and it'll highlight the entire block of code. After which you could do Command+f
(Ctrl+f on Windows) to search ONLY in the highlighted block, or you could just highlight whatever you need and search just that block of code.

推荐答案

Go到设置|键盘映射,在其他组中搜索查找... 操作。此操作应具有以下描述:

Go to Settings | Keymap, search for the Find... action in the Other group. This action should have the following description:


在活动编辑器中查找字符串,显示
模态对话框

Find a string in active editor, shows modal dialog

为此操作指定键盘快捷键(您需要复制默认键盘图以进行修改),例如 Ctrl + Alt + Shift + F

Assign a keyboard shortcut to this action (you need to make a copy of default keymap to modify it), for example Ctrl+Alt+Shift+F.

在编辑器中,选择任何一个块文本,然后按此快捷方式,将打开一个对话框,范围自动设置为所选文本

When in editor, select any block of text, then press this shortcut, a dialog will open with the Scope automatically set to Selected text:

< img src =https://i.stack.imgur.com/RFTqL.pngalt =查找文字>

快速选择站立时的方法体在开口大括号上使用 Ctrl + W

To quickly select the method body while standing on the opening curly brace use Ctrl+W.

这篇关于如何在IntelliJ IDEA中的特定代码块内搜索?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆