public void AddAnalyzerProvider(
     IIncrementalAnalyzerProvider provider,
     IncrementalAnalyzerProviderMetadata metadata
     )
 {
     // base implementation do nothing.
 }
        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
     )
 {
     // preview solution crawler doesn't support adding and removing analyzer dynamically
     throw new NotSupportedException();
 }
 public PreviewWorkCoordinatorRegistrationService(IDiagnosticAnalyzerService diagnosticService)
 {
     _provider = diagnosticService as IIncrementalAnalyzerProvider;
     Contract.ThrowIfNull(_provider);
 }
 public IIncrementalAnalyzer CreatePerLanguageIncrementalAnalyzer(Workspace workspace, IIncrementalAnalyzerProvider provider)
 {
     return new DesignerAttributeIncrementalAnalyzer(_serviceProvider, _notificationService, _asyncListeners);
 }
Exemple #6
0
 public PreviewSolutionCrawlerRegistrationService(IDiagnosticAnalyzerService diagnosticService)
 {
     _provider = diagnosticService as IIncrementalAnalyzerProvider;
     Contract.ThrowIfNull(_provider);
 }
 public IIncrementalAnalyzer CreatePerLanguageIncrementalAnalyzer(Workspace workspace, IIncrementalAnalyzerProvider provider)
 {
     var optionService = workspace.Services.GetService<IOptionService>();
     return new DesignerAttributeIncrementalAnalyzer(_serviceProvider, optionService, _notificationService, _asyncListeners);
 }
 public IIncrementalAnalyzer CreatePerLanguageIncrementalAnalyzer(Workspace workspace, IIncrementalAnalyzerProvider provider)
 {
     return(new Analyzer());
 }
 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.
 }
 public IIncrementalAnalyzer CreatePerLanguageIncrementalAnalyzer(Workspace workspace, IIncrementalAnalyzerProvider provider)
 {
     return new Analyzer();
 }
        public IIncrementalAnalyzer CreatePerLanguageIncrementalAnalyzer(Workspace workspace, IIncrementalAnalyzerProvider provider)
        {
            var optionService = workspace.Services.GetService <IOptionService>();

            return(new DesignerAttributeIncrementalAnalyzer(_serviceProvider, optionService, _notificationService, _asyncListeners));
        }
 public PreviewSolutionCrawlerRegistrationService(IDiagnosticAnalyzerService diagnosticService)
 {
     _provider = diagnosticService as IIncrementalAnalyzerProvider;
     Contract.ThrowIfNull(_provider);
 }
 public IIncrementalAnalyzer CreatePerLanguageIncrementalAnalyzer(Workspace workspace, IIncrementalAnalyzerProvider provider)
 {
     return(new DesignerAttributeIncrementalAnalyzer(_serviceProvider, _notificationService, _asyncListeners));
 }
 public PreviewWorkCoordinatorRegistrationService(IDiagnosticAnalyzerService diagnosticService)
 {
     _provider = diagnosticService as IIncrementalAnalyzerProvider;
     Contract.ThrowIfNull(_provider);
 }