How to expand folder branch in Project Window Intellij IDEA? - intellij-idea

Sometimes I close folder/package in Project Tool Window and then I should click every folder in it to open them . How to avoid this and open all folders/packages quickly?

* on numpad
Also see IDEA guide about Title bar context menu and customize project window as you need.
Navigate to any folder / package by name! Use the shortcut Shift+Ctrl+N(on Mac ⇧+⌘+N) in the pop-up window type name of folder / package, and end of name add /, for example src/. See here guide for more understanding.
Use the great feature Speed Search for quick navigation:
And also use shortcut Alt+1 to open, Shift+Esc to hide Project Tool Window.

after every press numpad * folders will be expaned more and more

Related

Is there an 'Open Folder...' keyboard shortcut in VS Code?

I don't see a keyboard shortcut for "Open Folder..." listed on the documentation page below, and after searching elsewhere for a while I didn't see anything else.
https://code.visualstudio.com/docs/customization/keybindings
I thought I would ask here before putting an issue on GitHub about it. (Also there doesn't seem to be a open / closed issue about this anywhere on the GitHub repo.)
https://github.com/Microsoft/vscode/issues
There is indeed a shortcut for it, the command is workbench.action.files.openFolder, and the default keybinding is Ctrl+K,Ctrl+O.
It's easy to find in the list of shortcuts (File → Preferences → Keyboard Shortcuts) if you search for "folder" or "openFolder" in the Default Keybindings.
Hit Cmd+O on macOS or Ctrl+O on Windows/Linux to activate the open dialog, select a folder, and click "Open."
Note: This answer was written before multiple folder workspaces were implemented in VS Code. If you open folders this way, it will replace your entire workspace with the folder you selected to open. If you want to add a folder to your existing workspace, you must use Cmd+K, Cmd+O on a macOS or Ctrl+K, Ctrl+O on Windows/Linux.

Find a package by name in IntelliJ IDEA

I know the name of Java package and I want to find it in project.
How to do it fast in IntelliJ IDEA?
Is there any keyboard shortcut?
Open Project View tool window, switch to the Packages view mode, click on the gear icon, enable Flattern Packages option, disable Show Modules option.
Start typing the package name to activate the speed search.
Another option is to use Navigate | Class, type your.package.*, select some class, press Alt+Home for the navigation bar popup, use arrows to select the package, press F4 (may not work if navigation bar is not floating, but enabled in the View menu instead).
There is one more easy way, though specifically, it wont only search packages.
What you can do is a global search:
Ctrl + Shift + F
Be sure of focusing on the Project tab and then knock the keyboard, just look what is happening, maybe help you:)
Another easier way is to use the "Search Everywhere" option
1. Double click Shift button.
2. Enter the package name.
Though the result will not be on the top of the list, its easy to locate.

How to set single clicking to open file in IntelliJ IDEA?

And what are counterparts to eclipse's declaration view and javadoc view?
In the Project View click on the "gear" icon and enable the Open Files with Single Click option:
Use Ctrl+Q for Quick JavaDoc and Ctrl+Shift+I for the declaration pop-up.
Now it's available in a simpler way. In the Project View click on the Gear icon and then click Open Files with Single Click:
Go to Preferences and turn on Enable preview tab, that will enable Open Files with Single Click for all projects.
Javadoc opens with Ctrl+Q
There's no declaration view per se, however, you probably will be satisfied with Ctrl+Shift+I shortcut for quick lookup.
Don't know of any ways to configure it to open files on single clicks. Somehow, if you get used to the shortcuts, you skip using mouse very much. For instance, Alt+Home will bring the navigation bar up and you can move with arrows and open the file with Enter. Or just use some other shortcuts like Ctrl+N or Ctrl+E depending on the context.

How to automatically navigate to current class in IntelliJ IDEA Project Tool Window?

I would like to have a keyboard shortcut in IntelliJ IDEA that has the following effect: the tree in the project tool window expands to show the currently open class (or file), and this class becomes selected in the tree.
Is this possible?
Navigate (View in older versions)| Select In... (Alt+F1), Project View (Enter).
It's also possible to enable Autoscroll from Source option in the Project View so that current file is automatically selected.
IntelliJ IDEA 2019
Left click on the wheel > Always Select Opened File
There is also: Open Files with Single Click - the selected file from the tree view will be opened in the right side.
Old IntelliJ versions
Right click on Project/Packages area > Autoscroll from Source
or
Left click on the wheel > Autoscroll from Source
There is also: Autoscroll to Source - the selected file from the tree view will be opened in the right side.
Try
Alt F1(Select Target dialogue) + Enter.
Click at this icon on the top of tree-box.
you can do this also using the upper dynamic menu that change for every opened file. just click twice on the last folder and the file will be on the same folder branch
also good for pycharm
You can also make your own key combo to the "select in tree view" via prefs. I often do: shift + cmd + a and then just write select in.. and then press enter.

How do I create a new class in IntelliJ without using the mouse?

Is there a way to create a new class in a desired location without using the mouse in IntelliJ?
I understand there is no keyboard binding in the default keymap.
If you are already in the Project View, press Alt+Insert (New) | Class. Project View can be activated via Alt+1.
To create a new class in the same directory as the current one use Ctrl+Alt+Insert (New...).
You can also do it from the Navigation Bar, press Alt+Home, then choose package with arrow keys, then press Alt+Insert.
Another useful shortcut is View | Select In (Alt+F1), Project (1), then Alt+Insert to create a class near the existing one or use arrow keys to navigate through the packages.
And yet another way is to just type the class name in the existing code where you want to use it, IDEA will highlight it in red as it doesn't exist yet, then press Alt+Enter for the Intention Actions pop-up, choose Create Class.
You can also use: ctrl+alt+insert
With Esc and Command + 1 you can navigate between project view and editor area - back and forward, in this way you can select the folder/location you need
With Control +Option + N you can trigger New file menu and select whatever you need, class, interface, file, etc. This works in editor as well in project view and it relates to the current selected location
// please consider that this is working with standard key mapping
For Mac Os, command + 1 , then press control + return
On Mac OS 10.14.5, Idea Intellij 2019.1.3 - Press command + 1 to navigate to project files then press control + n
On Mac you can navigate to the location in Project view where you want to create your class and then use ⌘N followed by Enter.
I do this a lot, and I don't have an insert key on my laptop, so I made my own keybinding for it. You can do this by opening Settings > IDE Settings > Keymap and navigating to Main menu > File > New... (I would recommend typing "new" into the search box - that will narrow it down considerably).
Then you can add a new keyboard shortcut for it by double clicking on that item and selecting Add Keyboard Shortcut.
Alt-Home until you're in Packages view
Down-arrow until package is highlighted
Alt-insert
Enter X 2
Type name
$PROFIT$
If you use Mac, you are in luck. One can change the keymap for Intellij as Mac OS X, then you can use option+C.
In my (linux mint) system I can not get working combination alt+insert so I do the next steps:
alt+1 (navigate to "tree") --> "context button - analog right mouse click" (between right alt and ctrl) -- then with arrows (up or down) desired choice (create new class or package or ...)
Hope it helps some "mint" owners )).
I also searched this answer. Equivalent of command+N on Mac OS for Windows is ctr + alt + insert which #manyways already answered. If you searching this in settings it is in Settings > IDE Settings > Keymap, Other > New ...
If the difficulty is in finding the option that makes .java or .class files (Like me), then simply,
click on the folder you want to create file on. select new, and type file's name along with extension.
For example, instead of, helloWorld type helloworld.java or any file extension you desire.