public IDEExecutionContext(ICommonOperations commonOperations) { if(commonOperations == null) { throw new ArgumentNullException("commonOperations"); } CommonOperations = commonOperations; }
protected void Create(bool insertMode, params string[] lines) { _factory = new MockRepository(MockBehavior.Strict); _factory.DefaultValue = DefaultValue.Mock; _textView = CreateTextView(lines); _textBuffer = _textView.TextBuffer; _vim = _factory.Create<IVim>(MockBehavior.Loose); _editorOptions = _factory.Create<IEditorOptions>(MockBehavior.Loose); _textChangeTracker = _factory.Create<ITextChangeTracker>(MockBehavior.Loose); _textChangeTracker.SetupGet(x => x.CurrentChange).Returns(FSharpOption<TextChange>.None); _undoRedoOperations = new UndoRedoOperations(VimHost, new StatusUtil(), FSharpOption<ITextUndoHistory>.None, null); _wordCompletionSessionFactoryService = _factory.Create<IWordCompletionSessionFactoryService>(); var localSettings = new LocalSettings(Vim.GlobalSettings); _vimBuffer = Vim.CreateVimBuffer(_textView); _globalSettings = _vimBuffer.GlobalSettings; var vimTextBuffer = Vim.GetOrCreateVimTextBuffer(_textView.TextBuffer); var vimBufferData = CreateVimBufferData(vimTextBuffer, _textView); _operations = CommonOperationsFactory.GetCommonOperations(vimBufferData); _broker = _factory.Create<IDisplayWindowBroker>(); _broker.SetupGet(x => x.IsCompletionActive).Returns(false); _broker.SetupGet(x => x.IsQuickInfoActive).Returns(false); _broker.SetupGet(x => x.IsSignatureHelpActive).Returns(false); _broker.SetupGet(x => x.IsSmartTagSessionActive).Returns(false); _insertUtil = _factory.Create<IInsertUtil>(); _motionUtil = _factory.Create<IMotionUtil>(); _commandUtil = _factory.Create<ICommandUtil>(); _capture = _factory.Create<IMotionCapture>(); // Setup the mouse. By default we say it has no buttons down as that's the normal state _mouseDevice = _factory.Create<IMouseDevice>(); _mouseDevice.SetupGet(x => x.IsLeftButtonPressed).Returns(false); // Setup the keyboard. By default we don't say that any button is pressed. Insert mode is usually // only concerned with arrow keys and we will set those up as appropriate for the typing tests _keyboardDevice = _factory.Create<IKeyboardDevice>(); _keyboardDevice.Setup(x => x.IsArrowKeyDown).Returns(false); _modeRaw = new global::Vim.Modes.Insert.InsertMode( _vimBuffer, _operations, _broker.Object, _editorOptions.Object, _undoRedoOperations, _textChangeTracker.Object, _insertUtil.Object, _motionUtil.Object, _commandUtil.Object, _capture.Object, !insertMode, _keyboardDevice.Object, _mouseDevice.Object, WordUtil, _wordCompletionSessionFactoryService.Object); _mode = _modeRaw; _mode.OnEnter(ModeArgument.None); _mode.CommandRan += (sender, e) => { _lastCommandRan = e.CommandRunData; }; }
private void Create(params string[] lines) { _globalSettings = Vim.GlobalSettings; _vimBuffer = CreateVimBuffer(lines); _textView = (IWpfTextView)_vimBuffer.TextView; _textBuffer = _vimBuffer.TextBuffer; _commonOperationsRaw = (CommonOperations)CommonOperationsFactory.GetCommonOperations(_vimBuffer.VimBufferData); _commonOperations = _commonOperationsRaw; }
public NuGetUIProjectContext(INuGetUILogger logger, ISourceControlManagerProvider sourceControlManagerProvider, ICommonOperations commonOperations) { _logger = logger; _uiDispatcher = Dispatcher.CurrentDispatcher; _sourceControlManagerProvider = sourceControlManagerProvider; _commonOperations = commonOperations; if (commonOperations != null) { ExecutionContext = new IDEExecutionContext(commonOperations); } }
public void CreateLines(params string[] lines) { _view = Utils.EditorUtil.CreateView(lines); _view.Caret.MoveTo(new SnapshotPoint(_view.TextSnapshot, 0)); _buffer = _view.TextBuffer; _host = new Mock<IVimHost>(MockBehavior.Strict); _jumpList = new Mock<IJumpList>(MockBehavior.Strict); _editorOpts = new Mock<IEditorOperations>(MockBehavior.Strict); _operationsRaw = new OperationsImpl(_view, _editorOpts.Object, _host.Object, _jumpList.Object); _operations = _operationsRaw; }
public PackageManagementContext( ISourceRepositoryProvider sourceRepositoryProvider, ISolutionManager solutionManager, ISettings settings, ISourceControlManagerProvider sourceControlManagerProvider, ICommonOperations commonOperations) { SourceRepositoryProvider = sourceRepositoryProvider; VsSolutionManager = solutionManager; Settings = settings; SourceControlManagerProvider = sourceControlManagerProvider; CommonOperations = commonOperations; }
protected PowerShellHost(string name, IRunspaceManager runspaceManager) { _runspaceManager = runspaceManager; // TODO: Take these as ctor arguments _sourceRepositoryProvider = ServiceLocator.GetInstance<ISourceRepositoryProvider>(); _solutionManager = ServiceLocator.GetInstance<ISolutionManager>(); _settings = ServiceLocator.GetInstance<ISettings>(); _dte = ServiceLocator.GetInstance<DTE>(); _sourceControlManagerProvider = ServiceLocator.GetInstanceSafe<ISourceControlManagerProvider>(); _commonOperations = ServiceLocator.GetInstanceSafe<ICommonOperations>(); _packageManagementContext = new PackageManagementContext(_sourceRepositoryProvider, _solutionManager, _settings, _sourceControlManagerProvider, _commonOperations); _name = name; IsCommandEnabled = true; InitializeSources(); _sourceRepositoryProvider.PackageSourceProvider.PackageSourcesSaved += PackageSourceProvider_PackageSourcesSaved; }
public MainWindow() { InitializeComponent(); _commonOperations = new StandAloneUICommonOperations(); CreatePackageManagerControl(); }
public DrawingHelpers(IDrawing drawing, ICommonOperations commonOperations) { Common = commonOperations; _drawing = drawing; }
public CommandMargin(FrameworkElement parentVisualElement, IVimBuffer buffer, IEditorFormatMap editorFormatMap, IClassificationFormatMap classificationFormatMap, ICommonOperations commonOperations, IClipboardDevice clipboardDevice, bool isFirstCommandMargin) { _margin.CommandLineTextBox.Text = isFirstCommandMargin ? $"Welcome to VsVim Version {VimConstants.VersionNumber}" : string.Empty; _controller = new CommandMarginController(buffer, parentVisualElement, _margin, editorFormatMap, classificationFormatMap, commonOperations, clipboardDevice); _enabled = true; }
internal CommandUtil CreateCommandUtil( IVimBufferData vimBufferData, IMotionUtil motionUtil = null, ICommonOperations operations = null, IFoldManager foldManager = null, InsertUtil insertUtil = null) { motionUtil = motionUtil ?? new MotionUtil(vimBufferData, operations); operations = operations ?? CommonOperationsFactory.GetCommonOperations(vimBufferData); foldManager = foldManager ?? VimUtil.CreateFoldManager(vimBufferData.TextView, vimBufferData.StatusUtil); insertUtil = insertUtil ?? new InsertUtil(vimBufferData, motionUtil, operations); var lineChangeTracker = new LineChangeTracker(vimBufferData); return new CommandUtil( vimBufferData, motionUtil, operations, foldManager, insertUtil, _vimEditorHost.BulkOperations, MouseDevice, lineChangeTracker); }
internal CommandMarginController(IVimBuffer buffer, FrameworkElement parentVisualElement, CommandMarginControl control, IEditorFormatMap editorFormatMap, IClassificationFormatMap classificationFormatMap, ICommonOperations commonOperations, IClipboardDevice clipboardDevice) { _vimBuffer = buffer; _margin = control; _parentVisualElement = parentVisualElement; _editorFormatMap = editorFormatMap; _classificationFormatMap = classificationFormatMap; _commonOperations = commonOperations; _clipboardDevice = clipboardDevice; Connect(); UpdateForRecordingChanged(); UpdateTextColor(); UpdateStatusLineVisibility(); }
public void Create(params string[] lines) { _textView = EditorUtil.CreateView(lines); _vimData = new VimData(); _textView.Caret.MoveTo(new SnapshotPoint(_textView.TextSnapshot, 0)); _textBuffer = _textView.TextBuffer; _factory = new MockRepository(MockBehavior.Strict); _registerMap = VimUtil.CreateRegisterMap(MockObjectFactory.CreateClipboardDevice(_factory).Object); _host = _factory.Create<IVimHost>(); _jumpList = _factory.Create<IJumpList>(); _editorOptions = _factory.Create<IEditorOptions>(); _editorOptions.Setup(x => x.GetOptionValue(DefaultOptions.ConvertTabsToSpacesOptionId)).Returns(true); _editorOperations = _factory.Create<IEditorOperations>(); _editorOperations.Setup(x => x.AddAfterTextBufferChangePrimitive()); _editorOperations.Setup(x => x.AddBeforeTextBufferChangePrimitive()); _globalSettings = _factory.Create<IVimGlobalSettings>(); _globalSettings.SetupGet(x => x.Magic).Returns(true); _globalSettings.SetupGet(x => x.SmartCase).Returns(false); _globalSettings.SetupGet(x => x.IgnoreCase).Returns(true); _globalSettings.SetupGet(x => x.UseEditorIndent).Returns(false); _globalSettings.SetupGet(x => x.UseEditorTabSettings).Returns(false); _settings = MockObjectFactory.CreateLocalSettings(_globalSettings.Object, _factory); _settings.SetupGet(x => x.AutoIndent).Returns(false); _settings.SetupGet(x => x.GlobalSettings).Returns(_globalSettings.Object); _settings.SetupGet(x => x.ExpandTab).Returns(true); _settings.SetupGet(x => x.TabStop).Returns(4); _outlining = _factory.Create<IOutliningManager>(); _globalSettings.SetupGet(x => x.ShiftWidth).Returns(2); _statusUtil = _factory.Create<IStatusUtil>(); _undoRedoOperations = _factory.Create<IUndoRedoOperations>(); _undoRedoOperations.Setup(x => x.CreateUndoTransaction(It.IsAny<string>())).Returns<string>(name => new UndoTransaction(FSharpOption.Create(EditorUtil.GetUndoHistory(_textView.TextBuffer).CreateTransaction(name)))); _smartIndent = _factory.Create<ISmartIndentationService>(); _searchService = new SearchService(EditorUtil.FactoryService.TextSearchService, _globalSettings.Object); var data = new OperationsData( vimData: _vimData, vimHost: _host.Object, editorOperations: _editorOperations.Object, textView: _textView, outliningManager: FSharpOption.Create(_outlining.Object), jumpList: _jumpList.Object, localSettings: _settings.Object, undoRedoOperations: _undoRedoOperations.Object, registerMap: _registerMap, editorOptions: _editorOptions.Object, keyMap: null, navigator: null, statusUtil: _statusUtil.Object, foldManager: null, searchService: _searchService, smartIndentationService: _smartIndent.Object); _operationsRaw = new CommonOperations(data); _operations = _operationsRaw; }
public void Create(params string[] lines) { _view = EditorUtil.CreateView(lines); _view.Caret.MoveTo(new SnapshotPoint(_view.TextSnapshot, 0)); _buffer = _view.TextBuffer; _factory = new MockRepository(MockBehavior.Strict); _host = _factory.Create<IVimHost>(); _jumpList = _factory.Create<IJumpList>(); _editorOpts = _factory.Create<IEditorOperations>(); _settings = _factory.Create<IVimLocalSettings>(); _globalSettings = _factory.Create<IVimGlobalSettings>(); _outlining = _factory.Create<IOutliningManager>(); _globalSettings.SetupGet(x => x.ShiftWidth).Returns(2); _settings.SetupGet(x => x.GlobalSettings).Returns(_globalSettings.Object); _undoRedoOperations = _factory.Create<IUndoRedoOperations>(); var data = new OperationsData( vimHost: _host.Object, editorOperations: _editorOpts.Object, textView: _view, outliningManager: _outlining.Object, jumpList: _jumpList.Object, localSettings: _settings.Object, undoRedoOperations: _undoRedoOperations.Object, editorOptions: null, keyMap: null, navigator: null, statusUtil: null, foldManager: null); _operationsRaw = new OperationsImpl(data); _operations = _operationsRaw; }
public MainWindow() { InitializeComponent(); _commonOperations = new StandAloneUICommonOperations(); CreatePackageManagerControl(); }
public NuGetUIProjectContext(INuGetUILogger logger, ISourceControlManagerProvider sourceControlManagerProvider, ICommonOperations commonOperations) { _logger = logger; _uiDispatcher = Dispatcher.CurrentDispatcher; SourceControlManagerProvider = sourceControlManagerProvider; CommonOperations = commonOperations; if (commonOperations != null) { ExecutionContext = new IDEExecutionContext(commonOperations); } }
//An atempt at a fluent interface (with some ordering constraints..), with chained calls, //but only creating a single object per chain //I am sure this is a naive reimplementation of an established pattern //but I feel the specialised constraints and use cases are well taken care of here //This is to replace a drawtools helper that just has a huge number of overloaded methods to //simplfy drawing /* * Notes * - Arrow Outline approach takes a simple view on the arrow head. a custom implementation would look better * - If the option is NOT selected to have the end of the line section of the rounded lines at the start and end point * - at zero length lines the curves and arrows are drawn backwards, ie some artifcat for small lines within which the curves * - do not fit */ public DrawBuilder(IDrawing drawing, ICommonOperations commonOperations) { _drawing = drawing; _common = commonOperations; }
public void Create(params string[] lines) { _textView = EditorUtil.CreateView(lines); _vimData = new VimData(); _editorOptions = EditorUtil.FactoryService.EditorOptionsFactory.GetOptions(_textView); _textView.Caret.MoveTo(new SnapshotPoint(_textView.TextSnapshot, 0)); _textBuffer = _textView.TextBuffer; _factory = new MockRepository(MockBehavior.Strict); _registerMap = VimUtil.CreateRegisterMap(MockObjectFactory.CreateClipboardDevice(_factory).Object); _host = _factory.Create<IVimHost>(); _jumpList = _factory.Create<IJumpList>(); _editorOperations = _factory.Create<IEditorOperations>(); _editorOperations.Setup(x => x.AddAfterTextBufferChangePrimitive()); _editorOperations.Setup(x => x.AddBeforeTextBufferChangePrimitive()); _globalSettings = _factory.Create<IVimGlobalSettings>(); _globalSettings.SetupGet(x => x.Magic).Returns(true); _globalSettings.SetupGet(x => x.SmartCase).Returns(false); _globalSettings.SetupGet(x => x.IgnoreCase).Returns(true); _globalSettings.SetupGet(x => x.UseEditorIndent).Returns(false); _globalSettings.SetupGet(x => x.UseEditorTabSettings).Returns(false); _globalSettings.SetupGet(x => x.WrapScan).Returns(true); _settings = MockObjectFactory.CreateLocalSettings(_globalSettings.Object, _factory); _settings.SetupGet(x => x.AutoIndent).Returns(false); _settings.SetupGet(x => x.GlobalSettings).Returns(_globalSettings.Object); _settings.SetupGet(x => x.ExpandTab).Returns(true); _settings.SetupGet(x => x.TabStop).Returns(4); _outlining = _factory.Create<IOutliningManager>(); _outlining .Setup(x => x.ExpandAll(It.IsAny<SnapshotSpan>(), It.IsAny<Predicate<ICollapsed>>())) .Returns<IEnumerable<ICollapsible>>(null); _globalSettings.SetupGet(x => x.ShiftWidth).Returns(2); _statusUtil = _factory.Create<IStatusUtil>(); _searchService = VimUtil.CreateSearchService(_globalSettings.Object); _undoRedoOperations = VimUtil.CreateUndoRedoOperations(_statusUtil.Object); var data = new OperationsData( vimData: _vimData, vimHost: _host.Object, editorOperations: _editorOperations.Object, textView: _textView, outliningManager: FSharpOption.Create(_outlining.Object), jumpList: _jumpList.Object, localSettings: _settings.Object, undoRedoOperations: _undoRedoOperations, registerMap: _registerMap, editorOptions: _editorOptions, keyMap: null, navigator: null, statusUtil: _statusUtil.Object, foldManager: null, searchService: _searchService); _operationsRaw = new CommonOperations(data); _operations = _operationsRaw; }
public void TearDown() { _operations = null; _operationsRaw = null; }
public void Create(params string[] lines) { _view = Utils.EditorUtil.CreateView(lines); _view.Caret.MoveTo(new SnapshotPoint(_view.TextSnapshot, 0)); _buffer = _view.TextBuffer; _factory = new MockFactory(MockBehavior.Strict); _host = _factory.Create<IVimHost>(); _jumpList = _factory.Create<IJumpList>(); _editorOpts = _factory.Create<IEditorOperations>(); _settings = _factory.Create<IVimLocalSettings>(); _globalSettings = _factory.Create<IVimGlobalSettings>(); _outlining = _factory.Create<IOutliningManager>(); _globalSettings.SetupGet(x => x.ShiftWidth).Returns(2); _settings.SetupGet(x => x.GlobalSettings).Returns(_globalSettings.Object); _undoRedoOperations = _factory.Create<IUndoRedoOperations>(); _operationsRaw = new OperationsImpl(_view, _editorOpts.Object, _outlining.Object, _host.Object, _jumpList.Object,_settings.Object, _undoRedoOperations.Object); _operations = _operationsRaw; }
public CommandMargin(FrameworkElement parentVisualElement, IVimBuffer buffer, IEditorFormatMap editorFormatMap, IClassificationFormatMap classificationFormatMap, ICommonOperations commonOperations) { _margin.CommandLineTextBox.Text = "Welcome to Vim"; _controller = new CommandMarginController(buffer, parentVisualElement, _margin, editorFormatMap, classificationFormatMap, commonOperations); _enabled = true; }
/// <summary> /// Get CEF tenant /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='apiVersion'> /// </param> /// <param name='tenant'> /// Name of CEF account /// </param> public static Tenant GetTenant(this ICommonOperations operations, string apiVersion, string tenant) { return(operations.GetTenantAsync(apiVersion, tenant).GetAwaiter().GetResult()); }
public void Create(params string[] lines) { _textView = CreateTextView(lines); _textView.Caret.MoveTo(new SnapshotPoint(_textView.TextSnapshot, 0)); _textBuffer = _textView.TextBuffer; _factory = new MockRepository(MockBehavior.Strict); // Create the Vim instance with our Mock'd services _vimData = new VimData(); var registerMap = VimUtil.CreateRegisterMap(MockObjectFactory.CreateClipboardDevice(_factory).Object); _vimHost = _factory.Create <IVimHost>(); _globalSettings = _factory.Create <IVimGlobalSettings>(); _globalSettings.SetupGet(x => x.Magic).Returns(true); _globalSettings.SetupGet(x => x.SmartCase).Returns(false); _globalSettings.SetupGet(x => x.IgnoreCase).Returns(true); _globalSettings.SetupGet(x => x.IsVirtualEditOneMore).Returns(false); _globalSettings.SetupGet(x => x.UseEditorIndent).Returns(false); _globalSettings.SetupGet(x => x.UseEditorSettings).Returns(false); _globalSettings.SetupGet(x => x.VirtualEdit).Returns(String.Empty); _globalSettings.SetupGet(x => x.WrapScan).Returns(true); _globalSettings.SetupGet(x => x.ShiftWidth).Returns(2); _searchService = VimUtil.CreateSearchService(_globalSettings.Object); var vim = MockObjectFactory.CreateVim( registerMap: registerMap, host: _vimHost.Object, settings: _globalSettings.Object, searchService: _searchService, factory: _factory); // Create the IVimTextBuffer instance with our Mock'd services _localSettings = MockObjectFactory.CreateLocalSettings(_globalSettings.Object, _factory); _localSettings.SetupGet(x => x.AutoIndent).Returns(false); _localSettings.SetupGet(x => x.GlobalSettings).Returns(_globalSettings.Object); _localSettings.SetupGet(x => x.ExpandTab).Returns(true); _localSettings.SetupGet(x => x.TabStop).Returns(4); var vimTextBuffer = MockObjectFactory.CreateVimTextBuffer( _textBuffer, localSettings: _localSettings.Object, vim: vim.Object, factory: _factory); // Create the VimBufferData instance with our Mock'd services _jumpList = _factory.Create <IJumpList>(); _statusUtil = _factory.Create <IStatusUtil>(); _undoRedoOperations = VimUtil.CreateUndoRedoOperations(_statusUtil.Object); var vimBufferData = CreateVimBufferData( vimTextBuffer.Object, _textView, statusUtil: _statusUtil.Object, jumpList: _jumpList.Object, undoRedoOperations: _undoRedoOperations); _smartIndentationService = _factory.Create <ISmartIndentationService>(); _outlining = _factory.Create <IOutliningManager>(); _outlining .Setup(x => x.ExpandAll(It.IsAny <SnapshotSpan>(), It.IsAny <Predicate <ICollapsed> >())) .Returns <IEnumerable <ICollapsible> >(null); _operationsRaw = new CommonOperations( vimBufferData, EditorOperationsFactoryService.GetEditorOperations(_textView), FSharpOption.Create(_outlining.Object), _smartIndentationService.Object); _operations = _operationsRaw; }
public void Create(params string[] lines) { _textView = CreateTextView(lines); _textView.Caret.MoveTo(new SnapshotPoint(_textView.TextSnapshot, 0)); _textBuffer = _textView.TextBuffer; _foldManager = FoldManagerFactory.GetFoldManager(_textView); _factory = new MockRepository(MockBehavior.Strict); // Create the Vim instance with our Mock'd services _vimData = new VimData(); var registerMap = VimUtil.CreateRegisterMap(MockObjectFactory.CreateClipboardDevice(_factory).Object); _vimHost = _factory.Create<IVimHost>(); _globalSettings = _factory.Create<IVimGlobalSettings>(); _globalSettings.SetupGet(x => x.Magic).Returns(true); _globalSettings.SetupGet(x => x.SmartCase).Returns(false); _globalSettings.SetupGet(x => x.IgnoreCase).Returns(true); _globalSettings.SetupGet(x => x.IsVirtualEditOneMore).Returns(false); _globalSettings.SetupGet(x => x.SelectionKind).Returns(SelectionKind.Inclusive); _globalSettings.SetupGet(x => x.UseEditorIndent).Returns(false); _globalSettings.SetupGet(x => x.UseEditorSettings).Returns(false); _globalSettings.SetupGet(x => x.VirtualEdit).Returns(String.Empty); _globalSettings.SetupGet(x => x.WrapScan).Returns(true); _globalSettings.SetupGet(x => x.ShiftWidth).Returns(2); _searchService = new SearchService(TextSearchService, _globalSettings.Object); var vim = MockObjectFactory.CreateVim( registerMap: registerMap, host: _vimHost.Object, settings: _globalSettings.Object, searchService: _searchService, factory: _factory); // Create the IVimTextBuffer instance with our Mock'd services _localSettings = MockObjectFactory.CreateLocalSettings(_globalSettings.Object, _factory); _localSettings.SetupGet(x => x.AutoIndent).Returns(false); _localSettings.SetupGet(x => x.GlobalSettings).Returns(_globalSettings.Object); _localSettings.SetupGet(x => x.ExpandTab).Returns(true); _localSettings.SetupGet(x => x.TabStop).Returns(4); _vimTextBuffer = MockObjectFactory.CreateVimTextBuffer( _textBuffer, localSettings: _localSettings.Object, vim: vim.Object, factory: _factory); // Create the VimBufferData instance with our Mock'd services _jumpList = _factory.Create<IJumpList>(); _statusUtil = _factory.Create<IStatusUtil>(); _undoRedoOperations = VimUtil.CreateUndoRedoOperations(_statusUtil.Object); var vimBufferData = CreateVimBufferData( _vimTextBuffer.Object, _textView, statusUtil: _statusUtil.Object, jumpList: _jumpList.Object, undoRedoOperations: _undoRedoOperations); _smartIndentationService = _factory.Create<ISmartIndentationService>(); _outlining = _factory.Create<IOutliningManager>(); _outlining .Setup(x => x.ExpandAll(It.IsAny<SnapshotSpan>(), It.IsAny<Predicate<ICollapsed>>())) .Returns<IEnumerable<ICollapsible>>(null); _operationsRaw = new CommonOperations( vimBufferData, EditorOperationsFactoryService.GetEditorOperations(_textView), FSharpOption.Create(_outlining.Object), _smartIndentationService.Object); _operations = _operationsRaw; }
private void Create(params string[] lines) { _textView = EditorUtil.CreateTextView(lines); _globalSettings = new Vim.GlobalSettings(); _globalSettings.IncrementalSearch = true; _globalSettings.WrapScan = true; _localSettings = new LocalSettings(_globalSettings, EditorUtil.GetEditorOptions(_textView), _textView); _nav = VimUtil.CreateTextStructureNavigator(_textView, WordKind.NormalWord); _factory = new MockRepository(MockBehavior.Strict); _vimHost = _factory.Create<IVimHost>(); _vimHost.Setup(x => x.EnsureVisible(_textView, It.IsAny<SnapshotPoint>())); _statusUtil = _factory.Create<IStatusUtil>(); _statusUtil.Setup(x => x.OnWarning(Resources.Common_SearchBackwardWrapped)); _statusUtil.Setup(x => x.OnWarning(Resources.Common_SearchForwardWrapped)); _vimData = new VimData(); _operations = VimUtil.CreateCommonOperations( textView: _textView, localSettings: _localSettings, vimHost: _vimHost.Object, statusUtil: _statusUtil.Object); _searchRaw = new IncrementalSearch( _operations, _localSettings, _nav, _statusUtil.Object, _vimData); _search = _searchRaw; }
internal CommandUtil CreateCommandUtil( IVimBufferData vimBufferData, IMotionUtil motionUtil = null, ICommonOperations operations = null, IFoldManager foldManager = null, InsertUtil insertUtil = null) { motionUtil = motionUtil ?? new MotionUtil(vimBufferData, operations); operations = operations ?? CommonOperationsFactory.GetCommonOperations(vimBufferData); foldManager = foldManager ?? VimUtil.CreateFoldManager(vimBufferData.TextView, vimBufferData.StatusUtil); insertUtil = insertUtil ?? new InsertUtil(vimBufferData, operations); return new CommandUtil( vimBufferData, motionUtil, operations, foldManager, insertUtil, _bulkOperations); }
protected void Create(bool insertMode, params string[] lines) { _factory = new MockRepository(MockBehavior.Strict) { DefaultValue = DefaultValue.Mock }; _textView = CreateTextView(lines); _textBuffer = _textView.TextBuffer; _vim = _factory.Create <IVim>(MockBehavior.Loose); _editorOptions = _factory.Create <IEditorOptions>(MockBehavior.Loose); _textChangeTracker = _factory.Create <ITextChangeTracker>(MockBehavior.Loose); _textChangeTracker.SetupGet(x => x.CurrentChange).Returns(FSharpOption <TextChange> .None); _undoRedoOperations = new UndoRedoOperations(VimHost, new StatusUtil(), FSharpOption <ITextUndoHistory> .None, null); _wordCompletionSessionFactoryService = _factory.Create <IWordCompletionSessionFactoryService>(); var localSettings = new LocalSettings(Vim.GlobalSettings); _vimBuffer = Vim.CreateVimBuffer(_textView); _globalSettings = _vimBuffer.GlobalSettings; var vimTextBuffer = Vim.GetOrCreateVimTextBuffer(_textView.TextBuffer); var vimBufferData = CreateVimBufferData(vimTextBuffer, _textView); _operations = CommonOperationsFactory.GetCommonOperations(vimBufferData); _broker = _factory.Create <IDisplayWindowBroker>(); _broker.SetupGet(x => x.IsCompletionActive).Returns(false); _broker.SetupGet(x => x.IsQuickInfoActive).Returns(false); _broker.SetupGet(x => x.IsSignatureHelpActive).Returns(false); _insertUtil = _factory.Create <IInsertUtil>(); _insertUtil.Setup(x => x.NewUndoSequence()); _motionUtil = _factory.Create <IMotionUtil>(); _commandUtil = _factory.Create <ICommandUtil>(); _capture = _factory.Create <IMotionCapture>(); // Setup the mouse. By default we say it has no buttons down as that's the normal state _mouseDevice = _factory.Create <IMouseDevice>(); _mouseDevice.SetupGet(x => x.IsLeftButtonPressed).Returns(false); // Setup the keyboard. By default we don't say that any button is pressed. Insert mode is usually // only concerned with arrow keys and we will set those up as appropriate for the typing tests _keyboardDevice = _factory.Create <IKeyboardDevice>(); _keyboardDevice.Setup(x => x.IsArrowKeyDown).Returns(false); _modeRaw = new global::Vim.Modes.Insert.InsertMode( _vimBuffer, _operations, _broker.Object, _editorOptions.Object, _undoRedoOperations, _textChangeTracker.Object, _insertUtil.Object, _motionUtil.Object, _commandUtil.Object, _capture.Object, !insertMode, _keyboardDevice.Object, _mouseDevice.Object, WordUtil, _wordCompletionSessionFactoryService.Object); _mode = _modeRaw; _mode.OnEnter(ModeArgument.None); _mode.CommandRan += (sender, e) => { _lastCommandRan = e.CommandRunData; }; }
public void TearDown() { _operations = null; _operationsRaw = null; }
private PackageIdentity GetDirectInstall(IEnumerable<NuGetProjectAction> nuGetProjectActions, UserAction userAction, ICommonOperations commonOperations) { if (commonOperations != null && userAction != null && userAction.Action == NuGetProjectActionType.Install && nuGetProjectActions.Any()) { PackageIdentity directInstall = null; if(userAction.PackageIdentity != null) { directInstall = userAction.PackageIdentity; } else { var identitiesWithSameId = nuGetProjectActions.Where(n => n.PackageIdentity.Id.Equals(userAction)).ToList(); if(identitiesWithSameId.Count == 1) { directInstall = identitiesWithSameId[0].PackageIdentity; } // If there multiple actions with the same package id as the user action, just ignore } if (directInstall != null) { return directInstall; } } return null; }