Sublime Forum

Open reference in active column

#1

With Sublime Text 3 object reference is opened in active tab. With the 4 version it is opened in same tab or new created tab. Maybe can I edit settings?

0 Likes

#2

Can you clarify the steps you’re taking that are resulting in it not doing what you expect? If I understand you correctly (and I may not be) it sounds like you’re trying to go to the reference of symbols, but I believe that should still work the same unless you explicitly press extra keys or click the icon that indicates you want a split view.

0 Likes

#3

Yeah, sorry I not specified and have mistakes with terms.
For example:

  1. I set layout with 2 columns (shift+alt+2),
  2. First column contains some interested code, second - plain,
  3. I activate second column: click by cursor,
  4. Move cursor to some method of the first column,
  5. Pop-up window show definition and reference of the method by a project.

And now the difference:

  • 3rd version: link - code with definition/reference is opened in active column - 2nd column.
  • 4th version: the link is opened in same column (new tab) or (optional) in a newly created column (automatically).

I like mechanism of 3rd version: the original code is not lost sight of.

0 Likes

#4

So I cannot fix it?

0 Likes

#5

I remember some changes being made in this area. If I remember correctly they were related to fixing problems with Sublime re-opening a second copy of a file when you look up a reference/definition in cases where the file was already open but in a different group.

Does this also happen in Safe Mode?

0 Likes

#6

Yes, it’s the same in safe mode

0 Likes

#7

I’m running into the same thing on build 4126. Your reference to:

… sounds exactly like my problem.

Here is a .gif showing exactly what I’m experiencing.

Peek%202022-07-13%2016-38

I would expect the active tab to just select the already open “delete_me.h” file that’s in the group view on the right. However neither a normal left click or ctrl+left click select it as expected.

Has there been any update to this @OdatNurd?

0 Likes

#8

I assume changing the value of the select_across_groups preference doesn’t help?

0 Likes

#9

Correct. I tried toggling the value for this setting as it seems related but it had no effect.

0 Likes

#10
0 Likes

#11

@kingkeith
Thanks for the reference!

Unfortunately the code has changed a bit since then so it wasn’t exactly clear how to implement that comment’s proposed changes. I wasn’t trying to spend a lot of time on this so I just blindly removed all references of sublime.FORCE_GROUP from both Default/symbol.py and Default/switch_file.py and that seems to work:

Peek%202022-07-14%2013-07

Just my 2 cents, but given all the discussion around this it seems like it should exist as a setting.

0 Likes

Goto Definition (F12) Opens New Tab Despite Preopened Instance
#12

It is/was an issue in ST3 too, I posted about it 3 months ago and it’s comes up every now and then. Any road glad you’ve got a solution, I’m sure I’m gonna bump into this if I can get ST(4) working…

0 Likes

#13

Just popping in to say my above solution still works with the current ST4 build.

EDIT: Make sure to heed the advice of @OdatNurd below. The following steps might cause you problems later.

To make the process easy for others:

  1. command palette (ctrl+shift+p) > PackageResourceViewer: Extract Package > Default. Skip if you’ve done this already.
  2. command palette > PackageResourceViewer: Open Resource > Default > symbol.py & switch_file.py
  3. In symbol.py, replace all instances of flags = sublime.ENCODED_POSITION | sublime.FORCE_GROUP to flags = sublime.ENCODED_POSITION
  4. In switch_file.py change flags = sublime.FORCE_GROUP to flags = 0
0 Likes

#14

Under no circumstances should you ever extract the Default (or any) package; if you do that, you will lock its contents forever, stopping future upgrades to Sublime Text from being able to update it. This has rather disastrous effect, as seen in the posts linked below. All issues caused by locking the default key bindings into an old version so that newly updated key bindings required for core functionality suddenly don’t work.

If you’re going to use PackageResourceViewer to do this, do not ever choose Extract; choose the option to open a resource, open only the Default/symbol.py file, then make your change and save.

Even better, use OverrideAudit instead; it has a command to override a resource that works just like the Open Resource from PackageResourceViewer, and also has the ability to tell you when your override might be causing you problems so you can fix it.

2 Likes

#15

Thank you for the better way to do this! It feels like a perfect example of Cunningham’s Law :sweat_smile:

1 Like

#16

Haha; the method is sound, just that one aspect of execution is a bit hairy. I mean, they both work, but one of them has a higher than normal likelihood for a storm of angry users to protest when a future build stops working. :slight_smile:

0 Likes