private async Task FindUsagesInternalAsync(IProjectScope[] specFlowTestProjects, string fileName, SnapshotPoint triggerPoint, IAsyncContextMenu asyncContextMenu, CancellationToken cancellationToken, FindUsagesSummary summary)
        {
            foreach (var project in specFlowTestProjects)
            {
                if (cancellationToken.IsCancellationRequested)
                {
                    break;
                }

                var stepDefinitions = await GetStepDefinitionsAsync(project, fileName, triggerPoint);

                summary.FoundStepDefinitions += stepDefinitions.Length;
                if (stepDefinitions.Length == 0)
                {
                    continue;
                }

                var featureFiles  = project.GetProjectFiles(".feature");
                var configuration = project.GetDeveroomConfiguration();
                var projectUsages = _stepDefinitionUsageFinder.FindUsages(stepDefinitions, featureFiles, configuration);
                foreach (var usage in projectUsages)
                {
                    if (cancellationToken.IsCancellationRequested)
                    {
                        break;
                    }

                    //await Task.Delay(500);
                    asyncContextMenu.AddItems(CreateMenuItem(usage, project));
                    summary.UsagesFound++;
                }

                summary.ScannedFeatureFiles += featureFiles.Length;
            }
        }
        private async Task FindUsagesInProjectsAsync(IProjectScope[] specFlowTestProjects, string fileName, SnapshotPoint triggerPoint, IAsyncContextMenu asyncContextMenu, CancellationToken cancellationToken)
        {
            var summary = new FindUsagesSummary();

            try
            {
                await FindUsagesInternalAsync(specFlowTestProjects, fileName, triggerPoint, asyncContextMenu,
                                              cancellationToken, summary);
            }
            catch (Exception ex)
            {
                Logger.LogException(MonitoringService, ex);
                summary.WasError = true;
            }

            if (summary.WasError)
            {
                asyncContextMenu.AddItems(new ContextMenuItem("Could not complete find operation because of an error"));
            }
            else if (summary.FoundStepDefinitions == 0)
            {
                asyncContextMenu.AddItems(new ContextMenuItem("Could not find any step definitions at the current position"));
            }
            else if (summary.UsagesFound == 0)
            {
                asyncContextMenu.AddItems(new ContextMenuItem("Could not find any usage"));
            }

            MonitoringService.MonitorCommandFindStepDefinitionUsages(summary.UsagesFound, cancellationToken.IsCancellationRequested);
            if (cancellationToken.IsCancellationRequested)
            {
                Logger.LogVerbose("Finding step definition usages cancelled");
            }
            else
            {
                Logger.LogInfo($"Found {summary.UsagesFound} usages in {summary.ScannedFeatureFiles} feature files");
            }
            asyncContextMenu.Complete();
        }