public void AddAnalyzerProvider(IIncrementalAnalyzerProvider provider, IncrementalAnalyzerProviderMetadata metadata)
        {
            // now update all existing work coordinator
            lock (_gate)
            {
                var lazyProvider = new Lazy <IIncrementalAnalyzerProvider, IncrementalAnalyzerProviderMetadata>(() => provider, metadata);

                // update existing map for future solution crawler registration - no need for interlock but this makes add or update easier
                ImmutableInterlocked.AddOrUpdate(ref _analyzerProviders, metadata.Name, n => ImmutableArray.Create(lazyProvider), (n, v) => v.Add(lazyProvider));

                // assert map integrity
                AssertAnalyzerProviders(_analyzerProviders);

                // find existing coordinator to update
                var lazyProviders = _analyzerProviders[metadata.Name];
                foreach (var(workspace, coordinator) in _documentWorkCoordinatorMap)
                {
                    Contract.ThrowIfNull(workspace.Kind);

                    if (!TryGetProvider(workspace.Kind, lazyProviders, out var picked) || picked != lazyProvider)
                    {
                        // check whether new provider belong to current workspace
                        continue;
                    }

                    var analyzer = lazyProvider.Value.CreateIncrementalAnalyzer(workspace);
                    if (analyzer != null)
                    {
                        coordinator.AddAnalyzer(analyzer, metadata.HighPriorityForActiveFile);
                    }
                }
            }
        }
 public void AddAnalyzerProvider(
     IIncrementalAnalyzerProvider provider,
     IncrementalAnalyzerProviderMetadata metadata
     )
 {
     // base implementation do nothing.
 }
 private static bool IsDefaultProvider(IncrementalAnalyzerProviderMetadata providerMetadata)
 => providerMetadata.WorkspaceKinds == null || providerMetadata.WorkspaceKinds.Count == 0;
 private static bool IsDefaultProvider(IncrementalAnalyzerProviderMetadata providerMetadata)
 {
     return(providerMetadata.WorkspaceKinds == null || providerMetadata.WorkspaceKinds.Length == 0);
 }
 public void AddAnalyzerProvider(IIncrementalAnalyzerProvider provider, IncrementalAnalyzerProviderMetadata metadata)
 {
     // preview solution crawler doesn't support adding and removing analyzer dynamically
     throw new NotSupportedException();
 }
 public void AddAnalyzerProvider(IIncrementalAnalyzerProvider provider, IncrementalAnalyzerProviderMetadata metadata)
 {
     // base implementation do nothing.
 }