I use "Navigate-Declaration" all the time in IntelliJ IDEA. I would like to configure it to behave slightly differently when split editors are used.
The basic use case is simple:
However, things behave strange when using a split window:
If this class is already open in the left side tab group, IntelliJ will bring that tab forward in the left editor, replacing the one class I selected for viewing. However, if the class is not already open in any tab group, IntelliJ will open the file on the right side tab group. This is essentially the same as what happens when a split editor is not used.
Even worse, "Navigate->Back" action will now indeed navigate back to the original class in the right side, but does not change anything on the left side, i.e. that one class that I intended to refer to for a while is not visible.
So the behavior of the "Navigate->Open Declaration" action is dependent on the state of IntelliJ itself, and not on my intention. I do not want intelliJ to arbitrarily decide which split window to show a file in. I would rather that it only open the declaration in the tab group where the cursor curently is.
What would be really nice is an action like "Navigate->open declaration in current tab group". Does this exist? Can a plugin be created for this?
To navigate backwards, press Ctrl+Alt+Left . To navigate forward, press Ctrl+Alt+Right . To navigate to the last edited location, press Ctrl+Shift+Backspace . To find the current caret location in the editor, press Ctrl+M .
Code Editing Use the Code Editing page of the Settings/Preferences dialog to configure the general code editing options. Select this checkbox to have IntelliJ IDEA highlight pairs of opening/closing braces when you position the caret right before the opening or right after the closing one.
The file being edited right now is highlighted. Invoke switcher with hotkey Ctrl+Tab or Ctrl+Shift+Tab. Here's an even more convenient way to jump to any recently opened file: bring up the Recent Files window with Ctrl+E / Cmd E and just type the name of the file you want to navigate to.
I have the same issue but I have a workaround that works for most of my cases:
In Settings > Editor > General > Editor Tabs, and under Closing Policy, I set the tab limit to 1. This enforces a single tab per split, which prevents a hidden tab in another split from opening when you navigate to a symbol within it. When you go to declaration, if the destination file is in a split, it will go there, and if it doesn't exist, it will replace the tab in your split. This works for most cases, it might get trickier if you don't want intellij to change the part of the file you're looking at in a split, but for most cases it works.
(Also I don't use tabs generally to remember which files, I usually use the Recent Files window to navigate).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With