コード例 #1
0
ファイル: HostFactory.cs プロジェクト: louisfeng/VsVim
        public HostFactory(
            IVim vim,
            IVsEditorAdaptersFactoryService adaptersFactory,
            IDisplayWindowBrokerFactoryService displayWindowBrokerFactoryService,
            ITextManager textManager,
            IVsAdapter adapter,
            IVimProtectedOperations protectedOperations,
            IVimBufferCoordinatorFactory bufferCoordinatorFactory,
            IKeyUtil keyUtil,
            IEditorToSettingsSynchronizer editorToSettingSynchronizer,
            [ImportMany] IEnumerable<Lazy<ICommandTargetFactory, IOrderable>> commandTargetFactoryList)
        {
            _vim = vim;
            _displayWindowBrokerFactoryServcie = displayWindowBrokerFactoryService;
            _adaptersFactory = adaptersFactory;
            _textManager = textManager;
            _adapter = adapter;
            _protectedOperations = protectedOperations;
            _bufferCoordinatorFactory = bufferCoordinatorFactory;
            _keyUtil = keyUtil;
            _editorToSettingSynchronizer = editorToSettingSynchronizer;
            _commandTargetFactoryList = Orderer.Order(commandTargetFactoryList).Select(x => x.Value).ToReadOnlyCollection();

            #if DEBUG
            VimTrace.TraceSwitch.Level = TraceLevel.Info;
            #endif
        }
コード例 #2
0
 internal VsKeyProcessorProvider(IVim vim, IVsAdapter adapter, IVimBufferCoordinatorFactory bufferCoordinatorFactory, IKeyUtil keyUtil)
 {
     _vim     = vim;
     _adapter = adapter;
     _bufferCoordinatorFactory = bufferCoordinatorFactory;
     _keyUtil = keyUtil;
 }
コード例 #3
0
ファイル: VimTestBase.cs プロジェクト: oraclechang/VsVim
        protected VimTestBase()
        {
            _vim = CompositionContainer.GetExportedValue <IVim>();
            _vimBufferFactory        = CompositionContainer.GetExportedValue <IVimBufferFactory>();
            _vimErrorDetector        = CompositionContainer.GetExportedValue <IVimErrorDetector>();
            _commonOperationsFactory = CompositionContainer.GetExportedValue <ICommonOperationsFactory>();
            _wordUtilFactory         = CompositionContainer.GetExportedValue <IWordUtilFactory>();
            _bufferTrackingService   = CompositionContainer.GetExportedValue <IBufferTrackingService>();
            _foldManagerFactory      = CompositionContainer.GetExportedValue <IFoldManagerFactory>();
            _bulkOperations          = CompositionContainer.GetExportedValue <IBulkOperations>();
            _clipboardDevice         = CompositionContainer.GetExportedValue <IClipboardDevice>();
            _keyUtil = CompositionContainer.GetExportedValue <IKeyUtil>();

            _clipboardDevice.Text = String.Empty;

            // One setting we do differ on for a default is 'timeout'.  We don't want them interferring
            // with the reliability of tests.  The default is on but turn it off here to prevent any
            // problems
            _vim.GlobalSettings.Timeout = false;

            // Don't let the personal VimRc of the user interfere with the unit tests
            _vim.AutoLoadVimRc = false;

            // Don't show trace information in the unit tests.  It really clutters the output in an
            // xUnit run
            VimTrace.TraceSwitch.Level = TraceLevel.Off;
        }
コード例 #4
0
ファイル: HostFactory.cs プロジェクト: renjiec/VsVim
        public HostFactory(
            IVim vim,
            IVsEditorAdaptersFactoryService adaptersFactory,
            IResharperUtil resharperUtil,
            IDisplayWindowBrokerFactoryService displayWindowBrokerFactoryService,
            ITextManager textManager,
            IVsAdapter adapter,
            [EditorUtilsImport] IProtectedOperations protectedOperations,
            IVimBufferCoordinatorFactory bufferCoordinatorFactory,
            IKeyUtil keyUtil,
            IEditorToSettingsSynchronizer editorToSettingSynchronizer)
        {
            _vim           = vim;
            _resharperUtil = resharperUtil;
            _displayWindowBrokerFactoryServcie = displayWindowBrokerFactoryService;
            _adaptersFactory             = adaptersFactory;
            _textManager                 = textManager;
            _adapter                     = adapter;
            _protectedOperations         = protectedOperations;
            _bufferCoordinatorFactory    = bufferCoordinatorFactory;
            _keyUtil                     = keyUtil;
            _editorToSettingSynchronizer = editorToSettingSynchronizer;

#if DEBUG
            VimTrace.TraceSwitch.Level = TraceLevel.Info;
#endif
        }
コード例 #5
0
        public HostFactory(
            IVim vim,
            IVsEditorAdaptersFactoryService adaptersFactory,
            IDisplayWindowBrokerFactoryService displayWindowBrokerFactoryService,
            ITextManager textManager,
            IVsAdapter adapter,
            IVimProtectedOperations protectedOperations,
            IVimBufferCoordinatorFactory bufferCoordinatorFactory,
            IKeyUtil keyUtil,
            IEditorToSettingsSynchronizer editorToSettingSynchronizer,
            [ImportMany] IEnumerable <Lazy <ICommandTargetFactory, IOrderable> > commandTargetFactoryList)
        {
            _vim = vim;
            _displayWindowBrokerFactoryServcie = displayWindowBrokerFactoryService;
            _adaptersFactory             = adaptersFactory;
            _textManager                 = textManager;
            _adapter                     = adapter;
            _protectedOperations         = protectedOperations;
            _bufferCoordinatorFactory    = bufferCoordinatorFactory;
            _keyUtil                     = keyUtil;
            _editorToSettingSynchronizer = editorToSettingSynchronizer;
            _commandTargetFactoryList    = Orderer.Order(commandTargetFactoryList).Select(x => x.Value).ToReadOnlyCollection();

#if DEBUG
            VimTrace.TraceSwitch.Level = TraceLevel.Info;
#endif
        }
コード例 #6
0
ファイル: VimTestBase.cs プロジェクト: cloudstrifegit/VsVim
        protected VimTestBase()
        {
            _vim = CompositionContainer.GetExportedValue<IVim>();
            _vimBufferFactory = CompositionContainer.GetExportedValue<IVimBufferFactory>();
            _vimErrorDetector = CompositionContainer.GetExportedValue<IVimErrorDetector>();
            _commonOperationsFactory = CompositionContainer.GetExportedValue<ICommonOperationsFactory>();
            _wordUtilFactory = CompositionContainer.GetExportedValue<IWordUtilFactory>();
            _bufferTrackingService = CompositionContainer.GetExportedValue<IBufferTrackingService>();
            _foldManagerFactory = CompositionContainer.GetExportedValue<IFoldManagerFactory>();
            _bulkOperations = CompositionContainer.GetExportedValue<IBulkOperations>();
            _clipboardDevice = CompositionContainer.GetExportedValue<IClipboardDevice>();
            _keyUtil = CompositionContainer.GetExportedValue<IKeyUtil>();

            _clipboardDevice.Text = String.Empty;

            // One setting we do differ on for a default is 'timeout'.  We don't want them interferring
            // with the reliability of tests.  The default is on but turn it off here to prevent any
            // problems
            _vim.GlobalSettings.Timeout = false;

            // Don't let the personal VimRc of the user interfere with the unit tests
            _vim.AutoLoadVimRc = false;

            // Don't show trace information in the unit tests.  It really clutters the output in an
            // xUnit run
            VimTrace.TraceSwitch.Level = TraceLevel.Off;
        }
コード例 #7
0
ファイル: HostFactory.cs プロジェクト: 0-F/VsVim
        public HostFactory(
            IVim vim,
            IVsEditorAdaptersFactoryService adaptersFactory,
            IReSharperUtil resharperUtil,
            IDisplayWindowBrokerFactoryService displayWindowBrokerFactoryService,
            ITextManager textManager,
            IVsAdapter adapter,
            IVimProtectedOperations protectedOperations,
            IVimBufferCoordinatorFactory bufferCoordinatorFactory,
            IKeyUtil keyUtil,
            IEditorToSettingsSynchronizer editorToSettingSynchronizer)
        {
            _vim = vim;
            _resharperUtil = resharperUtil;
            _displayWindowBrokerFactoryServcie = displayWindowBrokerFactoryService;
            _adaptersFactory = adaptersFactory;
            _textManager = textManager;
            _adapter = adapter;
            _protectedOperations = protectedOperations;
            _bufferCoordinatorFactory = bufferCoordinatorFactory;
            _keyUtil = keyUtil;
            _editorToSettingSynchronizer = editorToSettingSynchronizer;

            #if DEBUG
            VimTrace.TraceSwitch.Level = TraceLevel.Info;
            #endif
        }
コード例 #8
0
        internal static Result <VsCommandTarget> Create(
            IVimBufferCoordinator vimBufferCoordinator,
            IVsTextView vsTextView,
            ITextManager textManager,
            IVsAdapter adapter,
            IDisplayWindowBroker broker,
            IKeyUtil keyUtil,
            IVimApplicationSettings vimApplicationSettings,
            ReadOnlyCollection <ICommandTargetFactory> commandTargetFactoryList)
        {
            var vsCommandTarget = new VsCommandTarget(vimBufferCoordinator, textManager, adapter, broker, keyUtil, vimApplicationSettings);

            var hresult = vsTextView.AddCommandFilter(vsCommandTarget, out IOleCommandTarget nextCommandTarget);

            if (ErrorHandler.Failed(hresult))
            {
                return(Result.CreateError(hresult));
            }

            var commandTargets = commandTargetFactoryList
                                 .Select(x => x.CreateCommandTarget(nextCommandTarget, vimBufferCoordinator))
                                 .Where(x => x != null)
                                 .ToReadOnlyCollection();

            vsCommandTarget.CompleteInit(nextCommandTarget, commandTargets);
            return(Result.CreateSuccess(vsCommandTarget));
        }
コード例 #9
0
 internal VsKeyProcessorProvider(IVim vim, IVsAdapter adapter, IVimBufferCoordinatorFactory bufferCoordinatorFactory, IKeyUtil keyUtil)
 {
     _vim = vim;
     _adapter = adapter;
     _bufferCoordinatorFactory = bufferCoordinatorFactory;
     _keyUtil = keyUtil;
 }
コード例 #10
0
ファイル: HostFactory.cs プロジェクト: oraclechang/VsVim
        public HostFactory(
            IVim vim,
            ITextBufferFactoryService bufferFactoryService,
            ITextEditorFactoryService editorFactoryService,
            IEditorOptionsFactoryService editorOptionsFactoryService,
            IKeyBindingService keyBindingService,
            SVsServiceProvider serviceProvider,
            IVsEditorAdaptersFactoryService adaptersFactory,
            IResharperUtil resharperUtil,
            IDisplayWindowBrokerFactoryService displayWindowBrokerFactoryService,
            IVsAdapter adapter,
            [EditorUtilsImport] IProtectedOperations protectedOperations,
            IVimBufferCoordinatorFactory bufferCoordinatorFactory,
            IKeyUtil keyUtil)
        {
            _vim = vim;
            _keyBindingService           = keyBindingService;
            _bufferFactoryService        = bufferFactoryService;
            _editorFactoryService        = editorFactoryService;
            _editorOptionsFactoryService = editorOptionsFactoryService;
            _resharperUtil = resharperUtil;
            _displayWindowBrokerFactoryServcie = displayWindowBrokerFactoryService;
            _adaptersFactory          = adaptersFactory;
            _adapter                  = adapter;
            _protectedOperations      = protectedOperations;
            _bufferCoordinatorFactory = bufferCoordinatorFactory;
            _keyUtil                  = keyUtil;

            _vim.AutoLoadVimRc = false;

#if DEBUG
            VimTrace.TraceSwitch.Level = TraceLevel.Info;
#endif
        }
コード例 #11
0
ファイル: VsKeyProcessor.cs プロジェクト: ketiko/VsVim
 internal VsKeyProcessor(IVsAdapter adapter, IVimBufferCoordinator bufferCoordinator, IKeyUtil keyUtil)
     : base(bufferCoordinator.VimBuffer, keyUtil)
 {
     _adapter = adapter;
     _bufferCoordinator = bufferCoordinator;
     _searchInProgressInfo = new Lazy<PropertyInfo>(FindSearchInProgressPropertyInfo);
 }
コード例 #12
0
ファイル: HostFactory.cs プロジェクト: nligerakis/VsVim
        public HostFactory(
            IVim vim,
            ITextBufferFactoryService bufferFactoryService,
            ITextEditorFactoryService editorFactoryService,
            IEditorOptionsFactoryService editorOptionsFactoryService,
            IKeyBindingService keyBindingService,
            SVsServiceProvider serviceProvider,
            IVsEditorAdaptersFactoryService adaptersFactory,
            IResharperUtil resharperUtil,
            IDisplayWindowBrokerFactoryService displayWindowBrokerFactoryService,
            ITextManager textManager,
            IVsAdapter adapter,
            [EditorUtilsImport] IProtectedOperations protectedOperations,
            IVimBufferCoordinatorFactory bufferCoordinatorFactory,
            IKeyUtil keyUtil)
        {
            _vim = vim;
            _keyBindingService = keyBindingService;
            _bufferFactoryService = bufferFactoryService;
            _editorFactoryService = editorFactoryService;
            _editorOptionsFactoryService = editorOptionsFactoryService;
            _resharperUtil = resharperUtil;
            _displayWindowBrokerFactoryServcie = displayWindowBrokerFactoryService;
            _adaptersFactory = adaptersFactory;
            _textManager = textManager;
            _adapter = adapter;
            _protectedOperations = protectedOperations;
            _bufferCoordinatorFactory = bufferCoordinatorFactory;
            _keyUtil = keyUtil;

            #if DEBUG
            VimTrace.TraceSwitch.Level = TraceLevel.Info;
            #endif
        }
コード例 #13
0
ファイル: VsKeyProcessor.cs プロジェクト: RobertHu/VsVim
 internal VsKeyProcessor(IVsAdapter adapter, IVimBufferCoordinator bufferCoordinator, IKeyUtil keyUtil, IReportDesignerUtil reportDesignerUtil, IWpfTextView wpfTextView)
     : base(bufferCoordinator.VimBuffer, keyUtil, wpfTextView)
 {
     _adapter = adapter;
     _reportDesignerUtil = reportDesignerUtil;
     _bufferCoordinator = bufferCoordinator;
     _searchInProgressInfo = new Lazy<PropertyInfo>(FindSearchInProgressPropertyInfo);
 }
コード例 #14
0
 internal VsVimKeyProcessorProvider(IVim vim, IVsAdapter adapter, IVimBufferCoordinatorFactory bufferCoordinatorFactory, IKeyUtil keyUtil, IReportDesignerUtil reportDesignerUtil)
 {
     _vim     = vim;
     _adapter = adapter;
     _bufferCoordinatorFactory = bufferCoordinatorFactory;
     _keyUtil            = keyUtil;
     _reportDesignerUtil = reportDesignerUtil;
 }
コード例 #15
0
 internal VsVimKeyProcessorProvider(IVim vim, IVsAdapter adapter, IVimBufferCoordinatorFactory bufferCoordinatorFactory, IKeyUtil keyUtil, IReportDesignerUtil reportDesignerUtil)
 {
     _vim = vim;
     _adapter = adapter;
     _bufferCoordinatorFactory = bufferCoordinatorFactory;
     _keyUtil = keyUtil;
     _reportDesignerUtil = reportDesignerUtil;
 }
コード例 #16
0
        internal FallbackKeyProcessorProvider(SVsServiceProvider serviceProvider, IKeyUtil keyUtil, IVimApplicationSettings vimApplicationSettings, IVim vim)
        {
            _dte     = (_DTE)serviceProvider.GetService(typeof(_DTE));
            _keyUtil = keyUtil;
            _vimApplicationSettings = vimApplicationSettings;
            _vim = vim;

            _vsShell   = (IVsShell)serviceProvider.GetService(typeof(SVsShell));
            _scopeData = new ScopeData(_vsShell);
        }
コード例 #17
0
        internal FallbackKeyProcessorProvider(SVsServiceProvider serviceProvider, IKeyUtil keyUtil, IVimApplicationSettings vimApplicationSettings, IVim vim)
        {
            _dte = (_DTE)serviceProvider.GetService(typeof(_DTE));
            _keyUtil = keyUtil;
            _vimApplicationSettings = vimApplicationSettings;
            _vim = vim;

            var vsShell = (IVsShell)serviceProvider.GetService(typeof(SVsShell));
            _scopeData = new ScopeData(vsShell);
        }
コード例 #18
0
ファイル: VsCommandTarget.cs プロジェクト: louisfeng/VsVim
 internal VsCommandTarget(
     IVimBufferCoordinator vimBufferCoordinator,
     ITextManager textManager,
     IVsAdapter vsAdapter,
     IDisplayWindowBroker broker,
     IKeyUtil keyUtil,
     IOleCommandTarget nextTarget,
     ReadOnlyCollection<ICommandTarget> commandTargets)
     : this(vimBufferCoordinator, textManager, vsAdapter, broker, keyUtil)
 {
     CompleteInit(nextTarget, commandTargets);
 }
コード例 #19
0
ファイル: VsCommandTarget.cs プロジェクト: kun-liu/VsVim
 internal VsCommandTarget(
     IVimBufferCoordinator vimBufferCoordinator,
     ITextManager textManager,
     IVsAdapter vsAdapter,
     IDisplayWindowBroker broker,
     IKeyUtil keyUtil,
     IOleCommandTarget nextTarget,
     ReadOnlyCollection <ICommandTarget> commandTargets)
     : this(vimBufferCoordinator, textManager, vsAdapter, broker, keyUtil)
 {
     CompleteInit(nextTarget, commandTargets);
 }
コード例 #20
0
 internal DefaultKeyProcessorProvider(
     IVim vim,
     IKeyUtil keyUtil,
     ICompletionBroker completionBroker,
     ISignatureHelpBroker signatureHelpBroker,
     InlineRenameListenerFactory inlineRenameListenerFactory)
 {
     _vim                         = vim;
     _keyUtil                     = keyUtil;
     _completionBroker            = completionBroker;
     _signatureHelpBroker         = signatureHelpBroker;
     _inlineRenameListenerFactory = inlineRenameListenerFactory;
 }
コード例 #21
0
ファイル: VimKeyProcessor.cs プロジェクト: wangzq/VsVim
        public VimKeyProcessor(
            IVimBuffer vimBuffer,
            IKeyUtil keyUtil,
            ICompletionBroker completionBroker,
            ISignatureHelpBroker signatureHelpBroker,
            InlineRenameListenerFactory inlineRenameListenerFactory)

        {
            VimBuffer                    = vimBuffer;
            _keyUtil                     = keyUtil;
            _completionBroker            = completionBroker;
            _signatureHelpBroker         = signatureHelpBroker;
            _inlineRenameListenerFactory = inlineRenameListenerFactory;
        }
コード例 #22
0
        /// <summary>
        /// In general a key processor applies to a specific IWpfTextView but
        /// by not making use of it, the fallback processor can be reused for
        /// multiple text views
        /// </summary>
        internal FallbackKeyProcessor(_DTE dte, IKeyUtil keyUtil, IVimApplicationSettings vimApplicationSettings, ITextView textView, IVimBuffer vimBuffer, ScopeData scopeData)
        {
            _dte     = dte;
            _keyUtil = keyUtil;
            _vimApplicationSettings = vimApplicationSettings;
            _vimBuffer           = vimBuffer;
            _scopeData           = scopeData;
            _fallbackCommandList = new List <FallbackCommand>();

            // Register for key binding changes and get the current bindings
            _vimApplicationSettings.SettingsChanged += OnSettingsChanged;
            GetKeyBindings();

            textView.Closed += OnTextViewClosed;
        }
コード例 #23
0
ファイル: VsCommandTarget.cs プロジェクト: kun-liu/VsVim
 private VsCommandTarget(
     IVimBufferCoordinator vimBufferCoordinator,
     ITextManager textManager,
     IVsAdapter vsAdapter,
     IDisplayWindowBroker broker,
     IKeyUtil keyUtil)
 {
     _vimBuffer            = vimBufferCoordinator.VimBuffer;
     _vim                  = _vimBuffer.Vim;
     _vimBufferCoordinator = vimBufferCoordinator;
     _textBuffer           = _vimBuffer.TextBuffer;
     _vsAdapter            = vsAdapter;
     _broker               = broker;
     _keyUtil              = keyUtil;
 }
コード例 #24
0
ファイル: VsCommandTarget.cs プロジェクト: louisfeng/VsVim
 private VsCommandTarget(
     IVimBufferCoordinator vimBufferCoordinator,
     ITextManager textManager,
     IVsAdapter vsAdapter,
     IDisplayWindowBroker broker,
     IKeyUtil keyUtil)
 {
     _vimBuffer = vimBufferCoordinator.VimBuffer;
     _vim = _vimBuffer.Vim;
     _vimBufferCoordinator = vimBufferCoordinator;
     _textBuffer = _vimBuffer.TextBuffer;
     _vsAdapter = vsAdapter;
     _broker = broker;
     _keyUtil = keyUtil;
 }
コード例 #25
0
ファイル: FallbackKeyProcessor.cs プロジェクト: kun-liu/VsVim
        /// <summary>
        /// In general a key processor applies to a specific IWpfTextView but
        /// by not making use of it, the fallback processor can be reused for
        /// multiple text views
        /// </summary>
        internal FallbackKeyProcessor(_DTE dte, IKeyUtil keyUtil, IVimApplicationSettings vimApplicationSettings, ITextView textView, IVimBuffer vimBuffer, ScopeData scopeData)
        {
            _dte = dte;
            _keyUtil = keyUtil;
            _vimApplicationSettings = vimApplicationSettings;
            _vimBuffer = vimBuffer;
            _scopeData = scopeData;
            _fallbackCommandList = new List<FallbackCommand>();

            // Register for key binding changes and get the current bindings
            _vimApplicationSettings.SettingsChanged += OnSettingsChanged;
            GetKeyBindings();

            textView.Closed += OnTextViewClosed;
        }
コード例 #26
0
        /// <summary>
        /// In general a key processor applies to a specific IWpfTextView but
        /// by not making use of it, the fallback processor can be reused for
        /// multiple text views
        /// </summary>
        internal FallbackKeyProcessor(IVsShell vsShell, _DTE dte, IKeyUtil keyUtil, IVimApplicationSettings vimApplicationSettings, ITextView textView, IVimBuffer vimBuffer, ScopeData scopeData)
        {
            _vsShell = vsShell;
            _dte     = dte;
            _keyUtil = keyUtil;
            _vimApplicationSettings = vimApplicationSettings;
            _vimBuffer           = vimBuffer;
            _scopeData           = scopeData;
            _fallbackCommandList = Enumerable.Empty <FallbackCommand>().ToLookup(x => 'a');

            // Register for key binding changes and get the current bindings
            _vimApplicationSettings.SettingsChanged += OnSettingsChanged;
            GetKeyBindings();

            textView.Closed += OnTextViewClosed;
        }
コード例 #27
0
ファイル: VsCommandTarget.cs プロジェクト: oraclechang/VsVim
 private VsCommandTarget(
     IVimBufferCoordinator bufferCoordinator,
     IVsAdapter vsAdapter,
     IDisplayWindowBroker broker,
     IResharperUtil resharperUtil,
     IKeyUtil keyUtil)
 {
     _vimBuffer         = bufferCoordinator.VimBuffer;
     _vim               = _vimBuffer.Vim;
     _bufferCoordinator = bufferCoordinator;
     _textBuffer        = _vimBuffer.TextBuffer;
     _vsAdapter         = vsAdapter;
     _broker            = broker;
     _resharperUtil     = resharperUtil;
     _keyUtil           = keyUtil;
 }
コード例 #28
0
ファイル: VsCommandTarget.cs プロジェクト: oraclechang/VsVim
 private VsCommandTarget(
     IVimBufferCoordinator bufferCoordinator,
     IVsAdapter vsAdapter,
     IDisplayWindowBroker broker,
     IResharperUtil resharperUtil,
     IKeyUtil keyUtil)
 {
     _vimBuffer = bufferCoordinator.VimBuffer;
     _vim = _vimBuffer.Vim;
     _bufferCoordinator = bufferCoordinator;
     _textBuffer = _vimBuffer.TextBuffer;
     _vsAdapter = vsAdapter;
     _broker = broker;
     _resharperUtil = resharperUtil;
     _keyUtil = keyUtil;
 }
コード例 #29
0
        /// <summary>
        /// In general a key processor applies to a specific IWpfTextView but
        /// by not making use of it, the fallback processor can be reused for
        /// multiple text views
        /// </summary>
        internal FallbackKeyProcessor(IVsShell vsShell, _DTE dte, IKeyUtil keyUtil, IVimApplicationSettings vimApplicationSettings, ITextView textView, IVimBuffer vimBuffer, ScopeData scopeData)
        {
            _vsShell = vsShell;
            _dte = dte;
            _keyUtil = keyUtil;
            _vimApplicationSettings = vimApplicationSettings;
            _vimBuffer = vimBuffer;
            _scopeData = scopeData;
            _fallbackCommandList = Enumerable.Empty<FallbackCommand>().ToLookup(x => 'a');

            // Register for key binding changes and get the current bindings
            _vimApplicationSettings.SettingsChanged += OnSettingsChanged;
            GetKeyBindings();

            textView.Closed += OnTextViewClosed;
        }
コード例 #30
0
        public VimEditorHost(CompositionContainer compositionContainer) : base(compositionContainer)
        {
            _vim = CompositionContainer.GetExportedValue <IVim>();
            _vimBufferFactory        = CompositionContainer.GetExportedValue <IVimBufferFactory>();
            _vimErrorDetector        = CompositionContainer.GetExportedValue <IVimErrorDetector>();
            _commonOperationsFactory = CompositionContainer.GetExportedValue <ICommonOperationsFactory>();
            _bufferTrackingService   = CompositionContainer.GetExportedValue <IBufferTrackingService>();
            _foldManagerFactory      = CompositionContainer.GetExportedValue <IFoldManagerFactory>();
            _bulkOperations          = CompositionContainer.GetExportedValue <IBulkOperations>();
            _keyUtil             = CompositionContainer.GetExportedValue <IKeyUtil>();
            _protectedOperations = CompositionContainer.GetExportedValue <IProtectedOperations>();

            _keyboardDevice                 = CompositionContainer.GetExportedValue <IKeyboardDevice>();
            _mouseDevice                    = CompositionContainer.GetExportedValue <IMouseDevice>();
            _clipboardDevice                = CompositionContainer.GetExportedValue <IClipboardDevice>();
            _editorFormatMapService         = CompositionContainer.GetExportedValue <IEditorFormatMapService>();
            _classificationFormatMapService = CompositionContainer.GetExportedValue <IClassificationFormatMapService>();
        }
コード例 #31
0
ファイル: VimEditorHost.cs プロジェクト: jockus/VsVim
        public VimEditorHost(CompositionContainer compositionContainer)
            : base(compositionContainer)
        {
            _vim = CompositionContainer.GetExportedValue<IVim>();
            _vimBufferFactory = CompositionContainer.GetExportedValue<IVimBufferFactory>();
            _vimErrorDetector = CompositionContainer.GetExportedValue<IVimErrorDetector>();
            _commonOperationsFactory = CompositionContainer.GetExportedValue<ICommonOperationsFactory>();
            _wordUtil = CompositionContainer.GetExportedValue<IWordUtil>();
            _bufferTrackingService = CompositionContainer.GetExportedValue<IBufferTrackingService>();
            _foldManagerFactory = CompositionContainer.GetExportedValue<IFoldManagerFactory>();
            _bulkOperations = CompositionContainer.GetExportedValue<IBulkOperations>();
            _keyUtil = CompositionContainer.GetExportedValue<IKeyUtil>();
            _vimProtectedOperations = CompositionContainer.GetExportedValue<IVimProtectedOperations>();

            _keyboardDevice = CompositionContainer.GetExportedValue<IKeyboardDevice>();
            _mouseDevice = CompositionContainer.GetExportedValue<IMouseDevice>();
            _clipboardDevice = CompositionContainer.GetExportedValue<IClipboardDevice>();
        }
コード例 #32
0
ファイル: VimKeyProcessor.cs プロジェクト: RobertHu/VsVim
        public VimKeyProcessor(IVimBuffer vimBuffer, IKeyUtil keyUtil, IWpfTextView wpfTextView)
        {
            _vimBuffer = vimBuffer;
            _keyUtil = keyUtil;
            wpfTextView.VisualElement.MouseDown += (s, e) =>
                {
                    if (e.ChangedButton == MouseButton.Middle && e.ButtonState == MouseButtonState.Pressed)
                    {
                        var position = e.GetPosition(wpfTextView.VisualElement);
                        var viewLine = wpfTextView.TextViewLines.GetTextViewLineContainingYCoordinate(position.Y + wpfTextView.ViewportTop);
                        wpfTextView.Caret.MoveTo(viewLine, position.X + wpfTextView.ViewportLeft);

                        // Run the 'put' command directly here.  Don't try to run 'P' because a key mapping could
                        // prevent it from running correctly
                        var command = Command.NewNormalCommand(NormalCommand.NewPutBeforeCaret(false), CommandData.Default);
                        _vimBuffer.CommandUtil.RunCommand(command);
                    }
                };
        }
コード例 #33
0
ファイル: VsCommandTarget.cs プロジェクト: oraclechang/VsVim
        internal static Result <VsCommandTarget> Create(
            IVimBufferCoordinator bufferCoordinator,
            IVsTextView vsTextView,
            IVsAdapter adapter,
            IDisplayWindowBroker broker,
            IResharperUtil resharperUtil,
            IKeyUtil keyUtil)
        {
            var vsCommandTarget = new VsCommandTarget(bufferCoordinator, adapter, broker, resharperUtil, keyUtil);
            var hresult         = vsTextView.AddCommandFilter(vsCommandTarget, out vsCommandTarget._nextTarget);
            var result          = Result.CreateSuccessOrError(vsCommandTarget, hresult);

            if (result.IsSuccess)
            {
                bufferCoordinator.VimBuffer.TextView.Properties[Key] = vsCommandTarget;
            }

            return(result);
        }
コード例 #34
0
        public VimKeyProcessor(IVimBuffer vimBuffer, IKeyUtil keyUtil, IWpfTextView wpfTextView)
        {
            _vimBuffer = vimBuffer;
            _keyUtil   = keyUtil;
            wpfTextView.VisualElement.MouseDown += (s, e) =>
            {
                if (e.ChangedButton == MouseButton.Middle && e.ButtonState == MouseButtonState.Pressed)
                {
                    var position = e.GetPosition(wpfTextView.VisualElement);
                    var viewLine = wpfTextView.TextViewLines.GetTextViewLineContainingYCoordinate(position.Y + wpfTextView.ViewportTop);
                    wpfTextView.Caret.MoveTo(viewLine, position.X + wpfTextView.ViewportLeft);

                    // Run the 'put' command directly here.  Don't try to run 'P' because a key mapping could
                    // prevent it from running correctly
                    var command = Command.NewNormalCommand(NormalCommand.NewPutBeforeCaret(false), CommandData.Default);
                    _vimBuffer.CommandUtil.RunCommand(command);
                }
            };
        }
コード例 #35
0
ファイル: VimTestBase.cs プロジェクト: oysteinkrog/VsVim
        protected VimTestBase()
        {
            // Parts of the core editor in Vs2012 depend on there being an Application.Current value else
            // they will throw a NullReferenceException.  Create one here to ensure the unit tests successfully
            // pass
            if (Application.Current == null)
            {
                new Application();
            }

            _vim = CompositionContainer.GetExportedValue <IVim>();
            _vimBufferFactory        = CompositionContainer.GetExportedValue <IVimBufferFactory>();
            _vimErrorDetector        = CompositionContainer.GetExportedValue <IVimErrorDetector>();
            _commonOperationsFactory = CompositionContainer.GetExportedValue <ICommonOperationsFactory>();
            _wordUtilFactory         = CompositionContainer.GetExportedValue <IWordUtilFactory>();
            _bufferTrackingService   = CompositionContainer.GetExportedValue <IBufferTrackingService>();
            _foldManagerFactory      = CompositionContainer.GetExportedValue <IFoldManagerFactory>();
            _bulkOperations          = CompositionContainer.GetExportedValue <IBulkOperations>();
            _keyUtil = CompositionContainer.GetExportedValue <IKeyUtil>();
            _vimProtectedOperations = CompositionContainer.GetExportedValue <IVimProtectedOperations>();

            _keyboardDevice       = CompositionContainer.GetExportedValue <IKeyboardDevice>();
            _mouseDevice          = CompositionContainer.GetExportedValue <IMouseDevice>();
            _clipboardDevice      = CompositionContainer.GetExportedValue <IClipboardDevice>();
            _clipboardDevice.Text = String.Empty;

            // One setting we do differ on for a default is 'timeout'.  We don't want them interfering
            // with the reliability of tests.  The default is on but turn it off here to prevent any
            // problems
            _vim.GlobalSettings.Timeout = false;

            // Don't let the personal VimRc of the user interfere with the unit tests
            _vim.AutoLoadVimRc = false;

            // Don't show trace information in the unit tests.  It really clutters the output in an
            // xUnit run
            VimTrace.TraceSwitch.Level = TraceLevel.Off;
        }
コード例 #36
0
ファイル: VimTestBase.cs プロジェクト: honeyhoneywell/VsVim
        protected VimTestBase()
        {
            // Parts of the core editor in Vs2012 depend on there being an Application.Current value else
            // they will throw a NullReferenceException.  Create one here to ensure the unit tests successfully
            // pass
            if (Application.Current == null)
            {
                new Application();
            }

            _vim = CompositionContainer.GetExportedValue<IVim>();
            _vimBufferFactory = CompositionContainer.GetExportedValue<IVimBufferFactory>();
            _vimErrorDetector = CompositionContainer.GetExportedValue<IVimErrorDetector>();
            _commonOperationsFactory = CompositionContainer.GetExportedValue<ICommonOperationsFactory>();
            _wordUtil = CompositionContainer.GetExportedValue<IWordUtil>();
            _bufferTrackingService = CompositionContainer.GetExportedValue<IBufferTrackingService>();
            _foldManagerFactory = CompositionContainer.GetExportedValue<IFoldManagerFactory>();
            _bulkOperations = CompositionContainer.GetExportedValue<IBulkOperations>();
            _keyUtil = CompositionContainer.GetExportedValue<IKeyUtil>();
            _vimProtectedOperations = CompositionContainer.GetExportedValue<IVimProtectedOperations>();

            _keyboardDevice = CompositionContainer.GetExportedValue<IKeyboardDevice>();
            _mouseDevice = CompositionContainer.GetExportedValue<IMouseDevice>();
            _clipboardDevice = CompositionContainer.GetExportedValue<IClipboardDevice>();
            _clipboardDevice.Text = String.Empty;

            // One setting we do differ on for a default is 'timeout'.  We don't want them interfering
            // with the reliability of tests.  The default is on but turn it off here to prevent any
            // problems
            _vim.GlobalSettings.Timeout = false;

            // Don't let the personal VimRc of the user interfere with the unit tests
            _vim.AutoLoadVimRc = false;

            // Don't show trace information in the unit tests.  It really clutters the output in an
            // xUnit run
            VimTrace.TraceSwitch.Level = TraceLevel.Off;
        }
コード例 #37
0
ファイル: HostFactory.cs プロジェクト: trigifu/VsVim
        public HostFactory(
            IVim vim,
            IVsEditorAdaptersFactoryService adaptersFactory,
            IDisplayWindowBrokerFactoryService displayWindowBrokerFactoryService,
            ITextManager textManager,
            IVsAdapter adapter,
            IProtectedOperations protectedOperations,
            IVimBufferCoordinatorFactory bufferCoordinatorFactory,
            IKeyUtil keyUtil,
            IEditorToSettingsSynchronizer editorToSettingSynchronizer,
            IVimApplicationSettings vimApplicationSettings,
            [ImportMany] IEnumerable <Lazy <ICommandTargetFactory, IOrderable> > commandTargetFactoryList)
        {
            _vim = vim;
            _displayWindowBrokerFactoryServcie = displayWindowBrokerFactoryService;
            _adaptersFactory             = adaptersFactory;
            _textManager                 = textManager;
            _adapter                     = adapter;
            _protectedOperations         = protectedOperations;
            _bufferCoordinatorFactory    = bufferCoordinatorFactory;
            _keyUtil                     = keyUtil;
            _editorToSettingSynchronizer = editorToSettingSynchronizer;
            _vimApplicationSettings      = vimApplicationSettings;
            _commandTargetFactoryList    = Orderer.Order(commandTargetFactoryList).Select(x => x.Value).ToReadOnlyCollection();

#if DEBUG
            VimTrace.TraceSwitch.Level = TraceLevel.Verbose;
#endif

            // Make sure that for this
            _editorToSettingSynchronizer.SyncSetting(SettingSyncData.Create(
                                                         DefaultWpfViewOptions.EnableHighlightCurrentLineId,
                                                         WindowSettingNames.CursorLineName,
                                                         false,
                                                         x => SettingValue.NewToggle(x),
                                                         s => s.GetToggle()));
        }
コード例 #38
0
 internal DefaultKeyProcessorProvider(IVim vim, IKeyUtil keyUtil)
 {
     _vim = vim;
     _keyUtil = keyUtil;
 }
コード例 #39
0
 internal VsKeyProcessor(IVsAdapter adapter, IVimBufferCoordinator bufferCoordinator, IKeyUtil keyUtil)
     : base(bufferCoordinator.VimBuffer, keyUtil)
 {
     _adapter              = adapter;
     _bufferCoordinator    = bufferCoordinator;
     _searchInProgressInfo = new Lazy <PropertyInfo>(FindSearchInProgressPropertyInfo);
 }
コード例 #40
0
ファイル: VsCommandTarget.cs プロジェクト: Yzzl/VsVim
        internal static Result<VsCommandTarget> Create(
            IVimBufferCoordinator vimBufferCoordinator,
            IVsTextView vsTextView,
            ITextManager textManager,
            IVsAdapter adapter,
            IDisplayWindowBroker broker,
            IKeyUtil keyUtil,
            IVimApplicationSettings vimApplicationSettings,
            ReadOnlyCollection<ICommandTargetFactory> commandTargetFactoryList)
        {
            var vsCommandTarget = new VsCommandTarget(vimBufferCoordinator, textManager, adapter, broker, keyUtil, vimApplicationSettings);

            IOleCommandTarget nextCommandTarget;
            var hresult = vsTextView.AddCommandFilter(vsCommandTarget, out nextCommandTarget);
            if (ErrorHandler.Failed(hresult))
            {
                return Result.CreateError(hresult);
            }

            var commandTargets = commandTargetFactoryList
                .Select(x => x.CreateCommandTarget(nextCommandTarget, vimBufferCoordinator))
                .Where(x => x != null)
                .ToReadOnlyCollection();
            vsCommandTarget.CompleteInit(nextCommandTarget, commandTargets);
            return Result.CreateSuccess(vsCommandTarget);
        }
コード例 #41
0
 internal VsKeyProcessor(IVsAdapter adapter, IVimBufferCoordinator bufferCoordinator, IKeyUtil keyUtil, IReportDesignerUtil reportDesignerUtil, IWpfTextView wpfTextView)
     : base(bufferCoordinator.VimBuffer, keyUtil, wpfTextView)
 {
     _adapter              = adapter;
     _reportDesignerUtil   = reportDesignerUtil;
     _bufferCoordinator    = bufferCoordinator;
     _searchInProgressInfo = new Lazy <PropertyInfo>(FindSearchInProgressPropertyInfo);
 }
コード例 #42
0
 public KeyUtilTest()
 {
     _keyUtilRaw = new KeyUtil();
     _keyUtil    = _keyUtilRaw;
 }
コード例 #43
0
ファイル: KeyUtilTest.cs プロジェクト: mrmonday/VsVim
 public KeyUtilTest()
 {
     _keyUtilRaw = new KeyUtil();
     _keyUtil = _keyUtilRaw;
 }
コード例 #44
0
 protected AlternateKeyUtilTest()
 {
     _keyUtilRaw = new AlternateKeyUtil();
     _keyUtil    = _keyUtilRaw;
 }
コード例 #45
0
 public VimKeyProcessor(IVimBuffer vimBuffer, IKeyUtil keyUtil)
 {
     _vimBuffer = vimBuffer;
     _keyUtil = keyUtil;
 }
コード例 #46
0
ファイル: VsSimulation.cs プロジェクト: wmchristie/VsVim
        internal VsSimulation(IVimBufferCoordinator bufferCoordinator, bool simulateResharper, bool simulateStandardKeyMappings, IEditorOperationsFactoryService editorOperationsFactoryService, IKeyUtil keyUtil)
        {
            _keyUtil = keyUtil;
            _wpfTextView = (IWpfTextView)bufferCoordinator.VimBuffer.TextView;
            _factory = new MockRepository(MockBehavior.Strict);
            _vsKeyProcessorSimulation = new VsKeyProcessorSimulation(this, _wpfTextView);
            _testableSynchronizationContext = new TestableSynchronizationContext();
            _simulateStandardKeyMappings = simulateStandardKeyMappings;

            // Create the IVsAdapter and pick reasonable defaults here.  Consumers can modify
            // this via an exposed property
            _vsAdapter = _factory.Create<IVsAdapter>();
            _vsAdapter.SetupGet(x => x.InAutomationFunction).Returns(false);
            _vsAdapter.SetupGet(x => x.KeyboardDevice).Returns(_vsKeyProcessorSimulation.KeyBoardDevice);
            _vsAdapter.Setup(x => x.IsReadOnly(It.IsAny<ITextBuffer>())).Returns(false);
            _vsAdapter.Setup(x => x.IsReadOnly(It.IsAny<ITextView>())).Returns(false);
            _vsAdapter.Setup(x => x.IsIncrementalSearchActive(_wpfTextView)).Returns(false);

            _resharperUtil = _factory.Create<IResharperUtil>();
            _resharperUtil.SetupGet(x => x.IsInstalled).Returns(simulateResharper);

            _displayWindowBroker = _factory.Create<IDisplayWindowBroker>();
            _displayWindowBroker.SetupGet(x => x.IsCompletionActive).Returns(false);
            _displayWindowBroker.SetupGet(x => x.IsQuickInfoActive).Returns(false);
            _displayWindowBroker.SetupGet(x => x.IsSignatureHelpActive).Returns(false);
            _displayWindowBroker.SetupGet(x => x.IsSmartTagSessionActive).Returns(false);

            _defaultCommandTarget = new DefaultCommandTarget(
                bufferCoordinator.VimBuffer.TextView,
                editorOperationsFactoryService.GetEditorOperations(bufferCoordinator.VimBuffer.TextView));

            // Create the VsCommandTarget.  It's next is the final and default Visual Studio
            // command target
            var vsTextView = _factory.Create<IVsTextView>();
            IOleCommandTarget nextCommandTarget = _defaultCommandTarget;
            vsTextView.Setup(x => x.AddCommandFilter(It.IsAny<IOleCommandTarget>(), out nextCommandTarget)).Returns(VSConstants.S_OK);
            var vsCommandTarget = VsCommandTarget.Create(
                bufferCoordinator,
                vsTextView.Object,
                _factory.Create<ITextManager>().Object,
                _vsAdapter.Object,
                _displayWindowBroker.Object,
                _resharperUtil.Object,
                _keyUtil).Value;

            // Time to setup the start command target.  If we are simulating R# then put them ahead of VsVim
            // on the IOleCommandTarget chain.  VsVim doesn't try to fight R# and prefers instead to be
            // behind them
            if (simulateResharper)
            {
                var resharperCommandTarget = new ResharperCommandTarget(_wpfTextView, vsCommandTarget);
                _commandTarget = resharperCommandTarget;
            }
            else
            {
                _commandTarget = vsCommandTarget;
            }

            // Visual Studio hides the default IOleCommandTarget inside of the IWpfTextView property
            // bag.  The default KeyProcessor implementation looks here for IOleCommandTarget to
            // process text input.
            //
            // This should always point to the head of the IOleCommandTarget chain.  In the implementation
            // it actually points to the IVsTextView implementation which then immediately routes to the
            // IOleCommandTarget head
            _wpfTextView.Properties[typeof(IOleCommandTarget)] = _commandTarget;

            // Create the input controller.  Make sure that the VsVim one is ahead in the list
            // from the default Visual Studio one.  We can guarantee this is true due to MEF
            // ordering of the components
            _vsKeyProcessorSimulation.KeyProcessors.Add(new VsKeyProcessor(_vsAdapter.Object, bufferCoordinator, _keyUtil));
            _vsKeyProcessorSimulation.KeyProcessors.Add(new SimulationKeyProcessor(bufferCoordinator.VimBuffer.TextView));
        }
コード例 #47
0
ファイル: VsCommandTarget.cs プロジェクト: wmchristie/VsVim
        internal static Result<VsCommandTarget> Create(
            IVimBufferCoordinator bufferCoordinator,
            IVsTextView vsTextView,
            ITextManager textManager,
            IVsAdapter adapter,
            IDisplayWindowBroker broker,
            IResharperUtil resharperUtil,
            IKeyUtil keyUtil)
        {
            var vsCommandTarget = new VsCommandTarget(bufferCoordinator, textManager, adapter, broker, resharperUtil, keyUtil);
            var hresult = vsTextView.AddCommandFilter(vsCommandTarget, out vsCommandTarget._nextTarget);
            var result = Result.CreateSuccessOrError(vsCommandTarget, hresult);
            if (result.IsSuccess)
            {
                bufferCoordinator.VimBuffer.TextView.Properties[Key] = vsCommandTarget;
            }

            return result;
        }
コード例 #48
0
        internal VsSimulation(IVimBufferCoordinator bufferCoordinator, bool simulateResharper, bool simulateStandardKeyMappings, IEditorOperationsFactoryService editorOperationsFactoryService, IKeyUtil keyUtil)
        {
            _keyUtil     = keyUtil;
            _wpfTextView = (IWpfTextView)bufferCoordinator.VimBuffer.TextView;
            _factory     = new MockRepository(MockBehavior.Strict);
            _vsKeyboardInputSimulation   = new VsKeyboardInputSimulation(this, _wpfTextView);
            _simulateStandardKeyMappings = simulateStandardKeyMappings;

            // Create the IVsAdapter and pick reasonable defaults here.  Consumers can modify
            // this via an exposed property
            _vsAdapter = _factory.Create <IVsAdapter>();
            _vsAdapter.SetupGet(x => x.InAutomationFunction).Returns(false);
            _vsAdapter.SetupGet(x => x.KeyboardDevice).Returns(_vsKeyboardInputSimulation.KeyBoardDevice);
            _vsAdapter.Setup(x => x.IsReadOnly(It.IsAny <ITextBuffer>())).Returns(false);
            _vsAdapter.Setup(x => x.IsReadOnly(It.IsAny <ITextView>())).Returns(false);
            _vsAdapter.Setup(x => x.IsIncrementalSearchActive(_wpfTextView)).Returns(false);

            _reportDesignerUtil = _factory.Create <IReportDesignerUtil>();
            _reportDesignerUtil.Setup(x => x.IsExpressionView(_wpfTextView)).Returns(false);

            _displayWindowBroker = _factory.Create <IDisplayWindowBroker>();
            _displayWindowBroker.SetupGet(x => x.IsCompletionActive).Returns(false);
            _displayWindowBroker.SetupGet(x => x.IsQuickInfoActive).Returns(false);
            _displayWindowBroker.SetupGet(x => x.IsSignatureHelpActive).Returns(false);

            _vimApplicationSettings = _factory.Create <IVimApplicationSettings>();
            _vimApplicationSettings.SetupGet(x => x.UseEditorDefaults).Returns(true);
            _vimApplicationSettings.SetupGet(x => x.UseEditorIndent).Returns(true);
            _vimApplicationSettings.SetupGet(x => x.UseEditorTabAndBackspace).Returns(true);

            _commonOperations = _factory.Create <ICommonOperations>();

            _vsSimulationCommandTarget = new SimulationCommandTarget(
                bufferCoordinator.VimBuffer.TextView,
                editorOperationsFactoryService.GetEditorOperations(bufferCoordinator.VimBuffer.TextView));

            var textManager    = _factory.Create <ITextManager>();
            var commandTargets = new List <ICommandTarget>();

            if (simulateResharper)
            {
                commandTargets.Add(ReSharperKeyUtil.GetOrCreate(bufferCoordinator));
            }
            commandTargets.Add(new StandardCommandTarget(
                                   bufferCoordinator,
                                   textManager.Object,
                                   _commonOperations.Object,
                                   _displayWindowBroker.Object,
                                   _vsSimulationCommandTarget));

            // Create the VsCommandTarget.  It's next is the final and default Visual Studio
            // command target
            _vsCommandTarget = new VsCommandTarget(
                bufferCoordinator,
                textManager.Object,
                _vsAdapter.Object,
                _displayWindowBroker.Object,
                _keyUtil,
                _vimApplicationSettings.Object,
                _vsSimulationCommandTarget,
                commandTargets.ToReadOnlyCollectionShallow());

            // Time to setup the start command target.  If we are simulating R# then put them ahead of VsVim
            // on the IOleCommandTarget chain.  VsVim doesn't try to fight R# and prefers instead to be
            // behind them
            if (simulateResharper)
            {
                _reSharperCommandTarget = new ReSharperCommandTargetSimulation(_wpfTextView, _vsCommandTarget);
                _commandTarget          = _reSharperCommandTarget;
            }
            else
            {
                _commandTarget = _vsCommandTarget;
            }

            // Visual Studio hides the default IOleCommandTarget inside of the IWpfTextView property
            // bag.  The default KeyProcessor implementation looks here for IOleCommandTarget to
            // process text input.
            //
            // This should always point to the head of the IOleCommandTarget chain.  In the implementation
            // it actually points to the IVsTextView implementation which then immediately routes to the
            // IOleCommandTarget head
            _wpfTextView.Properties[typeof(IOleCommandTarget)] = _commandTarget;

            // Create the input controller.  Make sure that the VsVim one is ahead in the list
            // from the default Visual Studio one.  We can guarantee this is true due to MEF
            // ordering of the components
            if (simulateResharper)
            {
                _vsKeyboardInputSimulation.KeyProcessors.Add(ReSharperKeyUtil.GetOrCreate(bufferCoordinator));
            }
            _vsKeyboardInputSimulation.KeyProcessors.Add(new VsVimKeyProcessor(_vsAdapter.Object, bufferCoordinator, _keyUtil, _reportDesignerUtil.Object));
            _vsKeyboardInputSimulation.KeyProcessors.Add((KeyProcessor)bufferCoordinator);
            _vsKeyboardInputSimulation.KeyProcessors.Add(new SimulationKeyProcessor(bufferCoordinator.VimBuffer.TextView));
        }
コード例 #49
0
ファイル: VsKeyProcessor.cs プロジェクト: IvaN9900/VsVim
 internal VsKeyProcessor(IVsAdapter adapter, IVimBufferCoordinator bufferCoordinator, IKeyUtil keyUtil)
     : base(bufferCoordinator.VimBuffer, keyUtil)
 {
     _adapter = adapter;
     _bufferCoordinator = bufferCoordinator;
 }
コード例 #50
0
 public VimKeyProcessor(IVimBuffer vimBuffer, IKeyUtil keyUtil)
 {
     _vimBuffer = vimBuffer;
     _keyUtil   = keyUtil;
 }
コード例 #51
0
 internal DefaultKeyProcessorProvider(IVim vim, IKeyUtil keyUtil)
 {
     _vim     = vim;
     _keyUtil = keyUtil;
 }
コード例 #52
0
        internal VsSimulation(IVimBufferCoordinator bufferCoordinator, bool simulateResharper, bool simulateStandardKeyMappings, IEditorOperationsFactoryService editorOperationsFactoryService, IKeyUtil keyUtil)
        {
            _keyUtil     = keyUtil;
            _wpfTextView = (IWpfTextView)bufferCoordinator.VimBuffer.TextView;
            _factory     = new MockRepository(MockBehavior.Strict);
            _vsKeyProcessorSimulation       = new VsKeyProcessorSimulation(this, _wpfTextView);
            _testableSynchronizationContext = new TestableSynchronizationContext();
            _simulateStandardKeyMappings    = simulateStandardKeyMappings;

            // Create the IVsAdapter and pick reasonable defaults here.  Consumers can modify
            // this via an exposed property
            _vsAdapter = _factory.Create <IVsAdapter>();
            _vsAdapter.SetupGet(x => x.InAutomationFunction).Returns(false);
            _vsAdapter.SetupGet(x => x.KeyboardDevice).Returns(_vsKeyProcessorSimulation.KeyBoardDevice);
            _vsAdapter.Setup(x => x.IsReadOnly(It.IsAny <ITextBuffer>())).Returns(false);
            _vsAdapter.Setup(x => x.IsReadOnly(It.IsAny <ITextView>())).Returns(false);
            _vsAdapter.Setup(x => x.IsIncrementalSearchActive(_wpfTextView)).Returns(false);

            _resharperUtil = _factory.Create <IResharperUtil>();
            _resharperUtil.SetupGet(x => x.IsInstalled).Returns(simulateResharper);

            _displayWindowBroker = _factory.Create <IDisplayWindowBroker>();
            _displayWindowBroker.SetupGet(x => x.IsCompletionActive).Returns(false);
            _displayWindowBroker.SetupGet(x => x.IsQuickInfoActive).Returns(false);
            _displayWindowBroker.SetupGet(x => x.IsSignatureHelpActive).Returns(false);
            _displayWindowBroker.SetupGet(x => x.IsSmartTagSessionActive).Returns(false);

            _defaultCommandTarget = new DefaultCommandTarget(
                bufferCoordinator.VimBuffer.TextView,
                editorOperationsFactoryService.GetEditorOperations(bufferCoordinator.VimBuffer.TextView));

            // Create the VsCommandTarget.  It's next is the final and default Visual Studio
            // command target
            var vsTextView = _factory.Create <IVsTextView>();
            IOleCommandTarget nextCommandTarget = _defaultCommandTarget;

            vsTextView.Setup(x => x.AddCommandFilter(It.IsAny <IOleCommandTarget>(), out nextCommandTarget)).Returns(VSConstants.S_OK);
            var vsCommandTarget = VsCommandTarget.Create(
                bufferCoordinator,
                vsTextView.Object,
                _factory.Create <ITextManager>().Object,
                _vsAdapter.Object,
                _displayWindowBroker.Object,
                _resharperUtil.Object,
                _keyUtil).Value;

            // Time to setup the start command target.  If we are simulating R# then put them ahead of VsVim
            // on the IOleCommandTarget chain.  VsVim doesn't try to fight R# and prefers instead to be
            // behind them
            if (simulateResharper)
            {
                var resharperCommandTarget = new ResharperCommandTarget(_wpfTextView, vsCommandTarget);
                _commandTarget = resharperCommandTarget;
            }
            else
            {
                _commandTarget = vsCommandTarget;
            }

            // Visual Studio hides the default IOleCommandTarget inside of the IWpfTextView property
            // bag.  The default KeyProcessor implementation looks here for IOleCommandTarget to
            // process text input.
            //
            // This should always point to the head of the IOleCommandTarget chain.  In the implementation
            // it actually points to the IVsTextView implementation which then immediately routes to the
            // IOleCommandTarget head
            _wpfTextView.Properties[typeof(IOleCommandTarget)] = _commandTarget;

            // Create the input controller.  Make sure that the VsVim one is ahead in the list
            // from the default Visual Studio one.  We can guarantee this is true due to MEF
            // ordering of the components
            _vsKeyProcessorSimulation.KeyProcessors.Add(new VsKeyProcessor(_vsAdapter.Object, bufferCoordinator, _keyUtil));
            _vsKeyProcessorSimulation.KeyProcessors.Add(new SimulationKeyProcessor(bufferCoordinator.VimBuffer.TextView));
        }
コード例 #53
0
 internal KeyboardDeviceImpl(IKeyUtil keyUtil)
 {
     _keyUtil = keyUtil;
 }
コード例 #54
0
ファイル: AlternateKeyUtilTest.cs プロジェクト: Yzzl/VsVim
 protected AlternateKeyUtilTest()
 {
     _keyUtilRaw = new AlternateKeyUtil();
     _keyUtil = _keyUtilRaw;
 }