void IWpfTextViewCreationListener.TextViewCreated(IWpfTextView textView) { // Create the IVimBuffer after loading the VimRc so that it gets the appropriate // settings var opt = _vim.GetOrCreateVimBufferForHost(textView); if (opt.IsNone()) { return; } var vimBuffer = opt.Value; // Visual Studio really puts us in a bind with respect to setting synchronization. It doesn't // have a prescribed time to apply it's own customized settings and in fact differs between // versions (2010 after TextViewCreated and 2012 is before). If we start synchronizing // before Visual Studio settings take affect then they will just overwrite the Vim settings. // // We need to pick a point where VS is done with settings. Then we can start synchronization // and change the settings to what we want them to be. // // In most cases we can just wait until IVsTextViewCreationListener.VsTextViewCreated fires // because that happens after language preferences have taken affect. Unfortunately this won't // fire for ever IWpfTextView. If the IWpfTextView doesn't have any shims it won't fire. So // we post a simple action as a backup mechanism to catch this case. _toSyncSet.Add(vimBuffer); _protectedOperations.BeginInvoke(() => BeginSettingSynchronization(vimBuffer), DispatcherPriority.Loaded); }
KeyProcessor IKeyProcessorProvider.GetAssociatedProcessor(IWpfTextView wpfTextView) { var opt = _vim.GetOrCreateVimBufferForHost(wpfTextView); if (opt.IsNone()) { return(null); } var vimBuffer = opt.Value; var vimBufferCoordinator = _bufferCoordinatorFactory.GetVimBufferCoordinator(vimBuffer); return(new VsKeyProcessor(_adapter, vimBufferCoordinator, _keyUtil)); }
KeyProcessor IKeyProcessorProvider.GetAssociatedProcessor(IWpfTextView wpfTextView) { if (!_isVisualAssistInstalled) { return(null); } var opt = _vim.GetOrCreateVimBufferForHost(wpfTextView); if (opt.IsNone()) { return(null); } return(new VisualAssistKeyProcessor(opt.Value)); }