コード例 #1
0
ファイル: HostFactory.cs プロジェクト: bentayloruk/VsVim
        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);
        }
コード例 #2
0
ファイル: MemoryLeakTest.cs プロジェクト: bentayloruk/VsVim
        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);
        }
コード例 #3
0
        public void GetOrCreateBuffer_CreateForNewView()
        {
            var textView = EditorUtil.CreateView();
            var buffer   = _vim.GetOrCreateBuffer(textView);

            Assert.AreSame(textView, buffer.TextView);
        }
コード例 #4
0
ファイル: MemoryLeakTest.cs プロジェクト: junkshow/VsVim
        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;
        }
コード例 #5
0
        public IWpfTextViewMargin CreateMargin(IWpfTextViewHost wpfTextViewHost, IWpfTextViewMargin marginContainer)
        {
            var buffer = _vim.GetOrCreateBuffer(wpfTextViewHost.TextView);

            return(new CommandMargin(buffer, _optionsProviderFactories));
        }
コード例 #6
0
        public KeyProcessor GetAssociatedProcessor(IWpfTextView wpfTextView)
        {
            var buffer = _vim.GetOrCreateBuffer(wpfTextView);

            return(new VsKeyProcessor(_adapter, buffer));
        }