Exemple #1
0
        public static async Task <IEnumerable <INavigableItem> > FindExternalDefinitionsAsync(ISymbol symbol, Project project, IEnumerable <Lazy <INavigableDefinitionProvider> > externalDefinitionProviders, CancellationToken cancellationToken)
        {
            foreach (var definitionProvider in externalDefinitionProviders)
            {
                var definitions = await definitionProvider.Value.FindDefinitionsAsync(project, symbol, cancellationToken).ConfigureAwait(false);

                if (definitions != null && definitions.Any())
                {
                    var preferredDefinitions = NavigableItemFactory.GetPreferredNavigableItems(project.Solution, definitions);
                    if (preferredDefinitions.Any())
                    {
                        return(preferredDefinitions);
                    }
                }
            }

            return(SpecializedCollections.EmptyEnumerable <INavigableItem>());
        }