void IWpfTextViewCreationListener.TextViewCreated(IWpfTextView textView) { // Load the VimRC file if we haven't tried yet MaybeLoadVimRc(); // Create the IVimBuffer after loading the VimRc so that it gets the appropriate // settings var buffer = _vim.GetOrCreateBuffer(textView); Action doCheck = () => { // Run the key binding check now if (_keyBindingService.ConflictingKeyBindingState == ConflictingKeyBindingState.HasNotChecked) { if (Settings.Settings.Default.IgnoredConflictingKeyBinding) { _keyBindingService.IgnoreAnyConflicts(); } else { _keyBindingService.RunConflictingKeyBindingStateCheck(buffer, (x, y) => { }); } } }; Dispatcher.CurrentDispatcher.BeginInvoke(doCheck, null); }
private IVimBuffer CreateVimBuffer() { var list = EditorUtil.GetEditorCatalog(); list.Add(new AssemblyCatalog(typeof(Vim.IVim).Assembly)); list.Add(new AssemblyCatalog(typeof(Vim.UI.Wpf.KeyProcessor).Assembly)); list.Add(new AssemblyCatalog(typeof(VsVim.VsCommandTarget).Assembly)); list.Add(new TypeCatalog( typeof(VsVim.UnitTest.MemoryLeakTest.ServiceProvider), typeof(VsVim.UnitTest.MemoryLeakTest.VsEditorAdaptersFactoryService), typeof(VsVim.UnitTest.MemoryLeakTest.ErrorHandler))); var catalog = new AggregateCatalog(list.ToArray()); var container = new CompositionContainer(catalog); var factory = container.GetExport <ITextEditorFactoryService>().Value; var textView = factory.CreateTextView(); // Verify we actually created the IVimBuffer instance _vim = container.GetExport <IVim>().Value; var vimBuffer = _vim.GetOrCreateBuffer(textView); Assert.IsNotNull(vimBuffer); // Do one round of DoEvents since several services queue up actions to // take immediately after the IVimBuffer is created for (var i = 0; i < 10; i++) { Dispatcher.CurrentDispatcher.DoEvents(); } return(vimBuffer); }
public void GetOrCreateBuffer_CreateForNewView() { var textView = EditorUtil.CreateView(); var buffer = _vim.GetOrCreateBuffer(textView); Assert.AreSame(textView, buffer.TextView); }
private IVimBuffer CreateVimBuffer() { var list = EditorUtil.GetEditorCatalog(); list.Add(new AssemblyCatalog(typeof(Vim.IVim).Assembly)); list.Add(new AssemblyCatalog(typeof(Vim.UI.Wpf.KeyProcessor).Assembly)); list.Add(new AssemblyCatalog(typeof(VsVim.VsCommandTarget).Assembly)); list.Add(new TypeCatalog( typeof(VsVim.UnitTest.MemoryLeakTest.ServiceProvider), typeof(VsVim.UnitTest.MemoryLeakTest.VsEditorAdaptersFactoryService), typeof(VsVim.UnitTest.MemoryLeakTest.ErrorHandler))); var catalog = new AggregateCatalog(list.ToArray()); var container = new CompositionContainer(catalog); var factory = container.GetExport<ITextEditorFactoryService>().Value; var textView = factory.CreateTextView(); // Verify we actually created the IVimBuffer instance _vim = container.GetExport<IVim>().Value; var vimBuffer = _vim.GetOrCreateBuffer(textView); Assert.IsNotNull(vimBuffer); // Do one round of DoEvents since several services queue up actions to // take immediately after the IVimBuffer is created for (var i = 0; i < 10; i++) { Dispatcher.CurrentDispatcher.DoEvents(); } return vimBuffer; }
public IWpfTextViewMargin CreateMargin(IWpfTextViewHost wpfTextViewHost, IWpfTextViewMargin marginContainer) { var buffer = _vim.GetOrCreateBuffer(wpfTextViewHost.TextView); return(new CommandMargin(buffer, _optionsProviderFactories)); }
public KeyProcessor GetAssociatedProcessor(IWpfTextView wpfTextView) { var buffer = _vim.GetOrCreateBuffer(wpfTextView); return(new VsKeyProcessor(_adapter, buffer)); }