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 static Mock <IVimBuffer> CreateVimBuffer( ITextView textView, string name = null, IVim vim = null, IJumpList jumpList = null, IVimLocalSettings settings = null, IIncrementalSearch incrementalSearch = null, IMotionUtil motionUtil = null, ITextStructureNavigator wordNavigator = null, MockRepository factory = null) { factory = factory ?? new MockRepository(MockBehavior.Strict); name = name ?? "test"; vim = vim ?? CreateVim().Object; jumpList = jumpList ?? (factory.Create <IJumpList>().Object); motionUtil = motionUtil ?? factory.Create <IMotionUtil>().Object; wordNavigator = wordNavigator ?? factory.Create <ITextStructureNavigator>().Object; settings = settings ?? new LocalSettings(vim.Settings, FSharpOption.Create(textView)); var mock = factory.Create <IVimBuffer>(); mock.SetupGet(x => x.TextView).Returns(textView); mock.SetupGet(x => x.MotionUtil).Returns(motionUtil); mock.SetupGet(x => x.TextBuffer).Returns(() => textView.TextBuffer); mock.SetupGet(x => x.TextSnapshot).Returns(() => textView.TextSnapshot); mock.SetupGet(x => x.Name).Returns(name); mock.SetupGet(x => x.Settings).Returns(settings); mock.SetupGet(x => x.MarkMap).Returns(vim.MarkMap); mock.SetupGet(x => x.RegisterMap).Returns(vim.RegisterMap); mock.SetupGet(x => x.JumpList).Returns(jumpList); mock.SetupGet(x => x.Vim).Returns(vim); mock.SetupGet(x => x.VimData).Returns(vim.VimData); mock.SetupGet(x => x.IncrementalSearch).Returns(incrementalSearch); mock.SetupGet(x => x.WordNavigator).Returns(wordNavigator); return(mock); }
public void Create(params string[] lines) { _textView = EditorUtil.CreateView(lines); _buffer = EditorUtil.FactoryService.Vim.CreateBuffer(_textView); _search = _buffer.IncrementalSearch; _taggerRaw = new IncrementalSearchTagger(_buffer); _tagger = _taggerRaw; }
/// <summary> /// Attaches events for invoking Statement completion /// </summary> public IntellisenseController(IntellisenseControllerProvider provider, ITextView textView) { _textView = textView; _provider = provider; _editOps = provider._EditOperationsFactory.GetEditorOperations(textView); _incSearch = provider._IncrementalSearch.GetIncrementalSearch(textView); _textView.MouseHover += new EventHandler<MouseHoverEventArgs>(TextViewMouseHover); textView.Properties.AddProperty(typeof(IntellisenseController), this); // added so our key processors can get back to us }
public static BindResult <SearchResult> DoSearch(this IIncrementalSearch search, string text, Path path = null, bool enter = true) { path = path ?? Path.Forward; var result = search.Begin(path).Run(text); return(enter ? result.Run(VimKey.Enter) : result); }
public static IMotionCapture CreateMotionCapture( VimBufferData vimBufferData, IIncrementalSearch incrementalSearch = null) { incrementalSearch = incrementalSearch ?? new IncrementalSearch( vimBufferData, EditorUtil.FactoryService.CommonOperationsFactory.GetCommonOperations(vimBufferData)); return(new MotionCapture(vimBufferData, incrementalSearch)); }
public EditFilter(System.IServiceProvider serviceProvider, ITextView textView, IEditorOperations editorOps, IEditorOptions editorOptions, IIntellisenseSessionStack intellisenseStack, IComponentModel compModel) { _serviceProvider = serviceProvider; _textView = textView; _intellisenseStack = intellisenseStack; _compModel = compModel; var agg = _compModel.GetService<IClassifierAggregatorService>(); _incSearch = _compModel.GetService<IIncrementalSearchFactoryService>().GetIncrementalSearch(_textView); _editorOptions = editorOptions; }
/// <summary> /// Attaches events for invoking Statement completion /// </summary> public IntellisenseController(IntellisenseControllerProvider provider, ITextView textView) { _textView = textView; _provider = provider; _classifier = _provider._classifierAgg.GetClassifier(_textView.TextBuffer); _editOps = provider._EditOperationsFactory.GetEditorOperations(textView); _incSearch = provider._IncrementalSearch.GetIncrementalSearch(textView); _textView.MouseHover += TextViewMouseHover; textView.Properties.AddProperty(typeof(IntellisenseController), this); // added so our key processors can get back to us }
/// <summary> /// Attaches events for invoking Statement completion /// </summary> /// <param name="subjectBuffers"></param> /// <param name="textView"></param> /// <param name="completionBrokerMap"></param> public IntellisenseController(IntellisenseControllerProvider provider, IList <ITextBuffer> subjectBuffers, ITextView textView) { _subjectBuffers = subjectBuffers; _textView = textView; _provider = provider; _editOps = provider._EditOperationsFactory.GetEditorOperations(textView); _incSearch = provider._IncrementalSearch.GetIncrementalSearch(textView); _textView.MouseHover += new EventHandler <MouseHoverEventArgs>(TextViewMouseHover); textView.Properties.AddProperty(typeof(IntellisenseController), this); // added so our key processors can get back to us }
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.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 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; }
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; }
public EditFilter(ITextView textView, IEditorOperations editorOps, IEditorOptions editorOptions, IIntellisenseSessionStack intellisenseStack, IComponentModel compModel) { _textView = textView; _editorOps = editorOps; _intellisenseStack = intellisenseStack; _compModel = compModel; var agg = _compModel.GetService <IClassifierAggregatorService>(); _classifier = agg.GetClassifier(textView.TextBuffer); _incSearch = _compModel.GetService <IIncrementalSearchFactoryService>().GetIncrementalSearch(_textView); _broker = _compModel.GetService <ICompletionBroker>(); _editorOptions = editorOptions; }
public void SetUp() { _textView = EditorUtil.CreateView(); _localSettings = new LocalSettings(new GlobalSettings(), _textView); _incrementalSearch = VimUtil.CreateIncrementalSearch(_textView, _localSettings, new VimData()); _factory = new MockRepository(MockBehavior.Strict); _host = _factory.Create <IVimHost>(); _captureRaw = new MotionCapture( _host.Object, _textView, _incrementalSearch, _localSettings); _capture = _captureRaw; }
public MotionCaptureTest() { _textView = CreateTextView(); var vimTextBuffer = Vim.CreateVimTextBuffer(_textView.TextBuffer); var vimBufferData = CreateVimBufferData(vimTextBuffer, _textView); _incrementalSearch = new IncrementalSearch( vimBufferData, CommonOperationsFactory.GetCommonOperations(vimBufferData)); _localSettings = vimTextBuffer.LocalSettings; _captureRaw = new MotionCapture( vimBufferData, _incrementalSearch); _capture = _captureRaw; }
public static Mock <IVimBuffer> CreateVimBuffer( ITextView textView, string name = null, IVim vim = null, IJumpList jumpList = null, IVimLocalSettings localSettings = null, IIncrementalSearch incrementalSearch = null, IMotionUtil motionUtil = null, WordUtil wordUtil = null, MockRepository factory = null) { factory = factory ?? new MockRepository(MockBehavior.Strict); name = name ?? "test"; vim = vim ?? CreateVim().Object; jumpList = jumpList ?? (factory.Create <IJumpList>().Object); motionUtil = motionUtil ?? factory.Create <IMotionUtil>().Object; localSettings = localSettings ?? new LocalSettings(vim.GlobalSettings); wordUtil = wordUtil ?? new WordUtil(textView.TextBuffer, localSettings); var vimTextBuffer = CreateVimTextBuffer( textView.TextBuffer, localSettings: localSettings, vim: vim, wordUtil: wordUtil, factory: factory); var mock = factory.Create <IVimBuffer>(); mock.SetupGet(x => x.TextView).Returns(textView); mock.SetupGet(x => x.MotionUtil).Returns(motionUtil); mock.SetupGet(x => x.TextBuffer).Returns(() => textView.TextBuffer); mock.SetupGet(x => x.TextSnapshot).Returns(() => textView.TextSnapshot); mock.SetupGet(x => x.Name).Returns(name); mock.SetupGet(x => x.LocalSettings).Returns(localSettings); mock.SetupGet(x => x.GlobalSettings).Returns(localSettings.GlobalSettings); mock.SetupGet(x => x.MarkMap).Returns(vim.MarkMap); mock.SetupGet(x => x.RegisterMap).Returns(vim.RegisterMap); mock.SetupGet(x => x.JumpList).Returns(jumpList); mock.SetupGet(x => x.Vim).Returns(vim); mock.SetupGet(x => x.VimData).Returns(vim.VimData); mock.SetupGet(x => x.IncrementalSearch).Returns(incrementalSearch); mock.SetupGet(x => x.WordNavigator).Returns(wordUtil.WordNavigator); mock.SetupGet(x => x.VimTextBuffer).Returns(vimTextBuffer.Object); return(mock); }
/// <summary> /// Attaches events for invoking Statement completion /// </summary> public IntellisenseController(IntellisenseControllerProvider provider, ITextView textView, IServiceProvider serviceProvider) { _textView = textView; _provider = provider; _editOps = provider._EditOperationsFactory.GetEditorOperations(textView); _incSearch = provider._IncrementalSearch.GetIncrementalSearch(textView); _textView.MouseHover += TextViewMouseHover; _serviceProvider = serviceProvider; if (textView.TextBuffer.IsPythonContent()) { try { _expansionClient = new ExpansionClient(textView, provider._adaptersFactory, provider._ServiceProvider); var textMgr = (IVsTextManager2)_serviceProvider.GetService(typeof(SVsTextManager)); textMgr.GetExpansionManager(out _expansionMgr); } catch (ArgumentException) { // No expansion client for this buffer, but we can continue without it } } textView.Properties.AddProperty(typeof(IntellisenseController), this); // added so our key processors can get back to us _textView.Closed += TextView_Closed; }
private void Create(params string[] lines) { _vimHost = (MockVimHost)Vim.VimHost; _textView = CreateTextView(lines); _globalSettings = Vim.GlobalSettings; _globalSettings.IncrementalSearch = true; _globalSettings.WrapScan = true; var vimTextBuffer = Vim.CreateVimTextBuffer(_textView.TextBuffer); _factory = new MockRepository(MockBehavior.Strict); _statusUtil = _factory.Create<IStatusUtil>(); _statusUtil.Setup(x => x.OnWarning(Resources.Common_SearchBackwardWrapped)); _statusUtil.Setup(x => x.OnWarning(Resources.Common_SearchForwardWrapped)); _vimData = Vim.VimData; var vimBufferData = CreateVimBufferData(vimTextBuffer, _textView); var operations = CommonOperationsFactory.GetCommonOperations(vimBufferData); _searchRaw = new IncrementalSearch(vimBufferData, operations); _search = _searchRaw; }
/// <summary> /// Attaches events for invoking Statement completion /// </summary> public IntellisenseController(IntellisenseControllerProvider provider, ITextView textView, IServiceProvider serviceProvider) { _textView = textView; _provider = provider; _editOps = provider._EditOperationsFactory.GetEditorOperations(textView); _incSearch = provider._IncrementalSearch.GetIncrementalSearch(textView); _textView.MouseHover += TextViewMouseHover; _serviceProvider = serviceProvider; if (textView.TextBuffer.IsPythonContent()) { try { _expansionClient = new ExpansionClient(textView, provider._adaptersFactory, provider._ServiceProvider); var textMgr = (IVsTextManager2)_serviceProvider.GetService(typeof(SVsTextManager)); textMgr.GetExpansionManager(out _expansionMgr); } catch (ArgumentException ex) { // No expansion client for this buffer, but we can continue without it Debug.Fail(ex.ToString()); } } textView.Properties.AddProperty(typeof(IntellisenseController), this); // added so our key processors can get back to us }
public static Mock<IVimBuffer> CreateVimBuffer( ITextView textView, string name = null, IVim vim = null, IJumpList jumpList = null, IVimLocalSettings localSettings = null, IIncrementalSearch incrementalSearch = null, IMotionUtil motionUtil = null, ITextStructureNavigator wordNavigator = null, MockRepository factory = null) { factory = factory ?? new MockRepository(MockBehavior.Strict); name = name ?? "test"; vim = vim ?? CreateVim().Object; jumpList = jumpList ?? (factory.Create<IJumpList>().Object); motionUtil = motionUtil ?? factory.Create<IMotionUtil>().Object; wordNavigator = wordNavigator ?? factory.Create<ITextStructureNavigator>().Object; localSettings = localSettings ?? new LocalSettings(vim.GlobalSettings); var vimTextBuffer = CreateVimTextBuffer( textView.TextBuffer, localSettings: localSettings, vim: vim, factory: factory); var mock = factory.Create<IVimBuffer>(); mock.SetupGet(x => x.TextView).Returns(textView); mock.SetupGet(x => x.MotionUtil).Returns(motionUtil); mock.SetupGet(x => x.TextBuffer).Returns(() => textView.TextBuffer); mock.SetupGet(x => x.TextSnapshot).Returns(() => textView.TextSnapshot); mock.SetupGet(x => x.Name).Returns(name); mock.SetupGet(x => x.LocalSettings).Returns(localSettings); mock.SetupGet(x => x.GlobalSettings).Returns(localSettings.GlobalSettings); mock.SetupGet(x => x.MarkMap).Returns(vim.MarkMap); mock.SetupGet(x => x.RegisterMap).Returns(vim.RegisterMap); mock.SetupGet(x => x.JumpList).Returns(jumpList); mock.SetupGet(x => x.Vim).Returns(vim); mock.SetupGet(x => x.VimData).Returns(vim.VimData); mock.SetupGet(x => x.IncrementalSearch).Returns(incrementalSearch); mock.SetupGet(x => x.WordNavigator).Returns(wordNavigator); mock.SetupGet(x => x.VimTextBuffer).Returns(vimTextBuffer.Object); return mock; }
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; }
private void Create(params string[] lines) { _textView = EditorUtil.CreateView(lines); _factory = new MockFactory(MockBehavior.Strict); _searchService = _factory.Create<ISearchService>(); _nav = _factory.Create<ITextStructureNavigator>(); _globalSettings = MockObjectFactory.CreateGlobalSettings(ignoreCase: true); _settings = MockObjectFactory.CreateLocalSettings(_globalSettings.Object); _outlining = new Mock<IOutliningManager>(MockBehavior.Strict); _outlining.Setup(x => x.ExpandAll(It.IsAny<SnapshotSpan>(), It.IsAny<Predicate<ICollapsed>>())).Returns<IEnumerable<ICollapsed>>(null); _searchRaw = new IncrementalSearch( _textView, _outlining.Object, _settings.Object, _nav.Object, _searchService.Object); _search = _searchRaw; }
protected override void Create(params string[] lines) { base.Create(lines); _incrementalSearch = _vimBuffer.IncrementalSearch; }
private void Create(params string[] lines) { _textView = EditorUtil.CreateView(lines); _textSearch = new Mock<ITextSearchService>(MockBehavior.Strict); _nav = new Mock<ITextStructureNavigator>(MockBehavior.Strict); _globalSettings = MockObjectFactory.CreateGlobalSettings(ignoreCase: true); _settings = MockObjectFactory.CreateLocalSettings(_globalSettings.Object); _searchRaw = new IncrementalSearch( _textView, _settings.Object, _textSearch.Object, _nav.Object); _search = _searchRaw; }
public void SetUp() { _textView = EditorUtil.CreateTextView(); _localSettings = new LocalSettings(new GlobalSettings(), EditorUtil.GetEditorOptions(_textView), _textView); _incrementalSearch = VimUtil.CreateIncrementalSearch(_textView, _localSettings, new VimData()); _factory = new MockRepository(MockBehavior.Strict); _host = _factory.Create<IVimHost>(); _captureRaw = new MotionCapture( _host.Object, _textView, _incrementalSearch, _localSettings); _capture = _captureRaw; }
public static Mock<IVimBuffer> CreateVimBuffer( ITextView textView, string name = null, IVim vim = null, IJumpList jumpList = null, IVimLocalSettings settings = null, IIncrementalSearch incrementalSearch = null, MockRepository factory = null) { factory = factory ?? new MockRepository(MockBehavior.Strict); name = name ?? "test"; vim = vim ?? CreateVim().Object; jumpList = jumpList ?? (factory.Create<IJumpList>().Object); settings = settings ?? new LocalSettings(vim.Settings, FSharpOption.Create(textView)); var mock = factory.Create<IVimBuffer>(); mock.SetupGet(x => x.TextView).Returns(textView); mock.SetupGet(x => x.TextBuffer).Returns(() => textView.TextBuffer); mock.SetupGet(x => x.TextSnapshot).Returns(() => textView.TextSnapshot); mock.SetupGet(x => x.Name).Returns(name); mock.SetupGet(x => x.Settings).Returns(settings); mock.SetupGet(x => x.MarkMap).Returns(vim.MarkMap); mock.SetupGet(x => x.RegisterMap).Returns(vim.RegisterMap); mock.SetupGet(x => x.JumpList).Returns(jumpList); mock.SetupGet(x => x.Vim).Returns(vim); mock.SetupGet(x => x.VimData).Returns(vim.VimData); mock.SetupGet(x => x.IncrementalSearch).Returns(incrementalSearch); return mock; }