intellij how to find / search for a folder / directory / package name

后端 未结 7 1805
北荒
北荒 2021-02-02 06:10

I wish to search just directory (folder) names and packages within the modules of my current project.

How can I do this?

CTRL+Shift+N<

相关标签:
7条回答
  • 2021-02-02 06:18

    I propose this as a partial solution to your query.

    The following steps will allow you to find a file or directory or package name or jar name that is visible in the project view.

    Caveats stated explicitly below, but give this a go.

    1. Click on the root folder in the Project View.
    2. Start typing words that you want to search on to find packages/files/folders/jars in the project view
    3. A tool tip will appear that contains the text Search For: along with the text that you have entered.
    4. The Project View will then highlight the first folder or file that matches the text that you have entered.

    This may be close to what you are looking for.

    The only caveat is that this search is constrained to those entities currently visible in the Project View so if you want to search a particular part of the project it appears that you have to expand those folder within the Project View. (From my testing of this in IntelliJ Ultimate Version 11.)

    One way to work around this is to go to the root element in your project. Perform a partial traversal of where you want to go then by pressing enter you open the folder that you have landed on and then that search is completed.

    Starting typing text again after pressing Enter will recommence the search from the current item in the Project View.

    So by experimenting with this feature you can interactively walk around your project in the Project View in a dialog-box-free manner.

    As a side note you can use the letters Camel Case style to traverse and find classes in the ProjectView

    0 讨论(0)
  • 2021-02-02 06:19

    In IntelliJ IDEA 13, you can use Goto File (Ctrl+Shift+N) and enter the directory/package name with a slash afterwards. Then you'll see all the matching directories in your project.

    0 讨论(0)
  • 2021-02-02 06:19

    If you have the file open in the editor and can't figure out the location in the project view

    WINDOWS: ALT + F1

    From Select In... pick the first item, Project View

    0 讨论(0)
  • 2021-02-02 06:21

    On mac it is

    CMD + Shift + O
    

    at least for intellij 14.1

    0 讨论(0)
  • 2021-02-02 06:28

    It seems IntelliJ doesn't directly support this. Here are the best alternatives I've thought of so far:

    I suggest these steps if there is nothing in the folder yet (Windows):

    • Windows:
      • Right click on the project root, and choose "show in explorer"
      • In the search box on the top right, search for the folder you want (e.g. META-INF)
      • Right click, "open folder location"
    • Linux/Unix/Cygwin:
      • Copy the path instead, (in the right-click menu),
      • cd to the directory using a console or cygwin,
      • use the 'find' utility. E.g. type find . -iname 'SomeFolderName*'

    If there is already something in the folder, I suggest you do this:

    • Ctrl-Shift-F to search for files
    • Enter the directory name inside a wildcard pattern (eg. */META-INF/*)
    • open the first file that occurs in that folder
    • Click on the circular target icon to "scroll from source" (at the top of the project panel).
    0 讨论(0)
  • 2021-02-02 06:31

    If you try

    CTRL + SHIFT + F

    You can do a global file search (like eclipse CTRL + H).

    In the file search, you can select which folder to search for, what file type to search for, case sensitive etc, all the normal stuff.

    Global Replace is

    CTRL + SHIFT + R

    (Mac replace CTRL for CMD)

    find in path

    0 讨论(0)
提交回复
热议问题