Skip to content

Light up "modern command handling" in Visual Studio 2017 version 15.6+ #161

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

Merged
merged 3 commits into from
Aug 3, 2018

Conversation

sharwell
Copy link
Collaborator

@sharwell sharwell commented Jun 12, 2018

  • Extract VSIX packaging to a separate project GitDiffMargin.Extension
  • Add a project GitDiffMargin.LegacyCommands, which uses the current TextViewCommandFilter to implement commands for all versions prior to Visual Studio 2017 version 15.6
  • Add a project GitDiffMargin.Commands, which uses the new ICommandHandler interface to implement commands in Visual Studio 2017 version 15.6 and later

This change should address the "Gold Bar" notification saying Git Diff Margin was responsible for editor slowness. When using chained command filters, the slowness detection doesn't know how to assign blame to a specific item in the chain, so Git Diff Margin can be blamed for cases where it's doing nothing but passing the command along the chain. The new code uses a declarative approach to handle specific commands, and is no longer part of the handling process for unrelated editor commands.

The code is based loosely on the Visual Studio 2017 backwards compatible editor command sample, but continues to use the IOleCommandTarget implementation for both old and new command handling approaches.

@olegtk I'm not sure y'all meant to make it this difficult to work with the new API, but if we have to multiply the number of assemblies by 4 every time we want to support a new editor feature this is going to get out of hand really fast. Please make sure that future APIs are designed from the perspective of users who are supporting earlier clients by default, with clients only supporting new APIs being the outlier not the standard.

@laurentkempe
Copy link
Owner

laurentkempe commented Jun 30, 2018

@sharwell I have set as StartUp Project GitDiffMargin.Extension and when I run it I get the following exception in the new VS instance

System.IO.FileNotFoundException: Could not load file or assembly 'GalaSoft.MvvmLight, Version=5.2.0.37222, Culture=neutral, PublicKeyToken=e7570ab207bcb616' or one of its dependencies. The system cannot find the file specified. File name: 'GalaSoft.MvvmLight, Version=5.2.0.37222, Culture=neutral, PublicKeyToken=e7570ab207bcb616' at GitDiffMargin.GitDiffMarginCommandHandler.QueryCommandStatus(Guid& commandGroup, UInt32 commandId, OleCommandText oleCommandText) at Tvl.VisualStudio.Shell.CommandFilter.Microsoft.VisualStudio.OLE.Interop.IOleCommandTarget.QueryStatus(Guid& guidCmdGroup, UInt32 cCmds, OLECMD[] prgCmds, IntPtr pCmdText) at Microsoft.VisualStudio.Editor.Implementation.CommandChainNode.InnerQueryStatus(Guid& pguidCmdGroup, UInt32 cCmds, OLECMD[] prgCmds, IntPtr pCmdText) at Microsoft.VisualStudio.Editor.Implementation.VsMouseProcessor.HandleClick(MouseButtonEventArgs e) at Microsoft.VisualStudio.Editor.Implementation.VsMouseProcessor.PostprocessMouseLeftButtonUp(MouseButtonEventArgs e) at Microsoft.VisualStudio.Text.Utilities.WpfMouseProcessor.<>c__DisplayClass38_2.<UIElement_MouseLeftButtonUp>b__1() at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.CallExtensionPoint(Object errorSource, Action call) --- End of stack trace from previous location where exception was thrown --- at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject) WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

I also see that the vsix miss quite some dlls like LibGit2Sharp, MvvmLight...

sharwell added 2 commits July 27, 2018 21:38
This change adds a new project, GitDiffMargin.Extension, which is responsible for creating
the VSIX output. The refactoring is a supporting change for future work which provides
improved support for APIs only available in later versions of Visual Studio without
breaking support for Visual Studio 2012+ users.
@sharwell
Copy link
Collaborator Author

sharwell commented Jul 28, 2018

@laurentkempe The previous AppVeyor build for this pull request contained the correct set of binaries. I rebased on master to fix the merge conflict and will review the AppVeyor output to confirm that it still contains the expected binaries.

@sharwell
Copy link
Collaborator Author

I compared the builds to the latest master branch build and found the following items missing:

  • GalaSoft.MvvmLight.Extras.dll
  • GalaSoft.MvvmLight.Platform.dll
  • LICENSE.md
  • Microsoft.Practices.ServiceLocation.dll
  • System.Windows.Interactivity.dll

I'll review the build to figure out why these aren't getting included correctly and update the pull request to fix it.

* GitDiffMargin.csproj items are included by CopyToOutputDirectory rather than IncludeInVSIX
* MvvmLightLibs is no longer treated as a development dependency
@sharwell
Copy link
Collaborator Author

@laurentkempe Alright the latest should include the correct outputs. Sorry for the confusion!

@laurentkempe
Copy link
Owner

No worries @sharwell I will have a look at it asap

@laurentkempe laurentkempe merged commit 5099c56 into laurentkempe:master Aug 3, 2018
@sharwell sharwell deleted the new-commanding branch August 10, 2018 12:09
@justcla
Copy link

justcla commented Aug 14, 2018

Nice. :-)
Thanks guys.

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

Successfully merging this pull request may close these issues.

3 participants