GitDiffMargin icon indicating copy to clipboard operation
GitDiffMargin copied to clipboard

Next/Previous function in tool bar and assigned to hot keys don't work

Open MartinL0815 opened this issue 3 years ago • 22 comments

Versions

  • Git Diff Margin version: 3.12.1
  • Visual Studio version: VS2019 16.11.5, VS2022 17.0.3

What happened

After activating the extensions tool bar I can't use the next/previous buttons, they don't have an effect, don't move the caret.

BTW: the Git Diff Margin tool bar cannot be activated from a right click on a tool bar, instead I need to open the customize dialog.

Using the assigned hot keys don't work, too.

Clicking onto a change in the margin, the next/previous buttons in the floating tool bar work perfectly!

Steps to Reproduce

Steps to reproduce the behavior:

  1. Open a file with changes in comparison to the original file in git
  2. Enable the Git Diff margin toolbar
  3. Click onto the next or previous change tool bar buttons
  4. nothing happens

Expected behavior

I expected, that the changes in the current file are navigated by the tool bar buttons or the assigned hot keys.

MartinL0815 avatar Jan 06 '22 12:01 MartinL0815

Thanks for taking the time to report this @MartinL0815

The next/previous toolbar buttons are working for me.

devenv_x9Lsp7rq5O

Using the assigned hot keys don't work, too.

I can reproduce the issue on VS2022 17.0.2 and 17.0.5, trying with different shortcut keys!

laurentkempe avatar Jan 15 '22 08:01 laurentkempe

Thanks @laurentkempe for your response!

Strange the next/previous buttons in the tool bar work for you.

First, the tool bar isn't available using the context menu of the tool bars. I need to open the customize dialog to make the tool bar visible. But all buttons are inactive of disabled!

Since the hot keys don't work too, this ew would match.

But if the tool bar buttons work for you, the situation would be not that easy.

Again - the buttons in the floating tool bar related to a specific change work without problems!

MartinL0815 avatar Jan 15 '22 09:01 MartinL0815

I am confused, could you add a screenshot of what you are taking about so that I am sure, thanks

laurentkempe avatar Jan 15 '22 09:01 laurentkempe

For sure, but earliest on Monday. So happy weekend!

MartinL0815 avatar Jan 15 '22 10:01 MartinL0815

Hi @laurentkempe,

Here some screenshoots:

  1. I try to activate the Git Diff Margin tool bar from the context menu of the tool bars, but the Git Diff Margin entry is missing: tool bars context menu
  2. Then I open the customize dialog and find the Git Diff Margin tool bar entry here to activate it: customize dialog
  3. After activating the tool bar it is visible, but all buttons are disabled: Git Diff Margin tool bar

Does this helps a bit?

I'd have expected, that the tool bar is accessible from the context menu and that the buttons on the tool bar are working, especially in a file with changes.

MartinL0815 avatar Jan 17 '22 13:01 MartinL0815

Hi @MartinL0815

Screenshots always help 👍🏼 I will to check but I am not sure the scenario is supported! What does happen when you click on the margin diff, like I show on

devenv_x9Lsp7rq5O

laurentkempe avatar Jan 17 '22 21:01 laurentkempe

Good morning @laurentkempe,

The margin works like expected.

Clicking on a change pops-up the floating toolbar, which provides the expected functionality.

MartinL0815 avatar Jan 18 '22 06:01 MartinL0815

Hey @MartinL0815

Yeah, I see it like you not working. I never considered using it like that. First, I mostly don't use the mouse, so I don't want to move my mouse that far from the context of something I want to see. What would be better would be that you cannot activate that toolbar, which created some confusion to you apparently.

laurentkempe avatar Jan 21 '22 21:01 laurentkempe

Sorry, I'm not sure if I understand.

The hotkeys don't work, which is annoying working on the ViM mode (VsVim).

So I tried to use the toolbar … with the mouse … unlikely. But the toolbar seems to be inactive, like there are no changes in the file i want to go through.

I don't understand where the confusion should come from. Why should the toolbar not work if a file is open with changes in?

MartinL0815 avatar Jan 21 '22 22:01 MartinL0815

I can confirm this issue (also with VS 2019 and VS 2022):

  • Shortcuts do not work
  • Toolbar does not work
  • Buttons in the margin diffs work, though

I would love if the shortcuts would work. I'm also using VsVim and easily navigating to hunks makes a huge difference :smiley:

ybc37 avatar Feb 01 '22 16:02 ybc37

I don't understand where the confusion should come from. Why should the toolbar not work if a file is open with changes in?

The confusion was on my side, I never thought of using the toolbar like you try to do! To me Git Diff Margin, is all about the margin, so using it from there or shortcuts. You are right @MartinL0815 if a user can display the toolbar, then it should just work from there too.

laurentkempe avatar Feb 03 '22 05:02 laurentkempe

I would love if the shortcuts would work. I'm also using VsVim and easily navigating to hunks makes a huge difference 😃

Thx for the confirmation @ybc37 It seems that one the latest updates of Visual Studio broke it. I would love to have more time that I could invest on it, but at the moment I cannot.

laurentkempe avatar Feb 03 '22 05:02 laurentkempe

I just found out about this extension and was hoping it could replace my external TortoiseGitMerge usage. The way I optimize my usage on there is through hotkeys for Prev/Next Diff, as well as reverting (basically quickly cherry-picking lines/changes), which unfortunately due to this bug is currently not possible.

I have noticed however that after opening "Show Difference" in the margin popup, I am able to use VS's Diff.NextDifference shortcuts. Although there doesn't seem to be a shortcut for Rollback.

It'd be nice to have a shortcut to bring up that diff, as well as for rollback. Maybe the former already exists from VS, but I couldn't find it. Alternatively... there's probably a way to invoke an external diff tool with a hotkey somehow?

Cleroth avatar Feb 17 '22 14:02 Cleroth

It seems that Microsoft will finally provide the same capabilities directly in Visual Studio

laurentkempe avatar Feb 18 '22 12:02 laurentkempe

Thanks @Cleroth for the feedback

It'd be nice to have a shortcut to bring up that diff, as well as for rollback. True, this is something I was used to doing by showing the popup with the hotkey, then tab tab and enter to rollback

image

But that shortcut doesn't work anymore neither, it seems that something changed in some of the latest versions of Visual Studio which breaks all the shortcuts.

laurentkempe avatar Feb 18 '22 12:02 laurentkempe

It seems that Microsoft will finally provide the same capabilities directly in Visual Studio

That's nice. Unfortunately I had to uninstall the extension as the editor became super sluggish after erasing some blocks of code. Maybe there's some conflict with Resharper or something. Hopefully the VS version won't have such performance problems.

After countless searches on how to use your own diff tool in VS, I just had to figure it out myself, which is actually really simple:

Tools -> External Tools -> Add Command: C:\Program Files\TortoiseGit\bin\TortoiseGitProc.exe Arguments: /command:diff /path:"$(ItemPath)" Setup hotkey with shortcut Tools.ExternalCommand# (I used Ctrl + D)

Not as good as having it in VS, but it works nicely for me, and can be possibly be adapted to any diff tool (likely the hard part is getting a file of the previous commit--luckily tortoisegit can do this).

Cleroth avatar Feb 18 '22 13:02 Cleroth

That's nice. Unfortunately I had to uninstall the extension as the editor became super sluggish after erasing some blocks of code. Maybe there's some conflict with Resharper or something. Hopefully the VS version won't have such performance problems.

😢 Was the file big @Cleroth? I never realized such things myself, but maybe because I don't have huge files and yes, it is possible that there is a conflict with ReSharper. After removing it, did the problem disappear?

After countless searches on how to use your own diff tool in VS, I just had to figure it out myself, which is actually really simple:

One of the features of GitDiffMargin was to let you double click on the margin to open the diff tool, if I remember it should open the diff tool configurer in your .gitconfig, but not sure anymore. I would need to look at the code.

I have been using Rider and not much VS lately. The diff tool in Rider is fantastic, I even stopped using SemanticMerge to resolve conflicts and use the one in Rider.

laurentkempe avatar Feb 18 '22 15:02 laurentkempe

It's a 11k loc file, so I suppose relatively big. The problem disappeared when I disabled GitDiffMargin. I tested 2 or 3 times. I did not try without Resharper.

I did like Rider when I tried it. Performance is great. Unfortunately the lack of ability to combine .cpp and .h into one tab (through TabsStudio extension in VS) is a showstopper for me. (I've made a suggestion). That and the scrollbar doesn't work like VS's map mode.

Cleroth avatar Feb 18 '22 17:02 Cleroth

It's a 11k loc file, so I suppose relatively big.

😵‍💫 Definitely!

The problem disappeared when I disabled GitDiffMargin. I tested 2 or 3 times. I did not try without Resharper.

I can imagine it comes from GitDiffMargin

laurentkempe avatar Feb 18 '22 22:02 laurentkempe

Confirmed under Visual Studio 2022 17.1.0

LuckyTil avatar Feb 19 '22 15:02 LuckyTil

I'd like to move to next change using keyboard shortcut, not let side menu nor tool bar. Below doesnt work to me.

How this can be done ?

obraz

maciey avatar Aug 29 '22 16:08 maciey

Hi,

After trying a bit the new features about the the (in)line diff & Co.

I'd like to get GitDiffMargin back, working, with keyboard shortcuts to step through and open a simple diff, not that complicated on provided by VS2022.

If there is a chance to fix the problems, please do it!

Best regards

Martin

MartinL0815 avatar Aug 29 '22 18:08 MartinL0815