Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
MartinL0815 opened this issue Jan 6, 2022 · 22 comments
Open
Labels

Comments

@MartinL0815
Copy link

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 MartinL0815 added the bug label Jan 6, 2022
@laurentkempe
Copy link
Owner

laurentkempe commented Jan 15, 2022

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!

@MartinL0815
Copy link
Author

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!

@laurentkempe
Copy link
Owner

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

@MartinL0815
Copy link
Author

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

@MartinL0815
Copy link
Author

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.

@laurentkempe
Copy link
Owner

laurentkempe commented Jan 17, 2022

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

@MartinL0815
Copy link
Author

MartinL0815 commented Jan 18, 2022

Good morning @laurentkempe,

The margin works like expected.

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

@laurentkempe
Copy link
Owner

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.

@MartinL0815
Copy link
Author

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?

@ybc37
Copy link

ybc37 commented Feb 1, 2022

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 😃

@laurentkempe
Copy link
Owner

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
Copy link
Owner

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.

@Cleroth
Copy link

Cleroth commented Feb 17, 2022

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?

@laurentkempe
Copy link
Owner

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

@laurentkempe
Copy link
Owner

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.

@Cleroth
Copy link

Cleroth commented Feb 18, 2022

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).

@laurentkempe
Copy link
Owner

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.

@Cleroth
Copy link

Cleroth commented Feb 18, 2022

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.

@laurentkempe
Copy link
Owner

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

@LuckyTil
Copy link

LuckyTil commented Feb 19, 2022

Confirmed under Visual Studio 2022 17.1.0

@maciey
Copy link

maciey commented Aug 29, 2022

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

@MartinL0815
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants