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 }
internal VsKeyProcessorProvider(IVim vim, IVsAdapter adapter, IVimBufferCoordinatorFactory bufferCoordinatorFactory, IKeyUtil keyUtil) { _vim = vim; _adapter = adapter; _bufferCoordinatorFactory = bufferCoordinatorFactory; _keyUtil = keyUtil; }
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; }
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 }
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 }
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; }
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 }
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)); }
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 }
internal VsKeyProcessor(IVsAdapter adapter, IVimBufferCoordinator bufferCoordinator, IKeyUtil keyUtil) : base(bufferCoordinator.VimBuffer, keyUtil) { _adapter = adapter; _bufferCoordinator = bufferCoordinator; _searchInProgressInfo = new Lazy<PropertyInfo>(FindSearchInProgressPropertyInfo); }
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 }
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); }
internal VsVimKeyProcessorProvider(IVim vim, IVsAdapter adapter, IVimBufferCoordinatorFactory bufferCoordinatorFactory, IKeyUtil keyUtil, IReportDesignerUtil reportDesignerUtil) { _vim = vim; _adapter = adapter; _bufferCoordinatorFactory = bufferCoordinatorFactory; _keyUtil = keyUtil; _reportDesignerUtil = reportDesignerUtil; }
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); }
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); }
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); }
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); }
internal DefaultKeyProcessorProvider( IVim vim, IKeyUtil keyUtil, ICompletionBroker completionBroker, ISignatureHelpBroker signatureHelpBroker, InlineRenameListenerFactory inlineRenameListenerFactory) { _vim = vim; _keyUtil = keyUtil; _completionBroker = completionBroker; _signatureHelpBroker = signatureHelpBroker; _inlineRenameListenerFactory = inlineRenameListenerFactory; }
public VimKeyProcessor( IVimBuffer vimBuffer, IKeyUtil keyUtil, ICompletionBroker completionBroker, ISignatureHelpBroker signatureHelpBroker, InlineRenameListenerFactory inlineRenameListenerFactory) { VimBuffer = vimBuffer; _keyUtil = keyUtil; _completionBroker = completionBroker; _signatureHelpBroker = signatureHelpBroker; _inlineRenameListenerFactory = inlineRenameListenerFactory; }
/// <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; }
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; }
/// <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; }
/// <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; }
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; }
/// <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; }
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>(); }
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>(); }
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); } }; }
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); }
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; }
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; }
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())); }
internal DefaultKeyProcessorProvider(IVim vim, IKeyUtil keyUtil) { _vim = vim; _keyUtil = keyUtil; }
internal VsKeyProcessor(IVsAdapter adapter, IVimBufferCoordinator bufferCoordinator, IKeyUtil keyUtil) : base(bufferCoordinator.VimBuffer, keyUtil) { _adapter = adapter; _bufferCoordinator = bufferCoordinator; _searchInProgressInfo = new Lazy <PropertyInfo>(FindSearchInProgressPropertyInfo); }
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); }
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); }
public KeyUtilTest() { _keyUtilRaw = new KeyUtil(); _keyUtil = _keyUtilRaw; }
protected AlternateKeyUtilTest() { _keyUtilRaw = new AlternateKeyUtil(); _keyUtil = _keyUtilRaw; }
public VimKeyProcessor(IVimBuffer vimBuffer, IKeyUtil keyUtil) { _vimBuffer = vimBuffer; _keyUtil = keyUtil; }
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)); }
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; }
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)); }
internal VsKeyProcessor(IVsAdapter adapter, IVimBufferCoordinator bufferCoordinator, IKeyUtil keyUtil) : base(bufferCoordinator.VimBuffer, keyUtil) { _adapter = adapter; _bufferCoordinator = bufferCoordinator; }
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)); }
internal KeyboardDeviceImpl(IKeyUtil keyUtil) { _keyUtil = keyUtil; }