private static void VerifySearchFileNamesResponse( ITypedRequestProcessProxy server, string searchPattern, DirectoryInfo chromiumDirectory, string fileName, int occurrenceCount) { var response = SendRequest<SearchFileNamesResponse>(server, new SearchFileNamesRequest { SearchParams = new SearchParams { SearchString = searchPattern, MaxResults = 2000, } }, ServerResponseTimeout)(); Assert.IsNotNull(response, "Server did not respond within timeout."); Assert.IsNotNull(response.SearchResult); Assert.IsNotNull(response.SearchResult.Entries); Assert.AreEqual(1, response.SearchResult.Entries.Count); var chromiumEntry = response.SearchResult.Entries[0] as DirectoryEntry; Assert.IsNotNull(chromiumEntry); Assert.AreEqual(chromiumDirectory.FullName, chromiumEntry.Name); chromiumEntry.Entries.ForAll(x => Debug.WriteLine(string.Format("File name: \"{0}\"", x.Name))); Assert.AreEqual(occurrenceCount, chromiumEntry.Entries.Count); Assert.AreEqual(occurrenceCount, chromiumEntry.Entries.Count(x => Path.GetFileName(x.Name) == fileName)); }
public UIRequestProcessor(ITypedRequestProcessProxy typedRequestProcessProxy, IDelayedOperationProcessor delayedOperationProcessor, ISynchronizationContextProvider synchronizationContextProvider) { _typedRequestProcessProxy = typedRequestProcessProxy; _delayedOperationProcessor = delayedOperationProcessor; _synchronizationContextProvider = synchronizationContextProvider; }
public ReportServerProgress( ITypedRequestProcessProxy typedRequestProcessProxy, ISynchronizationContextProvider synchronizationContextProvider, IStatusBar statusBar) { _typedRequestProcessProxy = typedRequestProcessProxy; _synchronizationContextProvider = synchronizationContextProvider; _statusBar = statusBar; }
private static void TestSearch(ITypedRequestProcessProxy server) { while (true) { var response = SendRequest<SearchFileNamesResponse>(server, new SearchFileNamesRequest { SearchParams = { SearchString = "histogram" } }, ServerResponseTimeout)(); if (response != null && response.SearchResult != null && response.SearchResult.Entries.Count > 0) break; Trace.WriteLine("It looks like the file indexer has not yet finished computing the new state."); Thread.Sleep(500); } while (true) { var response = SendRequest<SearchFileContentsResponse>(server, new SearchFileContentsRequest { SearchParams = { SearchString = "histogram" } }, ServerResponseTimeout)(); if (response != null && response.SearchResults != null && response.SearchResults.Entries.Count > 0) { Trace.WriteLine(string.Format("Found {0} files matching search text.", response.SearchResults.Entries.Count)); break; } Trace.WriteLine("It looks like the file indexer has not yet finished computing the new state."); Thread.Sleep(500); } var response4 = SendRequest<SearchFileContentsResponse>(server, new SearchFileContentsRequest { SearchParams = { SearchString = "histogram" } }, TimeSpan.FromSeconds(0.01))(); var response5 = SendRequest<SearchFileContentsResponse>(server, new SearchFileContentsRequest { SearchParams = { SearchString = "histogram" } }, TimeSpan.FromSeconds(0.01))(); var response6 = SendRequest<SearchFileContentsResponse>(server, new SearchFileContentsRequest { SearchParams = { SearchString = "histogram" } }, TimeSpan.FromSeconds(0.01))(); var response7 = SendRequest<SearchFileContentsResponse>(server, new SearchFileContentsRequest { SearchParams = { SearchString = "histogram" } }, TimeSpan.FromSeconds(0.01))(); var response8 = SendRequest<SearchFileContentsResponse>(server, new SearchFileContentsRequest { SearchParams = { SearchString = "histogram" } }, TimeSpan.FromSeconds(0.01))(); var response9 = SendRequest<SearchFileContentsResponse>(server, new SearchFileContentsRequest { SearchParams = { SearchString = "histogram" } }, TimeSpan.FromSeconds(10.0))(); }
/// <summary> /// Called when Visual Studio creates our container ToolWindow. /// </summary> public void OnVsToolWindowCreated(IServiceProvider serviceProvider) { var componentModel = (IComponentModel)serviceProvider.GetService(typeof(SComponentModel)); _uiRequestProcessor = componentModel.DefaultExportProvider.GetExportedValue<IUIRequestProcessor>(); _typedRequestProcessProxy = componentModel.DefaultExportProvider.GetExportedValue<ITypedRequestProcessProxy>(); _fileSystemTreeSource = componentModel.DefaultExportProvider.GetExportedValue<IFileSystemTreeSource>(); _typedRequestProcessProxy.EventReceived += TypedRequestProcessProxy_EventReceived; _fileSystemTreeSource.TreeReceived += FileSystemTreeSource_OnTreeReceived; _fileSystemTreeSource.ErrorReceived += FileSystemTreeSource_OnErrorReceived; var standarImageSourceFactory = componentModel.DefaultExportProvider.GetExportedValue<IStandarImageSourceFactory>(); _controller = new CodeSearchController( this, _uiRequestProcessor, componentModel.DefaultExportProvider.GetExportedValue<IUIDelayedOperationProcessor>(), _progressBarTracker, standarImageSourceFactory, componentModel.DefaultExportProvider.GetExportedValue<IWindowsExplorer>(), componentModel.DefaultExportProvider.GetExportedValue<IClipboard>(), componentModel.DefaultExportProvider.GetExportedValue<ISynchronizationContextProvider>(), componentModel.DefaultExportProvider.GetExportedValue<IOpenDocumentHelper>(), componentModel.DefaultExportProvider.GetExportedValue<ITextDocumentTable>(), componentModel.DefaultExportProvider.GetExportedValue<IEventBus>(), componentModel.DefaultExportProvider.GetExportedValue<IGlobalSettingsProvider>(), componentModel.DefaultExportProvider.GetExportedValue<IBuildOutputParser>(), componentModel.DefaultExportProvider.GetExportedValue<IVsEditorAdaptersFactoryService>()); // TODO(rpaquay): leaky abstraction. We need this because the ViewModel // exposes pictures from Visual Studio resources. ViewModel.ImageSourceFactory = standarImageSourceFactory; _fileSystemTreeSource.Fetch(); // Hookup property changed notifier ViewModel.PropertyChanged += ViewModel_PropertyChanged; ViewModel.RootNodesChanged += ViewModelOnRootNodesChanged; }
private static void VerifySearchCodeResponse( ITypedRequestProcessProxy server, string searchPattern, Options options, DirectoryInfo chromiumDirectory, int occurrenceCount, params int[] positionsAndLengths) { var response = SendRequest<SearchCodeResponse>(server, new SearchCodeRequest { SearchParams = new SearchParams { SearchString = searchPattern, MaxResults = 2000, MatchCase = options.HasFlag(Options.MatchCase), Regex = options.HasFlag(Options.Regex), } }, ServerResponseTimeout)(); Assert.IsNotNull(response, "Server did not respond within timeout."); Assert.IsNotNull(response.SearchResults); Assert.IsNotNull(response.SearchResults.Entries); Assert.AreEqual(1, response.SearchResults.Entries.Count); var chromiumEntry = response.SearchResults.Entries[0] as DirectoryEntry; Assert.IsNotNull(chromiumEntry); Assert.AreEqual(chromiumDirectory.FullName, chromiumEntry.Name); chromiumEntry.Entries.ForAll((index, x) => { Debug.WriteLine(string.Format("File name: \"{0}\"", x.Name)); Assert.IsNotNull(x.Data); Assert.IsTrue(x.Data is FilePositionsData); ((FilePositionsData)x.Data).Positions.ForEach(y => { Debug.WriteLine(string.Format(" Text position: offset={0}, length={1}, text={2}", y.Position, y.Length, ExtractFileText(chromiumEntry, x, y))); if (positionsAndLengths != null && positionsAndLengths.Length > 0) { Assert.AreEqual(positionsAndLengths[index * 2], y.Position); Assert.AreEqual(positionsAndLengths[(index * 2) + 1], y.Length); } }); }); Assert.AreEqual(occurrenceCount, chromiumEntry.Entries.Count); }
public static void Initialize(TestContext context) { _container = SetupMefContainer(); _server = _container.GetExportedValue<ITypedRequestProcessProxy>(); _testFile = Utils.GetChromiumTestEnlistmentFile(); GetFileSystemFromServer(_server, _testFile); }
private static void TestSearch(ITypedRequestProcessProxy server) { while (true) { var response = SendRequest <SearchFilePathsResponse>(server, new SearchFilePathsRequest { SearchParams = { SearchString = "histogram" } }, ServerResponseTimeout)(); if (response != null && response.SearchResult != null && response.SearchResult.Entries.Count > 0) { break; } Trace.WriteLine("It looks like the file indexer has not yet finished computing the new state."); Thread.Sleep(500); } while (true) { var response = SendRequest <SearchCodeResponse>(server, new SearchCodeRequest { SearchParams = { SearchString = "histogram" } }, ServerResponseTimeout)(); if (response != null && response.SearchResults != null && response.SearchResults.Entries.Count > 0) { Trace.WriteLine(string.Format("Found {0} files matching search text.", response.SearchResults.Entries.Count)); break; } Trace.WriteLine("It looks like the file indexer has not yet finished computing the new state."); Thread.Sleep(500); } var response4 = SendRequest <SearchCodeResponse>(server, new SearchCodeRequest { SearchParams = { SearchString = "histogram" } }, TimeSpan.FromSeconds(0.01))(); var response5 = SendRequest <SearchCodeResponse>(server, new SearchCodeRequest { SearchParams = { SearchString = "histogram" } }, TimeSpan.FromSeconds(0.01))(); var response6 = SendRequest <SearchCodeResponse>(server, new SearchCodeRequest { SearchParams = { SearchString = "histogram" } }, TimeSpan.FromSeconds(0.01))(); var response7 = SendRequest <SearchCodeResponse>(server, new SearchCodeRequest { SearchParams = { SearchString = "histogram" } }, TimeSpan.FromSeconds(0.01))(); var response8 = SendRequest <SearchCodeResponse>(server, new SearchCodeRequest { SearchParams = { SearchString = "histogram" } }, TimeSpan.FromSeconds(0.01))(); var response9 = SendRequest <SearchCodeResponse>(server, new SearchCodeRequest { SearchParams = { SearchString = "histogram" } }, TimeSpan.FromSeconds(10.0))(); }
public NodeViewModelLoader(ITypedRequestProcessProxy typedRequestProcessProxy) { _typedRequestProcessProxy = typedRequestProcessProxy; }
public FileSystemTreeSource(ITypedRequestProcessProxy proxy, IDelayedOperationProcessor delayedOperationProcessor) { _proxy = proxy; _delayedOperationProcessor = delayedOperationProcessor; _proxy.EventReceived += ProxyOnEventReceived; }