IntelliJ IDEA: how to search for a folder / directory / package name? - intellij-idea

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 allows me to find a
class
CTRL+Shift+Alt+N allows
me to find a symbol
Is there a function for that allows me to search just directories, folders and package names?
I'd like the result of this search to be that the directory / package sought is highlighted in the "Project" box.
For example, if I type in "model.feed" then then I get this:
and preferably while I'm typing that a list of any directories matching would be shown in real time (in the same way as classes are when you do CTRL+Shift+N).
I'm using IntelliJ IDEA 12.0.4 (Ultimate).

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.

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.
Click on the root folder in the Project View.
Start typing words that you want to search on to find packages/files/folders/jars in the project view
A tool tip will appear that contains the text Search For: along with the text that you have
entered.
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

WINDOWS:
CTRL + SHIFT + N
MACOS:
⌘ command + ⇧ shift + O

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)

On mac it is
CMD + Shift + O
at least for intellij 14.1

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

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).

If you find yourself wanting to search for folders/packages often, you can use the Go to File command (Ctrl + Shift + N) and set a filter on Directories so that you can quickly search for directories and packages. The filter will be saved for the next time you use Go to File. As a demonstration:
Use Go to File (Ctrl + Shift + N) and click on the filter icon (funnel-shaped) on the top right of the search box. Disable/unselect all other selections and only keep Directories selected.
Try searching -- you should only see directories and packages in the result.
Try using Go to File again -- you should find that the filter still exists

Related

How can I look for both folders and files in VS Code?

I come from JetBrains, and when I want to look for a folder or a file, I simply press Ctrl + Shift + N:
Look for a folder:
Look for a file:
In JetBrains, after selecting a folder, the explorer navigates to it.
Now, in Visual Studio Code, when I look for a file, I'm using Ctrl + P. But it seems like I can't look for a folder.
I found a partial solution that can look for folders in the project explorer Ctrl + E but it doesn't seems to work completely.
Is there a way to tell VS Code to include folders in the searchbox?
No, but there are 2 alternatives you might be interested in.
Mini Search in Explorer, By pressing / in Explorer, then type search text (Only works with expanded folders)
Reveal in Explorer, By opening a file in search results, Shift+Alt+R reveals folder structure in Explorer.

CLion code navigation with C++ doesn't work

I've used AppCode (Intellij C++/ObjC IDE that replaces Xcode) for a while and really gotten used to being able to Ctrl+Click on any identifier to get to its definition/decleration.
Now on a new work place, I'm using CLion for a somewhat larger code base and Ctrl+Click hardly ever works. It only seem to work when the identifier is in the same file.
Is there anything I need to setup for this to work correctly? CLion seem to index the code successfully and doing text searches works fine.
You need to use import project functionality of CLion from File -> Import Project and give ok for CMakeLists.txt file automatic creation. Never mind the file is for CMake, you can build your project with other tools too, but CLion uses it for the dependencies.
Then append in the beginning of that file a line stating:
include_directories(.)
After that go to File -> Settings and there search for Keymap from the left and after that on right, right below the word "keymap" there is a selection element for taking for example Eclipse default keymapping in use and there you have at least (I tested only it) the ctrl + click functionality working like charm!!
kudos about the include_directories(.) goes to this question: CLion indexer does not resolve some includes in the project directory
You need to press ctrl + alt + shift + n.
And after pressing it a dialog box will appear to enter your variable/function name and click enter.
Tip: Filter the result for a better experience. Filter option is present on right side of the dialog box.
To get a quick peek of function/variable definition press ctrl + q while focusing on the variable or function.
To get the detailed or full definition of function press ctrl + shift + i while focusing on the variable or function.
I just looked at one of my more complicated teaching examples with multiple header/source files where this would come up.
What I see is that ctl-click (and the red/green arrows in the gutter) does work only in the same file. But I can right-click on a method from another file and choose to go to either the declaration (in header) or definition (in cpp).
The hotkeys to do this are not ctl-click. But you can remap hotkeys in IntelliJ ides, so you may be able to come up with hotkey combinations that don't seem too awkward to you.
What helped me was to run File > New CMake Project from Sources
Until that point, Ctrl+click in CLion would go to the definitions, but wouldn't find any usages.

How to create a file in a specific directory in Rubymine/PHPStorm/other JetBrains IDEs without leaving the home row

Currently, I am doing the following:
cmd-1 to go to the project structure view
Move to the arrow keys (not on the home row - I want to avoid this step), or, (horrors!) the mouse to navigate to the folder I want to create the file in
ctrl-alt-n to open the new file dialogue, which always created the file in the selected directory
Is there a better way to specify/move to the directory without having to use the arrow keys/mouse so that I can stay on the home row?
I have tried:
Moving to the root of the project structure pane using pageupand typing the name of the directory - this is good, but pageup is way off the home row. Also it often selects the wrong folder (e.g. the one in /spec, not the one in /app) and I can only get to the right one with the arrow keys again. There seems to be no way to type app/controllers as it doesn't process the slash as a directory separator for some reason.
Using the navigation bar via option-pageup, moving all the way left with the left arrow, then either navigating to the right directory with other arrow keys, or using ctrl-alt-n from the roor and typing the full path, but this is also way off the home row and no faster.
Type ⌘+SHIFT+O (or CTRL+SHIFT+N if you are using Linux/Windows keymap) to open the Navigate to file dialog (or hit SHIFT+SHIFT to open the Search Everywhere dialog).
Type the name of the directory you want to create the file in. Note that the directory name must end with / in order for IntelliJ to know that you want to open a directory not a file.
You can type just part of the path, such as webapp/resources/
Hit Enter and the selected directory will be opened in Project view.
Then you can use ⌘+N (ALT+Insert) to create new file as usual.

Replace string in under a directory in netbeans

I want to replace some strings in a particular directory in netbeans 7.3
Is it possible?
mainly i need to replace
'Notifynotify' string by
'Notify'
In NetBeans press CTRL + SHIFT + H to open the Find and Replace option. There you can change any piece of text by another one, and in any folder / subfolder you want by changing the Scope parameter in the same window. You can select Current project (whole project), Open projects, An specific selection (If you highlight a package / folder in the project view) or a free browse option.
Answer in this link.

sublime text 3, indexing, and goto symbol/goto definition

so I downloaded sublime text 3 which allegedly "Sublime Text now scans the files in your project, and builds an index of which files contain which symbols. This backs the new features Goto Definition and Goto Symbol in Project".
I created a new project containing the source code of zend framework...I then attempt to do goto definition and goto symbol but they are all still only allow you to "Goto" definitions/symbols in the current file instead of the entire project.
How exactly should I configure sublime text 3 such that I can use the goto definition/symbol to any method in the project and not just the current file (akin to Eclipse's Ctrl + Shift + M Open method feature).
First off, make sure the relevant folders are added to your project by checking that they appear in the side bar under FOLDERS (which you can toggle using ⌘-K ⌘-B). If the Zend folder isn't there, add it by going to Project » Add Folder to Project....
Then you should use Goto » Goto Symbol in Project... (or ⇧-⌘-R). Goto Definition should search in the whole project. At least this is what it behaves like for me on Sublime 3 build 3019 for OS X.
Replace ⌘ with CTRL and ⇧ with SHIFT if on Windows.
Assuming this is not a shortcut issue (You can test this by trying to find symbol from the menu)
Try:
Quit Sublime Text 3.
Clear out the Sublime Text 3 Index folder
In OS X, delete the contents of ~/Library/Application
Support/Sublime Text 3/Index
In Windows, delete the contents of AppData\Local\Sublime Text 3\Index\
Open ST3 and your project
Open Console (View -> Show Console)
Check for errors
Most likely after step 3, your project will be back to normal, but if it isn't check what the problem is while indexing and try to search for that specific problem.
EDIT: Depending on the size of your project rebuilding cache might take looong