Ejemplo n.º 1
0
            private ImmutableArray <Checksum> GetHostAnalyzerReferences(
                ISolutionSynchronizationService snapshotService, string language, IEnumerable <AnalyzerReference> references, CancellationToken cancellationToken)
            {
                if (references == null)
                {
                    return(ImmutableArray <Checksum> .Empty);
                }

                // TODO: cache this to somewhere
                var builder = ImmutableArray.CreateBuilder <Checksum>();

                foreach (var reference in references)
                {
                    var analyzers = reference.GetAnalyzers(language);
                    if (analyzers.Length == 0)
                    {
                        // skip reference that doesn't contain any analyzers for the given language
                        // we do this so that we don't load analyzer dlls that MEF exported from vsix
                        // not related to this solution
                        continue;
                    }

                    var asset = snapshotService.GetGlobalAsset(reference, cancellationToken);
                    builder.Add(asset.Checksum);
                }

                return(builder.ToImmutable());
            }
        private ImmutableArray <byte[]> GetHostAnalyzerReferences(ISolutionSynchronizationService snapshotService, IEnumerable <AnalyzerReference> references, CancellationToken cancellationToken)
        {
            // TODO: cache this to somewhere
            var builder = ImmutableArray.CreateBuilder <byte[]>();

            foreach (var reference in references)
            {
                var asset = snapshotService.GetGlobalAsset(reference, cancellationToken);
                builder.Add(asset.Checksum.ToArray());
            }

            return(builder.ToImmutable());
        }
        private ImmutableArray<byte[]> GetHostAnalyzerReferences(
            ISolutionSynchronizationService snapshotService, string language, IEnumerable<AnalyzerReference> references, CancellationToken cancellationToken)
        {
            // TODO: cache this to somewhere
            var builder = ImmutableArray.CreateBuilder<byte[]>();
            foreach (var reference in references)
            {
                var analyzers = reference.GetAnalyzers(language);
                if (analyzers.Length == 0)
                {
                    // skip reference that doesn't contain any analyzers for the given language
                    // we do this so that we don't load analyzer dlls that MEF exported from vsix
                    // not related to this solution
                    continue;
                }

                var asset = snapshotService.GetGlobalAsset(reference, cancellationToken);
                builder.Add(asset.Checksum.ToArray());
            }

            return builder.ToImmutable();
        }