private CommandKeyBindingSnapshot GetCommandKeyBindingSnapshot(IVim vim, IKeyBindingService keyBindingService) { var textView = vim.VimHost.CreateHiddenTextView(); try { var vimBuffer = vim.CreateVimBuffer(textView); return keyBindingService.CreateCommandKeyBindingSnapshot(vimBuffer); } finally { textView.Close(); } }
public void ShowDialog(IVimBuffer vimBuffer) { try { var snapshot = _keyBindingService.CreateCommandKeyBindingSnapshot(vimBuffer); new ConflictingKeyBindingDialog(snapshot, _vimApplicationSettings, _protectedOperations).ShowDialog(); } catch (Exception) { // When dogfooding VsVim there is a bug in Visual Studio which causes the // VsVim DLL to be loaded twice (once for VsVim and once for the Settings // and associated designers). This causes WPF to error when loading the dialog // resources and an unhandled exception occurs. VsShellUtilities.ShowMessageBox( _serviceProvider, "Error displaying options page", "Error", OLEMSGICON.OLEMSGICON_WARNING, OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST); } }