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?
Open reference in active column
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.
Yeah, sorry I not specified and have mistakes with terms.
For example:
- I set layout with 2 columns (shift+alt+2),
- First column contains some interested code, second - plain,
- I activate second column: click by cursor,
- Move cursor to some method of the first column,
- 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.
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?
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.
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?
I assume changing the value of the select_across_groups
preference doesn’t help?
Correct. I tried toggling the value for this setting as it seems related but it had no effect.
@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:
Just my 2 cents, but given all the discussion around this it seems like it should exist as a setting.
Goto Definition (F12) Opens New Tab Despite Preopened Instance
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…
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:
- command palette (ctrl+shift+p) > PackageResourceViewer: Extract Package > Default. Skip if you’ve done this already.
- command palette > PackageResourceViewer: Open Resource > Default > symbol.py & switch_file.py
- In
symbol.py
, replace all instances offlags = sublime.ENCODED_POSITION | sublime.FORCE_GROUP
toflags = sublime.ENCODED_POSITION
- In
switch_file.py
changeflags = sublime.FORCE_GROUP
toflags = 0
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.
Thank you for the better way to do this! It feels like a perfect example of Cunningham’s Law
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.
(Posting in a couple of relevant threads, hopefully the moderators will excuse me.)
Been suffering this for a long while, but thanks to LSP plugin and your threads guys (i.e. the knowledge that it’s sublime.FORCE_GROUP that’s causing the undesirable behavior), turns out LSP already has an option to neutralize it:
{ "keys": ["super+b"], "command": "lsp_symbol_definition", "args": {"side_by_side": false, "force_group": false} },
{ "keys": ["super+shift+b"], "command": "lsp_symbol_type_definition", "args": {"side_by_side": false, "force_group": false} },
Pure. Happiness.
Sharing in case you also prefer to switch to LSP and forget this disaster.
Is there still not an option in Sublime Text 4 to globally set the force_group to false??
I’ve been waiting for years on this, what is the deal!
With the current behavior I end up with duplicate open files everywhere.