protected HostFactoryTest() { _globalSettings = Vim.GlobalSettings; _mockFactory = new MockRepository(MockBehavior.Strict); _synchronizer = _mockFactory.Create <IEditorToSettingsSynchronizer>(MockBehavior.Strict); _synchronizer.Setup(x => x.SyncSetting(It.IsAny <SettingSyncData>())); _vsEditorAdaptersFactoryService = _mockFactory.Create <IVsEditorAdaptersFactoryService>(); _vimApplicationSettings = _mockFactory.Create <IVimApplicationSettings>(MockBehavior.Loose); var vsAdapter = _mockFactory.Create <IVsAdapter>(); vsAdapter.SetupGet(x => x.EditorAdapter).Returns(_vsEditorAdaptersFactoryService.Object); _hostFactory = new HostFactory( Vim, _vsEditorAdaptersFactoryService.Object, _mockFactory.Create <IDisplayWindowBrokerFactoryService>(MockBehavior.Loose).Object, _mockFactory.Create <ITextManager>(MockBehavior.Loose).Object, vsAdapter.Object, ProtectedOperations, new VimBufferCoordinatorFactory(Vim), _mockFactory.Create <IKeyUtil>(MockBehavior.Loose).Object, _synchronizer.Object, _vimApplicationSettings.Object, new Lazy <ICommandTargetFactory, IOrderable>[] { }); }
private void Create(params string[] lines) { _textView = EditorUtil.CreateView(lines); _globalSettings = new Vim.GlobalSettings(); _globalSettings.IncrementalSearch = true; _globalSettings.WrapScan = true; _localSettings = new LocalSettings(_globalSettings, _textView); _nav = VimUtil.CreateTextStructureNavigator(_textView.TextBuffer); _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; }
public VimTest() { _factory = new MockRepository(MockBehavior.Strict); _globalSettings = new GlobalSettings(); _markMap = _factory.Create <IMarkMap>(MockBehavior.Strict); _fileSystem = _factory.Create <IFileSystem>(MockBehavior.Strict); _bufferFactory = VimBufferFactory; _keyMap = new KeyMap(_globalSettings); _vimHost = _factory.Create <IVimHost>(MockBehavior.Strict); _searchInfo = _factory.Create <ISearchService>(MockBehavior.Strict); _vimRaw = new Vim( _vimHost.Object, _bufferFactory, FSharpList <Lazy <IVimBufferCreationListener> > .Empty, _globalSettings, _markMap.Object, _keyMap, MockObjectFactory.CreateClipboardDevice().Object, _searchInfo.Object, _fileSystem.Object, new VimData(), _factory.Create <IBulkOperations>().Object); _vim = _vimRaw; _vim.AutoLoadVimRc = false; }
private void Create(ITextView textView) { _textView = textView; _textBuffer = textView.TextBuffer; _buffer = _textView.TextBuffer; _snapshot = _buffer.CurrentSnapshot; _buffer.Changed += delegate { _snapshot = _buffer.CurrentSnapshot; }; _globalSettings = new Vim.GlobalSettings(); _localSettings = new LocalSettings(_globalSettings, _textView); _markMap = new MarkMap(new TrackingLineColumnService()); _vimData = new VimData(); _search = VimUtil.CreateSearchService(_globalSettings); _jumpList = VimUtil.CreateJumpList(); _statusUtil = new Mock<IStatusUtil>(MockBehavior.Strict); _navigator = VimUtil.CreateTextStructureNavigator(_textView.TextBuffer); _motionUtil = new MotionUtil( _textView, _markMap, _localSettings, _search, _navigator, _jumpList, _statusUtil.Object, _vimData); }
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(ITextView textView, IEditorOptions editorOptions = null) { _textView = textView; _textBuffer = textView.TextBuffer; _snapshot = _textBuffer.CurrentSnapshot; _textBuffer.Changed += delegate { _snapshot = _textBuffer.CurrentSnapshot; }; _globalSettings = new Vim.GlobalSettings(); _localSettings = new LocalSettings(_globalSettings, FSharpOption.CreateForReference(editorOptions), FSharpOption.CreateForReference(textView)); _markMap = new MarkMap(new TrackingLineColumnService()); _vimData = new VimData(); _search = VimUtil.CreateSearchService(_globalSettings); _jumpList = VimUtil.CreateJumpList(); _statusUtil = new Mock<IStatusUtil>(MockBehavior.Strict); _navigator = VimUtil.CreateTextStructureNavigator(_textView, WordKind.NormalWord); _motionUtil = new MotionUtil( _textView, _markMap, _localSettings, _search, _navigator, _jumpList, _statusUtil.Object, VimUtil.GetWordUtil(textView), _vimData); }
protected VimTest() { _factory = new MockRepository(MockBehavior.Strict); _globalSettings = new GlobalSettings(); _fileSystem = _factory.Create<IFileSystem>(MockBehavior.Strict); _bufferFactory = VimBufferFactory; _simpleListener = new SimpleListener(); var creationListeners = new [] { new Lazy<IVimBufferCreationListener>(() => _simpleListener) }; var map = new Dictionary<string, VariableValue>(); _keyMap = new KeyMap(_globalSettings, map); _vimHost = _factory.Create<IVimHost>(MockBehavior.Strict); _vimHost.Setup(x => x.CreateHiddenTextView()).Returns(CreateTextView()); _vimHost.Setup(x => x.AutoSynchronizeSettings).Returns(true); _vimRaw = new Vim( _vimHost.Object, _bufferFactory, CompositionContainer.GetExportedValue<IVimInterpreterFactory>(), creationListeners.ToFSharpList(), _globalSettings, _factory.Create<IMarkMap>().Object, _keyMap, MockObjectFactory.CreateClipboardDevice().Object, _factory.Create<ISearchService>().Object, _fileSystem.Object, new VimData(_globalSettings), _factory.Create<IBulkOperations>().Object, map, new EditorToSettingSynchronizer()); _vim = _vimRaw; _vim.AutoLoadVimRc = false; }
protected VimTest() { _factory = new MockRepository(MockBehavior.Strict); _globalSettings = new GlobalSettings(); _fileSystem = _factory.Create <IFileSystem>(MockBehavior.Strict); _bufferFactory = VimBufferFactory; _simpleListener = new SimpleListener(); var creationListeners = new [] { new Lazy <IVimBufferCreationListener>(() => _simpleListener) }; var map = new Dictionary <string, VariableValue>(); _keyMap = new KeyMap(_globalSettings, map); _vimHost = _factory.Create <IVimHost>(MockBehavior.Strict); _vimHost.Setup(x => x.CreateHiddenTextView()).Returns(CreateTextView()); _vimHost.Setup(x => x.AutoSynchronizeSettings).Returns(true); _vimRaw = new Vim( _vimHost.Object, _bufferFactory, CompositionContainer.GetExportedValue <IVimInterpreterFactory>(), creationListeners.ToFSharpList(), _globalSettings, _factory.Create <IMarkMap>().Object, _keyMap, MockObjectFactory.CreateClipboardDevice().Object, _factory.Create <ISearchService>().Object, _fileSystem.Object, new VimData(), _factory.Create <IBulkOperations>().Object, map, new EditorToSettingSynchronizer()); _vim = _vimRaw; _vim.AutoLoadVimRc = false; }
internal static void Initialize(IVimGlobalSettings globalSettings, IVimApplicationSettings vimApplicationSettings) { var settingsSource = new SettingsSource(vimApplicationSettings); globalSettings.AddCustomSetting(UseEditorIndentName, UseEditorIndentName, settingsSource); globalSettings.AddCustomSetting(UseEditorDefaultsName, UseEditorDefaultsName, settingsSource); globalSettings.AddCustomSetting(UseEditorTabAndBackspaceName, UseEditorTabAndBackspaceName, settingsSource); }
private void Create(params string[] lines) { _vimTextBuffer = CreateVimTextBuffer(lines); _textBuffer = _vimTextBuffer.TextBuffer; _localSettings = _vimTextBuffer.LocalSettings; _globalSettings = _localSettings.GlobalSettings; }
public void Setup() { _settings = new Vim.GlobalSettings(); _settings.IgnoreCase = true; _settings.SmartCase = false; _factory = new VimRegexFactory(_settings); }
protected VimTest(bool createVim = true) { _factory = new MockRepository(MockBehavior.Strict); _globalSettings = new GlobalSettings(); _fileSystem = _factory.Create <IFileSystem>(MockBehavior.Strict); _bufferFactory = VimBufferFactory; _simpleListener = new SimpleListener(); _variableMap = new Dictionary <string, VariableValue>(); _keyMap = new KeyMap(_globalSettings, _variableMap); _vimHost = _factory.Create <IVimHost>(MockBehavior.Strict); _vimHost.Setup(x => x.ShouldIncludeRcFile(It.IsAny <VimRcPath>())).Returns(true); _vimHost.Setup(x => x.CreateHiddenTextView()).Returns(CreateTextView()); _vimHost.Setup(x => x.AutoSynchronizeSettings).Returns(true); _vimHost.Setup(x => x.VimCreated(It.IsAny <IVim>())); _vimHost.Setup(x => x.GetName(It.IsAny <ITextBuffer>())).Returns("VimTest.cs"); _vimHost.Setup(x => x.EnsurePackageLoaded()); _vimHost.SetupGet(x => x.DefaultSettings).Returns(DefaultSettings.GVim74); _vimHost.Setup(x => x.DoActionWhenTextViewReady(It.IsAny <FSharpFunc <Unit, Unit> >(), It.IsAny <ITextView>())) .Callback((FSharpFunc <Unit, Unit> action, ITextView textView) => action.Invoke(null)); if (createVim) { CreateVim(); } }
protected HostFactoryTest() { _globalSettings = Vim.GlobalSettings; _protectedOperations = new TestableProtectedOperations(); _mockFactory = new MockRepository(MockBehavior.Strict); _synchronizer = _mockFactory.Create<IEditorToSettingsSynchronizer>(MockBehavior.Strict); _vsEditorAdaptersFactoryService = _mockFactory.Create<IVsEditorAdaptersFactoryService>(); _vimApplicationSettings = _mockFactory.Create<IVimApplicationSettings>(MockBehavior.Loose); var vsAdapter = _mockFactory.Create<IVsAdapter>(); vsAdapter.SetupGet(x => x.EditorAdapter).Returns(_vsEditorAdaptersFactoryService.Object); _hostFactory = new HostFactory( Vim, _vsEditorAdaptersFactoryService.Object, _mockFactory.Create<IDisplayWindowBrokerFactoryService>(MockBehavior.Loose).Object, _mockFactory.Create<ITextManager>(MockBehavior.Loose).Object, vsAdapter.Object, _protectedOperations, new VimBufferCoordinatorFactory(Vim), _mockFactory.Create<IKeyUtil>(MockBehavior.Loose).Object, _synchronizer.Object, _vimApplicationSettings.Object, new Lazy<ICommandTargetFactory, IOrderable>[] { }); }
protected void Create(params string[] lines) { _textView = CreateTextView(lines); _textBuffer = _textView.TextBuffer; _vimBuffer = Vim.CreateVimBuffer(_textView); _globalSettings = Vim.GlobalSettings; }
public KeyMapTest() { _globalSettings = new GlobalSettings(); _variableMap = new Dictionary<string, VariableValue>(); _mapRaw = new KeyMap(_globalSettings, _variableMap); _map = _mapRaw; }
public KeyMapTest() { _globalSettings = new GlobalSettings(); _variableMap = new Dictionary <string, VariableValue>(); _mapRaw = new KeyMap(_globalSettings, _variableMap); _map = _mapRaw; }
protected void Create(params string[] lines) { _textView = CreateTextView(lines); _vimBuffer = Vim.CreateVimBuffer(_textView); _vimBuffer.SwitchMode(ModeKind.Normal, ModeArgument.None); _globalSettings = _vimBuffer.LocalSettings.GlobalSettings; VimHost.FocusedTextView = _textView; }
public void Setup() { _synchronizer = new EditorToSettingSynchronizer(EditorUtil.FactoryService.Vim); _buffer = EditorUtil.FactoryService.Vim.CreateBuffer(EditorUtil.CreateTextView("")); _localSettings = _buffer.LocalSettings; _globalSettings = _localSettings.GlobalSettings; _editorOptions = _localSettings.EditorOptions.Value; }
internal static Mock<IVimLocalSettings> CreateLocalSettings( IVimGlobalSettings global = null) { global = global ?? CreateGlobalSettings().Object; var mock = new Mock<IVimLocalSettings>(MockBehavior.Strict); mock.SetupGet(x => x.GlobalSettings).Returns(global); return mock; }
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 = CreateUndoRedoOperations(); _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; }; }
public EditorToSettingSynchronizerTest() { _synchronizer = new EditorToSettingSynchronizer(EditorOptionsFactoryService, Vim); _buffer = CreateVimBuffer(""); _localSettings = _buffer.LocalSettings; _globalSettings = _localSettings.GlobalSettings; _editorOptions = _buffer.TextView.Options; }
private void Create(VisualKind kind, int caretPosition, params string[] lines) { _textView = CreateTextView(lines); _textView.MoveCaretTo(caretPosition); _globalSettings = new GlobalSettings(); _incrementalSearch = new Mock <IIncrementalSearch>(MockBehavior.Loose); _tracker = new SelectionTracker(_textView, _globalSettings, _incrementalSearch.Object, kind); _tracker.Start(); }
public VimRcTest() { _vim = (Vim)Vim; _globalSettings = Vim.GlobalSettings; _fileSystem = new Mock <IFileSystem>(); _originalFileSystem = _vim._fileSystem; _vim._fileSystem = _fileSystem.Object; VimHost.CreateHiddenTextViewFunc = () => TextEditorFactoryService.CreateTextView(); }
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; }
protected void Create(ModeArgument argument, params string[] lines) { _textView = CreateTextView(lines); _textBuffer = _textView.TextBuffer; _vimBuffer = Vim.CreateVimBuffer(_textView); _vimBuffer.SwitchMode(ModeKind.Insert, argument); _register = Vim.RegisterMap.GetRegister('c'); _globalSettings = Vim.GlobalSettings; _localSettings = _vimBuffer.LocalSettings; }
public void Setup() { _synchronizer = new EditorToSettingSynchronizer(EditorUtil.FactoryService.EditorOptionsFactory, EditorUtil.FactoryService.Vim); var textView = EditorUtil.CreateTextView(""); _buffer = EditorUtil.FactoryService.Vim.CreateVimBuffer(textView); _localSettings = _buffer.LocalSettings; _globalSettings = _localSettings.GlobalSettings; _editorOptions = EditorUtil.FactoryService.EditorOptionsFactory.GetOptions(textView); }
public VimRcTest() { _vim = (Vim)Vim; _globalSettings = Vim.GlobalSettings; _fileSystem = new Mock <IFileSystem>(); _fileSystem.Setup(x => x.GetVimRcDirectories()).Returns(new string[] { }); _originalFileSystem = _vim.FileSystem; _vim.FileSystem = _fileSystem.Object; VimHost.CreateHiddenTextViewFunc = () => TextEditorFactoryService.CreateTextView(); }
public static Mock<IVimLocalSettings> CreateLocalSettings( IVimGlobalSettings global = null, MockRepository factory = null) { factory = factory ?? new MockRepository(MockBehavior.Strict); global = global ?? CreateGlobalSettings(factory: factory).Object; var mock = factory.Create<IVimLocalSettings>(MockBehavior.Strict); mock.SetupGet(x => x.GlobalSettings).Returns(global); return mock; }
public void Create(params string[] lines) { _textView = EditorUtil.CreateView(lines); _buffer = EditorUtil.FactoryService.Vim.CreateBuffer(_textView); _globalSettings = _buffer.Settings.GlobalSettings; _globalSettings.IncrementalSearch = true; _globalSettings.WrapScan = true; _search = _buffer.IncrementalSearch; _taggerRaw = new IncrementalSearchTagger(_buffer); _tagger = _taggerRaw; }
public static Mock <IVimLocalSettings> CreateLocalSettings( IVimGlobalSettings global = null, MockRepository factory = null) { factory = factory ?? new MockRepository(MockBehavior.Strict); global = global ?? CreateGlobalSettings(factory: factory).Object; var mock = factory.Create <IVimLocalSettings>(MockBehavior.Strict); mock.SetupGet(x => x.GlobalSettings).Returns(global); return(mock); }
protected void Create(params string[] lines) { _vimBuffer = CreateVimBuffer(lines); _textView = _vimBuffer.TextView; _textBuffer = _vimBuffer.TextBuffer; _globalSettings = _vimBuffer.GlobalSettings; _globalSettings.SelectModeOptions = SelectModeOptions.Mouse | SelectModeOptions.Keyboard; _textSelection = _textView.Selection; _context = new TestableSynchronizationContext(); _context.Install(); }
internal static void Initialize(IVimGlobalSettings globalSettings, IVimApplicationSettings vimApplicationSettings) { var settingsSource = new SettingsSource(vimApplicationSettings); globalSettings.AddCustomSetting(UseEditorIndentName, UseEditorIndentName, settingsSource); globalSettings.AddCustomSetting(UseEditorDefaultsName, UseEditorDefaultsName, settingsSource); globalSettings.AddCustomSetting(UseEditorTabAndBackspaceName, UseEditorTabAndBackspaceName, settingsSource); globalSettings.AddCustomSetting(UseEditorCommandMarginName, UseEditorCommandMarginName, settingsSource); globalSettings.AddCustomSetting(CleanMacrosName, CleanMacrosName, settingsSource); globalSettings.AddCustomSetting(HideMarksName, HideMarksName, settingsSource); }
protected virtual void Create(params string[] lines) { _vimBuffer = CreateVimBuffer(lines); _textView = _vimBuffer.TextView; _textBuffer = _vimBuffer.TextBuffer; _globalSettings = _vimBuffer.GlobalSettings; _globalSettings.SelectModeOptions = SelectModeOptions.Mouse | SelectModeOptions.Keyboard; _textSelection = _textView.Selection; _context = new TestableSynchronizationContext(); _context.Install(); }
public void Create(ITextView textView) { _textView = textView; _buffer = _textView.TextBuffer; _snapshot = _buffer.CurrentSnapshot; _buffer.Changed += delegate { _snapshot = _buffer.CurrentSnapshot; }; _settings = new Vim.GlobalSettings(); _localSettings = new LocalSettings(_settings, _textView); _utilRaw = new TextViewMotionUtil(_textView, _localSettings); _util = _utilRaw; }
internal void Create(params string[] lines) { _vimBuffer = CreateVimBuffer(lines); _textView = _vimBuffer.TextView; _globalSettings = _vimBuffer.LocalSettings.GlobalSettings; _globalSettings.IncrementalSearch = true; _globalSettings.WrapScan = true; _search = _vimBuffer.IncrementalSearch; _taggerSourceRaw = new IncrementalSearchTaggerSource(_vimBuffer); _taggerSource = _taggerSourceRaw; }
internal CharDisplayTaggerSource(ITextView textView, IEditorFormatMap editorFormatMap, IVimGlobalSettings globalSettings) { _textView = textView; _editorFormatMap = editorFormatMap; _globalSettings = globalSettings; UpdateBrushes(); _textView.TextBuffer.Changed += OnTextBufferChanged; _editorFormatMap.FormatMappingChanged += OnFormatMappingChanged; _globalSettings.SettingChanged += OnSettingChanged; }
/// <summary> /// Create the IVimBuffer with the given set of lines. Note that we intentionally don't /// set the mode to Insert here because the given commands should work irrespective of the /// mode /// </summary> /// <param name="lines"></param> private void Create(params string[] lines) { _textView = CreateTextView(lines); _buffer = Vim.CreateVimBuffer(_textView); _globalSettings = _buffer.GlobalSettings; _localSettings = _buffer.LocalSettings; var operations = CommonOperationsFactory.GetCommonOperations(_buffer.VimBufferData); _insertUtilRaw = new InsertUtil(_buffer.VimBufferData, operations); _insertUtil = _insertUtilRaw; }
public void Create(params string[] lines) { _vimBuffer = CreateVimBuffer(lines); _textView = _vimBuffer.TextView; _globalSettings = _vimBuffer.LocalSettings.GlobalSettings; _globalSettings.IncrementalSearch = true; _globalSettings.WrapScan = true; _search = _vimBuffer.IncrementalSearch; _taggerSourceRaw = new IncrementalSearchTaggerSource(_vimBuffer); _taggerSource = _taggerSourceRaw; }
public void Create(params string[] lines) { _textView = EditorUtil.CreateTextView(lines); _buffer = EditorUtil.FactoryService.Vim.CreateBuffer(_textView); _globalSettings = _buffer.LocalSettings.GlobalSettings; _globalSettings.IncrementalSearch = true; _globalSettings.WrapScan = true; _search = _buffer.IncrementalSearch; _taggerRaw = new IncrementalSearchTagger(_buffer); _tagger = _taggerRaw; }
protected VimRegexTest() { // This can't be simplified due to a bug in Roslyn. Suppressing the suggestion // until fixed // https://github.com/dotnet/roslyn/issues/23368 #pragma warning disable IDE0017 _globalSettings = new GlobalSettings(); #pragma warning restore IDE0017 _globalSettings.IgnoreCase = true; _globalSettings.SmartCase = false; }
protected virtual void Create(params string[] lines) { _vimBuffer = CreateVimBuffer(lines); _textView = _vimBuffer.TextView; _textBuffer = _vimBuffer.TextBuffer; _globalSettings = _vimBuffer.GlobalSettings; _globalSettings.SelectModeOptions = SelectModeOptions.Mouse | SelectModeOptions.Keyboard; _textSelection = _textView.Selection; _testableMouseDevice = (TestableMouseDevice)MouseDevice; _testableMouseDevice.IsLeftButtonPressed = true; }
/// <summary> /// Create the IVimBuffer with the given set of lines. Note that we intentionally don't /// set the mode to Insert here because the given commands should work irrespective of the /// mode /// </summary> /// <param name="lines"></param> private void Create(params string[] lines) { _textView = CreateTextView(lines); _textBuffer = _textView.TextBuffer; _vimBuffer = Vim.CreateVimBuffer(_textView); _globalSettings = _vimBuffer.GlobalSettings; _localSettings = _vimBuffer.LocalSettings; var operations = CommonOperationsFactory.GetCommonOperations(_vimBuffer.VimBufferData); _insertUtilRaw = new InsertUtil(_vimBuffer.VimBufferData, operations); _insertUtil = _insertUtilRaw; }
private void Create(VisualKind kind, int caretPosition, params string[] lines) { _textView = CreateTextView(lines); _textView.MoveCaretTo(caretPosition); _globalSettings = new GlobalSettings(); var localSettings = new LocalSettings(_globalSettings); var vimTextBuffer = MockObjectFactory.CreateVimTextBuffer(_textView.TextBuffer, localSettings); _vimBufferData = MockObjectFactory.CreateVimBufferData(vimTextBuffer.Object, _textView); _incrementalSearch = new Mock<IIncrementalSearch>(MockBehavior.Loose); _tracker = new SelectionTracker(_vimBufferData, _incrementalSearch.Object, kind); _tracker.Start(); }
internal ImeCoordinator(IVim vim) { _vim = vim; _globalSettings = _vim.GlobalSettings; _inputModeState = new InputModeState(_vim.GlobalSettings); _inputMode = InputMode.None; _vim.GlobalSettings.SettingChanged += OnSettingChanged; AdjustImeState(_inputMode, _inputMode); }
private void Create(VisualKind kind, int caretPosition, params string[] lines) { _textView = CreateTextView(lines); _textView.MoveCaretTo(caretPosition); _globalSettings = new GlobalSettings(); var localSettings = new LocalSettings(_globalSettings); var vimTextBuffer = MockObjectFactory.CreateVimTextBuffer(_textView.TextBuffer, localSettings); _vimBufferData = MockObjectFactory.CreateVimBufferData(vimTextBuffer.Object, _textView); _incrementalSearch = new Mock <IIncrementalSearch>(MockBehavior.Loose); _tracker = new SelectionTracker(_vimBufferData, _incrementalSearch.Object, kind); _tracker.Start(); }
protected virtual void Create(params string[] lines) { _vimBuffer = CreateVimBuffer(lines); _textView = _vimBuffer.TextView; _textBuffer = _vimBuffer.TextBuffer; _globalSettings = _vimBuffer.GlobalSettings; _globalSettings.SelectModeOptions = SelectModeOptions.Mouse | SelectModeOptions.Keyboard; _textSelection = _textView.Selection; _context = new TestableSynchronizationContext(); _context.Install(); _testableMouseDevice = (TestableMouseDevice)MouseDevice; _testableMouseDevice.IsLeftButtonPressed = true; }
public void Create(params string[] lines) { _textBuffer = EditorUtil.CreateTextBuffer(lines); _navigator = VimUtil.CreateTextStructureNavigator(_textBuffer, WordKind.NormalWord); _globalSettings = new Vim.GlobalSettings(); _globalSettings.Magic = true; _globalSettings.IgnoreCase = true; _globalSettings.SmartCase = false; _textSearch = EditorUtil.FactoryService.TextSearchService; _searchRaw = new SearchService(_textSearch, _globalSettings); _search = _searchRaw; }
public void Create(params string[] lines) { _textBuffer = CreateTextBuffer(lines); _wordNavigator = WordUtilFactory.GetWordUtil(_textBuffer).CreateTextStructureNavigator(WordKind.NormalWord); _globalSettings = Vim.GlobalSettings; _globalSettings.Magic = true; _globalSettings.IgnoreCase = true; _globalSettings.SmartCase = false; _textSearch = TextSearchService; _searchRaw = new SearchService(_textSearch, _globalSettings); _search = _searchRaw; }
public virtual void Create(ITextSearchService textSearchService, params string[] lines) { _textBuffer = CreateTextBuffer(lines); _wordNavigator = WordUtil.CreateTextStructureNavigator(WordKind.NormalWord, _textBuffer.ContentType); _globalSettings = Vim.GlobalSettings; _globalSettings.Magic = true; _globalSettings.IgnoreCase = true; _globalSettings.SmartCase = false; _textSearch = textSearchService; _searchRaw = new SearchService(_textSearch, _globalSettings); _search = _searchRaw; }
protected void Create(params string[] lines) { _textView = CreateTextView(lines); _textBuffer = _textView.TextBuffer; _globalSettings = Vim.GlobalSettings; _globalSettings.IgnoreCase = true; _globalSettings.HighlightSearch = true; _vimData = Vim.VimData; _asyncTaggerSourceRaw = new HighlightSearchTaggerSource( _textView, _globalSettings, _vimData, Vim.VimHost); _asyncTaggerSource = _asyncTaggerSourceRaw; }
public void Create(ITextView textView) { _textView = textView; _buffer = _textView.TextBuffer; _snapshot = _buffer.CurrentSnapshot; _buffer.Changed += delegate { _snapshot = _buffer.CurrentSnapshot; }; _settings = new Vim.GlobalSettings(); _localSettings = new LocalSettings(_settings, _textView); _markMap = new MarkMap(new TrackingLineColumnService()); _utilRaw = new TextViewMotionUtil( _textView, _markMap, _localSettings); _util = _utilRaw; }
internal BlockCaretController( IVimBuffer buffer, IBlockCaret blockCaret) { _buffer = buffer; _blockCaret = blockCaret; _globalSettings = _buffer.LocalSettings.GlobalSettings; _buffer.SwitchedMode += OnCaretRelatedEvent; _buffer.KeyInputStart += OnCaretRelatedEvent; _buffer.KeyInputEnd += OnCaretRelatedEvent; _buffer.Closed += OnBufferClosed; _globalSettings.SettingChanged += OnSettingsChanged; UpdateCaretDisplay(); UpdateCaretOpacity(); }
public void Create(params string[] lines) { _context = new TestableSynchronizationContext(); SynchronizationContext.SetSynchronizationContext(_context); _textView = CreateTextView(lines); _textBuffer = _textView.TextBuffer; _vimBuffer = Vim.CreateVimBuffer(_textView); _vimBuffer.SwitchMode(ModeKind.Normal, ModeArgument.None); _vimTextBuffer = _vimBuffer.VimTextBuffer; _registerMap = _vimBuffer.RegisterMap; _globalSettings = _vimBuffer.LocalSettings.GlobalSettings; Assert.IsTrue(_context.IsEmpty); // Need to make sure it's focused so macro recording will work ((MockVimHost)_vimBuffer.Vim.VimHost).FocusedTextView = _textView; }
public VimTest() { _factory = new MockRepository(MockBehavior.Strict); _globalSettings = new GlobalSettings(); _markMap = _factory.Create<IMarkMap>(MockBehavior.Strict); _fileSystem = _factory.Create<IFileSystem>(MockBehavior.Strict); _bufferFactory = VimBufferFactory; var map = new Dictionary<string, VariableValue>(); _keyMap = new KeyMap(_globalSettings, map); _vimHost = _factory.Create<IVimHost>(MockBehavior.Strict); _searchInfo = _factory.Create<ISearchService>(MockBehavior.Strict); _vimRaw = new Vim( _vimHost.Object, _bufferFactory, FSharpList<Lazy<IVimBufferCreationListener>>.Empty, _globalSettings, _markMap.Object, _keyMap, MockObjectFactory.CreateClipboardDevice().Object, _searchInfo.Object, _fileSystem.Object, new VimData(), _factory.Create<IBulkOperations>().Object, map); _vim = _vimRaw; _vim.AutoLoadVimRc = false; }