sajalverma17 / GitBranchDiffer

A Visual Studio Extension that displays source files Added/Modified/Renamed between a base branch you choose to diff against, and the current working branch in your Git repo. The diffed files are shown in the Solution Explorer using a Solution Explorer Filter
MIT License
6 stars 1 forks source link

If Track Active Item in Solution Explorer is ON, GitBranchDiffer opens diff window even if user changes document #4

Closed sajalverma17 closed 3 years ago

sajalverma17 commented 3 years ago

Version Information :

Describe the bug Bug apprears when opening a file from Solution Explorer after the "Show diff in solution" filter was successfully applied on in. If user changes the document window in documents pane, and this triggers a change in solution explorer, branch diff window is opened.

To Reproduce Steps to reproduce the behavior:

  1. Options -> General -> Check "Track Active Item in Solution Explorer"
  2. Apply GitBranchDiff filter
  3. Change documents to another document which exists in filtered Solution Explorer
  4. This opens a the document, but also opens the comparison of the file with base branch, even if user did not click the item in Solution Explorer

Expected behavior GitBranchDiffer should only open a branch diff window if they are selecting a node in solution explorer. Any other changes should not result in this

sajalverma17 commented 3 years ago

This bug exists because we use the Selection Changed DTE events, and use them to see if anything selection was changed in solution explorer, and then open a comparison window.

Ideally, we should have used Document DTE events to open a comparison window. That is leads to another bug and I switched to selection changed events. We can not suppress VS from opening the document in regular view and force it to open comparison view when using Document Events. So I ended up with Selection Changed DTE event so a comparison window opens if user click an item in Solution Explorer.

This bug is a drawback of that approach and I may have to find a third approach that fixes both the bugs.

sajalverma17 commented 3 years ago

Fixed with #19