Exemplo n.º 1
0
        private async Task SearchCurrentDocumentAsync(CancellationToken cancellationToken)
        {
            if (_activeDocument == null)
            {
                return;
            }

            var project = _activeDocument.Project;
            var service = _host.GetNavigateToSearchService(project);

            if (service == null)
            {
                return;
            }

            await _progress.AddItemsAsync(1, cancellationToken).ConfigureAwait(false);

            try
            {
                await service.SearchDocumentAsync(
                    _activeDocument, _searchPattern, _kinds,
                    r => _callback.AddItemAsync(project, r, cancellationToken),
                    cancellationToken).ConfigureAwait(false);
            }
            finally
            {
                await _progress.ItemCompletedAsync(cancellationToken).ConfigureAwait(false);
            }
        }
        public async Task FindReferencesAsync()
        {
            await _progressTracker.AddItemsAsync(1).ConfigureAwait(false);

            try
            {
                if (_searchKind != SearchKind.None)
                {
                    await FindReferencesWorkerAsync().ConfigureAwait(false);
                }
            }
            finally
            {
                await _progressTracker.ItemCompletedAsync().ConfigureAwait(false);
            }
        }
        public async Task FindReferencesAsync(SymbolAndProjectId symbolAndProjectId)
        {
            await _progress.OnStartedAsync().ConfigureAwait(false);

            await _progressTracker.AddItemsAsync(1).ConfigureAwait(false);

            try
            {
                var symbols = await DetermineAllSymbolsAsync(symbolAndProjectId).ConfigureAwait(false);

                var projectMap = await CreateProjectMapAsync(symbols).ConfigureAwait(false);

                var projectToDocumentMap = await CreateProjectToDocumentMapAsync(projectMap).ConfigureAwait(false);

                ValidateProjectToDocumentMap(projectToDocumentMap);

                await ProcessAsync(projectToDocumentMap).ConfigureAwait(false);
            }
            finally
            {
                await _progressTracker.ItemCompletedAsync().ConfigureAwait(false);

                await _progress.OnCompletedAsync().ConfigureAwait(false);
            }
        }
 private async Task ProcessDocumentAsync(Document document)
 {
     try
     {
         await ProcessDocumentWorkerAsync(document).ConfigureAwait(false);
     }
     finally
     {
         await _progressTracker.ItemCompletedAsync().ConfigureAwait(false);
     }
 }
 private async Task ProcessDocumentAsync(Document document, CancellationToken cancellationToken)
 {
     try
     {
         await ProcessDocumentWorkerAsync(document, cancellationToken).ConfigureAwait(false);
     }
     finally
     {
         await _progressTracker.ItemCompletedAsync(cancellationToken).ConfigureAwait(false);
     }
 }
Exemplo n.º 6
0
 private async Task SearchAsync(
     Project project,
     ImmutableArray <Document> priorityDocuments,
     HashSet <INavigateToSearchResult> seenItems)
 {
     try
     {
         await SearchCoreAsync(project, priorityDocuments, seenItems).ConfigureAwait(false);
     }
     finally
     {
         await _progress.ItemCompletedAsync().ConfigureAwait(false);
     }
 }
Exemplo n.º 7
0
        private async Task <(Project project, NavigateToSearchLocation location)> SearchAsync(
            Project project, bool isFullyLoaded, HashSet <INavigateToSearchResult> seenItems, CancellationToken cancellationToken)
        {
            try
            {
                var location = await SearchCoreAsync(project, isFullyLoaded, seenItems, cancellationToken).ConfigureAwait(false);

                return(project, location);
            }
            finally
            {
                await _progress.ItemCompletedAsync(cancellationToken).ConfigureAwait(false);
            }
        }
 public ValueTask ItemCompletedAsync(CancellationToken cancellationToken)
 => _progressTracker.ItemCompletedAsync(cancellationToken);
 public async ValueTask DisposeAsync()
 => await _progressTracker.ItemCompletedAsync(_cancellationToken).ConfigureAwait(false);