oni icon indicating copy to clipboard operation
oni copied to clipboard

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

Open marene opened this issue 8 years ago • 8 comments

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'

marene avatar May 31 '18 13:05 marene

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.

oni-bot avatar May 31 '18 13:05 oni-bot

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.

CrossR avatar May 31 '18 14:05 CrossR

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

marene avatar May 31 '18 16:05 marene

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 [email protected] 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 .

TalAmuyal avatar Jun 01 '18 06:06 TalAmuyal

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

marene avatar Jun 04 '18 15:06 marene

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

badosu avatar Aug 20 '18 12:08 badosu

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, and ExistingTab`. 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

psxpaul avatar Aug 20 '18 17:08 psxpaul

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

akinsho avatar Aug 23 '18 10:08 akinsho