Is there a way to always use the next splitter/window when using "Go to definition" and similar?

Answered

Whenever I do any of the following operations, I would much rather have the file open in the next editor pane (or next editor window, if using multi-monitor windows) rather than on top of my current file:

  • go to definition
  • go to type definition
  • cmd-click on a symbol to get the Usages popup, then click on any of the usage
  • etc.

Is there a setting or a plug-in to achieve this?

My current workaround is to use `TabMover`, but then its always a two step process: (1) go to def, (2) move newly opened editor to next splitter/window with `TabMover`.

1
7 comments

Could you please attach a video to demonstrate it? Isn't it like how it works in my screenshot? When I cmd+click "out", System.java got opened in a new tab next to the main file.

0

Here is a video of a cmd-click on an function showing the useage popup. I then double click on one of the item, and the corresponding file is displayed in the same editor.


https://www.swisstransfer.com/d/09a0925b-6f20-4398-8b0d-2be69cab9db2

(Note: this is actually RustRover)

0
Hello @Abeyeler 
 
By default, Distraction-Free mode goes with Settings | Editor | General | Editor Tabs | Appearance | Tab placement | None. That's why clicking on the usage replaces the tab.
Change that to "Top". After that, clicking on the usage will open a new tab in Distraction-Free mode.
Note: this setting will alter Distraction Free Mode. When you exit it, and enter next time, you will see tabs again. To hide tab headers back, set Tab placement to None.
0

I'm not sure I understand this. To clarify, I'm not using the distraction free mode (I'm hiding tabs to reclaim vertical space).

Also, I tried to re-enable tabs (Tab placement Top as suggested), but that doesn't change the original behaviour: go to def still open the new tab in the same splitter.

0
Thank you for the clarification. I appreciate it.
Unfortunately, there is no way to open a new tab in split mode directly from the Usages window. As a workaround, you can assign a hotkey for the Split and Move Right action under Settings | Keymap | Main Menu | Window | Editor Tabs | Split and Move Right. In this case, the workflow will be as follows: Click on the desired file in the Usage window. When the new file tab opens, press the Split and Move Right hotkey. The file will be split and moved to the right.

If you'd like a separate hotkey for this, please submit a feature request on our tracker:
https://youtrack.jetbrains.com/issues/ijpl
0

As I mention above, I already have a shortcut for “move tab to next splitter/window” (using the TabMover plugin). The thing is, 95% of the time I “Go to definition”, I want to do so without loosing the focus on what I am currently working on (aka the editor tab I'm currently in). So what I'm looking for a some kind of global setting to redirect all “go to defintion” away from that current editor.

Thinking about it, there might be many ways to achieve the same end result:

  • Always open definition to the “Next” tab (but what about chaining Go to def?)
  • Mark a specific splitter as a “Go to def” target (eg. left splitter is where I work, right splitter is where I have my definition)
  • others?
0

Unfortunately, there is no such global setting to redirect all “go to definition” actions
0

Please sign in to leave a comment.