Oni: <f12> opens in current tab, but it seems like it should not

Created on 31 May 2018  Â·  8Comments  Â·  Source: onivim/oni

Oni Version: 0.3.4
Neovim Version (Linux only): 0.2.3-843-gf5b0f5e
Operating System: Ubuntu 16.04.3 LTS

Describe your issue

When hitting f12 while the cursor is on a symbol, it goes to that symbol's definition, but in the same tab as the one currently being opened.

Expected behaviour

This was bugging me (because i felt like it should have been going to those definitions in a new tab, much more practical imo), so i had a little peek in the code, and found this: https://github.com/onivim/oni/blob/master/browser/src/Editor/NeovimEditor/Definition.ts#L53
Based on the Enum definition here: https://github.com/onivim/oni/blob/master/browser/src/Editor/NeovimEditor/Definition.ts#L13, it looks like f12 should be opening in a new tab, but is not.

Steps to reproduce

Get your cursor over a symbol usage, then hit f12

Proposed solution

I feel like solving this might be quite easy: just change this line (https://github.com/onivim/oni/blob/master/browser/src/Editor/NeovimEditor/Definition.ts#L59-L60) to:

default:
  return 'tabe'

Most helpful comment

Yes, @badosu this should be fixed with my change. The default language.gotoDefinition command should use Oni.DefaultFileOpenOptions to determine where to open. You can change this by adding to your config.tsx:

Oni.DefaultFileOpenOptions.openMode = Oni.FileOpenMode.NewTab

The valid values are Edit,NewTab,VerticalSplit,HorizontalSplit, andExistingTab`. My change also adds the following commands, which should behave as you expect (equivalent horizontal and vertical commands already exist):

  • language.gotoDefinition.openNewTab
  • language.gotoDefinition.openEdit
  • language.gotoDefinition.openExistingTab

All 8 comments

Hello and welcome to the Oni repository! Thanks for opening your first issue here. To help us out, please make sure to include as much detail as possible - including screenshots and logs, if possible.

Makes sense to me! I've hit this before as well.

I feel like solving this might be quite easy: just change this line (https://github.com/onivim/oni/blob/master/browser/src/Editor/NeovimEditor/Definition.ts#L59-L60) to:

I think that would fix it for people who are using vim style tabs, but would potentally be awkward for people who use buffers option for their tabs. (That is every open buffer has its own tab).

We'd instead probably want to use this function : https://github.com/onivim/oni/blob/a34e1d64ecf529f2d31f5f0bbb9cc33c4d19980e/browser/src/Editor/NeovimEditor/NeovimEditor.tsx#L882-L905

Since it deals with that for us and does tabs for most users, and buffers for those who don't.

Good point.
I did try to test it out, but had some troubles making my build work, I'll give it a fair shot when I'm not at work

Actually, I like the current behavior - so will you mind, putting this
change under a togglable config?

On Thu, May 31, 2018, 19:58 Matthieu ARENE notifications@github.com wrote:

Good point.
I did try to test it out, but had some troubles making my build work, I'll
give it a fair shot when I'm not at work

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/onivim/oni/issues/2272#issuecomment-393601253, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AE3Ijd-0RAmK9ME4EYjUa03hnVkGu7Qhks5t4CFQgaJpZM4UVE6f
.

If i ever get time to change that, I'll make sure to make it togglable, yes :)

@psxpaul Does #2504 fix this? If so, how would one configure it?

Yes, @badosu this should be fixed with my change. The default language.gotoDefinition command should use Oni.DefaultFileOpenOptions to determine where to open. You can change this by adding to your config.tsx:

Oni.DefaultFileOpenOptions.openMode = Oni.FileOpenMode.NewTab

The valid values are Edit,NewTab,VerticalSplit,HorizontalSplit, andExistingTab`. My change also adds the following commands, which should behave as you expect (equivalent horizontal and vertical commands already exist):

  • language.gotoDefinition.openNewTab
  • language.gotoDefinition.openEdit
  • language.gotoDefinition.openExistingTab

Going to close this now since @psxpaul's PR was merged please feel free to reopen it if it doesn't quite solve the problem

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bryphe picture bryphe  Â·  29Comments

Melkor333 picture Melkor333  Â·  23Comments

bryphe picture bryphe  Â·  22Comments

hkupty picture hkupty  Â·  27Comments

keforbes picture keforbes  Â·  19Comments